diff options
579 files changed, 9027 insertions, 4824 deletions
diff --git a/BUILD/autorun.sh b/BUILD/autorun.sh index 1d7cf5561ad..39346270af9 100755 --- a/BUILD/autorun.sh +++ b/BUILD/autorun.sh @@ -19,8 +19,6 @@ # Create MySQL cmake configure wrapper -die() { echo "$@"; exit 1; } - # Use a configure script that will call CMake. path=`dirname $0` cp $path/cmake_configure.sh $path/../configure diff --git a/CMakeLists.txt b/CMakeLists.txt index a87d08cd1ae..a04181fd6ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -177,12 +177,16 @@ IF (WITH_ASAN) # gcc 4.8.1 and new versions of clang MY_CHECK_AND_SET_COMPILER_FLAG("-fsanitize=address -O1 -Wno-error -fPIC" DEBUG RELWITHDEBINFO) + SET(HAVE_C_FSANITIZE ${HAVE_C__fsanitize_address__O1__Wno_error__fPIC}) + SET(HAVE_CXX_FSANITIZE ${HAVE_CXX__fsanitize_address__O1__Wno_error__fPIC}) IF(HAVE_C_FSANITIZE AND HAVE_CXX_FSANITIZE) SET(WITH_ASAN_OK 1) ELSE() # older versions of clang MY_CHECK_AND_SET_COMPILER_FLAG("-faddress-sanitizer -O1 -fPIC" DEBUG RELWITHDEBINFO) + SET(HAVE_C_FADDRESS ${HAVE_C__faddress_sanitizer__O1__fPIC}) + SET(HAVE_CXX_FADDRESS ${HAVE_CXX__faddress_sanitizer__O1__fPIC}) IF(HAVE_C_FADDRESS AND HAVE_CXX_FADDRESS) SET(WITH_ASAN_OK 1) ENDIF() @@ -1,24 +1,26 @@ MariaDB is brought to you by the MariaDB Foundation, a non profit organization registered in the USA. -The current main members and sponsors of the MariaDB Foundation are: - -MariaDB Corporation http://www.mariadb.com (2013 - 2016) -Booking.com http://www.booking.com (2013 - 2016) -Parallels http://www.parallels.com/products/plesk (2013 - 2016) -Automattic http://automattic.com (2014 - 2016) -Verkkokauppa.com http://verkkokauppa.com (2015 - 2016) -Visma http://visma.com/ (2015 - 2016) -Webyog http://webyog.com (2015 - 2016) -Wikimedia Foundation http://wikimedia.org (2015 - 2016) -Acronis http://acronis.com (2016) - -For a full list of supporters and sponsors see +The current main sponsors of the MariaDB Foundation are: + +Booking.com http://www.booking.com (2013 - 2016) +Development Bank of Singapore http://dbs.com (2016) +MariaDB Corporation https://www.mariadb.com (2013 - 2016) +Visma http://visma.com (2015 - 2016) +Acronis http://acronis.com (2016) +Nexedi https://www.nexedi.com (2016) +Automattic https://automattic.com (2014 - 2016) +Verkkokauppa.com https://www.verkkokauppa.com (2015 - 2016) +Virtuozzo https://virtuozzo.com (2016) + +For a full list of sponsors, see https://mariadb.org/about/supporters/ +and for individual contributors, see +https://mariadb.org/donate/individual-sponsors/ -You can also do this by running SHOW CONTRIBUTORS. +You can also get the list of sponsors by running SHOW CONTRIBUTORS. -For all corporate memberships and sponsorships please contact the +For all corporate sponsorships please contact the MariaDB Foundation Board via foundation@mariadb.org. The MariaDB Foundation is responsible for the MariaDB source @@ -38,7 +40,7 @@ following services to the MariaDB community: To be able to do the above we need help from corporations and individuals! You can help support MariaDB by becoming a MariaDB developer or a -member or sponsor of the MariaDB Foundation. To donate or sponsor, +sponsor of the MariaDB Foundation. To donate or sponsor, go to https://mariadb.org/donate/ You can get a list of all the main authors of MariaDB / MySQL by running diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index 3e821b183bd..3a6f5462ced 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -240,7 +240,7 @@ static int process_selected_tables(char *db, char **table_names, int tables); static int process_all_tables_in_db(char *database); static int process_one_db(char *database); static int use_db(char *database); -static int handle_request_for_tables(char *tables, size_t length, my_bool view); +static int handle_request_for_tables(char *, size_t, my_bool, my_bool); static int dbConnect(char *host, char *user,char *passwd); static void dbDisconnect(char *host); static void DBerror(MYSQL *mysql, const char *when); @@ -577,7 +577,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) } *--end = 0; handle_request_for_tables(table_names_comma_sep + 1, tot_length - 1, - opt_do_views != 0); + opt_do_views != 0, opt_all_in_1); my_free(table_names_comma_sep); } else @@ -588,7 +588,7 @@ static int process_selected_tables(char *db, char **table_names, int tables) view= is_view(table); if (view < 0) continue; - handle_request_for_tables(table, table_len, (view == 1)); + handle_request_for_tables(table, table_len, view == 1, opt_all_in_1); } DBUG_RETURN(0); } /* process_selected_tables */ @@ -616,13 +616,9 @@ static char *fix_table_name(char *dest, char *src) *dest++= '`'; for (; *src; src++) { - switch (*src) { - case '`': /* escape backtick character */ + if (*src == '`') *dest++= '`'; - /* fall through */ - default: - *dest++= *src; - } + *dest++= *src; } *dest++= '`'; @@ -711,9 +707,9 @@ static int process_all_tables_in_db(char *database) *--end = 0; *--views_end = 0; if (tot_length) - handle_request_for_tables(tables + 1, tot_length - 1, FALSE); + handle_request_for_tables(tables + 1, tot_length - 1, FALSE, opt_all_in_1); if (tot_views_length) - handle_request_for_tables(views + 1, tot_views_length - 1, TRUE); + handle_request_for_tables(views + 1, tot_views_length - 1, TRUE, opt_all_in_1); my_free(tables); my_free(views); } @@ -739,7 +735,7 @@ static int process_all_tables_in_db(char *database) !strcmp(row[0], "slow_log"))) continue; /* Skip logging tables */ - handle_request_for_tables(row[0], fixed_name_length(row[0]), view); + handle_request_for_tables(row[0], fixed_name_length(row[0]), view, opt_all_in_1); } } mysql_free_result(res); @@ -800,13 +796,11 @@ static int rebuild_table(char *name) int rc= 0; DBUG_ENTER("rebuild_table"); - query= (char*)my_malloc(sizeof(char) * (12 + fixed_name_length(name) + 6 + 1), + query= (char*)my_malloc(sizeof(char) * (12 + strlen(name) + 6 + 1), MYF(MY_WME)); if (!query) DBUG_RETURN(1); - ptr= strmov(query, "ALTER TABLE "); - ptr= fix_table_name(ptr, name); - ptr= strxmov(ptr, " FORCE", NullS); + ptr= strxmov(query, "ALTER TABLE ", name, " FORCE", NullS); if (verbose >= 3) puts(query); if (mysql_real_query(sock, query, (ulong)(ptr - query))) @@ -870,7 +864,8 @@ static int disable_binlog() return run_query("SET SQL_LOG_BIN=0", 0); } -static int handle_request_for_tables(char *tables, size_t length, my_bool view) +static int handle_request_for_tables(char *tables, size_t length, + my_bool view, my_bool dont_quote) { char *query, *end, options[100], message[100]; char table_name_buff[NAME_CHAR_LEN*2*2+1], *table_name; @@ -929,7 +924,7 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view) if (!(query =(char *) my_malloc(query_size, MYF(MY_WME)))) DBUG_RETURN(1); - if (opt_all_in_1) + if (dont_quote) { DBUG_ASSERT(strlen(op)+strlen(tables)+strlen(options)+8+1 <= query_size); @@ -974,6 +969,13 @@ static int handle_request_for_tables(char *tables, size_t length, my_bool view) DBUG_RETURN(0); } +static void insert_table_name(DYNAMIC_ARRAY *arr, char *in, size_t dblen) +{ + char buf[NAME_LEN*2+2]; + in[dblen]= 0; + my_snprintf(buf, sizeof(buf), "%`s.%`s", in, in + dblen + 1); + insert_dynamic(arr, (uchar*) buf); +} static void print_result() { @@ -981,16 +983,13 @@ static void print_result() MYSQL_ROW row; char prev[(NAME_LEN+9)*3+2]; char prev_alter[MAX_ALTER_STR_SIZE]; - char *db_name; - uint length_of_db; + size_t length_of_db= strlen(sock->db); uint i; my_bool found_error=0, table_rebuild=0; DYNAMIC_ARRAY *array4repair= &tables4repair; DBUG_ENTER("print_result"); res = mysql_use_result(sock); - db_name= sock->db; - length_of_db= strlen(db_name); prev[0] = '\0'; prev_alter[0]= 0; @@ -1014,16 +1013,10 @@ static void print_result() if (prev_alter[0]) insert_dynamic(&alter_table_cmds, (uchar*) prev_alter); else - { - char *table_name= prev + (length_of_db+1); - insert_dynamic(&tables4rebuild, (uchar*) table_name); - } + insert_table_name(&tables4rebuild, prev, length_of_db); } else - { - char *table_name= prev + (length_of_db+1); - insert_dynamic(array4repair, table_name); - } + insert_table_name(array4repair, prev, length_of_db); } array4repair= &tables4repair; found_error=0; @@ -1068,16 +1061,10 @@ static void print_result() if (prev_alter[0]) insert_dynamic(&alter_table_cmds, prev_alter); else - { - char *table_name= prev + (length_of_db+1); - insert_dynamic(&tables4rebuild, table_name); - } + insert_table_name(&tables4rebuild, prev, length_of_db); } else - { - char *table_name= prev + (length_of_db+1); - insert_dynamic(array4repair, table_name); - } + insert_table_name(array4repair, prev, length_of_db); } mysql_free_result(res); DBUG_VOID_RETURN; @@ -1222,7 +1209,7 @@ int main(int argc, char **argv) for (i = 0; i < tables4repair.elements ; i++) { char *name= (char*) dynamic_array_ptr(&tables4repair, i); - handle_request_for_tables(name, fixed_name_length(name), FALSE); + handle_request_for_tables(name, fixed_name_length(name), FALSE, TRUE); } for (i = 0; i < tables4rebuild.elements ; i++) rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i)); @@ -1233,7 +1220,7 @@ int main(int argc, char **argv) for (i = 0; i < views4repair.elements ; i++) { char *name= (char*) dynamic_array_ptr(&views4repair, i); - handle_request_for_tables(name, fixed_name_length(name), TRUE); + handle_request_for_tables(name, fixed_name_length(name), TRUE, TRUE); } } ret= MY_TEST(first_error); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 5b15155e039..aee445d387d 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -37,6 +37,7 @@ /* Global Thread counter */ uint counter= 0; +pthread_mutex_t init_mutex; pthread_mutex_t counter_mutex; pthread_cond_t count_threshhold; @@ -421,8 +422,19 @@ static MYSQL *db_connect(char *host, char *database, MYSQL *mysql; if (verbose) fprintf(stdout, "Connecting to %s\n", host ? host : "localhost"); - if (!(mysql= mysql_init(NULL))) - return 0; + if (opt_use_threads && !lock_tables) + { + pthread_mutex_lock(&init_mutex); + if (!(mysql= mysql_init(NULL))) + { + pthread_mutex_unlock(&init_mutex); + return 0; + } + pthread_mutex_unlock(&init_mutex); + } + else + if (!(mysql= mysql_init(NULL))) + return 0; if (opt_compress) mysql_options(mysql,MYSQL_OPT_COMPRESS,NullS); if (opt_local_file) @@ -614,7 +626,7 @@ error: pthread_cond_signal(&count_threshhold); pthread_mutex_unlock(&counter_mutex); mysql_thread_end(); - + pthread_exit(0); return 0; } @@ -638,15 +650,31 @@ int main(int argc, char **argv) if (opt_use_threads && !lock_tables) { - pthread_t mainthread; /* Thread descriptor */ - pthread_attr_t attr; /* Thread attributes */ + char **save_argv; + uint worker_thread_count= 0, table_count= 0, i= 0; + pthread_t *worker_threads; /* Thread descriptor */ + pthread_attr_t attr; /* Thread attributes */ pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, - PTHREAD_CREATE_DETACHED); + PTHREAD_CREATE_JOINABLE); + pthread_mutex_init(&init_mutex, NULL); pthread_mutex_init(&counter_mutex, NULL); pthread_cond_init(&count_threshhold, NULL); + /* Count the number of tables. This number denotes the total number + of threads spawn. + */ + save_argv= argv; + for (table_count= 0; *argv != NULL; argv++) + table_count++; + argv= save_argv; + + if (!(worker_threads= (pthread_t*) my_malloc(table_count * + sizeof(*worker_threads), + MYF(0)))) + return -2; + for (counter= 0; *argv != NULL; argv++) /* Loop through tables */ { pthread_mutex_lock(&counter_mutex); @@ -661,15 +689,16 @@ int main(int argc, char **argv) counter++; pthread_mutex_unlock(&counter_mutex); /* now create the thread */ - if (pthread_create(&mainthread, &attr, worker_thread, - (void *)*argv) != 0) + if (pthread_create(&worker_threads[worker_thread_count], &attr, + worker_thread, (void *)*argv) != 0) { pthread_mutex_lock(&counter_mutex); counter--; pthread_mutex_unlock(&counter_mutex); - fprintf(stderr,"%s: Could not create thread\n", - my_progname); + fprintf(stderr,"%s: Could not create thread\n", my_progname); + continue; } + worker_thread_count++; } /* @@ -684,9 +713,18 @@ int main(int argc, char **argv) pthread_cond_timedwait(&count_threshhold, &counter_mutex, &abstime); } pthread_mutex_unlock(&counter_mutex); + pthread_mutex_destroy(&init_mutex); pthread_mutex_destroy(&counter_mutex); pthread_cond_destroy(&count_threshhold); pthread_attr_destroy(&attr); + + for(i= 0; i < worker_thread_count; i++) + { + if (pthread_join(worker_threads[i], NULL)) + fprintf(stderr,"%s: Could not join worker thread.\n", my_progname); + } + + my_free(worker_threads); } else { diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 4ff408bfa9d..b802642a02c 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -121,7 +121,7 @@ static my_bool tty_password= 0; static my_bool opt_mark_progress= 0; static my_bool ps_protocol= 0, ps_protocol_enabled= 0; static my_bool sp_protocol= 0, sp_protocol_enabled= 0; -static my_bool view_protocol= 0, view_protocol_enabled= 0, wait_longer= 0; +static my_bool view_protocol= 0, view_protocol_enabled= 0; static my_bool cursor_protocol= 0, cursor_protocol_enabled= 0; static my_bool parsing_disabled= 0; static my_bool display_result_vertically= FALSE, display_result_lower= FALSE, @@ -181,6 +181,7 @@ static uint my_end_arg= 0; static uint opt_tail_lines= 0; static uint opt_connect_timeout= 0; +static uint opt_wait_for_pos_timeout= 0; static char delimiter[MAX_DELIMITER_LENGTH]= ";"; static uint delimiter_length= 1; @@ -4657,7 +4658,7 @@ void do_sync_with_master2(struct st_command *command, long offset, MYSQL_ROW row; MYSQL *mysql= cur_con->mysql; char query_buf[FN_REFLEN+128]; - int timeout= wait_longer ? 1500 : 300; /* seconds */ + int timeout= opt_wait_for_pos_timeout; if (!master_pos.file[0]) die("Calling 'sync_with_master' without calling 'save_master_pos'"); @@ -5012,7 +5013,7 @@ static int my_kill(int pid, int sig) void do_shutdown_server(struct st_command *command) { - long timeout= wait_longer ? 60*5 : 60; + long timeout= opt_wait_for_pos_timeout ? opt_wait_for_pos_timeout / 5 : 300; int pid; DYNAMIC_STRING ds_pidfile_name; MYSQL* mysql = cur_con->mysql; @@ -6951,9 +6952,10 @@ static struct my_option my_long_options[] = "Number of seconds before connection timeout.", &opt_connect_timeout, &opt_connect_timeout, 0, GET_UINT, REQUIRED_ARG, 120, 0, 3600 * 12, 0, 0, 0}, - {"wait-longer-for-timeouts", 0, - "Wait longer for timeouts. Useful when running under valgrind", - &wait_longer, &wait_longer, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, + {"wait_for_pos_timeout", 0, + "Number of seconds to wait for master_pos_wait", + &opt_wait_for_pos_timeout, &opt_wait_for_pos_timeout, 0, GET_UINT, + REQUIRED_ARG, 300, 0, 3600 * 12, 0, 0, 0}, {"plugin_dir", 0, "Directory for client-side plugins.", &opt_plugin_dir, &opt_plugin_dir, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake index de7fb5eb946..067a9f128a2 100644 --- a/cmake/wsrep.cmake +++ b/cmake/wsrep.cmake @@ -26,7 +26,7 @@ ENDIF() OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default}) # Set the patch version -SET(WSREP_PATCH_VERSION "13") +SET(WSREP_PATCH_VERSION "16") # Obtain wsrep API version FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION diff --git a/configure.cmake b/configure.cmake index 4470bee3223..cc80a8a5e4e 100644 --- a/configure.cmake +++ b/configure.cmake @@ -1018,7 +1018,7 @@ CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_sec "time.h" STRUCT_TIMESPEC_HAS_TV CHECK_STRUCT_HAS_MEMBER("struct timespec" tv_nsec "time.h" STRUCT_TIMESPEC_HAS_TV_NSEC) IF(NOT MSVC) - CHECK_C_SOURCE_RUNS( + CHECK_C_SOURCE_COMPILES( " #define _GNU_SOURCE #include <fcntl.h> diff --git a/extra/perror.c b/extra/perror.c index 11a703c8666..e96002cbb7b 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -222,7 +222,7 @@ static my_bool print_win_error_msg(DWORD error, my_bool verbose) will ignore calls to register already registered error numbers. */ -static const char **get_handler_error_messages() +static const char **get_handler_error_messages(int e __attribute__((unused))) { return handler_error_messages; } diff --git a/include/my_stacktrace.h b/include/my_stacktrace.h index fb2525e3a12..fad6e532de9 100644 --- a/include/my_stacktrace.h +++ b/include/my_stacktrace.h @@ -45,7 +45,7 @@ C_MODE_START #if defined(HAVE_STACKTRACE) || defined(HAVE_BACKTRACE) void my_init_stacktrace(); void my_print_stacktrace(uchar* stack_bottom, ulong thread_stack); -void my_safe_print_str(const char* val, int max_len); +int my_safe_print_str(const char* val, int max_len); void my_write_core(int sig); #if BACKTRACE_DEMANGLE char *my_demangle(const char *mangled_name, int *status); diff --git a/include/mysql.h.pp b/include/mysql.h.pp index e1a0901cee8..857f5b99a90 100644 --- a/include/mysql.h.pp +++ b/include/mysql.h.pp @@ -33,7 +33,7 @@ typedef struct st_net { char save_char; char net_skip_rest_factor; my_bool thread_specific_malloc; - my_bool compress; + unsigned char compress; my_bool unused3; void *thd; unsigned int last_errno; diff --git a/include/mysql_com.h b/include/mysql_com.h index 82f3b9f62ba..96b872ace37 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -418,7 +418,7 @@ typedef struct st_net { char save_char; char net_skip_rest_factor; my_bool thread_specific_malloc; - my_bool compress; + unsigned char compress; my_bool unused3; /* Please remove with the next incompatible ABI change. */ /* Pointer to query object in query cache, do not equal NULL (0) for diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 097cde04b43..555eadc9425 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -334,6 +334,12 @@ static int emb_stmt_execute(MYSQL_STMT *stmt) THD *thd; my_bool res; + if (stmt->param_count && !stmt->bind_param_done) + { + set_stmt_error(stmt, CR_PARAMS_NOT_BOUND, unknown_sqlstate, NULL); + DBUG_RETURN(1); + } + int4store(header, stmt->stmt_id); header[4]= (uchar) stmt->flags; thd= (THD*)stmt->mysql->thd; diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 17b2fd5b2bc..b5b16461781 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -45,6 +45,8 @@ loose-feedback-debug-startup-interval=20 loose-feedback-debug-first-interval=60 loose-feedback-debug-interval=60 +loose-pam-debug + loose-innodb_data_file_path= ibdata1:12M:autoextend loose-innodb_buffer_pool_size= 8M loose-innodb_lru_scan_depth= 100 diff --git a/mysql-test/include/report-features.test b/mysql-test/include/report-features.test deleted file mode 100644 index 75879f67165..00000000000 --- a/mysql-test/include/report-features.test +++ /dev/null @@ -1,12 +0,0 @@ -# -# show server variables -# - ---disable_query_log ---echo ===== ENGINES ===== -show engines; ---echo ===== VARIABLES ===== -show variables; ---echo ===== STOP ===== ---enable_query_log -exit; diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc index 96240e36db7..6f64ef45440 100644 --- a/mysql-test/include/wait_until_connected_again.inc +++ b/mysql-test/include/wait_until_connected_again.inc @@ -14,7 +14,7 @@ while ($mysql_errno) # Strangely enough, the server might return "Too many connections" # while being shutdown, thus 1040 is an "allowed" error # See BUG#36228 - --error 0,1040,1053,2002,2003,2005,2006,2013 + --error 0,1040,1053,2002,2003,2005,2006,2013,1927 show status; dec $counter; diff --git a/mysql-test/include/wait_until_disconnected.inc b/mysql-test/include/wait_until_disconnected.inc index 71361682442..658bf0be739 100644 --- a/mysql-test/include/wait_until_disconnected.inc +++ b/mysql-test/include/wait_until_disconnected.inc @@ -12,7 +12,7 @@ while (!$mysql_errno) # Strangely enough, the server might return "Too many connections" # while being shutdown, thus 1040 is an "allowed" error. # See BUG#36228. - --error 0,1040,1053,2002,2003,2005,2006,2013 + --error 0,1040,1053,2002,2003,2005,2006,2013,1927 show status; dec $counter; diff --git a/mysql-test/lib/My/SafeProcess.pm b/mysql-test/lib/My/SafeProcess.pm index a9b4f9a4ecc..f3ee772cca3 100644 --- a/mysql-test/lib/My/SafeProcess.pm +++ b/mysql-test/lib/My/SafeProcess.pm @@ -338,7 +338,7 @@ sub dump_core { my ($self)= @_; return if IS_WINDOWS; my $pid= $self->{SAFE_PID}; - die "Can't cet core from not started process" unless defined $pid; + die "Can't get core from not started process" unless defined $pid; _verbose("Sending ABRT to $self"); kill ("ABRT", $pid); return 1; diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index 8c2b67c2fda..2be903abf42 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -311,6 +311,7 @@ sub combinations_from_file($$) } our %disabled; +our %disabled_wildcards; sub parse_disabled { my ($filename, $suitename) = @_; @@ -319,10 +320,18 @@ sub parse_disabled { chomp; next if /^\s*#/ or /^\s*$/; mtr_error("Syntax error in $filename line $.") - unless /^\s*(?:([-0-9A-Za-z_\/]+)\.)?([-0-9A-Za-z_#]+)\s*:\s*(.*?)\s*$/; - mtr_error("Wrong suite name in $filename line $.") + unless /^\s*(?:([-0-9A-Za-z_\/]+)\.)?([-0-9A-Za-z_#\*]+)\s*:\s*(.*?)\s*$/; + mtr_error("Wrong suite name in $filename line $.: suitename = $suitename but the file says $1") if defined $1 and defined $suitename and $1 ne $suitename; - $disabled{($1 || $suitename || '') . ".$2"} = $3; + my ($sname, $casename, $text)= (($1 || $suitename || ''), $2, $3); + + if ($casename =~ /\*/) { + # Wildcard + $disabled_wildcards{$sname . ".$casename"}= $text; + } + else { + $disabled{$sname . ".$casename"}= $text; + } } close DISABLED; } @@ -720,6 +729,14 @@ sub collect_one_test_case { # Check for disabled tests # ---------------------------------------------------------------------- my $disable = $disabled{".$tname"} || $disabled{$name}; + if (not $disable) { + foreach my $w (keys %disabled_wildcards) { + if ($name =~ /^$w/) { + $disable= $disabled_wildcards{$w}; + last; + } + } + } if (not defined $disable and $suite->{parent}) { $disable = $disabled{$suite->{parent}->{name} . ".$tname"}; } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 0cddff81960..60c46f71ada 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -284,7 +284,6 @@ my $opt_port_base= $ENV{'MTR_PORT_BASE'} || "auto"; my $build_thread= 0; my $opt_record; -my $opt_report_features; our $opt_resfile= $ENV{'MTR_RESULT_FILE'} || 0; @@ -317,7 +316,6 @@ our $opt_user = "root"; our $opt_valgrind= 0; my $opt_valgrind_mysqld= 0; my $opt_valgrind_mysqltest= 0; -my @default_valgrind_args= ("--show-reachable=yes"); my @valgrind_args; my $opt_strace= 0; my $opt_strace_client; @@ -352,6 +350,7 @@ my $source_dist= -d "../sql"; my $opt_max_save_core= env_or_val(MTR_MAX_SAVE_CORE => 5); my $opt_max_save_datadir= env_or_val(MTR_MAX_SAVE_DATADIR => 20); my $opt_max_test_fail= env_or_val(MTR_MAX_TEST_FAIL => 10); +my $opt_core_on_failure= 0; my $opt_parallel= $ENV{MTR_PARALLEL} || 1; my $opt_port_group_size = $ENV{MTR_PORT_GROUP_SIZE} || 20; @@ -429,21 +428,6 @@ sub main { exit 0; } - if ( $opt_report_features ) { - # Put "report features" as the first test to run - my $tinfo = My::Test->new - ( - name => 'report_features', - # No result_file => Prints result - path => 'include/report-features.test', - template_path => "include/default_my.cnf", - master_opt => [], - slave_opt => [], - suite => 'main', - ); - unshift(@$tests, $tinfo); - } - ####################################################################### my $num_tests= @$tests; if ( $opt_parallel eq "auto" ) { @@ -1157,6 +1141,7 @@ sub command_line_setup { 'max-save-core=i' => \$opt_max_save_core, 'max-save-datadir=i' => \$opt_max_save_datadir, 'max-test-fail=i' => \$opt_max_test_fail, + 'core-on-failure' => \$opt_core_on_failure, # Coverage, profiling etc 'gcov' => \$opt_gcov, @@ -1190,7 +1175,6 @@ sub command_line_setup { 'client-libdir=s' => \$path_client_libdir, # Misc - 'report-features' => \$opt_report_features, 'comment=s' => \$opt_comment, 'fast' => \$opt_fast, 'force-restart' => \$opt_force_restart, @@ -1722,17 +1706,27 @@ sub command_line_setup { # Set special valgrind options unless options passed on command line push(@valgrind_args, "--trace-children=yes") unless @valgrind_args; + unshift(@valgrind_args, "--tool=callgrind"); } - if ( $opt_valgrind ) + # default to --tool=memcheck + if ($opt_valgrind && ! grep(/^--tool=/i, @valgrind_args)) { - # Set valgrind_options to default unless already defined - push(@valgrind_args, @default_valgrind_args) + # Set valgrind_option unless already defined + push(@valgrind_args, ("--show-reachable=yes", "--leak-check=yes", + "--num-callers=16")) unless @valgrind_args; + unshift(@valgrind_args, "--tool=memcheck"); + } + if ( $opt_valgrind ) + { # Make valgrind run in quiet mode so it only print errors push(@valgrind_args, "--quiet" ); + push(@valgrind_args, "--suppressions=${glob_mysql_test_dir}/valgrind.supp") + if -f "$glob_mysql_test_dir/valgrind.supp"; + mtr_report("Running valgrind with options \"", join(" ", @valgrind_args), "\""); } @@ -3770,6 +3764,7 @@ sub run_testcase ($$) { my $print_freq=20; mtr_verbose("Running test:", $tinfo->{name}); + $ENV{'MTR_TEST_NAME'} = $tinfo->{name}; resfile_report_test($tinfo) if $opt_resfile; # Allow only alpanumerics pluss _ - + . in combination names, @@ -4157,7 +4152,7 @@ sub run_testcase ($$) { } # Try to dump core for mysqltest and all servers - foreach my $proc ($test, started(all_servers())) + foreach my $proc ($test, started(all_servers())) { mtr_print("Trying to dump core for $proc"); if ($proc->dump_core()) @@ -4842,7 +4837,9 @@ sub after_failure ($) { sub report_failure_and_restart ($) { my $tinfo= shift; - if ($opt_valgrind_mysqld && ($tinfo->{'warnings'} || $tinfo->{'timeout'})) { + if ($opt_valgrind_mysqld && ($tinfo->{'warnings'} || $tinfo->{'timeout'}) && + $opt_core_on_failure == 0) + { # In these cases we may want valgrind report from normal termination $tinfo->{'dont_kill_server'}= 1; } @@ -5490,6 +5487,13 @@ sub start_mysqltest ($) { mtr_add_arg($args, "--sleep=%d", $opt_sleep); } + if ( $opt_valgrind ) + { + # We are running server under valgrind, which causes some replication + # test to be much slower, notable rpl_mdev6020. Increase timeout. + mtr_add_arg($args, "--wait-for-pos-timeout=1500"); + } + if ( $opt_ssl ) { # Turn on SSL for _all_ test cases if option --ssl was used @@ -5500,12 +5504,6 @@ sub start_mysqltest ($) { mtr_add_arg($args, "--max-connections=%d", $opt_max_connections); } - if ( $opt_valgrind ) - { - # Longer timeouts when running with valgrind - mtr_add_arg($args, "--wait-longer-for-timeouts"); - } - if ( $opt_embedded_server ) { @@ -5825,29 +5823,15 @@ sub valgrind_arguments { my $args= shift; my $exe= shift; - if ( $opt_callgrind) - { - mtr_add_arg($args, "--tool=callgrind"); - mtr_add_arg($args, "--base=$opt_vardir/log"); - } - else + # Ensure the jemalloc works with mysqld + if ($$exe =~ /mysqld/) { - mtr_add_arg($args, "--tool=memcheck"); # From >= 2.1.2 needs this option - mtr_add_arg($args, "--leak-check=yes"); - mtr_add_arg($args, "--num-callers=16"); - mtr_add_arg($args, "--suppressions=%s/valgrind.supp", $glob_mysql_test_dir) - if -f "$glob_mysql_test_dir/valgrind.supp"; - - # Ensure the jemalloc works with mysqld - if ($$exe =~ /mysqld/) - { - my %somalloc=( - 'system jemalloc' => 'libjemalloc*', - 'bundled jemalloc' => 'NONE' - ); - my ($syn) = $somalloc{$mysqld_variables{'version-malloc-library'}}; - mtr_add_arg($args, '--soname-synonyms=somalloc=%s', $syn) if $syn; - } + my %somalloc=( + 'system jemalloc' => 'libjemalloc*', + 'bundled jemalloc' => 'NONE' + ); + my ($syn) = $somalloc{$mysqld_variables{'version-malloc-library'}}; + mtr_add_arg($args, '--soname-synonyms=somalloc=%s', $syn) if $syn; } # Add valgrind options, can be overridden by user @@ -6139,6 +6123,7 @@ Options for debugging the product the current test run. Defaults to $opt_max_test_fail, set to 0 for no limit. Set it's default with MTR_MAX_TEST_FAIL + core-in-failure Generate a core even if run server is run with valgrind Options for valgrind @@ -6222,7 +6207,6 @@ Misc options gprof Collect profiling information using gprof. experimental=<file> Refer to list of tests considered experimental; failures will be marked exp-fail instead of fail. - report-features First run a "test" that reports mysql features timestamp Print timestamp before each test report line timediff With --timestamp, also print time passed since *previous* test started diff --git a/mysql-test/r/contributors.result b/mysql-test/r/contributors.result index 1e01ca81990..918ceaa496f 100644 --- a/mysql-test/r/contributors.result +++ b/mysql-test/r/contributors.result @@ -1,13 +1,14 @@ SHOW CONTRIBUTORS; Name Location Comment -Booking.com http://www.booking.com Founding member of the MariaDB Foundation -MariaDB Corporation https://mariadb.com Founding member of the MariaDB Foundation -Auttomattic http://automattic.com Member of the MariaDB Foundation -Visma http://visma.com Member of the MariaDB Foundation -Nexedi http://www.nexedi.com Member of the MariaDB Foundation -Acronis http://www.acronis.com Member of the MariaDB Foundation -Verkkokauppa.com Finland Sponsor of the MariaDB Foundation -Virtuozzo https://virtuozzo.com/ Sponsor of the MariaDB Foundation +Booking.com http://www.booking.com Founding member, Platinum Sponsor of the MariaDB Foundation +MariaDB Corporation https://mariadb.com Founding member, Gold Sponsor of the MariaDB Foundation +Visma http://visma.com Gold Sponsor of the MariaDB Foundation +DBS http://dbs.com Gold Sponsor of the MariaDB Foundation +Nexedi https://www.nexedi.com Silver Sponsor of the MariaDB Foundation +Acronis http://www.acronis.com Silver Sponsor of the MariaDB Foundation +Auttomattic https://automattic.com Bronze Sponsor of the MariaDB Foundation +Verkkokauppa.com https://virtuozzo.com Bronze Sponsor of the MariaDB Foundation +Virtuozzo https://virtuozzo.com/ Bronze Sponsor of the MariaDB Foundation Google USA Sponsoring encryption, parallel replication and GTID Facebook USA Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction diff --git a/mysql-test/r/create.result b/mysql-test/r/create.result index e7dfa79c803..36a192c2609 100644 --- a/mysql-test/r/create.result +++ b/mysql-test/r/create.result @@ -943,6 +943,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 7 diff --git a/mysql-test/r/derived.result b/mysql-test/r/derived.result index d3c0aae91db..04cb8c4c3ad 100644 --- a/mysql-test/r/derived.result +++ b/mysql-test/r/derived.result @@ -626,13 +626,13 @@ SELECT f3 FROM t2 HAVING f3 >= 8 ); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY <derived2> system NULL NULL NULL NULL 1 100.00 -1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 sq.f2 1 100.00 +1 PRIMARY <subquery4> eq_ref distinct_key distinct_key 4 const 1 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 2 100.00 Using where; FirstMatch(<subquery4>); Using join buffer (flat, BNL join) 4 MATERIALIZED t2 ALL NULL NULL NULL NULL 2 100.00 2 DERIVED t1 system NULL NULL NULL NULL 1 100.00 Warnings: Note 1276 Field or reference 'sq.f2' of SELECT #3 was resolved in SELECT #1 -Note 1003 select 6 AS `f1` from <materialize> (select `test`.`t2`.`f3` from `test`.`t2` having (`test`.`t2`.`f3` >= 8)) semi join (`test`.`t2`) where ((`test`.`t2`.`f3` = 6) and (9 = `<subquery4>`.`f3`)) +Note 1003 select 6 AS `f1` from <materialize> (select `test`.`t2`.`f3` from `test`.`t2` having (`test`.`t2`.`f3` >= 8)) semi join (`test`.`t2`) where ((`test`.`t2`.`f3` = 6) and (`<subquery4>`.`f3` = 9)) DROP TABLE t2,t1; # # MDEV-9462: Out of memory using explain on 2 empty tables diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index fb3509fcb24..52df8bf0012 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -79,6 +79,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -93,6 +94,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 12 @@ -166,6 +168,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -180,6 +183,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 12 @@ -232,6 +236,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -248,6 +253,7 @@ Handler_read_key 11 Handler_read_last 0 Handler_read_next 3 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 11 Handler_read_rnd_deleted 0 Handler_read_rnd_next 36 @@ -323,6 +329,7 @@ Handler_read_key 22 Handler_read_last 0 Handler_read_next 22 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 60 @@ -340,6 +347,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -356,6 +364,7 @@ Handler_read_key 11 Handler_read_last 0 Handler_read_next 3 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 11 Handler_read_rnd_deleted 0 Handler_read_rnd_next 36 @@ -604,6 +613,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 4 Handler_read_rnd_deleted 0 Handler_read_rnd_next 33 diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index 74247ae1b8e..dbeb458345e 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -2278,6 +2278,45 @@ EXECUTE stmt; t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1) DROP TABLE t1,t2,t3,t4,t5,t6; # +# MDEV-10500 CASE/IF Statement returns multiple values and shifts further result values to the next column +# +CREATE TABLE t1 ( +id int not null AUTO_INCREMENT, +active bool not null, +data1 bigint, +data2 bigint, +data3 bigint, +primary key (id) +); +INSERT INTO t1 (active,data1,data2,data3) VALUES (1,null,100,200); +SELECT +CASE WHEN active THEN SUM(data1) END AS C_1, +SUM(data2) AS C_2, +SUM(data3) AS C_3 +FROM t1; +C_1 C_2 C_3 +NULL 100 200 +SELECT +IF(active, SUM(data1), 5) AS C_1, +SUM(data2) AS C_2, +SUM(data3) AS C_3 +FROM t1; +C_1 C_2 C_3 +NULL 100 200 +DROP TABLE t1; +# +# MDEV-10468 Assertion `nr >= 0.0' failed in Item_sum_std::val_real() +# +SELECT STDDEV_POP(f) FROM (SELECT "1e+309" AS f UNION SELECT "-1e+309" AS f) tbl; +STDDEV_POP(f) +1.7976931348623157e308 +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: '1e+309' +Warning 1292 Truncated incorrect DOUBLE value: '-1e+309' +SELECT STDDEV(f) FROM (SELECT 1.7976931348623157e+308 AS f UNION SELECT -1.7976931348623157e+308 AS f) tbl; +STDDEV(f) +1.7976931348623157e308 +# # MDEV-8852 Implicit or explicit CAST from MAX(string) to INT,DOUBLE,DECIMAL does not produce warnings # SELECT MAX('x') << 1, CAST(MAX('x') AS DOUBLE), CAST(MAX('x') AS DECIMAL); @@ -2344,5 +2383,58 @@ companynr AVG(fld1) avg1 avg2 37 9223372036854775805.0000 9223372036854775805 9223372036854775805 DROP TABLE t1; # +# case where aggregate resolved in the local SELECT +# but outer ones are checked +# +create table t10 (a int , b int, c int); +insert into t10 values (0,0,0),(1,1,1); +create table t11 as select * from t10; +create table t12 as select * from t10; +explain extended select a from t10 where c<3 or a in (select c from t12 union select max(t10.b) from t11 group by t11.c); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t10 ALL NULL NULL NULL NULL 2 100.00 Using where +2 DEPENDENT SUBQUERY t12 ALL NULL NULL NULL NULL 2 100.00 Using where +3 DEPENDENT UNION t11 ALL NULL NULL NULL NULL 2 100.00 Using temporary +NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1276 Field or reference 'test.t10.b' of SELECT #3 was resolved in SELECT #1 +Note 1003 select `test`.`t10`.`a` AS `a` from `test`.`t10` where ((`test`.`t10`.`c` < 3) or <expr_cache><`test`.`t10`.`a`,`test`.`t10`.`b`>(<in_optimizer>(`test`.`t10`.`a`,<exists>(select `test`.`t12`.`c` from `test`.`t12` where (<cache>(`test`.`t10`.`a`) = `test`.`t12`.`c`) union select max(`test`.`t10`.`b`) from `test`.`t11` group by `test`.`t11`.`c` having (<cache>(`test`.`t10`.`a`) = <ref_null_helper>(max(`test`.`t10`.`b`))))))) +drop table t10,t11,t12; +# +# MDEV-10017: Get unexpected `Empty Set` for correlated subquery +# with aggregate functions +# +create table t1(c1 int, c2 int, c3 int); +insert into t1 values(1,1,1),(2,2,2),(3,3,3); +select * from t1; +c1 c2 c3 +1 1 1 +2 2 2 +3 3 3 +create table t2(c1 int, c2 int); +insert into t2 values(2,2); +select * from t2; +c1 c2 +2 2 +explain extended +select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+c) from t2 tt)); +ERROR HY000: Invalid use of group function +select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+c) from t2 tt)); +ERROR HY000: Invalid use of group function +explain extended +select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+tt.c1) from t2 tt)); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 +2 DEPENDENT SUBQUERY t system NULL NULL NULL NULL 1 100.00 +3 DEPENDENT SUBQUERY tt system NULL NULL NULL NULL 1 100.00 +Warnings: +Note 1276 Field or reference 'test.t1.c1' of SELECT #3 was resolved in SELECT #1 +Note 1003 select `test`.`t1`.`c1` AS `c1` from `test`.`t1` having (`test`.`t1`.`c1` >= <expr_cache><`test`.`t1`.`c1`>((select 2 AS `c` from dual order by (select min((`test`.`t1`.`c1` + 2)) from dual)))) +select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+tt.c1) from t2 tt)); +c1 +2 +3 +drop table t1,t2; +# # End of 10.1 tests # diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 703d9816f8b..bde4eca8334 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -787,10 +787,16 @@ select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2; 5.9 div 2 1.23456789e3 DIV 2 1.23456789e9 DIV 2 1.23456789e19 DIV 2 2 617 617283945 6172839450000000000 # -# End of 5.5 tests +# MDEV-10467 Assertion `nr >= 0.0' failed in Item_sum_std::val_real() # +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT STDDEV_SAMP(ROUND('0', 309)) FROM t1; +STDDEV_SAMP(ROUND('0', 309)) +0 +DROP TABLE t1; # -# Start of 10.0 tests +# End of 5.5 tests # # # MDEV-5781 Item_sum_std::val_real(): Assertion `nr >= 0.0' fails on query with STDDEV_POP, ROUND and variable diff --git a/mysql-test/r/func_misc.result b/mysql-test/r/func_misc.result index 4e38754788c..f6a04c6fb79 100644 --- a/mysql-test/r/func_misc.result +++ b/mysql-test/r/func_misc.result @@ -577,6 +577,13 @@ AND 57813X540X1723 = 'Test'; N AVG 0 NULL drop table t1; +SELECT NAME_CONST('a', -(1 OR 2)) OR 1; +ERROR HY000: Incorrect arguments to NAME_CONST +SELECT NAME_CONST('a', -(1 AND 2)) OR 1; +ERROR HY000: Incorrect arguments to NAME_CONST +SELECT NAME_CONST('a', -(1)) OR 1; +NAME_CONST('a', -(1)) OR 1 +1 # # End of 5.5 tests # diff --git a/mysql-test/r/func_time.result b/mysql-test/r/func_time.result index 9a9ab76883e..399aa978e47 100644 --- a/mysql-test/r/func_time.result +++ b/mysql-test/r/func_time.result @@ -2806,3 +2806,332 @@ Warning 1292 Truncated incorrect time value: '-1441:00:00' # # End of 10.0 tests # +# +# Start of 10.1 tests +# +# +# MDEV-10317 EXCTACT(MINUTE_MICROSECOND) truncates data +# +CREATE TABLE t1 (a DATETIME(6)); +INSERT INTO t1 VALUES ('1999-12-31 23:59:59.999999'); +SELECT +a, +EXTRACT(YEAR FROM a), +EXTRACT(YEAR_MONTH FROM a), +EXTRACT(QUARTER FROM a), +EXTRACT(MONTH FROM a), +EXTRACT(WEEK FROM a), +EXTRACT(DAY FROM a), +EXTRACT(DAY_HOUR FROM a), +EXTRACT(DAY_MINUTE FROM a), +EXTRACT(DAY_SECOND FROM a), +EXTRACT(HOUR FROM a), +EXTRACT(HOUR_MINUTE FROM a), +EXTRACT(HOUR_SECOND FROM a), +EXTRACT(MINUTE FROM a), +EXTRACT(MINUTE_SECOND FROM a), +EXTRACT(SECOND FROM a), +EXTRACT(MICROSECOND FROM a), +EXTRACT(DAY_MICROSECOND FROM a), +EXTRACT(HOUR_MICROSECOND FROM a), +EXTRACT(MINUTE_MICROSECOND FROM a), +EXTRACT(SECOND_MICROSECOND FROM a) +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a a 12 26 26 Y 128 6 63 +def EXTRACT(YEAR FROM a) 3 4 4 Y 32896 0 63 +def EXTRACT(YEAR_MONTH FROM a) 3 6 6 Y 32896 0 63 +def EXTRACT(QUARTER FROM a) 3 2 1 Y 32896 0 63 +def EXTRACT(MONTH FROM a) 3 2 2 Y 32896 0 63 +def EXTRACT(WEEK FROM a) 3 2 2 Y 32896 0 63 +def EXTRACT(DAY FROM a) 3 2 2 Y 32896 0 63 +def EXTRACT(DAY_HOUR FROM a) 3 5 4 Y 32896 0 63 +def EXTRACT(DAY_MINUTE FROM a) 3 7 6 Y 32896 0 63 +def EXTRACT(DAY_SECOND FROM a) 3 9 8 Y 32896 0 63 +def EXTRACT(HOUR FROM a) 3 3 2 Y 32896 0 63 +def EXTRACT(HOUR_MINUTE FROM a) 3 5 4 Y 32896 0 63 +def EXTRACT(HOUR_SECOND FROM a) 3 7 6 Y 32896 0 63 +def EXTRACT(MINUTE FROM a) 3 3 2 Y 32896 0 63 +def EXTRACT(MINUTE_SECOND FROM a) 3 5 4 Y 32896 0 63 +def EXTRACT(SECOND FROM a) 3 3 2 Y 32896 0 63 +def EXTRACT(MICROSECOND FROM a) 3 7 6 Y 32896 0 63 +def EXTRACT(DAY_MICROSECOND FROM a) 8 15 14 Y 32896 0 63 +def EXTRACT(HOUR_MICROSECOND FROM a) 8 13 12 Y 32896 0 63 +def EXTRACT(MINUTE_MICROSECOND FROM a) 8 11 10 Y 32896 0 63 +def EXTRACT(SECOND_MICROSECOND FROM a) 3 9 8 Y 32896 0 63 +a 1999-12-31 23:59:59.999999 +EXTRACT(YEAR FROM a) 1999 +EXTRACT(YEAR_MONTH FROM a) 199912 +EXTRACT(QUARTER FROM a) 4 +EXTRACT(MONTH FROM a) 12 +EXTRACT(WEEK FROM a) 52 +EXTRACT(DAY FROM a) 31 +EXTRACT(DAY_HOUR FROM a) 3123 +EXTRACT(DAY_MINUTE FROM a) 312359 +EXTRACT(DAY_SECOND FROM a) 31235959 +EXTRACT(HOUR FROM a) 23 +EXTRACT(HOUR_MINUTE FROM a) 2359 +EXTRACT(HOUR_SECOND FROM a) 235959 +EXTRACT(MINUTE FROM a) 59 +EXTRACT(MINUTE_SECOND FROM a) 5959 +EXTRACT(SECOND FROM a) 59 +EXTRACT(MICROSECOND FROM a) 999999 +EXTRACT(DAY_MICROSECOND FROM a) 31235959999999 +EXTRACT(HOUR_MICROSECOND FROM a) 235959999999 +EXTRACT(MINUTE_MICROSECOND FROM a) 5959999999 +EXTRACT(SECOND_MICROSECOND FROM a) 59999999 +CREATE TABLE t2 AS SELECT +a, +EXTRACT(YEAR FROM a), +EXTRACT(YEAR_MONTH FROM a), +EXTRACT(QUARTER FROM a), +EXTRACT(MONTH FROM a), +EXTRACT(WEEK FROM a), +EXTRACT(DAY FROM a), +EXTRACT(DAY_HOUR FROM a), +EXTRACT(DAY_MINUTE FROM a), +EXTRACT(DAY_SECOND FROM a), +EXTRACT(HOUR FROM a), +EXTRACT(HOUR_MINUTE FROM a), +EXTRACT(HOUR_SECOND FROM a), +EXTRACT(MINUTE FROM a), +EXTRACT(MINUTE_SECOND FROM a), +EXTRACT(SECOND FROM a), +EXTRACT(MICROSECOND FROM a), +EXTRACT(DAY_MICROSECOND FROM a), +EXTRACT(HOUR_MICROSECOND FROM a), +EXTRACT(MINUTE_MICROSECOND FROM a), +EXTRACT(SECOND_MICROSECOND FROM a) +FROM t1; +SELECT * FROM t2; +a 1999-12-31 23:59:59.999999 +EXTRACT(YEAR FROM a) 1999 +EXTRACT(YEAR_MONTH FROM a) 199912 +EXTRACT(QUARTER FROM a) 4 +EXTRACT(MONTH FROM a) 12 +EXTRACT(WEEK FROM a) 52 +EXTRACT(DAY FROM a) 31 +EXTRACT(DAY_HOUR FROM a) 3123 +EXTRACT(DAY_MINUTE FROM a) 312359 +EXTRACT(DAY_SECOND FROM a) 31235959 +EXTRACT(HOUR FROM a) 23 +EXTRACT(HOUR_MINUTE FROM a) 2359 +EXTRACT(HOUR_SECOND FROM a) 235959 +EXTRACT(MINUTE FROM a) 59 +EXTRACT(MINUTE_SECOND FROM a) 5959 +EXTRACT(SECOND FROM a) 59 +EXTRACT(MICROSECOND FROM a) 999999 +EXTRACT(DAY_MICROSECOND FROM a) 31235959999999 +EXTRACT(HOUR_MICROSECOND FROM a) 235959999999 +EXTRACT(MINUTE_MICROSECOND FROM a) 5959999999 +EXTRACT(SECOND_MICROSECOND FROM a) 59999999 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` datetime(6) DEFAULT NULL, + `EXTRACT(YEAR FROM a)` int(4) DEFAULT NULL, + `EXTRACT(YEAR_MONTH FROM a)` int(6) DEFAULT NULL, + `EXTRACT(QUARTER FROM a)` int(2) DEFAULT NULL, + `EXTRACT(MONTH FROM a)` int(2) DEFAULT NULL, + `EXTRACT(WEEK FROM a)` int(2) DEFAULT NULL, + `EXTRACT(DAY FROM a)` int(2) DEFAULT NULL, + `EXTRACT(DAY_HOUR FROM a)` int(5) DEFAULT NULL, + `EXTRACT(DAY_MINUTE FROM a)` int(7) DEFAULT NULL, + `EXTRACT(DAY_SECOND FROM a)` int(9) DEFAULT NULL, + `EXTRACT(HOUR FROM a)` int(3) DEFAULT NULL, + `EXTRACT(HOUR_MINUTE FROM a)` int(5) DEFAULT NULL, + `EXTRACT(HOUR_SECOND FROM a)` int(7) DEFAULT NULL, + `EXTRACT(MINUTE FROM a)` int(3) DEFAULT NULL, + `EXTRACT(MINUTE_SECOND FROM a)` int(5) DEFAULT NULL, + `EXTRACT(SECOND FROM a)` int(3) DEFAULT NULL, + `EXTRACT(MICROSECOND FROM a)` int(7) DEFAULT NULL, + `EXTRACT(DAY_MICROSECOND FROM a)` bigint(15) DEFAULT NULL, + `EXTRACT(HOUR_MICROSECOND FROM a)` bigint(13) DEFAULT NULL, + `EXTRACT(MINUTE_MICROSECOND FROM a)` bigint(11) DEFAULT NULL, + `EXTRACT(SECOND_MICROSECOND FROM a)` int(9) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1,t2; +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES ('-838:59:59.999999'),('838:59:59.999999'); +SELECT +a, +EXTRACT(YEAR FROM a), +EXTRACT(YEAR_MONTH FROM a), +EXTRACT(QUARTER FROM a), +EXTRACT(MONTH FROM a), +EXTRACT(WEEK FROM a), +EXTRACT(DAY FROM a), +EXTRACT(DAY_HOUR FROM a), +EXTRACT(DAY_MINUTE FROM a), +EXTRACT(DAY_SECOND FROM a), +EXTRACT(HOUR FROM a), +EXTRACT(HOUR_MINUTE FROM a), +EXTRACT(HOUR_SECOND FROM a), +EXTRACT(MINUTE FROM a), +EXTRACT(MINUTE_SECOND FROM a), +EXTRACT(SECOND FROM a), +EXTRACT(MICROSECOND FROM a), +EXTRACT(DAY_MICROSECOND FROM a), +EXTRACT(HOUR_MICROSECOND FROM a), +EXTRACT(MINUTE_MICROSECOND FROM a), +EXTRACT(SECOND_MICROSECOND FROM a) +FROM t1; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a a 11 17 17 Y 128 6 63 +def EXTRACT(YEAR FROM a) 3 4 1 Y 32896 0 63 +def EXTRACT(YEAR_MONTH FROM a) 3 6 1 Y 32896 0 63 +def EXTRACT(QUARTER FROM a) 3 2 1 Y 32896 0 63 +def EXTRACT(MONTH FROM a) 3 2 1 Y 32896 0 63 +def EXTRACT(WEEK FROM a) 3 2 9 Y 32896 0 63 +def EXTRACT(DAY FROM a) 3 2 2 Y 32896 0 63 +def EXTRACT(DAY_HOUR FROM a) 3 5 5 Y 32896 0 63 +def EXTRACT(DAY_MINUTE FROM a) 3 7 7 Y 32896 0 63 +def EXTRACT(DAY_SECOND FROM a) 3 9 9 Y 32896 0 63 +def EXTRACT(HOUR FROM a) 3 3 3 Y 32896 0 63 +def EXTRACT(HOUR_MINUTE FROM a) 3 5 5 Y 32896 0 63 +def EXTRACT(HOUR_SECOND FROM a) 3 7 7 Y 32896 0 63 +def EXTRACT(MINUTE FROM a) 3 3 3 Y 32896 0 63 +def EXTRACT(MINUTE_SECOND FROM a) 3 5 5 Y 32896 0 63 +def EXTRACT(SECOND FROM a) 3 3 3 Y 32896 0 63 +def EXTRACT(MICROSECOND FROM a) 3 7 7 Y 32896 0 63 +def EXTRACT(DAY_MICROSECOND FROM a) 8 15 15 Y 32896 0 63 +def EXTRACT(HOUR_MICROSECOND FROM a) 8 13 13 Y 32896 0 63 +def EXTRACT(MINUTE_MICROSECOND FROM a) 8 11 11 Y 32896 0 63 +def EXTRACT(SECOND_MICROSECOND FROM a) 3 9 9 Y 32896 0 63 +a -838:59:59.999999 +EXTRACT(YEAR FROM a) 0 +EXTRACT(YEAR_MONTH FROM a) 0 +EXTRACT(QUARTER FROM a) 0 +EXTRACT(MONTH FROM a) 0 +EXTRACT(WEEK FROM a) 613566757 +EXTRACT(DAY FROM a) 34 +EXTRACT(DAY_HOUR FROM a) -3422 +EXTRACT(DAY_MINUTE FROM a) -342259 +EXTRACT(DAY_SECOND FROM a) -34225959 +EXTRACT(HOUR FROM a) -22 +EXTRACT(HOUR_MINUTE FROM a) -2259 +EXTRACT(HOUR_SECOND FROM a) -225959 +EXTRACT(MINUTE FROM a) -59 +EXTRACT(MINUTE_SECOND FROM a) -5959 +EXTRACT(SECOND FROM a) -59 +EXTRACT(MICROSECOND FROM a) -999999 +EXTRACT(DAY_MICROSECOND FROM a) -34225959999999 +EXTRACT(HOUR_MICROSECOND FROM a) -225959999999 +EXTRACT(MINUTE_MICROSECOND FROM a) -5959999999 +EXTRACT(SECOND_MICROSECOND FROM a) -59999999 +a 838:59:59.999999 +EXTRACT(YEAR FROM a) 0 +EXTRACT(YEAR_MONTH FROM a) 0 +EXTRACT(QUARTER FROM a) 0 +EXTRACT(MONTH FROM a) 0 +EXTRACT(WEEK FROM a) 613566757 +EXTRACT(DAY FROM a) 34 +EXTRACT(DAY_HOUR FROM a) 3422 +EXTRACT(DAY_MINUTE FROM a) 342259 +EXTRACT(DAY_SECOND FROM a) 34225959 +EXTRACT(HOUR FROM a) 22 +EXTRACT(HOUR_MINUTE FROM a) 2259 +EXTRACT(HOUR_SECOND FROM a) 225959 +EXTRACT(MINUTE FROM a) 59 +EXTRACT(MINUTE_SECOND FROM a) 5959 +EXTRACT(SECOND FROM a) 59 +EXTRACT(MICROSECOND FROM a) 999999 +EXTRACT(DAY_MICROSECOND FROM a) 34225959999999 +EXTRACT(HOUR_MICROSECOND FROM a) 225959999999 +EXTRACT(MINUTE_MICROSECOND FROM a) 5959999999 +EXTRACT(SECOND_MICROSECOND FROM a) 59999999 +CREATE TABLE t2 AS SELECT +a, +EXTRACT(YEAR FROM a), +EXTRACT(YEAR_MONTH FROM a), +EXTRACT(QUARTER FROM a), +EXTRACT(MONTH FROM a), +EXTRACT(WEEK FROM a), +EXTRACT(DAY FROM a), +EXTRACT(DAY_HOUR FROM a), +EXTRACT(DAY_MINUTE FROM a), +EXTRACT(DAY_SECOND FROM a), +EXTRACT(HOUR FROM a), +EXTRACT(HOUR_MINUTE FROM a), +EXTRACT(HOUR_SECOND FROM a), +EXTRACT(MINUTE FROM a), +EXTRACT(MINUTE_SECOND FROM a), +EXTRACT(SECOND FROM a), +EXTRACT(MICROSECOND FROM a), +EXTRACT(DAY_MICROSECOND FROM a), +EXTRACT(HOUR_MICROSECOND FROM a), +EXTRACT(MINUTE_MICROSECOND FROM a), +EXTRACT(SECOND_MICROSECOND FROM a) +FROM t1; +SELECT * FROM t2; +a -838:59:59.999999 +EXTRACT(YEAR FROM a) 0 +EXTRACT(YEAR_MONTH FROM a) 0 +EXTRACT(QUARTER FROM a) 0 +EXTRACT(MONTH FROM a) 0 +EXTRACT(WEEK FROM a) 613566757 +EXTRACT(DAY FROM a) 34 +EXTRACT(DAY_HOUR FROM a) -3422 +EXTRACT(DAY_MINUTE FROM a) -342259 +EXTRACT(DAY_SECOND FROM a) -34225959 +EXTRACT(HOUR FROM a) -22 +EXTRACT(HOUR_MINUTE FROM a) -2259 +EXTRACT(HOUR_SECOND FROM a) -225959 +EXTRACT(MINUTE FROM a) -59 +EXTRACT(MINUTE_SECOND FROM a) -5959 +EXTRACT(SECOND FROM a) -59 +EXTRACT(MICROSECOND FROM a) -999999 +EXTRACT(DAY_MICROSECOND FROM a) -34225959999999 +EXTRACT(HOUR_MICROSECOND FROM a) -225959999999 +EXTRACT(MINUTE_MICROSECOND FROM a) -5959999999 +EXTRACT(SECOND_MICROSECOND FROM a) -59999999 +a 838:59:59.999999 +EXTRACT(YEAR FROM a) 0 +EXTRACT(YEAR_MONTH FROM a) 0 +EXTRACT(QUARTER FROM a) 0 +EXTRACT(MONTH FROM a) 0 +EXTRACT(WEEK FROM a) 613566757 +EXTRACT(DAY FROM a) 34 +EXTRACT(DAY_HOUR FROM a) 3422 +EXTRACT(DAY_MINUTE FROM a) 342259 +EXTRACT(DAY_SECOND FROM a) 34225959 +EXTRACT(HOUR FROM a) 22 +EXTRACT(HOUR_MINUTE FROM a) 2259 +EXTRACT(HOUR_SECOND FROM a) 225959 +EXTRACT(MINUTE FROM a) 59 +EXTRACT(MINUTE_SECOND FROM a) 5959 +EXTRACT(SECOND FROM a) 59 +EXTRACT(MICROSECOND FROM a) 999999 +EXTRACT(DAY_MICROSECOND FROM a) 34225959999999 +EXTRACT(HOUR_MICROSECOND FROM a) 225959999999 +EXTRACT(MINUTE_MICROSECOND FROM a) 5959999999 +EXTRACT(SECOND_MICROSECOND FROM a) 59999999 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` time(6) DEFAULT NULL, + `EXTRACT(YEAR FROM a)` int(4) DEFAULT NULL, + `EXTRACT(YEAR_MONTH FROM a)` int(6) DEFAULT NULL, + `EXTRACT(QUARTER FROM a)` int(2) DEFAULT NULL, + `EXTRACT(MONTH FROM a)` int(2) DEFAULT NULL, + `EXTRACT(WEEK FROM a)` int(2) DEFAULT NULL, + `EXTRACT(DAY FROM a)` int(2) DEFAULT NULL, + `EXTRACT(DAY_HOUR FROM a)` int(5) DEFAULT NULL, + `EXTRACT(DAY_MINUTE FROM a)` int(7) DEFAULT NULL, + `EXTRACT(DAY_SECOND FROM a)` int(9) DEFAULT NULL, + `EXTRACT(HOUR FROM a)` int(3) DEFAULT NULL, + `EXTRACT(HOUR_MINUTE FROM a)` int(5) DEFAULT NULL, + `EXTRACT(HOUR_SECOND FROM a)` int(7) DEFAULT NULL, + `EXTRACT(MINUTE FROM a)` int(3) DEFAULT NULL, + `EXTRACT(MINUTE_SECOND FROM a)` int(5) DEFAULT NULL, + `EXTRACT(SECOND FROM a)` int(3) DEFAULT NULL, + `EXTRACT(MICROSECOND FROM a)` int(7) DEFAULT NULL, + `EXTRACT(DAY_MICROSECOND FROM a)` bigint(15) DEFAULT NULL, + `EXTRACT(HOUR_MICROSECOND FROM a)` bigint(13) DEFAULT NULL, + `EXTRACT(MINUTE_MICROSECOND FROM a)` bigint(11) DEFAULT NULL, + `EXTRACT(SECOND_MICROSECOND FROM a)` int(9) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1,t2; +# +# End of 10.1 tests +# diff --git a/mysql-test/r/grant2.result b/mysql-test/r/grant2.result index d447bc10dc7..2ccc01d225a 100644 --- a/mysql-test/r/grant2.result +++ b/mysql-test/r/grant2.result @@ -812,7 +812,7 @@ mysqltest_db1.t3 preload_keys status OK # RENAME (doesn't work for temporary tables, thus should fail). # RENAME TABLE t3 TO t3_1; -ERROR 42000: DROP, ALTER command denied to user 'mysqltest_u1'@'localhost' for table 't3' +ERROR 42000: INSERT, CREATE command denied to user 'mysqltest_u1'@'localhost' for table 't3_1' # # HANDLER OPEN/READ/CLOSE. # diff --git a/mysql-test/r/group_by.result b/mysql-test/r/group_by.result index f27ae67adff..7cc5f1029b0 100644 --- a/mysql-test/r/group_by.result +++ b/mysql-test/r/group_by.result @@ -2723,3 +2723,37 @@ select distinct a from t1 group by 'a'; a 2001-02-02 drop table t1; +# +# MDEV-10324: Server crash in get_sel_arg_for_keypart or Assertion `n < size()' failed in Mem_root_array +# +CREATE TABLE t1 ( +job_id int(10) unsigned NOT NULL AUTO_INCREMENT, +job_cmd varbinary(60) NOT NULL DEFAULT '', +job_namespace int(11) NOT NULL, +job_title varbinary(255) NOT NULL, +job_params blob NOT NULL, +job_timestamp varbinary(14) DEFAULT NULL, +job_random int(10) unsigned NOT NULL DEFAULT '0', +job_token varbinary(32) NOT NULL DEFAULT '', +job_token_timestamp varbinary(14) DEFAULT NULL, +job_sha1 varbinary(32) NOT NULL DEFAULT '', +job_attempts int(10) unsigned NOT NULL DEFAULT '0', +PRIMARY KEY (job_id), +KEY job_cmd (job_cmd,job_namespace,job_title,job_params(128)), +KEY job_timestamp (job_timestamp), +KEY job_sha1 (job_sha1), +KEY job_cmd_token (job_cmd,job_token,job_random), +KEY job_cmd_token_id (job_cmd,job_token,job_id) +); +INSERT INTO t1 VALUES +(NULL, 'foo', 1, 'foo', 'foo', 'foo', 1, 'foo', 'foo', 'foo', 1), +(NULL, 'bar', 2, 'bar', 'bar', 'bar', 2, 'bar', 'bar', 'bar', 2); +SELECT DISTINCT job_cmd FROM t1 WHERE job_cmd IN ('foobar','null'); +job_cmd +drop table t1; +CREATE TABLE t1 (f1 INT NOT NULL, f2 VARCHAR(3) NOT NULL, KEY(f1), KEY(f2, f1)); +INSERT INTO t1 VALUES (0,'foo'),(1,'bar'); +SELECT 1 IN ( SELECT COUNT( DISTINCT f2 ) FROM t1 WHERE f1 <= 4 ); +1 IN ( SELECT COUNT( DISTINCT f2 ) FROM t1 WHERE f1 <= 4 ) +0 +drop table t1; diff --git a/mysql-test/r/group_by_innodb.result b/mysql-test/r/group_by_innodb.result index 381e0d7493c..bf6b25f31fa 100644 --- a/mysql-test/r/group_by_innodb.result +++ b/mysql-test/r/group_by_innodb.result @@ -123,4 +123,39 @@ id xtext optionen 2 number 22,25 1 select Kabel mit Stecker 5-polig,Kabel ohne Stecker DROP TABLE t1, t2; +# Port of testcase: +# +# Bug#20819199 ASSERTION FAILED IN TEST_IF_SKIP_SORT_ORDER +# +CREATE TABLE t0 ( a INT ); +INSERT INTO t0 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +CREATE TABLE t1 ( +pk INT NOT NULL AUTO_INCREMENT, +a INT, +b INT, +PRIMARY KEY (pk), +KEY idx1 (a), +KEY idx2 (b, a), +KEY idx3 (a, b) +) ENGINE = InnoDB; +INSERT INTO t1 (a, b) SELECT t01.a, t02.a FROM t0 t01, t0 t02; +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +EXPLAIN SELECT DISTINCT a, MAX(b) FROM t1 WHERE a >= 0 GROUP BY a,a; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range idx1,idx3 idx3 5 NULL 100 Using where; Using index +SELECT DISTINCT a, MAX(b) FROM t1 WHERE a >= 0 GROUP BY a,a; +a MAX(b) +1 10 +2 10 +3 10 +4 10 +5 10 +6 10 +7 10 +8 10 +9 10 +10 10 +DROP TABLE t0, t1; # End of tests diff --git a/mysql-test/r/group_min_max.result b/mysql-test/r/group_min_max.result index cf867dd1e18..7d57222aafd 100644 --- a/mysql-test/r/group_min_max.result +++ b/mysql-test/r/group_min_max.result @@ -2378,6 +2378,7 @@ SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value Handler_read_key 8 Handler_read_next 0 +Handler_read_retry 0 EXPLAIN SELECT max(b), a FROM t1 GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL a 5 NULL 8 Using index for group-by @@ -2387,6 +2388,7 @@ SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value Handler_read_key 8 Handler_read_next 0 +Handler_read_retry 0 FLUSH STATUS; SELECT * FROM (SELECT max(b), a FROM t1 GROUP BY a) b; max(b) a @@ -2398,6 +2400,7 @@ SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value Handler_read_key 8 Handler_read_next 0 +Handler_read_retry 0 FLUSH STATUS; (SELECT max(b), a FROM t1 GROUP BY a) UNION (SELECT max(b), a FROM t1 GROUP BY a); @@ -2410,6 +2413,7 @@ SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value Handler_read_key 16 Handler_read_next 0 +Handler_read_retry 0 EXPLAIN (SELECT max(b), a FROM t1 GROUP BY a) UNION (SELECT max(b), a FROM t1 GROUP BY a); id select_type table type possible_keys key key_len ref rows Extra @@ -2462,6 +2466,7 @@ SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value Handler_read_key 8 Handler_read_next 0 +Handler_read_retry 0 DELETE FROM t3; FLUSH STATUS; INSERT INTO t3 SELECT 1, (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) @@ -2470,12 +2475,14 @@ SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value Handler_read_key 8 Handler_read_next 0 +Handler_read_retry 0 FLUSH STATUS; DELETE FROM t3 WHERE (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) > 10000; SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value Handler_read_key 8 Handler_read_next 0 +Handler_read_retry 0 FLUSH STATUS; DELETE FROM t3 WHERE (SELECT (SELECT MAX(b) FROM t1 GROUP BY a HAVING a < 2) x FROM t1) > 10000; @@ -2484,6 +2491,7 @@ SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value Handler_read_key 8 Handler_read_next 1 +Handler_read_retry 0 DROP TABLE t1,t2,t3; CREATE TABLE t1 (a int, INDEX idx(a)); INSERT INTO t1 VALUES diff --git a/mysql-test/r/handler_read_last.result b/mysql-test/r/handler_read_last.result index 574c3c25ab1..9dd3784673a 100644 --- a/mysql-test/r/handler_read_last.result +++ b/mysql-test/r/handler_read_last.result @@ -12,6 +12,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -26,6 +27,7 @@ Handler_read_key 0 Handler_read_last 1 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -42,6 +44,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -58,6 +61,7 @@ Handler_read_key 0 Handler_read_last 1 Handler_read_next 0 Handler_read_prev 2 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/mysql-test/r/information_schema_stats.result b/mysql-test/r/information_schema_stats.result index cd73636879c..bc2ce9f0294 100644 --- a/mysql-test/r/information_schema_stats.result +++ b/mysql-test/r/information_schema_stats.result @@ -16,8 +16,8 @@ count(*) 2 select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ -test just_a_test IND_just_a_test_state 2 test just_a_test IND_just_a_test_first_name_last_name 1 +test just_a_test IND_just_a_test_state 2 select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES test just_a_test 18 5 5 @@ -56,9 +56,9 @@ count(*) 3 select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; TABLE_SCHEMA TABLE_NAME INDEX_NAME ROWS_READ +test just_a_test PRIMARY 5 test just_a_test first_name 1 test just_a_test state 2 -test just_a_test PRIMARY 5 select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; TABLE_SCHEMA TABLE_NAME ROWS_READ ROWS_CHANGED ROWS_CHANGED_X_INDEXES test just_a_test 8 5 15 diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result index cae402a9f12..1305be86e5a 100644 --- a/mysql-test/r/innodb_ext_key.result +++ b/mysql-test/r/innodb_ext_key.result @@ -20,6 +20,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 5 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -39,6 +40,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 1 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -60,6 +62,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -81,6 +84,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -102,6 +106,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 6 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -123,6 +128,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 1 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -146,6 +152,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 6 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -169,6 +176,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 3 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -188,6 +196,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 6 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -207,6 +216,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -228,6 +238,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 6 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -249,6 +260,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -270,6 +282,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 5 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -291,6 +304,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -317,6 +331,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 9 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 9 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -343,6 +358,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 2 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -370,6 +386,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 9 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 9 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -397,6 +414,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 3 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 3 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -422,6 +440,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 9 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 3 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -447,6 +466,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 3 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 3 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -477,6 +497,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 294 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -507,6 +528,7 @@ Handler_read_key 21 Handler_read_last 1 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -529,6 +551,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 1230 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -551,6 +574,7 @@ Handler_read_key 6 Handler_read_last 1 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -581,6 +605,7 @@ Handler_read_key 3 Handler_read_last 0 Handler_read_next 26 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -610,6 +635,7 @@ Handler_read_key 3 Handler_read_last 0 Handler_read_next 3 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -807,6 +833,7 @@ Handler_read_key 10 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 11 @@ -828,6 +855,7 @@ Handler_read_key 10 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 11 @@ -1040,5 +1068,70 @@ a 1 drop table t1, t2; set optimizer_switch=@save_optimizer_switch; +# +# MDEV-10325: Queries examines all rows of a tables when it should not +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( +pk int not null, +col1 varchar(32), +filler varchar(100), +key idx1(col1(10)), +primary key (pk) +)engine=innodb; +insert into t1 +select +A.a + 10*B.a + 100*C.a, +concat('1234567890-', 1000+ A.a + 10*B.a + 100*C.a), +repeat('filler-data-', 4) +from +t0 A, t0 B, t0 C; +drop table t0,t1; +# +# MDEV-10360: Extended keys: index properties depend on index order +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( +index_id bigint(20) unsigned NOT NULL, +index_class varchar(265) COLLATE latin1_general_ci DEFAULT NULL , +index_object_id int(10) unsigned NOT NULL DEFAULT '0' , +index_date_updated int(10) unsigned DEFAULT NULL , +PRIMARY KEY (index_id), +KEY object (index_class(181),index_object_id), +KEY index_date_updated (index_date_updated) +) engine=innodb; +create table t2 ( +index_id bigint(20) unsigned NOT NULL, +index_class varchar(265) COLLATE latin1_general_ci DEFAULT NULL , +index_object_id int(10) unsigned NOT NULL DEFAULT '0' , +index_date_updated int(10) unsigned DEFAULT NULL , +PRIMARY KEY (index_id), +KEY index_date_updated (index_date_updated), +KEY object (index_class(181),index_object_id) +) engine=innodb; +insert into t1 select +@a:=A.a + 10*B.a + 100*C.a, +concat('val-', @a), +123456, +A.a + 10*B.a +from +t0 A, t0 B, t0 C; +insert into t2 select * from t1; +# This must have the same query plan as the query below it: +# type=range, key=index_date_updated, key_len=13 +explain +select * from t1 force index(index_date_updated) +where index_date_updated= 10 and index_id < 800; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range index_date_updated index_date_updated 13 NULL # Using index condition +# This used to work from the start: +explain +select * from t2 force index(index_date_updated) +where index_date_updated= 10 and index_id < 800; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range index_date_updated index_date_updated 13 NULL # Using index condition +drop table t0,t1,t2; set optimizer_switch=@save_ext_key_optimizer_switch; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/r/insert_select.result b/mysql-test/r/insert_select.result index 8bfc4e9215e..3f4a26a728e 100644 --- a/mysql-test/r/insert_select.result +++ b/mysql-test/r/insert_select.result @@ -701,6 +701,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 1 diff --git a/mysql-test/r/join.result b/mysql-test/r/join.result index de5fabbd90c..7b476ca6415 100644 --- a/mysql-test/r/join.result +++ b/mysql-test/r/join.result @@ -860,6 +860,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 5 @@ -1271,6 +1272,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 1 diff --git a/mysql-test/r/join_outer.result b/mysql-test/r/join_outer.result index 2602181f234..8b4ee17f20e 100644 --- a/mysql-test/r/join_outer.result +++ b/mysql-test/r/join_outer.result @@ -1242,6 +1242,7 @@ Handler_read_key 5 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 6 @@ -1803,6 +1804,7 @@ Handler_read_key 4 Handler_read_last 0 Handler_read_next 5 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 1048581 @@ -1817,6 +1819,7 @@ Handler_read_key 4 Handler_read_last 0 Handler_read_next 5 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 1048581 diff --git a/mysql-test/r/join_outer_jcl6.result b/mysql-test/r/join_outer_jcl6.result index 51f43f1404e..9cdcea379b9 100644 --- a/mysql-test/r/join_outer_jcl6.result +++ b/mysql-test/r/join_outer_jcl6.result @@ -1253,6 +1253,7 @@ Handler_read_key 5 Handler_read_last 0 Handler_read_next 9 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 3 Handler_read_rnd_deleted 0 Handler_read_rnd_next 6 @@ -1814,6 +1815,7 @@ Handler_read_key 4 Handler_read_last 0 Handler_read_next 5 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 5 Handler_read_rnd_deleted 0 Handler_read_rnd_next 1048581 @@ -1828,6 +1830,7 @@ Handler_read_key 4 Handler_read_last 0 Handler_read_next 5 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 5 Handler_read_rnd_deleted 0 Handler_read_rnd_next 1048581 diff --git a/mysql-test/r/limit_rows_examined.result b/mysql-test/r/limit_rows_examined.result index cce8ee5a8e2..a7c477c9e4b 100644 --- a/mysql-test/r/limit_rows_examined.result +++ b/mysql-test/r/limit_rows_examined.result @@ -756,6 +756,7 @@ Handler_read_key 5 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 46 @@ -780,6 +781,7 @@ Handler_read_key 5 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 2 Handler_read_rnd_deleted 1 Handler_read_rnd_next 47 diff --git a/mysql-test/r/loaddata.result b/mysql-test/r/loaddata.result index 16572dd95c5..d21402a336a 100644 --- a/mysql-test/r/loaddata.result +++ b/mysql-test/r/loaddata.result @@ -537,7 +537,7 @@ disconnect con1; # Bug#11765139 58069: LOAD DATA INFILE: VALGRIND REPORTS INVALID MEMORY READS AND WRITES WITH U # CREATE TABLE t1(f1 INT); -SELECT 0xE1BB30 INTO OUTFILE 't1.dat'; +SELECT 0xE1C330 INTO OUTFILE 't1.dat'; LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8; DROP TABLE t1; # @@ -562,3 +562,34 @@ FIELDS TERMINATED BY 't' LINES TERMINATED BY ''; Got one of the listed errors SET @@sql_mode= @old_mode; DROP TABLE t1; + +# +# Bug#23080148 - Backport of Bug#20683959. +# Bug#20683959 LOAD DATA INFILE IGNORES A SPECIFIC ROW SILENTLY +# UNDER DB CHARSET IS UTF8. +# +CREATE DATABASE d1 CHARSET latin1; +USE d1; +CREATE TABLE t1 (val TEXT); +LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1; +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT HEX(val) FROM t1; +HEX(val) +C38322525420406E696F757A656368756E3A20E98198E2889AF58081AEE7B99DE4B88AE383A3E7B99DE69690F58087B3E7B9A7EFBDA8E7B99DEFBDB3E7B99DE78999E880B3E7B8BAEFBDAAE7B9A7E89699E296A1E7B8BAE4BBA3EFBD8CE7B8BAEFBDA9E7B8B2E2889AE38184E7B99DEFBDB3E7B99DE4B88AE383A3E7B99DE69690F58087B3E7B9A7EFBDA8E7B99DEFBDB3E7B99DE5B3A8EFBD84E8ABA0EFBDA8E89C89F580948EE599AAE7B8BAEFBDAAE7B8BAE9A198EFBDA9EFBDB1E7B9A7E581B5E289A0E7B8BAEFBDBEE7B9A7E9A194EFBDA9E882B4EFBDA5EFBDB5E980A7F5808B96E28693E99EABE38287E58F99E7B8BAE58AB1E28691E7B8BAF5808B9AE7828AE98095EFBDB1E7B8BAEFBDAFE7B8B2E288ABE6A89FE89EB3E6BA98F58081ADE88EA0EFBDBAE98095E6BA98F58081AEE89D93EFBDBAE8AD9BEFBDACE980A7F5808B96E28693E7B8BAF580918EE288AAE7B8BAE4B88AEFBC9EE7B8BAE4B99DE28691E7B8BAF5808B96EFBCA0E88DB3E6A68AEFBDB9EFBDB3E981B2E5B3A8E296A1E7B8BAE7A4BCE7828AE88DB3E6A68AEFBDB0EFBDBDE7B8BAA0E7B8BAE88B93EFBDBEE5B899EFBC9E +CREATE DATABASE d2 CHARSET utf8; +USE d2; +CREATE TABLE t1 (val TEXT); +LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1; +Warnings: +Warning 1366 Incorrect string value: '\xF5\x80\x81\xAE\xE7\xB9...' for column 'val' at row 1 +SELECT COUNT(*) FROM t1; +COUNT(*) +1 +SELECT HEX(val) FROM t1; +HEX(val) +C38322525420406E696F757A656368756E3A20E98198E2889A3F3F3F3FE7B99DE4B88AE383A3E7B99DE696903F3F3F3FE7B9A7EFBDA8E7B99DEFBDB3E7B99DE78999E880B3E7B8BAEFBDAAE7B9A7E89699E296A1E7B8BAE4BBA3EFBD8CE7B8BAEFBDA9E7B8B2E2889AE38184E7B99DEFBDB3E7B99DE4B88AE383A3E7B99DE696903F3F3F3FE7B9A7EFBDA8E7B99DEFBDB3E7B99DE5B3A8EFBD84E8ABA0EFBDA8E89C893F3F3F3FE599AAE7B8BAEFBDAAE7B8BAE9A198EFBDA9EFBDB1E7B9A7E581B5E289A0E7B8BAEFBDBEE7B9A7E9A194EFBDA9E882B4EFBDA5EFBDB5E980A73F3F3F3FE28693E99EABE38287E58F99E7B8BAE58AB1E28691E7B8BA3F3F3F3FE7828AE98095EFBDB1E7B8BAEFBDAFE7B8B2E288ABE6A89FE89EB3E6BA983F3F3F3FE88EA0EFBDBAE98095E6BA983F3F3F3FE89D93EFBDBAE8AD9BEFBDACE980A73F3F3F3FE28693E7B8BA3F3F3F3FE288AAE7B8BAE4B88AEFBC9EE7B8BAE4B99DE28691E7B8BA3F3F3F3FEFBCA0E88DB3E6A68AEFBDB9EFBDB3E981B2E5B3A8E296A1E7B8BAE7A4BCE7828AE88DB3E6A68AEFBDB0EFBDBDE7B8BA3FE7B8BAE88B93EFBDBEE5B899EFBC9E +DROP TABLE d1.t1, d2.t1; +DROP DATABASE d1; +DROP DATABASE d2; diff --git a/mysql-test/r/myisam_enable_keys-10506.result b/mysql-test/r/myisam_enable_keys-10506.result new file mode 100644 index 00000000000..e7ffba787f0 --- /dev/null +++ b/mysql-test/r/myisam_enable_keys-10506.result @@ -0,0 +1,114 @@ +CREATE TABLE t1 ( +pk INT AUTO_INCREMENT, +i INT, +d DATE, +dt DATETIME, +v VARCHAR(1), +PRIMARY KEY (pk), +KEY (dt) +) ENGINE=MyISAM; +INSERT INTO t1 (i, d, dt, v) VALUES +(9, '2005-07-23', '2004-05-13 01:01:39', 't'), +(2, '2009-11-01', '2003-12-24 07:39:29', 'h'), +(6, NULL, '2008-07-03 05:32:22', 'l'), +(6, '2007-07-16', '2008-08-28 18:46:11', 'j'), +(5, NULL, '2001-07-12 21:27:00', 'h'), +(3, '2007-07-22', '1900-01-01 00:00:00', 'p'), +(2, '2000-11-21', '2007-05-25 11:58:54', 'g'), +(6, '1900-01-01', '2009-06-03 17:11:10', 'i'), +(2, '2008-02-10', '2001-06-15 16:20:07', 'p'), +(3, '2009-06-04', '1900-01-01 00:00:00', 'h'), +(9, '2007-04-25', '1900-01-01 00:00:00', 'e'), +(9, '2006-03-02', '1900-01-01 00:00:00', 'e'), +(1, '1900-01-01', '2002-11-08 09:33:27', 'u'), +(7, '2008-07-13', '2007-08-07 17:35:52', 'j'), +(0, '2004-11-12', '2006-05-01 00:00:00', 'e'), +(0, '1900-01-01', '2003-05-01 00:00:00', 'z'), +(1, '2009-09-02', '2007-02-12 09:30:49', 'w'), +(0, '2004-11-06', '1900-01-01 00:00:00', 't'), +(4, '2003-01-06', '2002-07-03 02:51:11', 'i'), +(6, '2006-01-14', '2008-02-26 04:57:32', 'i'), +(0, '2002-01-19', '2009-02-12 00:00:00', 'i'), +(8, '2007-02-12', '1900-01-01 00:00:00', 'b'), +(4, '1900-01-01', '2001-05-16 05:28:40', 'm'), +(2, '2005-07-16', NULL, 'j'), +(1, '2004-09-04', '2001-01-24 21:45:18', 'v'), +(3, '2009-07-01', NULL, NULL), +(2, '2009-07-21', '2002-07-24 00:00:00', 'h'), +(4, NULL, '2001-11-03 12:22:30', 'q'), +(1, '2002-06-22', '2008-06-17 03:17:59', 'f'), +(7, '2005-06-23', '2005-12-24 00:00:00', 'p'), +(6, '2001-05-20', '2008-10-23 00:00:00', NULL), +(3, '2001-10-01', '2000-10-12 16:32:35', 'o'), +(3, '2001-01-07', '2005-09-11 10:09:54', 'w'), +(6, '2007-11-02', '2009-09-10 01:44:18', 'l'), +(6, NULL, NULL, 'i'), +(9, NULL, '2002-05-18 15:21:55', 'd'), +(4, '2008-12-21', '2004-10-15 10:09:54', 'j'), +(6, '2003-10-05', '2009-07-13 03:51:02', 'e'), +(2, '2001-03-03', '1900-01-01 00:00:00', 'e'), +(2, '2007-04-04', '2001-11-08 21:14:52', 'q'), +(5, NULL, '2006-12-02 00:00:00', 'm'), +(0, '2009-01-04', '1900-01-01 00:00:00', NULL), +(8, '2008-04-03', '2005-01-01 11:55:18', 'q'), +(8, NULL, '2005-02-28 03:44:02', 'w'), +(0, '2003-08-22', NULL, 'c'), +(9, '1900-01-01', NULL, 'y'), +(NULL, NULL, '2006-08-25 16:28:09', 'g'), +(5, '2004-07-04', '2002-08-11 00:00:00', 'z'), +(1, '1900-01-01', '2007-07-22 21:19:18', 'm'), +(2, '2007-02-04', '2006-02-10 18:41:38', 't'), +(2, '1900-01-01', '2009-02-16 14:58:58', 'd'), +(7, '2001-03-14', '2007-08-14 00:00:00', 'h'), +(0, NULL, '1900-01-01 00:00:00', NULL), +(1, '2008-10-05', NULL, 'f'), +(6, '2001-11-25', '2008-12-03 06:59:23', 'l'), +(NULL, '2003-01-27', '2008-10-04 00:00:00', 'g'), +(8, '2008-08-08', '2009-07-07 07:00:21', 'v'), +(8, '2006-07-03', '2001-04-15 00:00:00', NULL), +(5, '2002-11-21', '2007-07-08 04:01:58', 'm'), +(5, '2006-04-08', '2007-09-23 00:01:35', 'i'), +(5, '2001-05-06', '2008-05-15 00:00:00', 'h'), +(7, '1900-01-01', '1900-01-01 00:00:00', 'u'), +(30, '2007-04-16', '2004-03-05 23:35:38', 'o'), +(NULL, '1900-01-01', '2007-08-25 01:32:47', 'z'), +(6, '2004-12-03', '1900-01-01 00:00:00', 'o'), +(8, '2001-06-23', '1900-01-01 00:00:00', 'f'), +(NULL, '2008-12-15', '2001-05-19 08:28:28', 'a'), +(9, '2000-02-15', '2009-09-03 06:07:22', 'd'), +(2, '2001-08-05', '2006-10-08 07:17:27', 'k'), +(5, '2004-01-17', '2003-09-06 20:36:01', 'd'), +(4, '2003-10-01', '2001-02-05 18:10:49', 'u'), +(4, '2003-07-28', '2001-01-07 16:11:37', 'h'), +(0, '1900-01-01', '2008-08-01 05:26:38', 'w'), +(9, '1900-01-01', '2001-05-08 00:00:00', 't'), +(1, '2000-04-17', '2008-07-10 21:26:28', 'i'), +(8, '2002-01-05', '2006-08-06 20:56:35', 'k'), +(9, '2001-04-10', '2003-02-17 00:00:00', 'z'), +(0, '2009-12-04', NULL, 'h'), +(7, NULL, '2004-10-27 00:29:57', 'h'), +(2, '2006-03-07', '2008-03-04 06:14:13', 'b'), +(0, '2001-10-15', '2001-03-17 00:00:00', 'm'), +(5, '1900-01-01', '2009-02-21 11:35:50', 'i'), +(4, NULL, '1900-01-01 00:00:00', 'w'), +(5, '2009-04-05', '1900-01-01 00:00:00', 'm'), +(6, '2001-03-19', '2001-04-12 00:00:00', 'q'), +(NULL, '2009-12-08', '2001-12-04 20:21:01', 'k'), +(2, '2005-02-09', '2001-05-27 08:41:01', 'l'), +(9, '2004-05-25', '2004-09-18 00:00:00', 'c'), +(3, '2005-01-17', '2002-09-12 11:18:48', 'd'), +(0, '2003-08-28', '1900-01-01 00:00:00', 'k'), +(6, '2006-10-11', '2003-10-28 03:31:02', 'a'), +(5, '1900-01-01', '2001-08-22 10:20:09', 'p'), +(8, '1900-01-01', '2008-04-24 00:00:00', 'o'), +(4, '2005-08-18', '2006-11-10 10:08:49', 'e'), +(NULL, '2007-03-12', '2007-10-16 00:00:00', 'n'), +(1, '2000-11-18', '2009-05-27 12:25:07', 't'), +(4, '2001-03-03', NULL, 'u'), +(3, '2003-09-11', '2001-09-10 18:10:10', 'f'), +(4, '2007-06-17', '1900-01-01 00:00:00', 't'), +(NULL, '2008-09-11', '2004-06-07 23:17:09', 'k'); +ALTER TABLE t1 ADD UNIQUE KEY ind1 (pk, d, i, v); +ALTER TABLE t1 ADD UNIQUE KEY ind2 (d, v); +ERROR 23000: Duplicate entry '2008-09-11-k' for key 'ind2' +DROP TABLE t1; diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index e0d93b02ecd..8894616fbb3 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -343,10 +343,37 @@ DROP TABLE bug47205; # #MDEV-6128:[PATCH] mysqlcheck wrongly escapes '.' in table names # -CREATE TABLE test.`t.1` (id int); +create table `t.1` (id int); +create view `v.1` as select 1; mysqlcheck test t.1 test.t.1 OK -drop table test.`t.1`; +mysqlcheck --all-in-1 test t.1 +test.t.1 OK +mysqlcheck --all-in-1 --databases --process-views test +test.t.1 OK +test.v.1 OK +create table `t.2`(a varchar(20) primary key) default character set utf8 collate utf8_general_ci engine=innodb; +flush table `t.2`; +mysqlcheck --check-upgrade --auto-repair test +test.t.1 OK +test.t.2 +error : Table rebuild required. Please do "ALTER TABLE `t.2` FORCE" or dump/reload to fix it! +test.t.3 Needs upgrade + +Repairing tables +test.t.3 OK +check table `t.1`, `t.2`, `t.3`; +Table Op Msg_type Msg_text +test.t.1 check status OK +test.t.2 check status OK +test.t.3 check status OK +check table `t.1`, `t.2`, `t.3` for upgrade; +Table Op Msg_type Msg_text +test.t.1 check status OK +test.t.2 check status OK +test.t.3 check status OK +drop view `v.1`; +drop table test.`t.1`, `t.2`, `t.3`; # # MDEV-8123 mysqlcheck: new --process-views option conflicts with --quick, --extended and such # @@ -381,6 +408,57 @@ show tables; Tables_in_test t1`1 drop table `t1``1`; +call mtr.add_suppression("ha_myisam"); +call mtr.add_suppression("Checking table"); +create database mysqltest1; +create table mysqltest1.t1 (a int) engine=myisam; +create table t2 (a int); +check table mysqltest1.t1; +Table Op Msg_type Msg_text +mysqltest1.t1 check warning Size of datafile is: 4 Should be: 0 +mysqltest1.t1 check error got error: 0 when reading datafile at record: 0 +mysqltest1.t1 check error Corrupt +mtr.global_suppressions Table is already up to date +mtr.test_suppressions Table is already up to date +mysql.column_stats Table is already up to date +mysql.columns_priv Table is already up to date +mysql.db Table is already up to date +mysql.event Table is already up to date +mysql.func Table is already up to date +mysql.gtid_slave_pos Table is already up to date +mysql.help_category Table is already up to date +mysql.help_keyword Table is already up to date +mysql.help_relation Table is already up to date +mysql.help_topic Table is already up to date +mysql.host Table is already up to date +mysql.index_stats Table is already up to date +mysql.innodb_index_stats OK +mysql.innodb_table_stats OK +mysql.plugin Table is already up to date +mysql.proc Table is already up to date +mysql.procs_priv Table is already up to date +mysql.proxies_priv Table is already up to date +mysql.roles_mapping Table is already up to date +mysql.servers Table is already up to date +mysql.table_stats Table is already up to date +mysql.tables_priv Table is already up to date +mysql.time_zone Table is already up to date +mysql.time_zone_leap_second Table is already up to date +mysql.time_zone_name Table is already up to date +mysql.time_zone_transition Table is already up to date +mysql.time_zone_transition_type Table is already up to date +mysql.user Table is already up to date +mysqltest1.t1 +warning : Table is marked as crashed +warning : Size of datafile is: 4 Should be: 0 +error : got error: 0 when reading datafile at record: 0 +error : Corrupt +test.t2 Table is already up to date + +Repairing tables +mysqltest1.t1 OK +drop table t2; +drop database mysqltest1; # #MDEV-7384 [PATCH] add PERSISENT FOR ALL option to mysqlanalyze/mysqlcheck # diff --git a/mysql-test/r/named_pipe.result b/mysql-test/r/named_pipe.result index aaf2fa063e1..70806a8aff8 100644 --- a/mysql-test/r/named_pipe.result +++ b/mysql-test/r/named_pipe.result @@ -2157,3 +2157,4 @@ Warning 1052 Column 'kundentyp' in group statement is ambiguous drop table t1; connection default; disconnect pipe_con; +FOUND /\[ERROR\] Create named pipe failed/ in second-mysqld.err diff --git a/mysql-test/r/null_key.result b/mysql-test/r/null_key.result index e80851329a4..81bfa1ac994 100644 --- a/mysql-test/r/null_key.result +++ b/mysql-test/r/null_key.result @@ -429,6 +429,7 @@ Handler_read_key 6 Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 5 diff --git a/mysql-test/r/openssl_1.result b/mysql-test/r/openssl_1.result index 12c91721381..712fbf725da 100644 --- a/mysql-test/r/openssl_1.result +++ b/mysql-test/r/openssl_1.result @@ -73,8 +73,8 @@ mysqltest: Could not open connection 'default': 2026 SSL connection error: Unabl SHOW STATUS LIKE 'Ssl_cipher'; Variable_name Value Ssl_cipher DHE-RSA-AES256-SHA -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +have_ssl +1 End of 5.0 tests DROP TABLE IF EXISTS thread_status; DROP EVENT IF EXISTS event_status; @@ -220,9 +220,9 @@ is still running; no cipher request crashed the server GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; FLUSH PRIVILEGES; connect con1,localhost,bug42158,,,,,SSL; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 disconnect con1; connection default; DROP USER bug42158@localhost; diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 3897184f3b1..262529ef0ce 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -1159,7 +1159,7 @@ INSERT INTO t1 SELECT a +32, b +32 FROM t1; INSERT INTO t1 SELECT a +64, b +64 FROM t1; EXPLAIN SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL ab 4 NULL 10 Using index for group-by +1 SIMPLE t1 index NULL PRIMARY 4 NULL 128 Using index SELECT a FROM t1 IGNORE INDEX FOR GROUP BY (a, ab) GROUP BY a; a 1 @@ -2860,6 +2860,7 @@ Handler_read_key 250 Handler_read_last 0 Handler_read_next 249 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 249 Handler_read_rnd_deleted 0 Handler_read_rnd_next 250 @@ -2878,6 +2879,7 @@ Handler_read_key 250 Handler_read_last 0 Handler_read_next 249 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 1 Handler_read_rnd_deleted 0 Handler_read_rnd_next 250 diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 99b0e287975..a45a389bab1 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -562,6 +562,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -582,6 +583,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -614,6 +616,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -632,6 +635,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -650,6 +654,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -668,6 +673,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/mysql-test/r/partition_explicit_prune.result b/mysql-test/r/partition_explicit_prune.result index ef196bcae0c..0cf9bde225c 100644 --- a/mysql-test/r/partition_explicit_prune.result +++ b/mysql-test/r/partition_explicit_prune.result @@ -19,7 +19,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_RND_NEXT 3 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 4 locks (1 table, 1 partition lock/unlock) FLUSH STATUS; SELECT a FROM t1 PARTITION (p0); @@ -31,7 +31,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_RND_NEXT 3 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 4 locks (1 table, 1 partition lock/unlock) FLUSH STATUS; INSERT INTO v1 VALUES (10); @@ -39,14 +39,14 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 2 # 4 locks (1 table, 1 partition lock/unlock) FLUSH STATUS; SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 2 locks (1 table, all partitions pruned) FLUSH STATUS; SELECT * FROM v1; @@ -59,7 +59,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_RND_NEXT 4 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 4 locks (1 table, 1 partition lock/unlock) FLUSH STATUS; SELECT a FROM t1 PARTITION (p0); @@ -72,7 +72,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_RND_NEXT 4 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 4 locks (1 table, 1 partition lock/unlock) SELECT * FROM t1; a @@ -89,14 +89,14 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 2 # 4 locks (1 table, 1 partition lock/unlock) FLUSH STATUS; SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 2 locks (1 table, all partitions pruned) SELECT * FROM v1; a @@ -121,7 +121,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 2 # 4 locks (1 table, 1 partition lock/unlock) FLUSH STATUS; @@ -131,7 +131,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 2 locks (1 table, all partitions pruned) FLUSH STATUS; INSERT INTO v1 VALUES (32); @@ -140,7 +140,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 4 locks (1 table, 1 partition lock/unlock) SELECT * FROM v1; a @@ -166,12 +166,12 @@ FLUSH STATUS; SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE -HANDLER_READ_RND_NEXT 26 -HANDLER_TMP_WRITE 47 +HANDLER_READ_RND_NEXT 27 +HANDLER_TMP_WRITE 49 # OK, seems to add number of variables processed before HANDLER_WRITE # and number of variables + 1 evaluated in the previous call in RND_NEXT CREATE TABLE t1 @@ -233,7 +233,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 2 # Should be 1 commit # 4 external locks (due to pruning of locks) @@ -250,7 +250,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 2 # Should be 1 commit # 4 external locks @@ -262,7 +262,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # should be 1 commit # 9 locks (1 ha_partition + 8 ha_innobase) # 17 writes (internal I_S) @@ -271,8 +271,8 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 2 -HANDLER_READ_RND_NEXT 26 -HANDLER_TMP_WRITE 47 +HANDLER_READ_RND_NEXT 27 +HANDLER_TMP_WRITE 49 HANDLER_WRITE 2 # + 1 commit # + 19 rnd next (internal I_S) @@ -282,8 +282,8 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 2 -HANDLER_READ_RND_NEXT 52 -HANDLER_TMP_WRITE 72 +HANDLER_READ_RND_NEXT 54 +HANDLER_TMP_WRITE 75 HANDLER_WRITE 2 # + 9 locks (unlocks) # + 19 rnd next (internal I_S) @@ -338,7 +338,7 @@ ERROR HY000: Unknown partition 'pNonexistent' in table 't1' SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # should have failed before locking (only 17 internal I_S writes) FLUSH STATUS; SELECT * FROM t1 PARTITION (subp2); @@ -348,7 +348,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_FIRST 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # Should be 1 commit # 4 locks (1 ha_partition + 1 ha_innobase) x 2 (lock/unlock) # 1 read first (also calls index_read) @@ -366,7 +366,7 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_FIRST 3 HANDLER_READ_NEXT 3 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # Should be 1 commit # 8 locks (1 ha_partition + 2 + 1 ha_innobase) x 2 # 3 read first (one for each partition) @@ -379,7 +379,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 1 commit # 18 locks # 18 READ KEY from opening a new partition table instance, @@ -398,8 +398,8 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 2 HANDLER_READ_FIRST 1 HANDLER_READ_NEXT 3 -HANDLER_READ_RND_NEXT 26 -HANDLER_TMP_WRITE 47 +HANDLER_READ_RND_NEXT 27 +HANDLER_TMP_WRITE 49 # + 1 commit # + 1 read first (read first key from index in one partition) # + 2 read key (innobase_get_index from index_init + from index_first) @@ -415,8 +415,8 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 3 HANDLER_READ_FIRST 3 HANDLER_READ_NEXT 4 -HANDLER_READ_RND_NEXT 52 -HANDLER_TMP_WRITE 72 +HANDLER_READ_RND_NEXT 54 +HANDLER_TMP_WRITE 75 # + 1 commit # + 2 read first (one for each subpart) # + 4 read key (innobase_get_index from index_init + from index_first) @@ -431,8 +431,8 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 4 HANDLER_READ_FIRST 3 HANDLER_READ_NEXT 4 -HANDLER_READ_RND_NEXT 78 -HANDLER_TMP_WRITE 97 +HANDLER_READ_RND_NEXT 81 +HANDLER_TMP_WRITE 101 # No matching partition, only internal I_S. SELECT * FROM t1 PARTITION (pNeg) WHERE a = 100; a b @@ -443,8 +443,8 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 5 HANDLER_READ_FIRST 3 HANDLER_READ_NEXT 4 -HANDLER_READ_RND_NEXT 104 -HANDLER_TMP_WRITE 122 +HANDLER_READ_RND_NEXT 108 +HANDLER_TMP_WRITE 127 # + 18 for unlock (same as lock above) (100 is not in pNeg, no match) # Test that EXPLAIN PARTITION works EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (pNonexistent); @@ -460,7 +460,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 8 locks (1 ha_partition + 3 ha_innobase) x 2 (lock/unlock) EXPLAIN PARTITIONS SELECT * FROM t1 PARTITION (subp3) AS TableAlias; id select_type table partitions type possible_keys key key_len ref rows Extra @@ -513,7 +513,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 1 # 2 locks (1 ha_partition) x 2 (lock/unlock), Was 4 locks before WL4443 # explicit pruning says part_id 0 and implicit pruning says part_id 1 @@ -526,7 +526,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 2 # 1 commit # 4 locks (1 ha_partition + 1 ha_innobase) x 2 (lock/unlock) @@ -544,7 +544,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_KEY 2 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_UPDATE 2 HANDLER_WRITE 2 # 1 commit @@ -566,7 +566,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 1 commit # 9 locks # 17 write (internal I_S) @@ -578,8 +578,8 @@ HANDLER_COMMIT 2 HANDLER_DELETE 2 HANDLER_READ_KEY 1 HANDLER_READ_NEXT 1 -HANDLER_READ_RND_NEXT 26 -HANDLER_TMP_WRITE 47 +HANDLER_READ_RND_NEXT 27 +HANDLER_TMP_WRITE 49 # + 1 commit # + 1 delete (one row deleted) # + 3 read key (1 innodb_get_index in records_in_range, @@ -596,9 +596,9 @@ HANDLER_COMMIT 2 HANDLER_DELETE 2 HANDLER_READ_KEY 1 HANDLER_READ_NEXT 1 -HANDLER_READ_RND_NEXT 52 +HANDLER_READ_RND_NEXT 54 HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 72 +HANDLER_TMP_WRITE 75 HANDLER_WRITE 1 # Failed before start_stmt/execution. # + 19 rnd next (internal I_S) @@ -612,9 +612,9 @@ HANDLER_COMMIT 3 HANDLER_DELETE 2 HANDLER_READ_KEY 1 HANDLER_READ_NEXT 1 -HANDLER_READ_RND_NEXT 78 +HANDLER_READ_RND_NEXT 81 HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 97 +HANDLER_TMP_WRITE 101 HANDLER_WRITE 3 # + 1 commit # + 19 rnd next (internal I_S) @@ -627,9 +627,9 @@ HANDLER_COMMIT 4 HANDLER_DELETE 2 HANDLER_READ_KEY 3 HANDLER_READ_NEXT 1 -HANDLER_READ_RND_NEXT 104 +HANDLER_READ_RND_NEXT 108 HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 122 +HANDLER_TMP_WRITE 127 HANDLER_UPDATE 2 HANDLER_WRITE 5 # + 1 commit @@ -650,9 +650,9 @@ HANDLER_DELETE 2 HANDLER_READ_FIRST 1 HANDLER_READ_KEY 3 HANDLER_READ_NEXT 4 -HANDLER_READ_RND_NEXT 130 +HANDLER_READ_RND_NEXT 135 HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 147 +HANDLER_TMP_WRITE 153 HANDLER_UPDATE 2 HANDLER_WRITE 5 # + 1 commit @@ -670,9 +670,9 @@ HANDLER_DELETE 2 HANDLER_READ_FIRST 1 HANDLER_READ_KEY 3 HANDLER_READ_NEXT 4 -HANDLER_READ_RND_NEXT 156 +HANDLER_READ_RND_NEXT 162 HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 172 +HANDLER_TMP_WRITE 179 HANDLER_UPDATE 2 HANDLER_WRITE 5 # + 9 locks @@ -696,7 +696,7 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_FIRST 4 HANDLER_READ_NEXT 5 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 1 commit # 10 locks (1 ha_partition + 4 ha_innobase) x 2 (lock/unlock) # 4 read first (for reading the first row in 4 partitions) @@ -709,7 +709,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 10 locks (table + 4 partition) x (lock + unlock) SELECT * FROM t1 PARTITION (pNeg, `p10-99`); a b @@ -720,7 +720,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 3 # 6 locks (1 ha_partition + 2 ha_innobase) x 2 (lock+unlock) # 1 rollback @@ -732,7 +732,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 10 # 10 lock (1 ha_partition + 4 ha_innobase) x 2 (lock + unlock) ALTER TABLE t1 TRUNCATE PARTITION pNeg, `p10-99`; @@ -742,7 +742,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 9 locks # 18 read key (ALTER forces table to be closed, see above for open) LOAD DATA INFILE 'loadtest.txt' INTO TABLE t1 PARTITION (pNeg, `p10-99`); @@ -750,8 +750,8 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 2 -HANDLER_READ_RND_NEXT 26 -HANDLER_TMP_WRITE 47 +HANDLER_READ_RND_NEXT 27 +HANDLER_TMP_WRITE 49 HANDLER_WRITE 10 # + 23 write (18 internal I_S + 5 rows) UNLOCK TABLES; @@ -759,8 +759,8 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 2 -HANDLER_READ_RND_NEXT 52 -HANDLER_TMP_WRITE 72 +HANDLER_READ_RND_NEXT 54 +HANDLER_TMP_WRITE 75 HANDLER_WRITE 10 # + 9 locks # @@ -773,7 +773,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_RND_NEXT 2 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_UPDATE 2 # 1 commit # 4 lock (1 ha_partition + 1 ha_innobase) x 2 (lock + unlock) @@ -791,7 +791,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_KEY 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_UPDATE 2 # 1 commit # 4 lock @@ -806,7 +806,7 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_KEY 1 HANDLER_READ_RND 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_UPDATE 2 # 1 commit # 4 lock @@ -819,7 +819,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # Nothing, since impossible PARTITION+WHERE clause. FLUSH STATUS; UPDATE t1 PARTITION(subp0) SET a = -2, b = concat(b, ', Updated from a = 100') @@ -828,7 +828,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # Nothing, since impossible PARTITION+WHERE clause. FLUSH STATUS; UPDATE t1 PARTITION(`p100-99999`) SET a = -2, b = concat(b, ', Updated from a = 100') @@ -840,7 +840,7 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_READ_KEY 1 HANDLER_READ_RND 1 HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_UPDATE 1 # 6 lock # 4 read key (1 index init + 1 index read + 1 rnd init + 1 rnd pos) @@ -856,7 +856,7 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_READ_KEY 1 HANDLER_READ_RND 1 HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_UPDATE 1 HANDLER_WRITE 1 # 10 locks @@ -874,7 +874,7 @@ HANDLER_COMMIT 1 HANDLER_DELETE 1 HANDLER_READ_KEY 1 HANDLER_READ_RND 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_UPDATE 1 HANDLER_WRITE 1 # 1 commit @@ -902,7 +902,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # Nothing (no matching partition found) FLUSH STATUS; UPDATE t1 PARTITION (pNeg) SET b = concat(b, ', Updated2') WHERE a = 1000000; @@ -910,7 +910,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # Nothing (no matching partition found) FLUSH STATUS; LOCK TABLE t1 WRITE; @@ -918,7 +918,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 9 locks UPDATE t1 PARTITION (subp7) SET b = concat(b, ', Updated to 103'), a = 103 WHERE a = 101; SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS @@ -927,8 +927,8 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 2 HANDLER_READ_KEY 1 HANDLER_READ_RND 1 -HANDLER_READ_RND_NEXT 26 -HANDLER_TMP_WRITE 47 +HANDLER_READ_RND_NEXT 27 +HANDLER_TMP_WRITE 49 HANDLER_UPDATE 2 # + 4 read key # + 1 read rnd @@ -941,8 +941,8 @@ HANDLER_COMMIT 3 HANDLER_DELETE 1 HANDLER_READ_KEY 2 HANDLER_READ_RND 2 -HANDLER_READ_RND_NEXT 52 -HANDLER_TMP_WRITE 72 +HANDLER_READ_RND_NEXT 54 +HANDLER_TMP_WRITE 75 HANDLER_UPDATE 3 HANDLER_WRITE 1 # + 1 delete @@ -957,8 +957,8 @@ HANDLER_COMMIT 3 HANDLER_DELETE 1 HANDLER_READ_KEY 2 HANDLER_READ_RND 2 -HANDLER_READ_RND_NEXT 78 -HANDLER_TMP_WRITE 97 +HANDLER_READ_RND_NEXT 81 +HANDLER_TMP_WRITE 101 HANDLER_UPDATE 3 HANDLER_WRITE 1 + 9 locks @@ -986,7 +986,7 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_DELETE 2 HANDLER_READ_KEY 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 1 delete # 4 locks (pruning works!). # 1 read key (index read) @@ -998,7 +998,7 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_DELETE 2 HANDLER_READ_RND_NEXT 3 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 1 delete # 4 locks # 1 read first @@ -1010,7 +1010,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 9 locks DELETE FROM t1 PARTITION (subp1) WHERE b = 'p0-9:subp3'; SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS @@ -1018,8 +1018,8 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 2 HANDLER_READ_KEY 1 -HANDLER_READ_RND_NEXT 26 -HANDLER_TMP_WRITE 47 +HANDLER_READ_RND_NEXT 27 +HANDLER_TMP_WRITE 49 # + 3 read key (1 innodb_get_index in records_in_range # + 1 innobase_get_index in index_init + 1 index read) DELETE FROM t1 PARTITION (`p0-9`) WHERE b = 'p0-9:subp3'; @@ -1030,8 +1030,8 @@ HANDLER_COMMIT 3 HANDLER_DELETE 2 HANDLER_READ_KEY 3 HANDLER_READ_NEXT 1 -HANDLER_READ_RND_NEXT 52 -HANDLER_TMP_WRITE 72 +HANDLER_READ_RND_NEXT 54 +HANDLER_TMP_WRITE 75 # + 1 delete # + 6 read key (same as above, but for two subpartitions) # + 1 read next (read next after found row) @@ -1043,8 +1043,8 @@ HANDLER_COMMIT 3 HANDLER_DELETE 2 HANDLER_READ_KEY 3 HANDLER_READ_NEXT 1 -HANDLER_READ_RND_NEXT 78 -HANDLER_TMP_WRITE 97 +HANDLER_READ_RND_NEXT 81 +HANDLER_TMP_WRITE 101 # + 9 locks # Test multi-table DELETE # Can be expressed in two different ways. @@ -1057,7 +1057,7 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_FIRST 5 HANDLER_READ_NEXT 5 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 10 # 24 locks (2 table, 5 + 5 subpartitions lock/unlock) FLUSH STATUS; @@ -1066,7 +1066,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 14 locks (1 table, 6 subpartitions lock/unlock) FLUSH STATUS; INSERT INTO t2 PARTITION (subp3) SELECT * FROM t1 PARTITION (subp3, `p10-99`, `p100-99999`); @@ -1076,7 +1076,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_READ_FIRST 5 HANDLER_ROLLBACK 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 1 # 16 locks (2 tables, 1 + 5 subpartitions lock/unlock) FLUSH STATUS; @@ -1091,7 +1091,7 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_FIRST 5 HANDLER_READ_NEXT 5 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 7 # 16 locks (2 tables, 1 + 5 subpartitions lock/unlock) TRUNCATE TABLE t2; @@ -1103,7 +1103,7 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_FIRST 5 HANDLER_READ_NEXT 5 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 10 # 30 locks (2 table, 8 + 5 subpartitions lock/unlock) FLUSH STATUS; @@ -1114,7 +1114,7 @@ VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_FIRST 5 HANDLER_READ_NEXT 7 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 HANDLER_WRITE 7 # 14 locks (2 table, 5 subpartitions lock/unlock) SHOW CREATE TABLE t1; @@ -1201,7 +1201,7 @@ WHERE t1.a = t3.a AND t3.b = 'subp3'' at line 1 SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # Multi table delete without any matching rows FLUSH STATUS; DELETE t1, t2 FROM t1 PARTITION (pNeg), t3, t2 PARTITION (subp3) @@ -1211,7 +1211,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_RND_NEXT 3 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 12 locks (3 in t1, 1 in t3, 2 in t2) x 2 (lock + unlock) # 1 read first (first rnd_next in t2) # 4 read key (1 innodb_get_index in rnd_init in t2 + index read in t2 @@ -1231,7 +1231,7 @@ HANDLER_READ_KEY 2 HANDLER_READ_NEXT 2 HANDLER_READ_RND 4 HANDLER_READ_RND_NEXT 16 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 4 delete (2 in t2 + 2 in t3) # 12 locks (3 in t2, 1 in t3, 2 in t1) x 2 (lock + unlock) # 3 read first (1 in t1 + 1 in t3 + 1 in t3, for second row in t1) @@ -1279,7 +1279,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 -HANDLER_TMP_WRITE 22 +HANDLER_TMP_WRITE 23 # 6 locks (lock/unlock two subpartitions + table) # Test on non partitioned table SELECT * FROM t3 PARTITION (pNeg); diff --git a/mysql-test/r/ps.result b/mysql-test/r/ps.result index 6f66ae31a39..aca74671561 100644 --- a/mysql-test/r/ps.result +++ b/mysql-test/r/ps.result @@ -3965,6 +3965,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -3979,6 +3980,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -3993,6 +3995,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 8 @@ -4007,6 +4010,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/mysql-test/r/ps_1general.result b/mysql-test/r/ps_1general.result index 0fa12287080..e34855eee62 100644 --- a/mysql-test/r/ps_1general.result +++ b/mysql-test/r/ps_1general.result @@ -789,3 +789,5 @@ execute stmt1; 1 drop prepare stmt1; drop table t1; +select ?+1; +Got one of the listed errors diff --git a/mysql-test/r/range.result b/mysql-test/r/range.result index 268bd184c58..5adb8225b38 100644 --- a/mysql-test/r/range.result +++ b/mysql-test/r/range.result @@ -2114,6 +2114,37 @@ a b 1 1 drop table t2; # +# MDEV-10228: Delete missing rows with OR conditions +# (The example uses UPDATE, because UPDATE allows to use index hints +# and so it's possible to make an example that works with any storage +# engine) +# +CREATE TABLE t1 ( +key1varchar varchar(14) NOT NULL, +key2int int(11) NOT NULL DEFAULT '0', +col1 int, +PRIMARY KEY (key1varchar,key2int), +KEY key1varchar (key1varchar), +KEY key2int (key2int) +) DEFAULT CHARSET=utf8; +insert into t1 values +('value1',0, 0), +('value1',1, 0), +('value1',1000685, 0), +('value1',1003560, 0), +('value1',1004807, 0); +update t1 force index (PRIMARY) set col1=12345 +where (key1varchar='value1' AND (key2int <=1 OR key2int > 1)); +# The following must show col1=12345 for all rows: +select * from t1; +key1varchar key2int col1 +value1 0 12345 +value1 1 12345 +value1 1000685 12345 +value1 1003560 12345 +value1 1004807 12345 +drop table t1; +# # BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE # CREATE TABLE t1 (pk INT PRIMARY KEY); diff --git a/mysql-test/r/range_mrr_icp.result b/mysql-test/r/range_mrr_icp.result index 5c6930f4323..4ef7c0b658c 100644 --- a/mysql-test/r/range_mrr_icp.result +++ b/mysql-test/r/range_mrr_icp.result @@ -2116,6 +2116,37 @@ a b 1 1 drop table t2; # +# MDEV-10228: Delete missing rows with OR conditions +# (The example uses UPDATE, because UPDATE allows to use index hints +# and so it's possible to make an example that works with any storage +# engine) +# +CREATE TABLE t1 ( +key1varchar varchar(14) NOT NULL, +key2int int(11) NOT NULL DEFAULT '0', +col1 int, +PRIMARY KEY (key1varchar,key2int), +KEY key1varchar (key1varchar), +KEY key2int (key2int) +) DEFAULT CHARSET=utf8; +insert into t1 values +('value1',0, 0), +('value1',1, 0), +('value1',1000685, 0), +('value1',1003560, 0), +('value1',1004807, 0); +update t1 force index (PRIMARY) set col1=12345 +where (key1varchar='value1' AND (key2int <=1 OR key2int > 1)); +# The following must show col1=12345 for all rows: +select * from t1; +key1varchar key2int col1 +value1 0 12345 +value1 1 12345 +value1 1000685 12345 +value1 1003560 12345 +value1 1004807 12345 +drop table t1; +# # BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE # CREATE TABLE t1 (pk INT PRIMARY KEY); diff --git a/mysql-test/r/range_vs_index_merge.result b/mysql-test/r/range_vs_index_merge.result index 1b12a9f5512..9af359a55f3 100644 --- a/mysql-test/r/range_vs_index_merge.result +++ b/mysql-test/r/range_vs_index_merge.result @@ -1310,6 +1310,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 385 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 377 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -1338,6 +1339,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 59 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -1367,6 +1369,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 59 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/mysql-test/r/range_vs_index_merge_innodb.result b/mysql-test/r/range_vs_index_merge_innodb.result index 8428936d25f..601ae9b7613 100644 --- a/mysql-test/r/range_vs_index_merge_innodb.result +++ b/mysql-test/r/range_vs_index_merge_innodb.result @@ -1311,6 +1311,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 385 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 377 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -1339,6 +1340,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 59 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -1368,6 +1370,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 59 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/mysql-test/r/select.result b/mysql-test/r/select.result index 8e516c93a14..5a8b52521cb 100644 --- a/mysql-test/r/select.result +++ b/mysql-test/r/select.result @@ -4351,6 +4351,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 6 diff --git a/mysql-test/r/select_jcl6.result b/mysql-test/r/select_jcl6.result index 99400a09ac7..c5f28395535 100644 --- a/mysql-test/r/select_jcl6.result +++ b/mysql-test/r/select_jcl6.result @@ -4362,6 +4362,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 10 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 10 Handler_read_rnd_deleted 1 Handler_read_rnd_next 6 diff --git a/mysql-test/r/select_pkeycache.result b/mysql-test/r/select_pkeycache.result index 8e516c93a14..5a8b52521cb 100644 --- a/mysql-test/r/select_pkeycache.result +++ b/mysql-test/r/select_pkeycache.result @@ -4351,6 +4351,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 6 diff --git a/mysql-test/r/single_delete_update.result b/mysql-test/r/single_delete_update.result index cdf97e20238..85e79f53c89 100644 --- a/mysql-test/r/single_delete_update.result +++ b/mysql-test/r/single_delete_update.result @@ -29,6 +29,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -48,6 +49,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -84,6 +86,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -103,6 +106,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 5 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -136,6 +140,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -155,6 +160,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 1 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -192,6 +198,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -211,6 +218,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -242,6 +250,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -261,6 +270,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 1 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -290,6 +300,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 1 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -309,6 +320,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 1 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -341,6 +353,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 7 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 4 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -365,6 +378,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 7 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 8 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -403,6 +417,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 4 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -422,6 +437,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 4 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -458,6 +474,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -477,6 +494,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 5 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -522,6 +540,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -547,6 +566,7 @@ Handler_read_key 0 Handler_read_last 1 Handler_read_next 0 Handler_read_prev 4 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -566,6 +586,7 @@ Handler_read_key 0 Handler_read_last 1 Handler_read_next 0 Handler_read_prev 4 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -603,6 +624,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -622,6 +644,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 5 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -663,6 +686,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -682,6 +706,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 5 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -720,6 +745,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -739,6 +765,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 1 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -776,6 +803,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -795,6 +823,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 5 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -826,6 +855,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -845,6 +875,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 1 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -875,6 +906,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 1 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -894,6 +926,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 1 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -927,6 +960,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 7 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 4 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -951,6 +985,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 7 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 8 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -993,6 +1028,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 4 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -1012,6 +1048,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 4 +Handler_read_retry 0 Handler_read_rnd 5 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -1053,6 +1090,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -1072,6 +1110,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 5 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -1111,6 +1150,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 4 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -1136,6 +1176,7 @@ Handler_read_key 0 Handler_read_last 1 Handler_read_next 0 Handler_read_prev 4 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -1155,6 +1196,7 @@ Handler_read_key 0 Handler_read_last 1 Handler_read_next 0 Handler_read_prev 4 +Handler_read_retry 0 Handler_read_rnd 5 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/mysql-test/r/sp-prelocking.result b/mysql-test/r/sp-prelocking.result index 9e82a966268..5b594e9ea55 100644 --- a/mysql-test/r/sp-prelocking.result +++ b/mysql-test/r/sp-prelocking.result @@ -320,3 +320,23 @@ c2 DROP TRIGGER t1_ai; DROP TABLE t1, t2; End of 5.0 tests +# +# Bug#21142859: FUNCTION UPDATING A VIEW FAILS TO FIND TABLE THAT ACTUALLY EXISTS +# +CREATE TABLE t1 SELECT 1 AS fld1, 'A' AS fld2; +CREATE TABLE t2 (fld3 INT, fld4 CHAR(1)); +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE TRIGGER t1_au AFTER UPDATE ON t1 +FOR EACH ROW INSERT INTO t2 VALUES (new.fld1, new.fld2); +CREATE FUNCTION f1() RETURNS INT +BEGIN +UPDATE v1 SET fld2='B' WHERE fld1=1; +RETURN row_count(); +END ! +# Without the patch, an error was getting reported. +SELECT f1(); +f1() +1 +DROP FUNCTION f1; +DROP VIEW v1; +DROP TABLE t1,t2; diff --git a/mysql-test/r/sp.result b/mysql-test/r/sp.result index ce23fe1693e..23c8bd00d33 100644 --- a/mysql-test/r/sp.result +++ b/mysql-test/r/sp.result @@ -7724,6 +7724,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -7735,6 +7736,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 4097 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/mysql-test/r/ssl.result b/mysql-test/r/ssl.result index 7cd18fbf539..2a45a5e4d62 100644 --- a/mysql-test/r/ssl.result +++ b/mysql-test/r/ssl.result @@ -1,7 +1,7 @@ connect ssl_con,localhost,root,,,,,SSL; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 SHOW STATUS LIKE 'Ssl_server_not_before'; Variable_name Value Ssl_server_not_before Apr 25 14:55:05 2015 GMT @@ -2164,9 +2164,9 @@ Privat (Private Nutzung) Mobilfunk Warnings: Warning 1052 Column 'kundentyp' in group statement is ambiguous drop table t1; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 select aes_decrypt('MySQL','adf'); aes_decrypt('MySQL','adf') NULL diff --git a/mysql-test/r/ssl_ca.result b/mysql-test/r/ssl_ca.result index ffc5671f85f..83a98902581 100644 --- a/mysql-test/r/ssl_ca.result +++ b/mysql-test/r/ssl_ca.result @@ -4,21 +4,21 @@ # try to connect with wrong '--ssl-ca' path : should fail ERROR 2026 (HY000): SSL connection error: SSL_CTX_set_default_verify_paths failed # try to connect with correct '--ssl-ca' path : should connect -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +have_ssl +1 # # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY # PATH SUBSTITUTION # # try to connect with '--ssl-ca' option using tilde home directoy # path substitution : should connect -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +have_ssl +1 # try to connect with '--ssl-key' option using tilde home directoy # path substitution : should connect -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +have_ssl +1 # try to connect with '--ssl-cert' option using tilde home directoy # path substitution : should connect -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +have_ssl +1 diff --git a/mysql-test/r/ssl_compress.result b/mysql-test/r/ssl_compress.result index 8260fde5c4e..09c682e3851 100644 --- a/mysql-test/r/ssl_compress.result +++ b/mysql-test/r/ssl_compress.result @@ -1,7 +1,7 @@ connect ssl_compress_con,localhost,root,,,,,SSL COMPRESS; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 SHOW STATUS LIKE 'Compression'; Variable_name Value Compression ON @@ -2161,9 +2161,9 @@ Privat (Private Nutzung) Mobilfunk Warnings: Warning 1052 Column 'kundentyp' in group statement is ambiguous drop table t1; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 SHOW STATUS LIKE 'Compression'; Variable_name Value Compression ON diff --git a/mysql-test/r/ssl_timeout.result b/mysql-test/r/ssl_timeout.result index 27dce524685..3c94a9927da 100644 --- a/mysql-test/r/ssl_timeout.result +++ b/mysql-test/r/ssl_timeout.result @@ -1,9 +1,9 @@ # connect with read timeout so SLEEP() should timeout connect ssl_con,localhost,root,,,,,SSL read_timeout=5; # Check ssl turned on -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher DHE-RSA-AES256-SHA +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 SELECT SLEEP(600); ERROR HY000: Lost connection to MySQL server during query connection default; diff --git a/mysql-test/r/status.result b/mysql-test/r/status.result index 60ec5d7dec3..9d75a262592 100644 --- a/mysql-test/r/status.result +++ b/mysql-test/r/status.result @@ -316,6 +316,7 @@ Handler_read_key 4 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 7 Handler_read_rnd_deleted 0 Handler_read_rnd_next 23 @@ -333,7 +334,7 @@ Created_tmp_files 0 Created_tmp_tables 2 Handler_tmp_update 2 Handler_tmp_write 7 -Rows_tmp_read 42 +Rows_tmp_read 43 drop table t1; CREATE TABLE t1 (i int(11) DEFAULT NULL, KEY i (i) ) ENGINE=MyISAM; insert into t1 values (1),(2),(3),(4),(5); @@ -358,6 +359,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 2 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 1 Handler_read_rnd_next 2 diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result index 92e75c5088d..ff5823c10d9 100644 --- a/mysql-test/r/subselect.result +++ b/mysql-test/r/subselect.result @@ -6896,6 +6896,7 @@ Handler_read_key 8 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 22 @@ -6933,6 +6934,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 16 @@ -7161,5 +7163,21 @@ INSERT INTO t1 VALUES ('foo'); SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar' UNION SELECT 'baz' ); f foo +SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar'); +f +foo drop table t1; SET NAMES default; +# +# MDEV-10045: Server crashes in Time_and_counter_tracker::incr_loops +# +SET NAMES utf8; +CREATE TABLE t1 (f1 VARCHAR(3), f2 INT UNSIGNED) ENGINE=MyISAM; +CREATE TABLE t2 (f3 INT) ENGINE=MyISAM; +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo' UNION SELECT 'bar' ); +f1 f2 f3 +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo'); +f1 f2 f3 +DROP TABLE t1, t2; +SET NAMES default; +End of 10.1 tests diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result index 906f6a2f083..a7e051e7c06 100644 --- a/mysql-test/r/subselect3.result +++ b/mysql-test/r/subselect3.result @@ -124,6 +124,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 41 @@ -889,6 +890,7 @@ ERROR 42S22: Unknown column 'c' in 'field list' SHOW WARNINGS; Level Code Message Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 +Note 1981 Aggregate function 'count()' of SELECT #3 belongs to SELECT #2 Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2 Error 1054 Unknown column 'c' in 'field list' DROP TABLE t1; diff --git a/mysql-test/r/subselect3_jcl6.result b/mysql-test/r/subselect3_jcl6.result index 7cea1cadddd..fd28084fa43 100644 --- a/mysql-test/r/subselect3_jcl6.result +++ b/mysql-test/r/subselect3_jcl6.result @@ -134,6 +134,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 41 @@ -899,6 +900,7 @@ ERROR 42S22: Unknown column 'c' in 'field list' SHOW WARNINGS; Level Code Message Note 1276 Field or reference 'test.t1.a' of SELECT #3 was resolved in SELECT #2 +Note 1981 Aggregate function 'count()' of SELECT #3 belongs to SELECT #2 Note 1276 Field or reference 'test.t1.c' of SELECT #3 was resolved in SELECT #2 Error 1054 Unknown column 'c' in 'field list' DROP TABLE t1; diff --git a/mysql-test/r/subselect_cache.result b/mysql-test/r/subselect_cache.result index 8ca6bf52e0e..97a5f5a77f6 100644 --- a/mysql-test/r/subselect_cache.result +++ b/mysql-test/r/subselect_cache.result @@ -36,6 +36,7 @@ Handler_read_key 7 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 31 @@ -289,6 +290,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 61 @@ -316,6 +318,7 @@ Handler_read_key 7 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 31 @@ -342,6 +345,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 61 @@ -369,6 +373,7 @@ Handler_read_key 7 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 31 @@ -395,6 +400,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 61 @@ -494,6 +500,7 @@ Handler_read_key 7 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 442 @@ -592,6 +599,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 472 @@ -615,6 +623,7 @@ Handler_read_key 17 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 4 Handler_read_rnd_deleted 0 Handler_read_rnd_next 36 @@ -637,6 +646,7 @@ Handler_read_key 10 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 4 Handler_read_rnd_deleted 0 Handler_read_rnd_next 86 @@ -660,6 +670,7 @@ Handler_read_key 17 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 4 Handler_read_rnd_deleted 0 Handler_read_rnd_next 41 @@ -682,6 +693,7 @@ Handler_read_key 10 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 4 Handler_read_rnd_deleted 0 Handler_read_rnd_next 91 @@ -711,6 +723,7 @@ Handler_read_key 7 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 31 @@ -739,6 +752,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 61 @@ -762,6 +776,7 @@ Handler_read_key 7 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 4 Handler_read_rnd_deleted 1 Handler_read_rnd_next 36 @@ -784,6 +799,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 4 Handler_read_rnd_deleted 1 Handler_read_rnd_next 66 @@ -883,6 +899,7 @@ Handler_read_key 70 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 141 @@ -981,6 +998,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 671 @@ -1606,6 +1624,7 @@ Handler_read_key 11 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 145 @@ -1636,6 +1655,7 @@ Handler_read_key 32 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 84 @@ -1669,6 +1689,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 127 @@ -1699,6 +1720,7 @@ Handler_read_key 13 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 69 @@ -1890,6 +1912,7 @@ Handler_read_key 15 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 8 Handler_read_rnd_deleted 0 Handler_read_rnd_next 57 @@ -1916,6 +1939,7 @@ Handler_read_key 21 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 8 Handler_read_rnd_deleted 0 Handler_read_rnd_next 37 @@ -1943,6 +1967,7 @@ Handler_read_key 15 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 8 Handler_read_rnd_deleted 0 Handler_read_rnd_next 57 @@ -1969,6 +1994,7 @@ Handler_read_key 22 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 8 Handler_read_rnd_deleted 0 Handler_read_rnd_next 41 @@ -2011,6 +2037,7 @@ Handler_read_key 15 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 16 @@ -2049,6 +2076,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 151 @@ -2086,6 +2114,7 @@ Handler_read_key 15 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 43 @@ -2123,6 +2152,7 @@ Handler_read_key 18 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 27 diff --git a/mysql-test/r/subselect_mat.result b/mysql-test/r/subselect_mat.result index c9fa7c0c672..af3df9ec811 100644 --- a/mysql-test/r/subselect_mat.result +++ b/mysql-test/r/subselect_mat.result @@ -1139,6 +1139,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 +Note 1981 Aggregate function 'max()' of SELECT #3 belongs to SELECT #1 Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`c` from `test`.`t2` where (<nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where (max(`test`.`t1`.`b`) = `test`.`t3`.`e`) having (<cache>(`test`.`t2`.`d`) >= <ref_null_helper>(`test`.`t3`.`e`)))))) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`))))) select a from t1 group by a having a in (select c from t2 where d >= some(select e from t3 where max(b)=e)); @@ -2237,6 +2238,7 @@ Handler_read_key 5000 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 6003 @@ -2261,6 +2263,19 @@ PREPARE stmt FROM ' EXECUTE stmt; EXECUTE stmt; DROP TABLE t1,t2,t3; +# +# MDEV-10389: Query returns different results on a debug vs non-debug build of the same revision +# +CREATE TABLE t1 (i1 INT, i2 INT NOT NULL); +INSERT INTO t1 VALUES (1,4),(2,6); +SELECT * FROM t1 AS alias1 +WHERE alias1.i1 IN ( +SELECT i1 FROM t1 WHERE alias1.i2 IN ( SELECT i2 FROM t1 HAVING i2 <> 7 ) +); +i1 i2 +1 4 +2 6 +DROP TABLE t1; set @subselect_mat_test_optimizer_switch_value=null; set @@optimizer_switch='materialization=on,in_to_exists=off,semijoin=off'; set optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on'; diff --git a/mysql-test/r/subselect_no_exists_to_in.result b/mysql-test/r/subselect_no_exists_to_in.result index 1802ff59ea2..303303f4619 100644 --- a/mysql-test/r/subselect_no_exists_to_in.result +++ b/mysql-test/r/subselect_no_exists_to_in.result @@ -6896,6 +6896,7 @@ Handler_read_key 8 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 22 @@ -6933,6 +6934,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 16 @@ -7161,8 +7163,24 @@ INSERT INTO t1 VALUES ('foo'); SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar' UNION SELECT 'baz' ); f foo +SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar'); +f +foo drop table t1; SET NAMES default; +# +# MDEV-10045: Server crashes in Time_and_counter_tracker::incr_loops +# +SET NAMES utf8; +CREATE TABLE t1 (f1 VARCHAR(3), f2 INT UNSIGNED) ENGINE=MyISAM; +CREATE TABLE t2 (f3 INT) ENGINE=MyISAM; +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo' UNION SELECT 'bar' ); +f1 f2 f3 +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo'); +f1 f2 f3 +DROP TABLE t1, t2; +SET NAMES default; +End of 10.1 tests set optimizer_switch=default; select @@optimizer_switch like '%exists_to_in=off%'; @@optimizer_switch like '%exists_to_in=off%' diff --git a/mysql-test/r/subselect_no_mat.result b/mysql-test/r/subselect_no_mat.result index 1eb33fc80e7..6bdb5d1fbc2 100644 --- a/mysql-test/r/subselect_no_mat.result +++ b/mysql-test/r/subselect_no_mat.result @@ -6890,6 +6890,7 @@ Handler_read_key 8 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 22 @@ -6927,6 +6928,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 16 @@ -7154,8 +7156,24 @@ INSERT INTO t1 VALUES ('foo'); SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar' UNION SELECT 'baz' ); f foo +SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar'); +f +foo drop table t1; SET NAMES default; +# +# MDEV-10045: Server crashes in Time_and_counter_tracker::incr_loops +# +SET NAMES utf8; +CREATE TABLE t1 (f1 VARCHAR(3), f2 INT UNSIGNED) ENGINE=MyISAM; +CREATE TABLE t2 (f3 INT) ENGINE=MyISAM; +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo' UNION SELECT 'bar' ); +f1 f2 f3 +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo'); +f1 f2 f3 +DROP TABLE t1, t2; +SET NAMES default; +End of 10.1 tests set optimizer_switch=default; select @@optimizer_switch like '%materialization=on%'; @@optimizer_switch like '%materialization=on%' diff --git a/mysql-test/r/subselect_no_opts.result b/mysql-test/r/subselect_no_opts.result index f65b505eeca..2ce0188cc6d 100644 --- a/mysql-test/r/subselect_no_opts.result +++ b/mysql-test/r/subselect_no_opts.result @@ -6887,6 +6887,7 @@ Handler_read_key 8 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 22 @@ -6924,6 +6925,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 16 @@ -7152,6 +7154,22 @@ INSERT INTO t1 VALUES ('foo'); SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar' UNION SELECT 'baz' ); f foo +SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar'); +f +foo drop table t1; SET NAMES default; +# +# MDEV-10045: Server crashes in Time_and_counter_tracker::incr_loops +# +SET NAMES utf8; +CREATE TABLE t1 (f1 VARCHAR(3), f2 INT UNSIGNED) ENGINE=MyISAM; +CREATE TABLE t2 (f3 INT) ENGINE=MyISAM; +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo' UNION SELECT 'bar' ); +f1 f2 f3 +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo'); +f1 f2 f3 +DROP TABLE t1, t2; +SET NAMES default; +End of 10.1 tests set @optimizer_switch_for_subselect_test=null; diff --git a/mysql-test/r/subselect_no_scache.result b/mysql-test/r/subselect_no_scache.result index 21ea53bf1b1..22f25cb0d50 100644 --- a/mysql-test/r/subselect_no_scache.result +++ b/mysql-test/r/subselect_no_scache.result @@ -6902,6 +6902,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 58 @@ -6939,6 +6940,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 16 @@ -7167,8 +7169,24 @@ INSERT INTO t1 VALUES ('foo'); SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar' UNION SELECT 'baz' ); f foo +SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar'); +f +foo drop table t1; SET NAMES default; +# +# MDEV-10045: Server crashes in Time_and_counter_tracker::incr_loops +# +SET NAMES utf8; +CREATE TABLE t1 (f1 VARCHAR(3), f2 INT UNSIGNED) ENGINE=MyISAM; +CREATE TABLE t2 (f3 INT) ENGINE=MyISAM; +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo' UNION SELECT 'bar' ); +f1 f2 f3 +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo'); +f1 f2 f3 +DROP TABLE t1, t2; +SET NAMES default; +End of 10.1 tests set optimizer_switch=default; select @@optimizer_switch like '%subquery_cache=on%'; @@optimizer_switch like '%subquery_cache=on%' diff --git a/mysql-test/r/subselect_no_semijoin.result b/mysql-test/r/subselect_no_semijoin.result index aabf0674b2f..017e9623c76 100644 --- a/mysql-test/r/subselect_no_semijoin.result +++ b/mysql-test/r/subselect_no_semijoin.result @@ -6887,6 +6887,7 @@ Handler_read_key 8 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 22 @@ -6924,6 +6925,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 16 @@ -7152,7 +7154,23 @@ INSERT INTO t1 VALUES ('foo'); SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar' UNION SELECT 'baz' ); f foo +SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar'); +f +foo drop table t1; SET NAMES default; +# +# MDEV-10045: Server crashes in Time_and_counter_tracker::incr_loops +# +SET NAMES utf8; +CREATE TABLE t1 (f1 VARCHAR(3), f2 INT UNSIGNED) ENGINE=MyISAM; +CREATE TABLE t2 (f3 INT) ENGINE=MyISAM; +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo' UNION SELECT 'bar' ); +f1 f2 f3 +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo'); +f1 f2 f3 +DROP TABLE t1, t2; +SET NAMES default; +End of 10.1 tests set @optimizer_switch_for_subselect_test=null; set @join_cache_level_for_subselect_test=NULL; diff --git a/mysql-test/r/subselect_sj_mat.result b/mysql-test/r/subselect_sj_mat.result index 2f3777a47fd..9aa223b83f2 100644 --- a/mysql-test/r/subselect_sj_mat.result +++ b/mysql-test/r/subselect_sj_mat.result @@ -1173,6 +1173,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 DEPENDENT SUBQUERY t3 ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.b' of SELECT #3 was resolved in SELECT #1 +Note 1981 Aggregate function 'max()' of SELECT #3 belongs to SELECT #1 Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` group by `test`.`t1`.`a` having <expr_cache><`test`.`t1`.`a`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t1`.`a`,<exists>(select `test`.`t2`.`c` from `test`.`t2` where (<nop>(<expr_cache><`test`.`t2`.`d`,`test`.`t1`.`b`,max(`test`.`t1`.`b`),max(`test`.`t1`.`b`)>(<in_optimizer>(`test`.`t2`.`d`,<exists>(select `test`.`t3`.`e` from `test`.`t3` where (max(`test`.`t1`.`b`) = `test`.`t3`.`e`) having (<cache>(`test`.`t2`.`d`) >= <ref_null_helper>(`test`.`t3`.`e`)))))) and (<cache>(`test`.`t1`.`a`) = `test`.`t2`.`c`))))) select a from t1 group by a having a in (select c from t2 where d >= some(select e from t3 where max(b)=e)); @@ -2277,6 +2278,7 @@ Handler_read_key 5000 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 6003 @@ -2301,3 +2303,16 @@ PREPARE stmt FROM ' EXECUTE stmt; EXECUTE stmt; DROP TABLE t1,t2,t3; +# +# MDEV-10389: Query returns different results on a debug vs non-debug build of the same revision +# +CREATE TABLE t1 (i1 INT, i2 INT NOT NULL); +INSERT INTO t1 VALUES (1,4),(2,6); +SELECT * FROM t1 AS alias1 +WHERE alias1.i1 IN ( +SELECT i1 FROM t1 WHERE alias1.i2 IN ( SELECT i2 FROM t1 HAVING i2 <> 7 ) +); +i1 i2 +1 4 +2 6 +DROP TABLE t1; diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 73396b53413..c655bc01b74 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -294,6 +294,9 @@ test.t1 repair status OK test.t2 repair status OK test.t3 repair status OK DROP TABLES t1, t2, t3; +CREATE TEMPORARY TABLE t1 (a int); +RENAME TABLE t1 TO t2; +DROP TABLE t2; create temporary temporary table t1 (a int); 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 'temporary table t1 (a int)' at line 1 flush status; diff --git a/mysql-test/r/type_date.result b/mysql-test/r/type_date.result index a1eeda063e4..d2587d7199e 100644 --- a/mysql-test/r/type_date.result +++ b/mysql-test/r/type_date.result @@ -165,6 +165,7 @@ str_to_date( '', a ) NULL DROP TABLE t1; CREATE TABLE t1 (a DATE, b INT, PRIMARY KEY (a,b)); +SET timestamp=UNIX_TIMESTAMP('2016-07-21 14:48:18'); INSERT INTO t1 VALUES (DATE(NOW()), 1); SELECT COUNT(*) FROM t1 WHERE a = NOW(); COUNT(*) @@ -192,6 +193,7 @@ COUNT(*) EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using where +SET timestamp=DEFAULT; DROP TABLE t1; CREATE TABLE t1 (a DATE); CREATE TABLE t2 (a DATE); diff --git a/mysql-test/r/update.result b/mysql-test/r/update.result index f7a36c537f9..68dbd0dc024 100644 --- a/mysql-test/r/update.result +++ b/mysql-test/r/update.result @@ -276,6 +276,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -289,6 +290,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 2 Handler_read_rnd_deleted 0 Handler_read_rnd_next 9 @@ -301,6 +303,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -313,6 +316,7 @@ Handler_read_key 0 Handler_read_last 1 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -326,6 +330,7 @@ Handler_read_key 0 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 1 Handler_read_rnd_deleted 2 Handler_read_rnd_next 7 @@ -381,6 +386,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 1 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 1 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -420,6 +426,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -432,6 +439,7 @@ Handler_read_key 2 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -443,6 +451,7 @@ Handler_read_key 3 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -454,6 +463,7 @@ Handler_read_key 3 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -703,6 +713,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 1 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 2 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/mysql-test/r/userstat.result b/mysql-test/r/userstat.result index a56ff5771f6..ea366e5284e 100644 --- a/mysql-test/r/userstat.result +++ b/mysql-test/r/userstat.result @@ -121,6 +121,7 @@ Handler_read_key 9 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 5 diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 0e0d37b5ec7..15f157431b4 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -4271,6 +4271,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 @@ -4294,6 +4295,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 17 diff --git a/mysql-test/r/xtradb_mrr.result b/mysql-test/r/xtradb_mrr.result index 15b750d2fd3..c238d0530af 100644 --- a/mysql-test/r/xtradb_mrr.result +++ b/mysql-test/r/xtradb_mrr.result @@ -311,10 +311,10 @@ concat('c-', 1000 + C.a, '-c'), 'filler' from t1 A, t1 B, t1 C; explain -select count(length(a) + length(filler)) from t2 where a>='a-1000-a' and a <'a-1001-a'; +select count(length(a) + length(filler)) from t2 force index (a) where a>='a-1000-a' and a <'a-1001-a'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range a a 9 NULL 99 Using index condition; Rowid-ordered scan -select count(length(a) + length(filler)) from t2 where a>='a-1000-a' and a <'a-1001-a'; +select count(length(a) + length(filler)) from t2 force index (a) where a>='a-1000-a' and a <'a-1001-a'; count(length(a) + length(filler)) 100 drop table t2; diff --git a/mysql-test/std_data/bug20683959loaddata.txt b/mysql-test/std_data/bug20683959loaddata.txt new file mode 100644 index 00000000000..1878cc78879 --- /dev/null +++ b/mysql-test/std_data/bug20683959loaddata.txt @@ -0,0 +1 @@ +Ã"RT @niouzechun: é˜âˆšõ€®ç¹ä¸Šãƒ£ç¹æ–õ€‡³ç¹§ï½¨ç¹ï½³ç¹ç‰™è€³ç¸ºï½ªç¹§è–™â–¡ç¸ºä»£ï½Œç¸ºï½©ç¸²âˆšã„ç¹ï½³ç¹ä¸Šãƒ£ç¹æ–õ€‡³ç¹§ï½¨ç¹ï½³ç¹å³¨ï½„è« ï½¨èœ‰õ€”Žå™ªç¸ºï½ªç¸ºé¡˜ï½©ï½±ç¹§åµâ‰ 縺セ繧顔ゥ肴・オ逧õ€‹–↓鞫ょå™ç¸ºåŠ±â†‘縺õ€‹šç‚Šé€•ï½±ç¸ºï½¯ç¸²âˆ«æ¨Ÿèž³æº˜õ€èŽ コ逕溘õ€®è“コè›ï½¬é€§õ€‹–↓縺õ€‘Žâˆªç¸ºä¸Šï¼žç¸ºä¹â†‘縺õ€‹–ï¼ è³æ¦Šï½¹ï½³é²å³¨â–¡ç¸ºç¤¼ç‚Šè³æ¦Šï½°ï½½ç¸º 縺苓セ帙> 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 new file mode 100644 index 00000000000..b366bde4daf --- /dev/null +++ b/mysql-test/suite/binlog/r/binlog_dmls_on_tmp_tables_readonly.result @@ -0,0 +1,59 @@ +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; +connect con1,localhost,test,,test; +connection default; +SET GLOBAL READ_ONLY=1; +connection con1; +CREATE TEMPORARY TABLE t1 (a INT) ENGINE=INNODB; +# Test INSERTS with autocommit being off and on. +BEGIN; +INSERT INTO t1 VALUES (10); +COMMIT; +INSERT INTO t1 VALUES (20); +# Test UPDATES with autocommit being off and on. +BEGIN; +UPDATE t1 SET a=30 WHERE a=10; +COMMIT; +UPDATE t1 SET a=40 WHERE a=20; +connection default; +SET GLOBAL READ_ONLY=0; +# Test scenario where global read_only is enabled in the middle of transaction. +# Test INSERT operations on temporary tables, INSERTs should be successful even +# when global read_only is enabled. +connection con1; +BEGIN; +INSERT INTO t1 VALUES(50); +connection default; +SET GLOBAL READ_ONLY=1; +connection con1; +SELECT @@GLOBAL.READ_ONLY; +@@GLOBAL.READ_ONLY +1 +COMMIT; +connection default; +SET GLOBAL READ_ONLY=0; +# Test UPDATE operations on temporary tables, UPDATEs should be successful even +# when global read_only is enabled. +connection con1; +BEGIN; +UPDATE t1 SET a=60 WHERE a=50; +connection default; +SET GLOBAL READ_ONLY=1; +connection con1; +SELECT @@GLOBAL.READ_ONLY; +@@GLOBAL.READ_ONLY +1 +COMMIT; +SELECT * FROM t1; +a +30 +40 +60 +# Clean up +connection default; +SET GLOBAL READ_ONLY=0; +disconnect con1; +DROP USER test@localhost; 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 new file mode 100644 index 00000000000..0fa35d57745 --- /dev/null +++ b/mysql-test/suite/binlog/t/binlog_dmls_on_tmp_tables_readonly.test @@ -0,0 +1,92 @@ +# ==== Purpose ==== +# +# Check that DMLs are allowed on temporary tables, when server is in read only +# mode and binary log is enabled with binlog-format being stmt/mixed mode. +# +# ==== Implementation ==== +# +# Start the server with binary log being enabled. Mark the server as read only. +# Create a non-SUPER user and let the user to create a temporary table and +# perform DML operations on that temporary table. DMLs should not be blocked +# with a 'server read-only mode' error. +# +# ==== References ==== +# +# Bug#12818255: READ-ONLY OPTION DOES NOT ALLOW INSERTS/UPDATES ON TEMPORARY +# TABLES +# Bug#14294223: CHANGES NOT ALLOWED TO TEMPORARY TABLES ON READ-ONLY SERVERS +############################################################################### +--source include/have_log_bin.inc +--source include/have_innodb.inc +--disable_warnings +DROP TABLE IF EXISTS t1 ; +--enable_warnings + +--enable_connect_log +--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; + +connect (con1,localhost,test,,test); + +connection default; +SET GLOBAL READ_ONLY=1; + +connection con1; +CREATE TEMPORARY TABLE t1 (a INT) ENGINE=INNODB; + +--echo # Test INSERTS with autocommit being off and on. +BEGIN; +INSERT INTO t1 VALUES (10); +COMMIT; +INSERT INTO t1 VALUES (20); + +--echo # Test UPDATES with autocommit being off and on. +BEGIN; +UPDATE t1 SET a=30 WHERE a=10; +COMMIT; +UPDATE t1 SET a=40 WHERE a=20; + +connection default; +SET GLOBAL READ_ONLY=0; + +--echo # Test scenario where global read_only is enabled in the middle of transaction. +--echo # Test INSERT operations on temporary tables, INSERTs should be successful even +--echo # when global read_only is enabled. +connection con1; +BEGIN; +INSERT INTO t1 VALUES(50); + +connection default; +SET GLOBAL READ_ONLY=1; + +connection con1; +SELECT @@GLOBAL.READ_ONLY; +COMMIT; + +connection default; +SET GLOBAL READ_ONLY=0; + +--echo # Test UPDATE operations on temporary tables, UPDATEs should be successful even +--echo # when global read_only is enabled. +connection con1; +BEGIN; +UPDATE t1 SET a=60 WHERE a=50; + +connection default; +SET GLOBAL READ_ONLY=1; + +connection con1; +SELECT @@GLOBAL.READ_ONLY; +COMMIT; + +SELECT * FROM t1; + +--echo # Clean up +connection default; +SET GLOBAL READ_ONLY=0; + +disconnect con1; +DROP USER test@localhost; +--disable_connect_log diff --git a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc index e19f8b4f820..cd060e7a370 100644 --- a/mysql-test/suite/funcs_1/datadict/processlist_priv.inc +++ b/mysql-test/suite/funcs_1/datadict/processlist_priv.inc @@ -152,7 +152,7 @@ connection default; let $wait_timeout= 10; let $wait_condition= SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST -WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1'; +WHERE DB = 'information_schema' AND COMMAND = 'Sleep' AND USER = 'ddicttestuser1' AND state=''; --source include/wait_condition.inc --replace_result ENGINE=MyISAM "" ENGINE=Aria "" " PAGE_CHECKSUM=1" "" " PAGE_CHECKSUM=0" "" eval SHOW CREATE TABLE $table; diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 25f20e01521..5f8d9c6ddff 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -28,3 +28,5 @@ galera_flush : mysql-wsrep/issues/229 galera_transaction_read_only : mysql-wsrep/issues/229 galera_gcs_fragment : Incorrect arguments to SET galera_flush_local : Fails sporadically +galera_binlog_stmt_autoinc : TODO: investigate +galera_concurrent_ctas : Test times out, investigate diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf index b8c61bc814d..e5cf769a910 100644 --- a/mysql-test/suite/galera/galera_2nodes.cnf +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -16,7 +16,7 @@ wsrep-sync-wait=7 #ist_port=@OPT.port #sst_port=@OPT.port wsrep-cluster-address=gcomm:// -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;gcache.size=10M;evs.suspect_timeout=PT10S' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -25,7 +25,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gcache.size=10M' +wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;gcache.size=10M;evs.suspect_timeout=PT10S' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' diff --git a/mysql-test/suite/galera/include/auto_increment_offset_restore.inc b/mysql-test/suite/galera/include/auto_increment_offset_restore.inc new file mode 100644 index 00000000000..6218dfd6f2c --- /dev/null +++ b/mysql-test/suite/galera/include/auto_increment_offset_restore.inc @@ -0,0 +1,35 @@ +# See auto_increment_offset_restore.inc for details. + +if (!$node_1) +{ + --die ERROR IN TEST: $node_1 must be set before sourcing auto_increment_offset_save.inc +} + +if (!$node_2) +{ + --die ERROR IN TEST: $node_2 must be set before sourcing auto_increment_offset_save.inc +} + +if (!$auto_increment_offset_node_1) +{ + --die ERROR IN TEST: $auto_increment_offset_node_1 must be set before sourcing auto_increment_offset_save.inc +} + +if (!$auto_increment_offset_node_2) +{ + --die ERROR IN TEST: $auto_increment_offset_node_2 must be set before sourcing auto_increment_offset_save.inc +} + +# Restore original auto_increment_offset values. +--disable_query_log +--connection $node_1 +--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1; +--connection $node_2 +--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2; + +if ($node_3) +{ +--connection $node_3 +--eval SET @@global.auto_increment_offset = $auto_increment_offset_node_3; +} +--enable_query_log diff --git a/mysql-test/suite/galera/include/auto_increment_offset_save.inc b/mysql-test/suite/galera/include/auto_increment_offset_save.inc new file mode 100644 index 00000000000..3c4db3f381c --- /dev/null +++ b/mysql-test/suite/galera/include/auto_increment_offset_save.inc @@ -0,0 +1,37 @@ +# This file can be used to save the @@global.auto_increment_offset value at +# the beginning of any test that intends to restart any of the participating +# nodes. This is required as the node may get auto-assigned a different +# auto_increment_offset value on restart, which could cause MTR's internal +# post-check to fail. auto_increment_offset_restore.inc can be used at the +# end of the test to restore these saved values. + +# Parameters +# ---------- +# $node_1 +# Connection handle for 1st node +# $node_2 +# Connection handle for 2nd node +# $node_3 (optional) +# Connection handle for 3rd node + +if (!$node_1) +{ + --die ERROR IN TEST: $node_1 must be set before sourcing auto_increment_offset_save.inc +} + +if (!$node_2) +{ + --die ERROR IN TEST: $node_2 must be set before sourcing auto_increment_offset_save.inc +} + +--connection $node_1 +let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`; +--connection $node_2 +let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`; + +if ($node_3) +{ + --connection $node_3 + let $auto_increment_offset_node_3 = `SELECT @@global.auto_increment_offset`; +} + diff --git a/mysql-test/suite/galera/r/GAL-382.result b/mysql-test/suite/galera/r/GAL-382.result new file mode 100644 index 00000000000..0c7365f3005 --- /dev/null +++ b/mysql-test/suite/galera/r/GAL-382.result @@ -0,0 +1,6 @@ +create table t1 (i int, j int, k int, primary key pk(i)) engine=innodb; +insert into t1 values (1, 1, 1), (2, 2, 2), (3, 3, 3); +create table t2 (i int, j int, k int, primary key pk(i, j, k), index idx(i, k, j)) engine=innodb; +replace into t2 (i, j, k) select /*!99997 */ i, k, j from t1; +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/MW-252.result b/mysql-test/suite/galera/r/MW-252.result new file mode 100644 index 00000000000..c422edcb82a --- /dev/null +++ b/mysql-test/suite/galera/r/MW-252.result @@ -0,0 +1,7 @@ +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +FLUSH TABLES WITH READ LOCK; +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +VARIABLE_VALUE = 2 +1 +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/MW-258.result b/mysql-test/suite/galera/r/MW-258.result new file mode 100644 index 00000000000..1b4d4ae0de8 --- /dev/null +++ b/mysql-test/suite/galera/r/MW-258.result @@ -0,0 +1,34 @@ +CREATE TABLE t1 (f1 INTEGER); +LOCK TABLE t1 WRITE; +value prior to RSU: +SHOW STATUS LIKE 'wsrep_desync_count'; +Variable_name Value +wsrep_desync_count 0 +SHOW VARIABLES LIKE 'wsrep_desync'; +Variable_name Value +wsrep_desync OFF +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_osu_method = RSU; +ALTER TABLE t1 ADD COLUMN f2 INTEGER;; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_osu_method = RSU; +ALTER TABLE t1 ADD COLUMN f3 INTEGER;; +value during RSU: +SHOW STATUS LIKE 'wsrep_desync_count'; +Variable_name Value +wsrep_desync_count 2 +SHOW VARIABLES LIKE 'wsrep_desync'; +Variable_name Value +wsrep_desync OFF +UNLOCK TABLES; +value after RSU: +SHOW STATUS LIKE 'wsrep_desync_count'; +Variable_name Value +wsrep_desync_count 0 +SHOW VARIABLES LIKE 'wsrep_desync'; +Variable_name Value +wsrep_desync OFF +SET GLOBAL wsrep_desync=0; +Warnings: +Warning 1231 'wsrep_desync' is already OFF. +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/MW-259.result b/mysql-test/suite/galera/r/MW-259.result new file mode 100644 index 00000000000..df76e959de5 --- /dev/null +++ b/mysql-test/suite/galera/r/MW-259.result @@ -0,0 +1,12 @@ +CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; +SET GLOBAL wsrep_desync=0; +Warnings: +Warning 1231 'wsrep_desync' is already OFF. +SET wsrep_OSU_method=RSU; +SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; +ALTER TABLE t1 ADD COLUMN f2 INTEGER;; +SET GLOBAL wsrep_desync=1;; +SET DEBUG_SYNC= 'now SIGNAL continue'; +DROP TABLE t1; +SET GLOBAL wsrep_desync=0; +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/suite/galera/r/MW-284.result b/mysql-test/suite/galera/r/MW-284.result index ad227390526..338f6c21375 100644 --- a/mysql-test/suite/galera/r/MW-284.result +++ b/mysql-test/suite/galera/r/MW-284.result @@ -20,3 +20,4 @@ connection node_3; STOP SLAVE; RESET SLAVE ALL; CALL mtr.add_suppression('failed registering on master'); +CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work'); diff --git a/mysql-test/suite/galera/r/MW-285.result b/mysql-test/suite/galera/r/MW-285.result new file mode 100644 index 00000000000..8c5a21fcbee --- /dev/null +++ b/mysql-test/suite/galera/r/MW-285.result @@ -0,0 +1,19 @@ +CREATE TABLE parent1 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB; +CREATE TABLE parent2 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB; +CREATE TABLE child ( +id INT PRIMARY KEY, +parent1_id INT, +parent2_id INT, +FOREIGN KEY (parent1_id) REFERENCES parent1(id), +FOREIGN KEY (parent1_id) REFERENCES parent2(id) +) ENGINE=InnoDB; +INSERT INTO parent1 VALUES (1); +INSERT INTO parent2 VALUES (1); +INSERT INTO child VALUES (1,1,1); +INSERT INTO child VALUES (2,1,1); +SET foreign_key_checks=OFF; +DROP TABLE parent1; +UPDATE child SET parent1_id=2 WHERE id=1; +DROP TABLE child; +DROP TABLE parent2; +SET foreign_key_checks=ON; diff --git a/mysql-test/suite/galera/r/MW-286.result b/mysql-test/suite/galera/r/MW-286.result new file mode 100644 index 00000000000..adc996c1cbe --- /dev/null +++ b/mysql-test/suite/galera/r/MW-286.result @@ -0,0 +1,13 @@ +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; +INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; +INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5;; +SET GLOBAL wsrep_desync = TRUE; +SET wsrep_on = FALSE; +ALTER TABLE t1 ADD PRIMARY KEY (f1); +ERROR 70100: Query execution was interrupted +SET wsrep_on = TRUE; +SET GLOBAL wsrep_desync = FALSE; +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera/r/MW-292.result b/mysql-test/suite/galera/r/MW-292.result new file mode 100644 index 00000000000..f038f880efa --- /dev/null +++ b/mysql-test/suite/galera/r/MW-292.result @@ -0,0 +1,30 @@ +CREATE TABLE rand_table (f1 FLOAT); +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); +SET AUTOCOMMIT=ON; +START TRANSACTION; +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; +f1 f2 +2 a +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync'; +COMMIT;; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +UPDATE t1 SET f2 = 'c' WHERE f1 = 2; +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync'; +SELECT TIMEDIFF(SYSDATE(), NOW()) < 2; +TIMEDIFF(SYSDATE(), NOW()) < 2 +1 +INSERT INTO rand_table VALUES (RAND()),(RAND()),(RAND()),(RAND()),(RAND()); +INSERT INTO rand_table VALUES (RAND()),(RAND()),(RAND()),(RAND()),(RAND()); +SELECT COUNT(DISTINCT f1) = 10 FROM rand_table; +COUNT(DISTINCT f1) = 10 +1 +wsrep_local_replays +1 +DROP TABLE t1; +DROP TABLE rand_table; diff --git a/mysql-test/suite/galera/r/MW-44.result b/mysql-test/suite/galera/r/MW-44.result new file mode 100644 index 00000000000..28a6f1ac8dd --- /dev/null +++ b/mysql-test/suite/galera/r/MW-44.result @@ -0,0 +1,14 @@ +TRUNCATE TABLE mysql.general_log; +TRUNCATE TABLE mysql.general_log; +SET SESSION wsrep_osu_method=TOI; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_osu_method=RSU; +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +SET SESSION wsrep_osu_method=TOI; +SELECT COUNT(*) = 2 FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%'; +COUNT(*) = 2 +1 +SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE 'SELECT%'; +COUNT(*) = 0 +1 +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera#414.result b/mysql-test/suite/galera/r/galera#414.result new file mode 100644 index 00000000000..029961f9463 --- /dev/null +++ b/mysql-test/suite/galera/r/galera#414.result @@ -0,0 +1,5 @@ +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_on = OFF; +SET SESSION wsrep_on = ON; +CALL mtr.add_suppression("Failed to set packet size"); +CALL mtr.add_suppression("Failed to set packet size"); diff --git a/mysql-test/suite/galera/r/galera_as_master.result b/mysql-test/suite/galera/r/galera_as_master.result index 92a1a0e7cb3..9d1262724d2 100644 --- a/mysql-test/suite/galera/r/galera_as_master.result +++ b/mysql-test/suite/galera/r/galera_as_master.result @@ -52,3 +52,4 @@ DROP TABLE t2, t3; connection node_3; STOP SLAVE; RESET SLAVE ALL; +CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work'); diff --git a/mysql-test/suite/galera/r/galera_as_slave_autoinc.result b/mysql-test/suite/galera/r/galera_as_slave_autoinc.result new file mode 100644 index 00000000000..b6314b862c2 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_as_slave_autoinc.result @@ -0,0 +1,82 @@ +START SLAVE; +SET SESSION binlog_format='STATEMENT'; +CREATE TABLE t1 ( +i int(11) NOT NULL AUTO_INCREMENT, +c char(32) DEFAULT 'dummy_text', +PRIMARY KEY (i) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +insert into t1(i) values(null); +select * from t1; +i c +1 dummy_text +insert into t1(i) values(null), (null), (null); +select * from t1; +i c +1 dummy_text +2 dummy_text +3 dummy_text +4 dummy_text +SET SESSION auto_increment_increment=7; +insert into t1(i) values(null), (null), (null); +SET SESSION auto_increment_offset=5; +insert into t1(i) values(null), (null), (null); +select * from t1; +i c +1 dummy_text +2 dummy_text +3 dummy_text +4 dummy_text +8 dummy_text +15 dummy_text +22 dummy_text +33 dummy_text +40 dummy_text +47 dummy_text +show variables like 'binlog_format'; +Variable_name Value +binlog_format STATEMENT +show variables like '%auto_increment%'; +Variable_name Value +auto_increment_increment 7 +auto_increment_offset 5 +wsrep_auto_increment_control ON +select * from t1; +i c +1 dummy_text +2 dummy_text +3 dummy_text +4 dummy_text +8 dummy_text +15 dummy_text +22 dummy_text +33 dummy_text +40 dummy_text +47 dummy_text +show variables like 'binlog_format'; +Variable_name Value +binlog_format ROW +show variables like 'auto_increment_increment'; +Variable_name Value +auto_increment_increment 2 +select * from t1; +i c +1 dummy_text +2 dummy_text +3 dummy_text +4 dummy_text +8 dummy_text +15 dummy_text +22 dummy_text +33 dummy_text +40 dummy_text +47 dummy_text +show variables like 'binlog_format'; +Variable_name Value +binlog_format ROW +show variables like 'auto_increment_increment'; +Variable_name Value +auto_increment_increment 2 +DROP TABLE t1; +STOP SLAVE; +RESET SLAVE ALL; +RESET MASTER; diff --git a/mysql-test/suite/galera/r/galera_as_slave_nonprim.result b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result index fd20f8db2f9..365ea31f292 100644 --- a/mysql-test/suite/galera/r/galera_as_slave_nonprim.result +++ b/mysql-test/suite/galera/r/galera_as_slave_nonprim.result @@ -12,7 +12,7 @@ STOP SLAVE; RESET SLAVE ALL; CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query"); CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047"); -CALL mtr.add_suppression("Send action {\\(nil\\), 328, TORDERED} returned -107 \\(Transport endpoint is not connected\\)"); +CALL mtr.add_suppression("Transport endpoint is not connected"); CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213"); CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047"); RESET MASTER; diff --git a/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result b/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result index 210492937b0..91b3c9ecaa8 100644 --- a/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result +++ b/mysql-test/suite/galera/r/galera_bf_abort_flush_for_export.result @@ -9,9 +9,10 @@ SET SESSION wsrep_sync_wait = 0; UNLOCK TABLES; COMMIT; SET AUTOCOMMIT=ON; -SELECT * FROM t1; -f1 -2 +SET SESSION wsrep_sync_wait = 7; +SELECT COUNT(*) = 1 FROM t1; +COUNT(*) = 1 +1 wsrep_local_aborts_increment 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result index 6879ecf67fc..b6a16f72ec3 100644 --- a/mysql-test/suite/galera/r/galera_defaults.result +++ b/mysql-test/suite/galera/r/galera_defaults.result @@ -32,8 +32,8 @@ WSREP_GTID_DOMAIN_ID 0 WSREP_GTID_MODE OFF WSREP_LOAD_DATA_SPLITTING ON WSREP_LOG_CONFLICTS OFF -WSREP_MAX_WS_ROWS 131072 -WSREP_MAX_WS_SIZE 1073741824 +WSREP_MAX_WS_ROWS 0 +WSREP_MAX_WS_SIZE 2147483647 WSREP_MYSQL_REPLICATION_BUNDLE 0 WSREP_NOTIFY_CMD WSREP_ON ON @@ -50,12 +50,12 @@ WSREP_SST_DONOR WSREP_SST_DONOR_REJECTS_QUERIES OFF WSREP_SST_METHOD rsync WSREP_SYNC_WAIT 7 -<BASE_HOST>; <BASE_PORT>; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.info_log_mask = 0; evs.install_timeout = PT7.5S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT5S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 0; evs.view_forget_timeout = P1D; <GCACHE_DIR>; gcache.keep_pages_size = 0; gcache.mem_size = 0; <GCACHE_NAME>; gcache.page_size = 128M; gcache.size = 10M; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; <GCS_RECV_Q_HARD_LIMIT>; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; <GMCAST_LISTEN_ADDR>; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; <IST_RECV_ADDR>; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = P30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 7; socket.checksum = 2; +<BASE_DIR>; <BASE_HOST>; <BASE_PORT>; cert.log_conflicts = no; debug = no; evs.auto_evict = 0; evs.causal_keepalive_period = PT1S; evs.debug_log_mask = 0x1; evs.delay_margin = PT1S; evs.delayed_keep_period = PT30S; evs.inactive_check_period = PT0.5S; evs.inactive_timeout = PT15S; evs.info_log_mask = 0; evs.install_timeout = PT7.5S; evs.join_retrans_period = PT1S; evs.keepalive_period = PT1S; evs.max_install_timeouts = 3; evs.send_window = 4; evs.stats_report_period = PT1M; evs.suspect_timeout = PT10S; evs.use_aggregate = true; evs.user_send_window = 2; evs.version = 0; evs.view_forget_timeout = P1D; <GCACHE_DIR>; gcache.keep_pages_size = 0; gcache.mem_size = 0; <GCACHE_NAME>; gcache.page_size = 128M; gcache.size = 10M; gcomm.thread_prio = ; gcs.fc_debug = 0; gcs.fc_factor = 1.0; gcs.fc_limit = 16; gcs.fc_master_slave = no; gcs.max_packet_size = 64500; gcs.max_throttle = 0.25; <GCS_RECV_Q_HARD_LIMIT>; gcs.recv_q_soft_limit = 0.25; gcs.sync_donor = no; <GMCAST_LISTEN_ADDR>; gmcast.mcast_addr = ; gmcast.mcast_ttl = 1; gmcast.peer_timeout = PT3S; gmcast.segment = 0; gmcast.time_wait = PT5S; gmcast.version = 0; <IST_RECV_ADDR>; pc.announce_timeout = PT3S; pc.checksum = false; pc.ignore_quorum = false; pc.ignore_sb = false; pc.linger = PT20S; pc.npvo = false; pc.recovery = true; pc.version = 0; pc.wait_prim = true; pc.wait_prim_timeout = P30S; pc.weight = 1; protonet.backend = asio; protonet.version = 0; repl.causal_read_timeout = PT90S; repl.commit_order = 3; repl.key_format = FLAT8; repl.max_ws_size = 2147483647; repl.proto_max = 7; socket.checksum = 2; socket.recv_buf_size = 212992; SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_%' AND VARIABLE_NAME != 'wsrep_debug_sync_waiters'; COUNT(*) -57 +58 SELECT VARIABLE_NAME FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME LIKE 'wsrep_%' AND VARIABLE_NAME != 'wsrep_debug_sync_waiters' @@ -76,6 +76,7 @@ WSREP_COMMIT_OOOE WSREP_COMMIT_OOOL WSREP_COMMIT_WINDOW WSREP_CONNECTED +WSREP_DESYNC_COUNT WSREP_EVS_DELAYED WSREP_EVS_EVICT_LIST WSREP_EVS_REPL_LATENCY diff --git a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result index a1ba8672eae..464a8b7ea97 100644 --- a/mysql-test/suite/galera/r/galera_gcs_fc_limit.result +++ b/mysql-test/suite/galera/r/galera_gcs_fc_limit.result @@ -5,7 +5,7 @@ SELECT COUNT(*) = 1 FROM t1; COUNT(*) = 1 1 SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1'; -FLUSH TABLES WITH READ LOCK; +LOCK TABLE t1 WRITE; connection node_1; INSERT INTO t1 VALUES (2); INSERT INTO t1 VALUES (3); diff --git a/mysql-test/suite/galera/r/galera_ist_recv_bind.result b/mysql-test/suite/galera/r/galera_ist_recv_bind.result new file mode 100644 index 00000000000..de4e07fbe41 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_recv_bind.result @@ -0,0 +1,13 @@ +SELECT @@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%'; +@@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%' +1 +SELECT @@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%'; +@@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%' +1 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; +SET SESSION wsrep_on = OFF; +SET SESSION wsrep_on = ON; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_kill_ddl.result b/mysql-test/suite/galera/r/galera_kill_ddl.result index c5b3e31b80e..9b15aaeb0af 100644 --- a/mysql-test/suite/galera/r/galera_kill_ddl.result +++ b/mysql-test/suite/galera/r/galera_kill_ddl.result @@ -10,8 +10,8 @@ connection node_2a; SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1'; COUNT(*) = 2 1 +connection node_1; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 -connection node_1; DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_log_output_csv.result b/mysql-test/suite/galera/r/galera_log_output_csv.result index 07a78469578..cdb5ee49f3e 100644 --- a/mysql-test/suite/galera/r/galera_log_output_csv.result +++ b/mysql-test/suite/galera/r/galera_log_output_csv.result @@ -9,9 +9,6 @@ SELECT 1 = 1 FROM t1; SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 1 = 1 FROM t1'; COUNT(*) = 1 1 -SELECT COUNT(*) > 0 FROM mysql.general_log WHERE argument = 'CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB'; -COUNT(*) > 0 -1 SELECT 2 = 2 FROM t1; 2 = 2 1 diff --git a/mysql-test/suite/galera/r/galera_parallel_simple.result b/mysql-test/suite/galera/r/galera_parallel_simple.result index 294a94baed3..6d023c38a57 100644 --- a/mysql-test/suite/galera/r/galera_parallel_simple.result +++ b/mysql-test/suite/galera/r/galera_parallel_simple.result @@ -1,6 +1,7 @@ CREATE TABLE t1 (id INT) ENGINE=InnoDB; CREATE TABLE t2 (id INT) ENGINE=InnoDB; SET GLOBAL wsrep_slave_threads = 2; +LOCK TABLE t1 WRITE; INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); INSERT INTO t1 VALUES (1); @@ -13,15 +14,15 @@ INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); +SET SESSION wsrep_sync_wait = 0; +UNLOCK TABLES; +SET SESSION wsrep_sync_wait = 7; SELECT COUNT(*) = 10 FROM t1; COUNT(*) = 10 0 SELECT COUNT(*) = 10 FROM t2; COUNT(*) = 10 0 -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%'; -COUNT(*) = 2 -1 SET GLOBAL wsrep_slave_threads = 1;; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/suite/galera/r/galera_repl_max_ws_size.result b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result index 00980181824..da24a741351 100644 --- a/mysql-test/suite/galera/r/galera_repl_max_ws_size.result +++ b/mysql-test/suite/galera/r/galera_repl_max_ws_size.result @@ -7,3 +7,7 @@ SELECT COUNT(*) = 0 FROM t1; COUNT(*) = 0 1 DROP TABLE t1; +CALL mtr.add_suppression("Maximum writeset size exceeded by"); +CALL mtr.add_suppression("transaction size limit"); +CALL mtr.add_suppression("transaction size exceeded"); +CALL mtr.add_suppression("rbr write fail"); diff --git a/mysql-test/suite/galera/r/galera_roles.result b/mysql-test/suite/galera/r/galera_roles.result index 1617f0d7b51..f07cd81c03f 100644 --- a/mysql-test/suite/galera/r/galera_roles.result +++ b/mysql-test/suite/galera/r/galera_roles.result @@ -74,8 +74,8 @@ SET ROLE role1; FLUSH TABLES; SELECT * FROM mysql.roles_mapping; Host User Role Admin_option - role1 Y localhost foo role1 N +localhost root role1 Y SHOW TABLES FROM test1; Tables_in_test1 t1 @@ -166,6 +166,45 @@ disconnect foo_node_2; connection node_1; DROP USER foo@localhost; DROP DATABASE test1; +# +# MDEV-10566: Create role statement replicated inconsistently in Galera Cluster +# + +# On node_1 +CREATE USER foo@localhost; +CREATE ROLE role1; +CREATE ROLE role2 WITH ADMIN CURRENT_USER; +CREATE ROLE role3 WITH ADMIN foo@localhost; +CREATE ROLE role4 WITH ADMIN role1; +SELECT * FROM mysql.roles_mapping; +Host User Role Admin_option + role1 role4 Y +localhost foo role3 Y +localhost root role1 Y +localhost root role2 Y +SELECT * FROM INFORMATION_SCHEMA.APPLICABLE_ROLES; +GRANTEE ROLE_NAME IS_GRANTABLE IS_DEFAULT +role1 role4 YES NULL +root@localhost role1 YES NO +root@localhost role2 YES NO + +# On node_2 +SELECT * FROM mysql.roles_mapping; +Host User Role Admin_option + role1 role4 Y +localhost foo role3 Y +localhost root role1 Y +localhost root role2 Y +SELECT * FROM INFORMATION_SCHEMA.APPLICABLE_ROLES; +GRANTEE ROLE_NAME IS_GRANTABLE IS_DEFAULT +role1 role4 YES NULL +root@localhost role1 YES NO +root@localhost role2 YES NO +DROP ROLE role1; +DROP ROLE role2; +DROP ROLE role3; +DROP ROLE role4; +DROP USER foo@localhost; disconnect node_2; disconnect node_1; # End of test diff --git a/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result b/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result index 2b2b80ee91c..aa0d20a3466 100644 --- a/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result +++ b/mysql-test/suite/galera/r/galera_rsu_wsrep_desync.result @@ -27,13 +27,12 @@ SET GLOBAL wsrep_desync=0; Warnings: Warning 1231 'wsrep_desync' is already OFF. SET wsrep_OSU_method=RSU; -SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; +SET DEBUG_SYNC = 'alter_table_before_create_table_no_lock WAIT_FOR continue'; ALTER TABLE t1 ADD COLUMN f2 INTEGER;; connection node_1a; -SET GLOBAL wsrep_desync=1; -ERROR HY000: Operation 'desync' failed for SET GLOBAL wsrep_desync=1 -SET GLOBAL wsrep_desync=0; +SET GLOBAL wsrep_desync=1;; SET DEBUG_SYNC= 'now SIGNAL continue'; +SET GLOBAL wsrep_desync=0; connection node_1; SHOW CREATE TABLE t1; Table Create Table diff --git a/mysql-test/suite/galera/r/galera_ssl_upgrade.result b/mysql-test/suite/galera/r/galera_ssl_upgrade.result index c0f2e84dc6f..b24671d120d 100644 --- a/mysql-test/suite/galera/r/galera_ssl_upgrade.result +++ b/mysql-test/suite/galera/r/galera_ssl_upgrade.result @@ -4,21 +4,12 @@ VARIABLE_VALUE = 'Synced' SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 -SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; -VARIABLE_VALUE = 'Synced' -1 SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 -SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; -VARIABLE_VALUE = 'Synced' -1 SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 -SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; -VARIABLE_VALUE = 'Synced' -1 SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 1 diff --git a/mysql-test/suite/galera/r/galera_transaction_replay.result b/mysql-test/suite/galera/r/galera_transaction_replay.result index d2c9a6b357a..e932e4aed02 100644 --- a/mysql-test/suite/galera/r/galera_transaction_replay.result +++ b/mysql-test/suite/galera/r/galera_transaction_replay.result @@ -39,3 +39,30 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; COUNT(*) = 1 1 DROP TABLE t1; +CREATE TABLE t1 (i int primary key, j int) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 0), (3, 0); +SELECT * FROM t1; +i j +1 0 +3 0 +PREPARE stmt1 FROM "UPDATE t1 SET j = 1 where i > 0"; +SET GLOBAL wsrep_provider_options = 'dbug=d,commit_monitor_enter_sync'; +EXECUTE stmt1;; +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_on = 0; +SET SESSION wsrep_on = 1; +INSERT INTO t1 VALUES(2,2); +SET GLOBAL wsrep_provider_options = 'dbug='; +SET GLOBAL wsrep_provider_options = 'signal=commit_monitor_enter_sync'; +SELECT * FROM t1; +i j +1 1 +2 2 +3 1 +SELECT * FROM t1; +i j +1 1 +2 2 +3 1 +DEALLOCATE PREPARE stmt1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_var_desync_on.result b/mysql-test/suite/galera/r/galera_var_desync_on.result index 383e077f775..54c30370c4a 100644 --- a/mysql-test/suite/galera/r/galera_var_desync_on.result +++ b/mysql-test/suite/galera/r/galera_var_desync_on.result @@ -31,4 +31,6 @@ connection node_2; SELECT COUNT(*) = 11 FROM t1; COUNT(*) = 11 1 +CALL mtr.add_suppression("Protocol violation"); DROP TABLE t1; +CALL mtr.add_suppression("Protocol violation"); diff --git a/mysql-test/suite/galera/r/galera_var_max_ws_rows.result b/mysql-test/suite/galera/r/galera_var_max_ws_rows.result new file mode 100644 index 00000000000..6e239c70a3e --- /dev/null +++ b/mysql-test/suite/galera/r/galera_var_max_ws_rows.result @@ -0,0 +1,115 @@ +CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); +CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; +SET GLOBAL wsrep_max_ws_rows = 4; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (3); +INSERT INTO t1 (f2) VALUES (4); +INSERT INTO t1 (f2) VALUES (5); +ERROR HY000: wsrep_max_ws_rows exceeded +COMMIT; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (3); +INSERT INTO t1 (f2) VALUES (4); +UPDATE t1 SET f2 = 10 WHERE f2 = 4; +ERROR HY000: wsrep_max_ws_rows exceeded +COMMIT; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (3); +INSERT INTO t1 (f2) VALUES (4); +DELETE FROM t1 WHERE f2 = 1; +ERROR HY000: wsrep_max_ws_rows exceeded +COMMIT; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SET GLOBAL wsrep_max_ws_rows = 5; +INSERT INTO t1 (f2) VALUES (1),(2),(3),(4),(5); +SET GLOBAL wsrep_max_ws_rows = 4; +UPDATE t1 SET f2 = f2 + 10; +ERROR HY000: wsrep_max_ws_rows exceeded +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +DELETE FROM t1 WHERE f2 < 10; +ERROR HY000: wsrep_max_ws_rows exceeded +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +INSERT INTO t1 (f2) SELECT * FROM ten; +ERROR HY000: wsrep_max_ws_rows exceeded +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +INSERT INTO t1 (f2) VALUES (10),(20),(30),(40),(50); +ERROR HY000: wsrep_max_ws_rows exceeded +SELECT COUNT(*) = 5 FROM t1; +COUNT(*) = 5 +1 +SET GLOBAL wsrep_max_ws_rows = 10; +DELETE FROM t1 WHERE f2 < 10; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SET GLOBAL wsrep_max_ws_rows = 100; +SELECT COUNT(*) = 100 FROM t1; +COUNT(*) = 100 +1 +DELETE FROM t1 WHERE f2 < 101; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SET GLOBAL wsrep_max_ws_rows = 9999; +INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; +ERROR HY000: wsrep_max_ws_rows exceeded +SET GLOBAL wsrep_max_ws_rows = 10000; +INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; +SET GLOBAL wsrep_max_ws_rows = 9999; +UPDATE t1 SET f2 = 2 WHERE f2 = 1; +ERROR HY000: wsrep_max_ws_rows exceeded +SET GLOBAL wsrep_max_ws_rows = 10000; +UPDATE t1 SET f2 = 2 WHERE f2 = 1; +SET GLOBAL wsrep_max_ws_rows = 9999; +DELETE FROM t1 WHERE f2 = 2; +ERROR HY000: wsrep_max_ws_rows exceeded +SET GLOBAL wsrep_max_ws_rows = 10000; +DELETE FROM t1 WHERE f2 = 2; +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +SET AUTOCOMMIT = ON; +SET GLOBAL wsrep_max_ws_rows = 1; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); +ERROR HY000: wsrep_max_ws_rows exceeded +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); +SET AUTOCOMMIT = OFF; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); +ERROR HY000: wsrep_max_ws_rows exceeded +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); +ERROR HY000: wsrep_max_ws_rows exceeded +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); +ERROR HY000: wsrep_max_ws_rows exceeded +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera/r/galera_var_max_ws_size.result b/mysql-test/suite/galera/r/galera_var_max_ws_size.result index 71859ef82e0..53bac04fa86 100644 --- a/mysql-test/suite/galera/r/galera_var_max_ws_size.result +++ b/mysql-test/suite/galera/r/galera_var_max_ws_size.result @@ -6,4 +6,13 @@ ERROR HY000: Got error 90 "Message too long" during COMMIT SELECT COUNT(*) = 0 FROM t1; COUNT(*) = 0 1 +SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=10000'; +SELECT @@wsrep_max_ws_size = 10000; +@@wsrep_max_ws_size = 10000 +1 +SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=20000'; +SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=10000'; +SET GLOBAL wsrep_max_ws_size = 20000; +provider_options_match +1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/mdev_10518.result b/mysql-test/suite/galera/r/mdev_10518.result new file mode 100644 index 00000000000..b2a3e0a65ef --- /dev/null +++ b/mysql-test/suite/galera/r/mdev_10518.result @@ -0,0 +1,74 @@ +# On node_1 +list of GTID variables : +gtid_domain_id 1 +gtid_binlog_pos +gtid_binlog_state +gtid_current_pos +gtid_slave_pos +wsrep_gtid_domain_id 4294967295 +wsrep_gtid_mode 1 +# On node_2 +list of GTID variables : +gtid_domain_id 2 +gtid_binlog_pos +gtid_binlog_state +gtid_current_pos +gtid_slave_pos +wsrep_gtid_domain_id 4294967295 +wsrep_gtid_mode 1 +# On node_1 +CREATE TABLE t1(i INT) ENGINE=INNODB; +CREATE TABLE t2(i INT) ENGINE=MEMORY; +INSERT INTO t1 VALUES(1); +SELECT * FROM t1; +i +1 +SELECT * FROM t2; +i +list of GTID variables : +gtid_domain_id 1 +gtid_binlog_pos 4294967295-1-3 +gtid_binlog_state 4294967295-1-3 +gtid_current_pos 4294967295-1-3 +gtid_slave_pos +wsrep_gtid_domain_id 4294967295 +wsrep_gtid_mode 1 +# On node_2 +SELECT * FROM t1; +i +1 +list of GTID variables : +gtid_domain_id 2 +gtid_binlog_pos 4294967295-1-3 +gtid_binlog_state 4294967295-1-3 +gtid_current_pos +gtid_slave_pos +wsrep_gtid_domain_id 4294967295 +wsrep_gtid_mode 1 +# On node_1 +INSERT INTO t2 VALUES(1); +SELECT * FROM t2; +i +1 +list of GTID variables : +gtid_domain_id 1 +gtid_binlog_pos 1-1-1,4294967295-1-3 +gtid_binlog_state 1-1-1,4294967295-1-3 +gtid_current_pos 1-1-1,4294967295-1-3 +gtid_slave_pos +wsrep_gtid_domain_id 4294967295 +wsrep_gtid_mode 1 +# On node_2 +SELECT * FROM t2; +i +list of GTID variables : +gtid_domain_id 2 +gtid_binlog_pos 4294967295-1-3 +gtid_binlog_state 4294967295-1-3 +gtid_current_pos +gtid_slave_pos +wsrep_gtid_domain_id 4294967295 +wsrep_gtid_mode 1 +# On node_1 +DROP TABLE t1, t2; +# End of test diff --git a/mysql-test/suite/galera/t/GAL-382.test b/mysql-test/suite/galera/t/GAL-382.test new file mode 100644 index 00000000000..05cc7346055 --- /dev/null +++ b/mysql-test/suite/galera/t/GAL-382.test @@ -0,0 +1,16 @@ +# +# GAL-382 InnoDB: Failing assertion: xid_seqno > trx_sys_cur_xid_seqno in trx0sys.cc line 356 +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 + +create table t1 (i int, j int, k int, primary key pk(i)) engine=innodb; +insert into t1 values (1, 1, 1), (2, 2, 2), (3, 3, 3); +create table t2 (i int, j int, k int, primary key pk(i, j, k), index idx(i, k, j)) engine=innodb; +replace into t2 (i, j, k) select /*!99997 */ i, k, j from t1; + +DROP TABLE t1; +DROP TABLE t2; diff --git a/mysql-test/suite/galera/t/MW-252.test b/mysql-test/suite/galera/t/MW-252.test new file mode 100644 index 00000000000..dfb82e8070a --- /dev/null +++ b/mysql-test/suite/galera/t/MW-252.test @@ -0,0 +1,42 @@ +# +# MW-252 - Check that FTWRL causes the node to become desynced +# and not subject to flow control +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; + +FLUSH TABLES WITH READ LOCK; + +# Node #1 is now desynced +--let $wait_condition = SELECT VARIABLE_VALUE = 'Donor/Desynced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment' +--source include/wait_condition.inc + +SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; + +# Node #2 can issue updates without flow control kicking in +--connection node_2 + +--let $count = 100 +--disable_query_log +while ($count) +{ + INSERT INTO t1 VALUES (1); + --dec $count +} +--enable_query_log + +# Restore cluster +--connection node_1 +UNLOCK TABLES; + +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment' +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 100 FROM t1 +--source include/wait_condition.inc + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MW-258.test b/mysql-test/suite/galera/t/MW-258.test new file mode 100644 index 00000000000..f5519f8a081 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-258.test @@ -0,0 +1,41 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER); +LOCK TABLE t1 WRITE; +--echo value prior to RSU: +SHOW STATUS LIKE 'wsrep_desync_count'; +SHOW VARIABLES LIKE 'wsrep_desync'; + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_osu_method = RSU; +--send ALTER TABLE t1 ADD COLUMN f2 INTEGER; + +--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1b +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_osu_method = RSU; +--send ALTER TABLE t1 ADD COLUMN f3 INTEGER; + +--sleep 5 +--connection node_1 +--echo value during RSU: +SHOW STATUS LIKE 'wsrep_desync_count'; +SHOW VARIABLES LIKE 'wsrep_desync'; +UNLOCK TABLES; + +--connection node_1a +--reap +--connection node_1b +--reap + +--connection node_1 +--echo value after RSU: +SHOW STATUS LIKE 'wsrep_desync_count'; +SHOW VARIABLES LIKE 'wsrep_desync'; +SET GLOBAL wsrep_desync=0; + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/MW-259.test b/mysql-test/suite/galera/t/MW-259.test new file mode 100644 index 00000000000..7298285f6ff --- /dev/null +++ b/mysql-test/suite/galera/t/MW-259.test @@ -0,0 +1,42 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; + +SET GLOBAL wsrep_desync=0; +SET wsrep_OSU_method=RSU; + +SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; +--send ALTER TABLE t1 ADD COLUMN f2 INTEGER; + +--connection node_1a + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: alter_table_before_open_tables' +--source include/wait_condition.inc + +# wsrep_desync=1 will block +--send SET GLOBAL wsrep_desync=1; + +--connection node_1b +--sleep 2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'SET GLOBAL wsrep_desync=1' +--source include/wait_condition.inc + +SET DEBUG_SYNC= 'now SIGNAL continue'; +DROP TABLE t1; +SET GLOBAL wsrep_desync=0; + +--connection node_1 +--reap + +--connection node_1a +--reap + +# Cleanup +SET DEBUG_SYNC= 'RESET'; + diff --git a/mysql-test/suite/galera/t/MW-284.test b/mysql-test/suite/galera/t/MW-284.test index 5998e22ed1e..f3ce1b0dc91 100644 --- a/mysql-test/suite/galera/t/MW-284.test +++ b/mysql-test/suite/galera/t/MW-284.test @@ -55,3 +55,4 @@ STOP SLAVE; RESET SLAVE ALL; CALL mtr.add_suppression('failed registering on master'); +CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work'); diff --git a/mysql-test/suite/galera/t/MW-285.test b/mysql-test/suite/galera/t/MW-285.test new file mode 100644 index 00000000000..1c567f7b250 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-285.test @@ -0,0 +1,31 @@ +# +# Broken FK constraints cause assertions +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE parent1 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB; +CREATE TABLE parent2 ( id INT PRIMARY KEY, KEY (id) ) ENGINE=InnoDB; + +CREATE TABLE child ( + id INT PRIMARY KEY, + parent1_id INT, + parent2_id INT, + FOREIGN KEY (parent1_id) REFERENCES parent1(id), + FOREIGN KEY (parent1_id) REFERENCES parent2(id) +) ENGINE=InnoDB; + +INSERT INTO parent1 VALUES (1); +INSERT INTO parent2 VALUES (1); +INSERT INTO child VALUES (1,1,1); +INSERT INTO child VALUES (2,1,1); + +SET foreign_key_checks=OFF; +DROP TABLE parent1; + +UPDATE child SET parent1_id=2 WHERE id=1; + +DROP TABLE child; +DROP TABLE parent2; +SET foreign_key_checks=ON; diff --git a/mysql-test/suite/galera/t/MW-286.test b/mysql-test/suite/galera/t/MW-286.test new file mode 100644 index 00000000000..1b2e322f078 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-286.test @@ -0,0 +1,32 @@ +# +# MW-286 Spurious deadlock error after error with wsrep_desync and wsrep_on +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/big_test.inc + +--connection node_1 +CREATE TABLE ten (f1 INTEGER); +INSERT INTO ten VALUES (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; + +# Insert some values before the ALTER +INSERT INTO t1 (f1) SELECT 000000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; + +# Insert more values while the ALTER is running +--send INSERT INTO t1 (f1) SELECT 100000 + (10000 * a1.f1) + (1000 * a2.f1) + (100 * a3.f1) + (10 * a4.f1) + a5.f1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4, ten AS a5; + +--connection node_2 +SET GLOBAL wsrep_desync = TRUE; +SET wsrep_on = FALSE; + +--error ER_QUERY_INTERRUPTED +ALTER TABLE t1 ADD PRIMARY KEY (f1); + +SET wsrep_on = TRUE; +SET GLOBAL wsrep_desync = FALSE; + +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera/t/MW-292.test b/mysql-test/suite/galera/t/MW-292.test new file mode 100644 index 00000000000..ecb1273759e --- /dev/null +++ b/mysql-test/suite/galera/t/MW-292.test @@ -0,0 +1,79 @@ +# +# MW-292 Reset timestamp after transaction replay +# +# We force transaction replay to happen and then we check that NOW() is not stuck in time. +# As a bonus we also check that RAND() continues to return random values after replay +# +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_debug_sync.inc +--source suite/galera/include/galera_have_debug_sync.inc + +--let $wsrep_local_replays_old = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` + +CREATE TABLE rand_table (f1 FLOAT); +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); +INSERT INTO t1 VALUES (1, 'a'); +INSERT INTO t1 VALUES (2, 'a'); + +--connection node_1 +SET AUTOCOMMIT=ON; +START TRANSACTION; + +UPDATE t1 SET f2 = 'b' WHERE f1 = 1; +SELECT * FROM t1 WHERE f1 = 2 FOR UPDATE; + +# Block the commit +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--let $galera_sync_point = commit_monitor_enter_sync +--source include/galera_set_sync_point.inc + +--connection node_1 +--send COMMIT; + +# Wait until commit is blocked +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +--source include/galera_wait_sync_point.inc + +# Issue a conflicting update on node #2 +--connection node_2 +UPDATE t1 SET f2 = 'c' WHERE f1 = 2; + +# Wait for both transactions to be blocked +--connection node_1a +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Update_rows_log_event::find_row%'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'init' AND INFO = 'COMMIT'; +--source include/wait_condition.inc + +# Unblock the commit +--connection node_1a +--source include/galera_clear_sync_point.inc +--source include/galera_signal_sync_point.inc + +# Commit succeeds via replay +--connection node_1 +--reap + +# Confirm that NOW() is not stuck in time relative to SYSDATE(); +--sleep 3 +SELECT TIMEDIFF(SYSDATE(), NOW()) < 2; + +INSERT INTO rand_table VALUES (RAND()),(RAND()),(RAND()),(RAND()),(RAND()); +INSERT INTO rand_table VALUES (RAND()),(RAND()),(RAND()),(RAND()),(RAND()); + +SELECT COUNT(DISTINCT f1) = 10 FROM rand_table; + +# wsrep_local_replays has increased by 1 +--let $wsrep_local_replays_new = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_replays'` +--disable_query_log +--eval SELECT $wsrep_local_replays_new - $wsrep_local_replays_old = 1 AS wsrep_local_replays; +--enable_query_log + +--connection node_2 +DROP TABLE t1; +DROP TABLE rand_table; diff --git a/mysql-test/suite/galera/t/MW-44-master.opt b/mysql-test/suite/galera/t/MW-44-master.opt new file mode 100644 index 00000000000..a15aa0a99d9 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-44-master.opt @@ -0,0 +1 @@ +--log-output=TABLE diff --git a/mysql-test/suite/galera/t/MW-44.test b/mysql-test/suite/galera/t/MW-44.test new file mode 100644 index 00000000000..55a3fd57f80 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-44.test @@ -0,0 +1,25 @@ +# +# MW-44: DDL is logged in the general_log on the slave +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +TRUNCATE TABLE mysql.general_log; + +--connection node_2 +TRUNCATE TABLE mysql.general_log; + +--connection node_1 +SET SESSION wsrep_osu_method=TOI; +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +SET SESSION wsrep_osu_method=RSU; +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +SET SESSION wsrep_osu_method=TOI; + +SELECT COUNT(*) = 2 FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%'; + +--connection node_2 +SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE 'SELECT%'; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera#414.cnf b/mysql-test/suite/galera/t/galera#414.cnf new file mode 100644 index 00000000000..fbd1c58754f --- /dev/null +++ b/mysql-test/suite/galera/t/galera#414.cnf @@ -0,0 +1,8 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcs.max_packet_size=2' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcs.max_packet_size=2' + diff --git a/mysql-test/suite/galera/t/galera#414.test b/mysql-test/suite/galera/t/galera#414.test new file mode 100644 index 00000000000..b426e6510b6 --- /dev/null +++ b/mysql-test/suite/galera/t/galera#414.test @@ -0,0 +1,32 @@ +# +# codership/galera#414 Shutdown crashes node if the node started with `gcs.max_packet_size=2` +# + +--source include/big_test.inc +--source include/galera_cluster.inc + +# We perform the shutdown/restart sequence in here. If there was a crash during shutdown, MTR will detect it + +--connection node_2 +--source include/shutdown_mysqld.inc + +--connection node_1 +SET SESSION wsrep_sync_wait = 0; +SET SESSION wsrep_on = OFF; +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_2 +--source include/start_mysqld.inc + +--connection node_1 +SET SESSION wsrep_on = ON; +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_1 +CALL mtr.add_suppression("Failed to set packet size"); + +--connection node_2 +CALL mtr.add_suppression("Failed to set packet size"); + diff --git a/mysql-test/suite/galera/t/galera_as_master.test b/mysql-test/suite/galera/t/galera_as_master.test index c5d4db9f192..93f9224b258 100644 --- a/mysql-test/suite/galera/t/galera_as_master.test +++ b/mysql-test/suite/galera/t/galera_as_master.test @@ -60,3 +60,6 @@ DROP TABLE t2, t3; STOP SLAVE; RESET SLAVE ALL; + +CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work'); + diff --git a/mysql-test/suite/galera/t/galera_as_slave_autoinc.cnf b/mysql-test/suite/galera/t/galera_as_slave_autoinc.cnf new file mode 100644 index 00000000000..9449ec9cf40 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_autoinc.cnf @@ -0,0 +1 @@ +!include ../galera_2nodes_as_slave.cnf diff --git a/mysql-test/suite/galera/t/galera_as_slave_autoinc.test b/mysql-test/suite/galera/t/galera_as_slave_autoinc.test new file mode 100644 index 00000000000..9292badc480 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_autoinc.test @@ -0,0 +1,83 @@ +# +# Test Galera as a slave to a MySQL master +# +# The galera/galera_2node_slave.cnf describes the setup of the nodes +# + +--source include/have_innodb.inc + +# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--source include/galera_cluster.inc + +--connection node_2 +--disable_query_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1; +--enable_query_log +START SLAVE; + +--connection node_1 + +## +## Verify the correct operation of the auto-increment when +## the binlog format set to the 'STATEMENT' on the master node: +## + +SET SESSION binlog_format='STATEMENT'; + +CREATE TABLE t1 ( + i int(11) NOT NULL AUTO_INCREMENT, + c char(32) DEFAULT 'dummy_text', + PRIMARY KEY (i) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; + +insert into t1(i) values(null); + +select * from t1; + +insert into t1(i) values(null), (null), (null); + +select * from t1; + +SET SESSION auto_increment_increment=7; +insert into t1(i) values(null), (null), (null); + +SET SESSION auto_increment_offset=5; +insert into t1(i) values(null), (null), (null); + +select * from t1; + +show variables like 'binlog_format'; +show variables like '%auto_increment%'; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 10 FROM t1; +--source include/wait_condition.inc + +select * from t1; + +show variables like 'binlog_format'; +show variables like 'auto_increment_increment'; + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +select * from t1; + +show variables like 'binlog_format'; +show variables like 'auto_increment_increment'; + +--connection node_1 +DROP TABLE t1; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +STOP SLAVE; +RESET SLAVE ALL; + +--connection node_1 +RESET MASTER; diff --git a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test index 5914e52d851..46a93458271 100644 --- a/mysql-test/suite/galera/t/galera_as_slave_nonprim.test +++ b/mysql-test/suite/galera/t/galera_as_slave_nonprim.test @@ -87,7 +87,7 @@ RESET SLAVE ALL; CALL mtr.add_suppression("Slave SQL: Error 'Unknown command' on query"); CALL mtr.add_suppression("Slave: Unknown command Error_code: 1047"); -CALL mtr.add_suppression("Send action {\\(nil\\), 328, TORDERED} returned -107 \\(Transport endpoint is not connected\\)"); +CALL mtr.add_suppression("Transport endpoint is not connected"); CALL mtr.add_suppression("Slave SQL: Error in Xid_log_event: Commit could not be completed, 'Deadlock found when trying to get lock; try restarting transaction', Error_code: 1213"); CALL mtr.add_suppression("Slave SQL: Node has dropped from cluster, Error_code: 1047"); diff --git a/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test b/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test index dbbe3b3c483..e32089ce21e 100644 --- a/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test +++ b/mysql-test/suite/galera/t/galera_bf_abort_flush_for_export.test @@ -27,9 +27,8 @@ UNLOCK TABLES; COMMIT; SET AUTOCOMMIT=ON; ---let $wait_condition = SELECT COUNT(*) = 1 FROM t1 ---source include/wait_condition.inc -SELECT * FROM t1; +SET SESSION wsrep_sync_wait = 7; +SELECT COUNT(*) = 1 FROM t1; --let $wsrep_local_bf_aborts_after = `SELECT VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_bf_aborts'` diff --git a/mysql-test/suite/galera/t/galera_defaults.test b/mysql-test/suite/galera/t/galera_defaults.test index 1cbb19cc405..3b1cb7b8650 100644 --- a/mysql-test/suite/galera/t/galera_defaults.test +++ b/mysql-test/suite/galera/t/galera_defaults.test @@ -13,7 +13,7 @@ # Make sure that the test is operating on the right version of galera library. --disable_query_log ---let $galera_version=3.9 +--let $galera_version=25.3.17 source ../wsrep/include/check_galera_version.inc; --enable_query_log diff --git a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test index fd77ec0a0eb..721d84ecb05 100644 --- a/mysql-test/suite/galera/t/galera_gcs_fc_limit.test +++ b/mysql-test/suite/galera/t/galera_gcs_fc_limit.test @@ -16,7 +16,7 @@ SELECT COUNT(*) = 1 FROM t1; SET GLOBAL wsrep_provider_options = 'gcs.fc_limit=1'; # Block the slave applier thread -FLUSH TABLES WITH READ LOCK; +LOCK TABLE t1 WRITE; --connection node_1 diff --git a/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf b/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf new file mode 100644 index 00000000000..2628f05eaef --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_recv_bind.cnf @@ -0,0 +1,8 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;ist.recv_bind=127.0.0.1;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;ist.recv_bind=127.0.0.1' + diff --git a/mysql-test/suite/galera/t/galera_ist_recv_bind.test b/mysql-test/suite/galera/t/galera_ist_recv_bind.test new file mode 100644 index 00000000000..cb7329073ad --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_recv_bind.test @@ -0,0 +1,54 @@ +# +# Test ist.recv_bind option. Since MTR can not do proper testing with multiple interfaces and such, we +# simply confirm that the option can be set (in the galera_ist_recv_bind.cnf file) and that IST works as expected +# + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--connection node_1 +SELECT @@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%'; + +--connection node_2 +SELECT @@wsrep_provider_options LIKE '%ist.recv_bind = 127.0.0.1%'; + +# Isolate node #2 + +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 1'; +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_2 +SET SESSION wsrep_on = OFF; +--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc +SET SESSION wsrep_on = ON; + +# Node #2 is now isolated. Run some transactions to accumulate writesets for IST + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1); + +# Restore node #2 + +--connection node_2 +SET GLOBAL wsrep_provider_options = 'gmcast.isolate = 0'; + +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--connection node_2 +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + +# Confirm that IST has taken place + +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc + +# Cleanup + +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test index eae28bdbcd7..931daaad30d 100644 --- a/mysql-test/suite/galera/t/galera_ist_restart_joiner.test +++ b/mysql-test/suite/galera/t/galera_ist_restart_joiner.test @@ -9,6 +9,11 @@ --source include/have_debug_sync.inc --source suite/galera/include/galera_have_debug_sync.inc +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + CREATE TABLE t1 (f1 INTEGER PRIMARY KEY, f2 CHAR(1)); INSERT INTO t1 VALUES (1, 'a'), (2, 'a'), (3, 'a'), (4, 'a'), (5, 'a'),(6, 'a'); @@ -106,3 +111,9 @@ SELECT COUNT(*) = 0 FROM t3; --connection node_1 DROP TABLE t1, t2, t3; + +# Restore original auto_increment_offset values. +--source include/auto_increment_offset_restore.inc + +--source include/galera_end.inc + diff --git a/mysql-test/suite/galera/t/galera_kill_ddl.test b/mysql-test/suite/galera/t/galera_kill_ddl.test index 3c2bce5b9c9..90f3f30cc76 100644 --- a/mysql-test/suite/galera/t/galera_kill_ddl.test +++ b/mysql-test/suite/galera/t/galera_kill_ddl.test @@ -28,8 +28,13 @@ ALTER TABLE t1 ADD COLUMN f2 INTEGER; --source include/galera_connect.inc --connection node_2a +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status'; +--source include/wait_condition.inc + SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='t1'; -SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; --connection node_1 --disable_query_log diff --git a/mysql-test/suite/galera/t/galera_log_output_csv.test b/mysql-test/suite/galera/t/galera_log_output_csv.test index 00009396f6a..94ae3dd6168 100644 --- a/mysql-test/suite/galera/t/galera_log_output_csv.test +++ b/mysql-test/suite/galera/t/galera_log_output_csv.test @@ -17,9 +17,6 @@ SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 1 = 1 FROM t1'; --connection node_2 -# CREATE TABLE from master is also present in the slave query log, but is logged twice, mysql-wsrep#44 -SELECT COUNT(*) > 0 FROM mysql.general_log WHERE argument = 'CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB'; - SELECT 2 = 2 FROM t1; SELECT COUNT(*) = 1 FROM mysql.slow_log WHERE sql_text = 'SELECT 2 = 2 FROM t1'; diff --git a/mysql-test/suite/galera/t/galera_parallel_simple.test b/mysql-test/suite/galera/t/galera_parallel_simple.test index b1dc14deb5b..e078a342c16 100644 --- a/mysql-test/suite/galera/t/galera_parallel_simple.test +++ b/mysql-test/suite/galera/t/galera_parallel_simple.test @@ -13,6 +13,7 @@ CREATE TABLE t2 (id INT) ENGINE=InnoDB; --connection node_2 SET GLOBAL wsrep_slave_threads = 2; +LOCK TABLE t1 WRITE; --connection node_1 INSERT INTO t1 VALUES (1); @@ -34,10 +35,20 @@ INSERT INTO t1 VALUES (1); INSERT INTO t2 VALUES (1); --connection node_2 +SET SESSION wsrep_sync_wait = 0; + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Waiting for table metadata lock%'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'applied write set%'; +--source include/wait_condition.inc + +UNLOCK TABLES; + +SET SESSION wsrep_sync_wait = 7; SELECT COUNT(*) = 10 FROM t1; SELECT COUNT(*) = 10 FROM t2; -SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'committed%'; --eval SET GLOBAL wsrep_slave_threads = $wsrep_slave_threads_orig; diff --git a/mysql-test/suite/galera/t/galera_pc_ignore_sb.test b/mysql-test/suite/galera/t/galera_pc_ignore_sb.test index f63215ebe4a..84fd3a91857 100644 --- a/mysql-test/suite/galera/t/galera_pc_ignore_sb.test +++ b/mysql-test/suite/galera/t/galera_pc_ignore_sb.test @@ -6,10 +6,9 @@ --source include/have_innodb.inc # Save original auto_increment_offset values. ---connection node_1 -let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`; ---connection node_2 -let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`; +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc --connection node_1 --let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` @@ -40,10 +39,8 @@ SET GLOBAL wsrep_cluster_address = ''; --source include/start_mysqld.inc --source include/wait_until_connected_again.inc ---disable_query_log # Restore original auto_increment_offset values. ---connection node_1 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1; ---connection node_2 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2; ---enable_query_log +--source include/auto_increment_offset_restore.inc + +--source include/galera_end.inc + diff --git a/mysql-test/suite/galera/t/galera_repl_max_ws_size.test b/mysql-test/suite/galera/t/galera_repl_max_ws_size.test index 37a2f7d4ce3..60b866ae018 100644 --- a/mysql-test/suite/galera/t/galera_repl_max_ws_size.test +++ b/mysql-test/suite/galera/t/galera_repl_max_ws_size.test @@ -23,3 +23,7 @@ SELECT COUNT(*) = 0 FROM t1; DROP TABLE t1; +CALL mtr.add_suppression("Maximum writeset size exceeded by"); +CALL mtr.add_suppression("transaction size limit"); +CALL mtr.add_suppression("transaction size exceeded"); +CALL mtr.add_suppression("rbr write fail"); diff --git a/mysql-test/suite/galera/t/galera_restart_nochanges.test b/mysql-test/suite/galera/t/galera_restart_nochanges.test index a61332cefd6..0a6a0c5ccbe 100644 --- a/mysql-test/suite/galera/t/galera_restart_nochanges.test +++ b/mysql-test/suite/galera/t/galera_restart_nochanges.test @@ -6,10 +6,9 @@ --source include/have_innodb.inc # Save original auto_increment_offset values. ---connection node_1 -let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`; ---connection node_2 -let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`; +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc --connection node_1 CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; @@ -18,6 +17,10 @@ INSERT INTO t1 VALUES (1); --connection node_2 --source include/restart_mysqld.inc +--connection node_1 +--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; +--source include/wait_condition.inc + --let $galera_connection_name = node_2a --let $galera_server_number = 2 --source include/galera_connect.inc @@ -29,11 +32,9 @@ SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N DROP TABLE t1; ---disable_query_log # Restore original auto_increment_offset values. ---connection node_1 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1; ---connection node_2a ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2; ---enable_query_log +--let $node_2=node_2a +--source include/auto_increment_offset_restore.inc + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera/t/galera_roles.test b/mysql-test/suite/galera/t/galera_roles.test index f9a15126e5e..16e417d1fdb 100644 --- a/mysql-test/suite/galera/t/galera_roles.test +++ b/mysql-test/suite/galera/t/galera_roles.test @@ -163,5 +163,37 @@ disconnect foo_node_2; DROP USER foo@localhost; DROP DATABASE test1; +--echo # +--echo # MDEV-10566: Create role statement replicated inconsistently in Galera Cluster +--echo # +--echo +--echo # On node_1 +--connection node_1 +CREATE USER foo@localhost; +CREATE ROLE role1; +CREATE ROLE role2 WITH ADMIN CURRENT_USER; +CREATE ROLE role3 WITH ADMIN foo@localhost; +CREATE ROLE role4 WITH ADMIN role1; + +--sorted_result +SELECT * FROM mysql.roles_mapping; +--sorted_result +SELECT * FROM INFORMATION_SCHEMA.APPLICABLE_ROLES; + +--echo +--echo # On node_2 +--connection node_2 +--sorted_result +SELECT * FROM mysql.roles_mapping; +--sorted_result +SELECT * FROM INFORMATION_SCHEMA.APPLICABLE_ROLES; + +# Cleanup +DROP ROLE role1; +DROP ROLE role2; +DROP ROLE role3; +DROP ROLE role4; +DROP USER foo@localhost; + --source include/galera_end.inc --echo # End of test diff --git a/mysql-test/suite/galera/t/galera_rsu_wsrep_desync.test b/mysql-test/suite/galera/t/galera_rsu_wsrep_desync.test index 36ec8563cbe..882f846fe67 100644 --- a/mysql-test/suite/galera/t/galera_rsu_wsrep_desync.test +++ b/mysql-test/suite/galera/t/galera_rsu_wsrep_desync.test @@ -17,9 +17,11 @@ SET wsrep_OSU_method=RSU; SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; --send ALTER TABLE t1 ADD COLUMN f2 INTEGER; + --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 ---connection node_1a +--connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a --let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: alter_table_before_open_tables' --source include/wait_condition.inc @@ -44,24 +46,32 @@ CREATE TABLE t1 (f1 INTEGER) Engine=InnoDB; SET GLOBAL wsrep_desync=0; SET wsrep_OSU_method=RSU; -SET DEBUG_SYNC = 'alter_table_before_open_tables WAIT_FOR continue'; +SET DEBUG_SYNC = 'alter_table_before_create_table_no_lock WAIT_FOR continue'; --send ALTER TABLE t1 ADD COLUMN f2 INTEGER; --connection node_1a ---let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: alter_table_before_open_tables' +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE = 'debug sync point: alter_table_before_create_table_no_lock' --source include/wait_condition.inc -# This transition is currently not allowed ---error ER_CANNOT_USER -SET GLOBAL wsrep_desync=1; -SET GLOBAL wsrep_desync=0; +# wsrep_desync=1 will block +--send SET GLOBAL wsrep_desync=1; + + +--connection node_1b +--sleep 2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE INFO = 'SET GLOBAL wsrep_desync=1' +--source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL continue'; --connection node_1 --reap +--connection node_1a +--reap +SET GLOBAL wsrep_desync=0; + SHOW CREATE TABLE t1; # Restore old state @@ -74,5 +84,3 @@ CALL mtr.add_suppression("desync failed"); --connection node_2 CALL mtr.add_suppression("Protocol violation"); - - diff --git a/mysql-test/suite/galera/t/galera_split_brain.test b/mysql-test/suite/galera/t/galera_split_brain.test index e0298e55422..22f6370241c 100644 --- a/mysql-test/suite/galera/t/galera_split_brain.test +++ b/mysql-test/suite/galera/t/galera_split_brain.test @@ -6,17 +6,16 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + call mtr.add_suppression("WSREP: TO isolation failed for: "); --connection node_1 --let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` -# Save original auto_increment_offset values. ---connection node_1 -let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`; ---connection node_2 -let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`; - --connection node_2 --source include/kill_galera.inc @@ -44,10 +43,8 @@ SET GLOBAL wsrep_cluster_address = ''; --source include/wait_until_connected_again.inc # Restore original auto_increment_offset values. ---disable_query_log ---connection node_1 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1; ---connection node_2a ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2; ---enable_query_log +--let $node_2=node_2a +--source include/auto_increment_offset_restore.inc + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera/t/galera_ssl_upgrade.test b/mysql-test/suite/galera/t/galera_ssl_upgrade.test index 07aac0fbe92..a424942da30 100644 --- a/mysql-test/suite/galera/t/galera_ssl_upgrade.test +++ b/mysql-test/suite/galera/t/galera_ssl_upgrade.test @@ -18,7 +18,8 @@ SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N --source include/start_mysqld.inc --source include/wait_until_connected_again.inc -SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; # 3. Restart node #2 with the new socket.ssl_ca , socket.ssl_cert and socket.ssl_key @@ -29,7 +30,8 @@ SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N --source include/start_mysqld.inc --source include/wait_until_connected_again.inc -SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; # 4. Restart node #1 with the new socket.ssl_ca , socket.ssl_cert and socket.ssl_key @@ -40,7 +42,8 @@ SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_N --source include/start_mysqld.inc --source include/wait_until_connected_again.inc -SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--let $wait_condition = SELECT VARIABLE_VALUE = 'Synced' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_state_comment'; +--source include/wait_condition.inc SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; # Upgrade complete. Both nodes now use the new key and certificate diff --git a/mysql-test/suite/galera/t/galera_suspend_slave.test b/mysql-test/suite/galera/t/galera_suspend_slave.test index b4302f7d195..353a7c38a73 100644 --- a/mysql-test/suite/galera/t/galera_suspend_slave.test +++ b/mysql-test/suite/galera/t/galera_suspend_slave.test @@ -8,10 +8,9 @@ --source include/have_innodb.inc # Save original auto_increment_offset values. ---connection node_1 -let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`; ---connection node_2 -let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`; +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; @@ -56,11 +55,7 @@ SELECT COUNT(*) = 1 FROM t1; DROP TABLE t1; ---disable_query_log # Restore original auto_increment_offset values. ---connection node_1 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1; ---connection node_2a ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2; ---enable_query_log +--let $node_2=node_2a +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_transaction_replay.test b/mysql-test/suite/galera/t/galera_transaction_replay.test index f99c0b1979f..29870829ba3 100644 --- a/mysql-test/suite/galera/t/galera_transaction_replay.test +++ b/mysql-test/suite/galera/t/galera_transaction_replay.test @@ -69,3 +69,56 @@ SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'b'; SELECT COUNT(*) = 1 FROM t1 WHERE f2 = 'c'; DROP TABLE t1; + +#echo "# test for PS replaying" + +# +# test replaying of prepared statements +# +--connection node_1 +CREATE TABLE t1 (i int primary key, j int) ENGINE=INNODB; +INSERT INTO t1 VALUES (1, 0), (3, 0); +SELECT * FROM t1; + +PREPARE stmt1 FROM "UPDATE t1 SET j = 1 where i > 0"; + +# block the commit of PS +--connection node_1a +--let $galera_sync_point = commit_monitor_enter_sync +--source include/galera_set_sync_point.inc + +--connection node_1 +--send EXECUTE stmt1; + +# Wait until commit is blocked +--connection node_1a +SET SESSION wsrep_sync_wait = 0; +--source include/galera_wait_sync_point.inc + +# Issue a conflicting update on node_2 +--connection node_2 +#UPDATE t1 SET j=2; +INSERT INTO t1 VALUES(2,2); + + +# Wait until applying begins in node_1 +--connection node_1a +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST WHERE STATE LIKE 'Write_rows_log_event::write_row%'; +--source include/wait_condition.inc + +# Unblock the PS commit +--connection node_1a +--source include/galera_clear_sync_point.inc +--source include/galera_signal_sync_point.inc + +# Commit succeeds +--connection node_1 +--reap +SELECT * FROM t1; + +--connection node_2 +SELECT * FROM t1; + +--connection node_1 +DEALLOCATE PREPARE stmt1; +DROP TABLE t1; diff --git a/mysql-test/suite/galera/t/galera_var_desync_on.test b/mysql-test/suite/galera/t/galera_var_desync_on.test index fb0fb9f762a..06c5d30a769 100644 --- a/mysql-test/suite/galera/t/galera_var_desync_on.test +++ b/mysql-test/suite/galera/t/galera_var_desync_on.test @@ -55,4 +55,8 @@ INSERT INTO t1 VALUES (11); # Replication continues normally SELECT COUNT(*) = 11 FROM t1; +CALL mtr.add_suppression("Protocol violation"); DROP TABLE t1; + +--connection node_1 +CALL mtr.add_suppression("Protocol violation"); diff --git a/mysql-test/suite/galera/t/galera_var_dirty_reads.test b/mysql-test/suite/galera/t/galera_var_dirty_reads.test index 9eea8efdaf3..dfd8d5ecf29 100644 --- a/mysql-test/suite/galera/t/galera_var_dirty_reads.test +++ b/mysql-test/suite/galera/t/galera_var_dirty_reads.test @@ -5,13 +5,10 @@ --source include/galera_cluster.inc --source include/have_innodb.inc ---disable_query_log # Save original auto_increment_offset values. ---connection node_1 -let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`; ---connection node_2 -let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`; ---enable_query_log +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc --connection node_2 --let $wsrep_cluster_address_saved = `SELECT @@global.wsrep_cluster_address` @@ -49,13 +46,8 @@ SELECT * FROM t1; # Cleanup DROP TABLE t1; ---disable_query_log # Restore original auto_increment_offset values. ---connection node_1 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1; ---connection node_2 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2; ---enable_query_log +--source include/auto_increment_offset_restore.inc --source include/galera_end.inc --echo # End of test diff --git a/mysql-test/suite/galera/t/galera_var_max_ws_rows.test b/mysql-test/suite/galera/t/galera_var_max_ws_rows.test new file mode 100644 index 00000000000..944238bf1aa --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_max_ws_rows.test @@ -0,0 +1,155 @@ +--source include/galera_cluster.inc +--source include/have_innodb.inc + +CREATE TABLE ten (f1 INTEGER) ENGINE=InnoDB; +INSERT INTO ten VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); + +CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 INTEGER) ENGINE=InnoDB; + +--let $wsrep_max_ws_rows_orig = `SELECT @@wsrep_max_ws_rows` +SET GLOBAL wsrep_max_ws_rows = 4; + +# Test that wsrep_max_ws_rows is enforced with multi statement transactions + +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (3); +INSERT INTO t1 (f2) VALUES (4); +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 (f2) VALUES (5); +COMMIT; +SELECT COUNT(*) = 0 FROM t1; + +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (3); +INSERT INTO t1 (f2) VALUES (4); +--error ER_ERROR_DURING_COMMIT +UPDATE t1 SET f2 = 10 WHERE f2 = 4; +COMMIT; +SELECT COUNT(*) = 0 FROM t1; + +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); +INSERT INTO t1 (f2) VALUES (3); +INSERT INTO t1 (f2) VALUES (4); +--error ER_ERROR_DURING_COMMIT +DELETE FROM t1 WHERE f2 = 1; +COMMIT; +SELECT COUNT(*) = 0 FROM t1; + + +# Test that wsrep_max_ws_rows is enforced on sigle statements + +SET GLOBAL wsrep_max_ws_rows = 5; +INSERT INTO t1 (f2) VALUES (1),(2),(3),(4),(5); +SET GLOBAL wsrep_max_ws_rows = 4; + +--error ER_ERROR_DURING_COMMIT +UPDATE t1 SET f2 = f2 + 10; +SELECT COUNT(*) = 5 FROM t1; + +--error ER_ERROR_DURING_COMMIT +DELETE FROM t1 WHERE f2 < 10; +SELECT COUNT(*) = 5 FROM t1; + +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 (f2) SELECT * FROM ten; +SELECT COUNT(*) = 5 FROM t1; + +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 (f2) VALUES (10),(20),(30),(40),(50); +SELECT COUNT(*) = 5 FROM t1; + +# Fewer than wsrep_max_ws_rows is OK + +SET GLOBAL wsrep_max_ws_rows = 10; +DELETE FROM t1 WHERE f2 < 10; +SELECT COUNT(*) = 0 FROM t1; + +# Test a series of transactions + +--disable_query_log +SET GLOBAL wsrep_max_ws_rows = 5; +let $i= 100; +while ($i) +{ + START TRANSACTION; + --eval INSERT INTO t1 (f2) VALUES ($i); + COMMIT; + dec $i; +} +--enable_query_log +SET GLOBAL wsrep_max_ws_rows = 100; +SELECT COUNT(*) = 100 FROM t1; +DELETE FROM t1 WHERE f2 < 101; +SELECT COUNT(*) = 0 FROM t1; + +# Test large statements + +SET GLOBAL wsrep_max_ws_rows = 9999; +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; +SET GLOBAL wsrep_max_ws_rows = 10000; +INSERT INTO t1 (f2) SELECT 1 FROM ten AS a1, ten AS a2, ten AS a3, ten AS a4; + +SET GLOBAL wsrep_max_ws_rows = 9999; +--error ER_ERROR_DURING_COMMIT +UPDATE t1 SET f2 = 2 WHERE f2 = 1; +SET GLOBAL wsrep_max_ws_rows = 10000; +UPDATE t1 SET f2 = 2 WHERE f2 = 1; + +SET GLOBAL wsrep_max_ws_rows = 9999; +--error ER_ERROR_DURING_COMMIT +DELETE FROM t1 WHERE f2 = 2; +SET GLOBAL wsrep_max_ws_rows = 10000; +DELETE FROM t1 WHERE f2 = 2; + +SELECT COUNT(*) = 0 FROM t1; + + +# Test that wsrep_max_ws_rows is reset when switching autocommit mode + +SET AUTOCOMMIT = ON; +SET GLOBAL wsrep_max_ws_rows = 1; + +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 (f2) VALUES (2); + +INSERT INTO t1 (f2) VALUES (1); +INSERT INTO t1 (f2) VALUES (2); + + +SET AUTOCOMMIT = OFF; +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 (f2) VALUES (2); + +INSERT INTO t1 (f2) VALUES (1); +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 (f2) VALUES (2); + + +# Test that wsrep_max_ws_rows is reset on implicit commits + +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); + +START TRANSACTION; +INSERT INTO t1 (f2) VALUES (1); +--error ER_ERROR_DURING_COMMIT +INSERT INTO t1 (f2) VALUES (2); + + +--disable_query_log +--eval SET GLOBAL wsrep_max_ws_rows = $wsrep_max_ws_rows_orig +--enable_query_log + +DROP TABLE t1; +DROP TABLE ten; diff --git a/mysql-test/suite/galera/t/galera_var_max_ws_size.test b/mysql-test/suite/galera/t/galera_var_max_ws_size.test index b66ef2d5ee2..8eb93bda9be 100644 --- a/mysql-test/suite/galera/t/galera_var_max_ws_size.test +++ b/mysql-test/suite/galera/t/galera_var_max_ws_size.test @@ -16,6 +16,29 @@ SET GLOBAL wsrep_max_ws_size = 1024; INSERT INTO t1 VALUES (DEFAULT, REPEAT('X', 1024)); SELECT COUNT(*) = 0 FROM t1; +# +# Changing repl.max_ws_size also changes wsrep_max_ws_size +# + +SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=10000'; +SELECT @@wsrep_max_ws_size = 10000; + + +# +# Changing wsrep_max_ws_size is equivalent to changing repl.max_ws_size +# + +SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=20000'; +--let $provider_options = `SELECT @@wsrep_provider_options` +SET GLOBAL wsrep_provider_options = 'repl.max_ws_size=10000'; + +SET GLOBAL wsrep_max_ws_size = 20000; +--let $provider_options_updated = `SELECT @@wsrep_provider_options` + +--disable_query_log +--eval SELECT STRCMP('$provider_options', '$provider_options_updated') = 0 AS provider_options_match +--enable_query_log + --disable_query_log --eval SET GLOBAL wsrep_max_ws_size = $wsrep_max_ws_size_orig --enable_query_log diff --git a/mysql-test/suite/galera/t/mdev_10518.cnf b/mysql-test/suite/galera/t/mdev_10518.cnf new file mode 100644 index 00000000000..482334c2f8a --- /dev/null +++ b/mysql-test/suite/galera/t/mdev_10518.cnf @@ -0,0 +1,17 @@ +!include ../galera_2nodes.cnf + +[mysqld] +log-bin +log-slave-updates + +[mysqld.1] +gtid_domain_id=1 +wsrep_gtid_mode=ON +# Maximum allowed wsrep_gtid_domain_id. +wsrep_gtid_domain_id=4294967295 + +[mysqld.2] +gtid_domain_id=2 +wsrep_gtid_mode=ON +#wsrep_gitd_domain_id value will be inherited from donor node (mysqld.1) +#wsrep_gitd_domain_id=X diff --git a/mysql-test/suite/galera/t/mdev_10518.test b/mysql-test/suite/galera/t/mdev_10518.test new file mode 100644 index 00000000000..c4127b4f655 --- /dev/null +++ b/mysql-test/suite/galera/t/mdev_10518.test @@ -0,0 +1,53 @@ +# Test for @@wsrep_gtid_mode and @@wsrep_gtid_domain_id variables +# +# When @@wsrep_gtid_mode=ON, all DDL/DML commands and transactions that +# are meant to be replicated over Galera cluster nodes are tagged with +# galera gtid_domain_id (@@wsrep_gtid_domain_id), while others are tagged +# with the local domain_id (@@gtid_domain_id). + +--source include/galera_cluster.inc +--source include/have_innodb.inc + +--echo # On node_1 +--connection node_1 +# print initial GTIDs +source include/print_gtid.inc; + +--echo # On node_2 +--connection node_2 +# print initial GTIDs +source include/print_gtid.inc; + +--echo # On node_1 +--connection node_1 +CREATE TABLE t1(i INT) ENGINE=INNODB; +CREATE TABLE t2(i INT) ENGINE=MEMORY; +INSERT INTO t1 VALUES(1); +SELECT * FROM t1; +SELECT * FROM t2; +source include/print_gtid.inc; + +--echo # On node_2 +--connection node_2 +SELECT * FROM t1; +source include/print_gtid.inc; + +--echo # On node_1 +--connection node_1 +INSERT INTO t2 VALUES(1); +SELECT * FROM t2; +source include/print_gtid.inc; + +--echo # On node_2 +--connection node_2 +SELECT * FROM t2; +source include/print_gtid.inc; + +--echo # On node_1 +--connection node_1 +# Cleanup +DROP TABLE t1, t2; + +--source include/galera_end.inc +--echo # End of test + diff --git a/mysql-test/suite/galera/t/mysql-wsrep#31.test b/mysql-test/suite/galera/t/mysql-wsrep#31.test index eaace5d50dd..c669d4834ba 100644 --- a/mysql-test/suite/galera/t/mysql-wsrep#31.test +++ b/mysql-test/suite/galera/t/mysql-wsrep#31.test @@ -1,6 +1,11 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +# Save original auto_increment_offset values. +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + --connection node_1 CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; @@ -36,4 +41,13 @@ if ($galera_wsrep_start_position != $expected_position) DROP TABLE t1; DROP DATABASE db; +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--source include/wait_until_connected_again.inc + +# Restore original auto_increment_offset values. +--let $node_2=node_2a +--source include/auto_increment_offset_restore.inc + +--source include/galera_end.inc + diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf index 2a06c1cd5a9..eaa2899968c 100644 --- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf +++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf @@ -18,7 +18,7 @@ wsrep-sync-wait=7 #ist_port=@OPT.port #sst_port=@OPT.port wsrep-cluster-address=gcomm:// -wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M' +wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;evs.suspect_timeout=PT10S' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' @@ -27,7 +27,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M' +wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;evs.suspect_timeout=PT10S' wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' @@ -36,7 +36,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' #ist_port=@OPT.port #sst_port=@OPT.port wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' -wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M' +wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M;evs.suspect_timeout=PT10S' wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port' diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result index f5a4cad4a23..69995acb982 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result +++ b/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result @@ -3,9 +3,6 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; SET SESSION wsrep_sync_wait = 0; -SHOW STATUS LIKE 'wsrep_cluster_status'; -Variable_name Value -wsrep_cluster_status non-Primary SET GLOBAL wsrep_provider_options = 'pc.bootstrap=1'; SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result index 85f923ad55e..6fb931638ef 100644 --- a/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result +++ b/mysql-test/suite/galera_3nodes/r/galera_pc_weight.result @@ -1,6 +1,8 @@ SET GLOBAL wsrep_provider_options = 'pc.weight=3'; Suspending node ... SET SESSION wsrep_sync_wait=0; +SET SESSION wsrep_on=OFF; +SET SESSION wsrep_on=ON; SHOW STATUS LIKE 'wsrep_cluster_size'; Variable_name Value wsrep_cluster_size 2 diff --git a/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test index e19169a350c..b4fe10bff0d 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test +++ b/mysql-test/suite/galera_3nodes/t/galera_certification_ccc.test @@ -10,12 +10,10 @@ --source include/galera_connect.inc # Save original auto_increment_offset values. ---connection node_1 -let $auto_increment_offset_node_1 = `SELECT @@global.auto_increment_offset`; ---connection node_2 -let $auto_increment_offset_node_2 = `SELECT @@global.auto_increment_offset`; ---connection node_3 -let $auto_increment_offset_node_3 = `SELECT @@global.auto_increment_offset`; +--let $node_1=node_1 +--let $node_2=node_2 +--let $node_3=node_3 +--source ../galera/include/auto_increment_offset_save.inc --connection node_1 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; @@ -49,12 +47,7 @@ SELECT COUNT(*) = 2 FROM t1; DROP TABLE t1; # Restore original auto_increment_offset values. ---disable_query_log ---connection node_1 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_1; ---connection node_2 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_2; ---connection node_3 ---eval SET @@global.auto_increment_offset = $auto_increment_offset_node_3; ---enable_query_log +--source ../galera/include/auto_increment_offset_restore.inc + +--source include/galera_end.inc diff --git a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test index af4a5fbf9d6..a6660bd08d1 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test +++ b/mysql-test/suite/galera_3nodes/t/galera_innobackupex_backup.test @@ -13,8 +13,8 @@ INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),(9),(10); SELECT COUNT(*) = 10 FROM t1; --exec rm -rf $MYSQL_TMP_DIR/innobackupex_backup ---exec innobackupex $MYSQL_TMP_DIR/innobackupex_backup --galera-info --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-backup.log ---exec innobackupex $MYSQL_TMP_DIR/innobackupex_backup --apply-log --galera-info --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-apply.log +--exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-backup.log +--exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 $MYSQL_TMP_DIR/innobackupex_backup --apply-log --galera-info --port=$NODE_MYPORT_2 --host=127.0.0.1 --no-timestamp > $MYSQL_TMP_DIR/innobackupex-apply.log --source include/kill_galera.inc --sleep 1 @@ -23,7 +23,7 @@ SELECT COUNT(*) = 10 FROM t1; INSERT INTO t1 VALUES (11),(12),(13),(14),(15),(16),(17),(18),(19),(20); --exec rm -rf $MYSQLTEST_VARDIR/mysqld.2/data/* ---exec innobackupex --copy-back $MYSQL_TMP_DIR/innobackupex_backup --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --port=$NODE_MYPORT_2 --host=127.0.0.1 > $MYSQL_TMP_DIR/innobackupex-restore.log +--exec innobackupex --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group=mysqld.2 --copy-back $MYSQL_TMP_DIR/innobackupex_backup --port=$NODE_MYPORT_2 --host=127.0.0.1 > $MYSQL_TMP_DIR/innobackupex-restore.log # # Convert the xtrabackup_galera_info into a grastate.dat file diff --git a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test index 7d8bbb39e35..8575d99f066 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test +++ b/mysql-test/suite/galera_3nodes/t/galera_ist_gcache_rollover.test @@ -82,6 +82,8 @@ INSERT INTO t1 VALUES (51), (52), (53), (54), (55); --connection node_3 --source include/wait_until_connected_again.inc +sleep 5; + # Final checks --connection node_2 SELECT COUNT(*) = 30 FROM t1; diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.cnf b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.cnf new file mode 100644 index 00000000000..d560b675427 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.cnf @@ -0,0 +1,5 @@ +# We need a dedicated .cnf file, even if empty, in order to force this test to run +# alone on a freshly started cluster. Otherwise there are adverse interactions with +# prior tests such as galera_3nodes.galera_innobackupex_backup + +!include ../galera_3nodes.cnf diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test index 6172ffcc743..f8381a3324b 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test @@ -23,7 +23,8 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1'; # Node #2 should be non-primary SET SESSION wsrep_sync_wait = 0; -SHOW STATUS LIKE 'wsrep_cluster_status'; +--let $wait_condition = SELECT variable_value = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE variable_name = 'wsrep_cluster_status'; +--source include/wait_condition.inc # Signal node #2 to bootstrap --connection node_2 diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.cnf b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.cnf new file mode 100644 index 00000000000..57026ce6928 --- /dev/null +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.cnf @@ -0,0 +1,5 @@ +# We need a dedicated .cnf file, even if empty, in order to force this test to run +# alone on a freshly started cluster. Otherwise there are adverse interactions with +# following tests such as galera_3nodes.galera_var_dirty_reads2 + +!include ../galera_3nodes.cnf diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test index 6585f1934a4..c118b7481bc 100644 --- a/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test +++ b/mysql-test/suite/galera_3nodes/t/galera_pc_weight.test @@ -19,6 +19,11 @@ SET GLOBAL wsrep_provider_options = 'pc.weight=3'; SET SESSION wsrep_sync_wait=0; --source include/wait_until_connected_again.inc +SET SESSION wsrep_on=OFF; +--let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status' +--source include/wait_condition.inc +SET SESSION wsrep_on=ON; + # We can not use SELECT queries here, as only SHOW is allowed to run. # For nodes #2 and #3, we expect a non-primary component of size 2 @@ -45,7 +50,7 @@ SHOW STATUS LIKE 'wsrep_local_state_comment'; --connection node_1 --source include/galera_resume.inc ---sleep 5 +--sleep 10 --source include/wait_until_connected_again.inc # For Node #1, we expect a primary component of size 1 diff --git a/mysql-test/suite/innodb/r/innodb-alter-table.result b/mysql-test/suite/innodb/r/innodb-alter-table.result index 4f4d628a1ee..6045b6d70a0 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-table.result +++ b/mysql-test/suite/innodb/r/innodb-alter-table.result @@ -135,3 +135,53 @@ child CREATE TABLE `child` ( CONSTRAINT `child_ibfk_1` FOREIGN KEY (`c`) REFERENCES `parent` (`a`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 DROP TABLE child, parent; +CREATE TABLE IF NOT EXISTS ticket ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +mask VARCHAR(16) DEFAULT '' NOT NULL, +subject VARCHAR(255) DEFAULT '' NOT NULL, +is_closed TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, +is_deleted TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, +team_id INT UNSIGNED DEFAULT 0 NOT NULL, +category_id INT UNSIGNED DEFAULT 0 NOT NULL, +first_message_id INT UNSIGNED DEFAULT 0 NOT NULL, +created_date INT UNSIGNED, +updated_date INT UNSIGNED, +due_date INT UNSIGNED, +first_wrote_address_id INT UNSIGNED NOT NULL DEFAULT 0, +last_wrote_address_id INT UNSIGNED NOT NULL DEFAULT 0, +spam_score DECIMAL(4,4) NOT NULL DEFAULT 0, +spam_training VARCHAR(1) NOT NULL DEFAULT '', +interesting_words VARCHAR(255) NOT NULL DEFAULT '', +next_action VARCHAR(255) NOT NULL DEFAULT '', +PRIMARY KEY (id) +) ENGINE=InnoDB; +ALTER TABLE ticket +CHANGE COLUMN team_id group_id INT UNSIGNED NOT NULL DEFAULT 0, +CHANGE COLUMN category_id bucket_id INT UNSIGNED NOT NULL DEFAULT 0, +ADD COLUMN org_id INT UNSIGNED NOT NULL DEFAULT 0, +ADD INDEX org_id (org_id); +SHOW CREATE TABLE ticket; +Table Create Table +ticket CREATE TABLE `ticket` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `mask` varchar(16) NOT NULL DEFAULT '', + `subject` varchar(255) NOT NULL DEFAULT '', + `is_closed` tinyint(1) unsigned NOT NULL DEFAULT 0, + `is_deleted` tinyint(1) unsigned NOT NULL DEFAULT 0, + `group_id` int(10) unsigned NOT NULL DEFAULT 0, + `bucket_id` int(10) unsigned NOT NULL DEFAULT 0, + `first_message_id` int(10) unsigned NOT NULL DEFAULT 0, + `created_date` int(10) unsigned DEFAULT NULL, + `updated_date` int(10) unsigned DEFAULT NULL, + `due_date` int(10) unsigned DEFAULT NULL, + `first_wrote_address_id` int(10) unsigned NOT NULL DEFAULT 0, + `last_wrote_address_id` int(10) unsigned NOT NULL DEFAULT 0, + `spam_score` decimal(4,4) NOT NULL DEFAULT 0.0000, + `spam_training` varchar(1) NOT NULL DEFAULT '', + `interesting_words` varchar(255) NOT NULL DEFAULT '', + `next_action` varchar(255) NOT NULL DEFAULT '', + `org_id` int(10) unsigned NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + KEY `org_id` (`org_id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE ticket; diff --git a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result index ce13ad0978b..3cc973ca3a3 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-tempfile.result +++ b/mysql-test/suite/innodb/r/innodb-alter-tempfile.result @@ -4,6 +4,10 @@ # Temporary tablename will be unique. This makes sure that future # in-place ALTERs of the same table will not be blocked due to # temporary tablename. +call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed +"); +call mtr.add_suppression("InnoDB: file read of space .* page .*"); +call mtr.add_suppression("InnoDB: Trying to recover it from the doublewrite buffer."); # Crash the server in ha_innobase::commit_inplace_alter_table() CREATE TABLE t1 (f1 INT NOT NULL, f2 INT NOT NULL) ENGINE=innodb; SET debug='d,innodb_alter_commit_crash_before_commit'; diff --git a/mysql-test/suite/innodb/r/innodb-fk-warnings.result b/mysql-test/suite/innodb/r/innodb-fk-warnings.result index eddedfc3620..d7c7acfb424 100644 --- a/mysql-test/suite/innodb/r/innodb-fk-warnings.result +++ b/mysql-test/suite/innodb/r/innodb-fk-warnings.result @@ -70,6 +70,20 @@ Level Code Message Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(b) references t1(a). Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") Warning 1215 Cannot add foreign key constraint +create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb; +ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Create table `mysqld.1`.`t2` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary near 'foreign key(a) references t1(a)) engine=innodb'. +Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint +alter table t1 add foreign key(b) references t1(a); +ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") +show warnings; +Level Code Message +Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary near 'foreign key(b) references t1(a)'. +Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") +Warning 1215 Cannot add foreign key constraint drop table t1; create table t1(a int not null primary key, b int, key(b)) engine=innodb; alter table t1 add foreign key(a,b) references t1(a); diff --git a/mysql-test/suite/innodb/r/innodb-wl5522,xtradb.rdiff b/mysql-test/suite/innodb/r/innodb-wl5522,xtradb.rdiff new file mode 100644 index 00000000000..4aea0b451ec --- /dev/null +++ b/mysql-test/suite/innodb/r/innodb-wl5522,xtradb.rdiff @@ -0,0 +1,56 @@ +--- suite/innodb/r/innodb-wl5522.result ++++ suite/innodb/r/innodb-wl5522.reject +@@ -580,7 +580,7 @@ + ERROR HY000: Tablespace has been discarded for table 't1' + restore: t1 .ibd and .cfg files + ALTER TABLE t1 IMPORT TABLESPACE; +-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x0) ++ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x0) + unlink: t1.ibd + unlink: t1.cfg + DROP TABLE t1; +@@ -592,7 +592,7 @@ + ERROR HY000: Tablespace has been discarded for table 't1' + restore: t1 .ibd and .cfg files + ALTER TABLE t1 IMPORT TABLESPACE; +-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x0) ++ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x0) + unlink: t1.ibd + unlink: t1.cfg + DROP TABLE t1; +@@ -766,7 +766,7 @@ + ERROR HY000: Tablespace has been discarded for table 't1' + restore: t1 .ibd and .cfg files + ALTER TABLE t1 IMPORT TABLESPACE; +-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x1) ++ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x1) + unlink: t1.ibd + unlink: t1.cfg + DROP TABLE t1; +@@ -778,7 +778,7 @@ + ERROR HY000: Tablespace has been discarded for table 't1' + restore: t1 .ibd and .cfg files + ALTER TABLE t1 IMPORT TABLESPACE; +-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x1) ++ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x21 and the meta-data file has 0x1) + unlink: t1.ibd + unlink: t1.cfg + DROP TABLE t1; +@@ -955,7 +955,7 @@ + ERROR HY000: Tablespace has been discarded for table 't1' + restore: t1 .ibd and .cfg files + ALTER TABLE t1 IMPORT TABLESPACE; +-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x21) ++ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x1 and the meta-data file has 0x21) + unlink: t1.ibd + unlink: t1.cfg + DROP TABLE t1; +@@ -967,7 +967,7 @@ + ERROR HY000: Tablespace has been discarded for table 't1' + restore: t1 .ibd and .cfg files + ALTER TABLE t1 IMPORT TABLESPACE; +-ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x5 and the meta-data file has 0x21) ++ERROR HY000: Schema mismatch (Table flags don't match, server table has 0x0 and the meta-data file has 0x21) + unlink: t1.ibd + unlink: t1.cfg + DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/innodb-alter-table.test b/mysql-test/suite/innodb/t/innodb-alter-table.test index 2ad9c8791cb..45342b4a218 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-table.test +++ b/mysql-test/suite/innodb/t/innodb-alter-table.test @@ -138,3 +138,36 @@ SHOW CREATE TABLE child; DROP TABLE child, parent; +# +# MDEV-10535: ALTER TABLE causes standalone/wsrep cluster crash +# +CREATE TABLE IF NOT EXISTS ticket ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + mask VARCHAR(16) DEFAULT '' NOT NULL, + subject VARCHAR(255) DEFAULT '' NOT NULL, + is_closed TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, + is_deleted TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL, + team_id INT UNSIGNED DEFAULT 0 NOT NULL, + category_id INT UNSIGNED DEFAULT 0 NOT NULL, + first_message_id INT UNSIGNED DEFAULT 0 NOT NULL, + created_date INT UNSIGNED, + updated_date INT UNSIGNED, + due_date INT UNSIGNED, + first_wrote_address_id INT UNSIGNED NOT NULL DEFAULT 0, + last_wrote_address_id INT UNSIGNED NOT NULL DEFAULT 0, + spam_score DECIMAL(4,4) NOT NULL DEFAULT 0, + spam_training VARCHAR(1) NOT NULL DEFAULT '', + interesting_words VARCHAR(255) NOT NULL DEFAULT '', + next_action VARCHAR(255) NOT NULL DEFAULT '', + PRIMARY KEY (id) +) ENGINE=InnoDB; + +ALTER TABLE ticket + CHANGE COLUMN team_id group_id INT UNSIGNED NOT NULL DEFAULT 0, + CHANGE COLUMN category_id bucket_id INT UNSIGNED NOT NULL DEFAULT 0, + ADD COLUMN org_id INT UNSIGNED NOT NULL DEFAULT 0, + ADD INDEX org_id (org_id); + +SHOW CREATE TABLE ticket; + +DROP TABLE ticket; diff --git a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test index ec1ea35f1cf..e1e736fc678 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-tempfile.test +++ b/mysql-test/suite/innodb/t/innodb-alter-tempfile.test @@ -20,6 +20,13 @@ --echo # in-place ALTERs of the same table will not be blocked due to --echo # temporary tablename. +# As we intentionally crash below, there could be partially written +# pages that are then recovered from the doublewrite buffer +call mtr.add_suppression("InnoDB: Warning: database page corruption or a failed +"); +call mtr.add_suppression("InnoDB: file read of space .* page .*"); +call mtr.add_suppression("InnoDB: Trying to recover it from the doublewrite buffer."); + let datadir= `select @@datadir`; --let $_server_id= `SELECT @@server_id` diff --git a/mysql-test/suite/innodb/t/innodb-fk-warnings.test b/mysql-test/suite/innodb/t/innodb-fk-warnings.test index a95a7f55a40..f45ae00d788 100644 --- a/mysql-test/suite/innodb/t/innodb-fk-warnings.test +++ b/mysql-test/suite/innodb/t/innodb-fk-warnings.test @@ -87,16 +87,16 @@ create temporary table t1(a int not null primary key, b int, key(b)) engine=inno --echo Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(b) references t1(a). --echo Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed") --echo Warning 1215 Cannot add foreign key constraint -#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ -#--error 1005 -#create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb; -#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ -#show warnings; -#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ -#--error 1005 -#alter table t1 add foreign key(b) references t1(a); -#--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ -#show warnings; +--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ +--error 1005 +create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb; +--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ +show warnings; +--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ +--error 1005 +alter table t1 add foreign key(b) references t1(a); +--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ +show warnings; drop table t1; # diff --git a/mysql-test/suite/perfschema/r/nesting.result b/mysql-test/suite/perfschema/r/nesting.result index 6a4233d2e42..e08aec94845 100644 --- a/mysql-test/suite/perfschema/r/nesting.result +++ b/mysql-test/suite/perfschema/r/nesting.result @@ -167,76 +167,78 @@ relative_event_id relative_end_event_id event_name comment nesting_event_type re 57 58 stage/sql/cleaning up (stage) STATEMENT 40 58 58 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 57 59 59 idle idle NULL NULL -60 76 statement/sql/select select "This is the first part of a multi query" as payload; +60 77 statement/sql/select select "This is the first part of a multi query" as payload; select "And this is the second part of a multi query" as payload; select "With a third part to make things complete" as payload NULL NULL -61 64 stage/sql/init (stage) STATEMENT 60 +61 65 stage/sql/init (stage) STATEMENT 60 62 62 wait/io/socket/sql/client_connection recv STAGE 61 63 63 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 61 64 64 wait/io/file/sql/query_log write STAGE 61 -65 65 stage/sql/checking permissions (stage) STATEMENT 60 -66 66 stage/sql/Opening tables (stage) STATEMENT 60 -67 67 stage/sql/After opening tables (stage) STATEMENT 60 -68 68 stage/sql/init (stage) STATEMENT 60 -69 69 stage/sql/optimizing (stage) STATEMENT 60 -70 70 stage/sql/executing (stage) STATEMENT 60 -71 71 stage/sql/end (stage) STATEMENT 60 -72 72 stage/sql/query end (stage) STATEMENT 60 -73 73 stage/sql/closing tables (stage) STATEMENT 60 -74 76 stage/sql/freeing items (stage) STATEMENT 60 -75 75 wait/io/socket/sql/client_connection send STAGE 74 -76 76 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 74 -77 91 statement/sql/select select "And this is the second part of a multi query" as payload; +65 65 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 61 +66 66 stage/sql/checking permissions (stage) STATEMENT 60 +67 67 stage/sql/Opening tables (stage) STATEMENT 60 +68 68 stage/sql/After opening tables (stage) STATEMENT 60 +69 69 stage/sql/init (stage) STATEMENT 60 +70 70 stage/sql/optimizing (stage) STATEMENT 60 +71 71 stage/sql/executing (stage) STATEMENT 60 +72 72 stage/sql/end (stage) STATEMENT 60 +73 73 stage/sql/query end (stage) STATEMENT 60 +74 74 stage/sql/closing tables (stage) STATEMENT 60 +75 77 stage/sql/freeing items (stage) STATEMENT 60 +76 76 wait/io/socket/sql/client_connection send STAGE 75 +77 77 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 75 +78 93 statement/sql/select select "And this is the second part of a multi query" as payload; select "With a third part to make things complete" as payload NULL NULL -78 79 stage/sql/init (stage) STATEMENT 77 -79 79 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 78 -80 80 stage/sql/checking permissions (stage) STATEMENT 77 -81 81 stage/sql/Opening tables (stage) STATEMENT 77 -82 82 stage/sql/After opening tables (stage) STATEMENT 77 -83 83 stage/sql/init (stage) STATEMENT 77 -84 84 stage/sql/optimizing (stage) STATEMENT 77 -85 85 stage/sql/executing (stage) STATEMENT 77 -86 86 stage/sql/end (stage) STATEMENT 77 -87 87 stage/sql/query end (stage) STATEMENT 77 -88 88 stage/sql/closing tables (stage) STATEMENT 77 -89 91 stage/sql/freeing items (stage) STATEMENT 77 -90 90 wait/io/socket/sql/client_connection send STAGE 89 -91 91 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 89 -92 108 statement/sql/select select "With a third part to make things complete" as payload NULL NULL -93 94 stage/sql/init (stage) STATEMENT 92 -94 94 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 93 -95 95 stage/sql/checking permissions (stage) STATEMENT 92 -96 96 stage/sql/Opening tables (stage) STATEMENT 92 -97 97 stage/sql/After opening tables (stage) STATEMENT 92 -98 98 stage/sql/init (stage) STATEMENT 92 -99 99 stage/sql/optimizing (stage) STATEMENT 92 -100 100 stage/sql/executing (stage) STATEMENT 92 -101 101 stage/sql/end (stage) STATEMENT 92 -102 102 stage/sql/query end (stage) STATEMENT 92 -103 103 stage/sql/closing tables (stage) STATEMENT 92 -104 104 stage/sql/freeing items (stage) STATEMENT 92 -105 105 wait/io/socket/sql/client_connection send STATEMENT 92 -106 106 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 92 -107 108 stage/sql/cleaning up (stage) STATEMENT 92 -108 108 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 107 -109 109 idle idle NULL NULL -110 128 statement/sql/select select "MARKER_END" as marker NULL NULL -111 114 stage/sql/init (stage) STATEMENT 110 -112 112 wait/io/socket/sql/client_connection recv STAGE 111 -113 113 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 111 -114 114 wait/io/file/sql/query_log write STAGE 111 -115 115 stage/sql/checking permissions (stage) STATEMENT 110 -116 116 stage/sql/Opening tables (stage) STATEMENT 110 -117 117 stage/sql/After opening tables (stage) STATEMENT 110 -118 118 stage/sql/init (stage) STATEMENT 110 -119 119 stage/sql/optimizing (stage) STATEMENT 110 -120 120 stage/sql/executing (stage) STATEMENT 110 -121 121 stage/sql/end (stage) STATEMENT 110 -122 122 stage/sql/query end (stage) STATEMENT 110 -123 123 stage/sql/closing tables (stage) STATEMENT 110 -124 124 stage/sql/freeing items (stage) STATEMENT 110 -125 125 wait/io/socket/sql/client_connection send STATEMENT 110 -126 126 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 110 -127 128 stage/sql/cleaning up (stage) STATEMENT 110 -128 128 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 127 +79 81 stage/sql/init (stage) STATEMENT 78 +80 80 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 79 +81 81 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 79 +82 82 stage/sql/checking permissions (stage) STATEMENT 78 +83 83 stage/sql/Opening tables (stage) STATEMENT 78 +84 84 stage/sql/After opening tables (stage) STATEMENT 78 +85 85 stage/sql/init (stage) STATEMENT 78 +86 86 stage/sql/optimizing (stage) STATEMENT 78 +87 87 stage/sql/executing (stage) STATEMENT 78 +88 88 stage/sql/end (stage) STATEMENT 78 +89 89 stage/sql/query end (stage) STATEMENT 78 +90 90 stage/sql/closing tables (stage) STATEMENT 78 +91 93 stage/sql/freeing items (stage) STATEMENT 78 +92 92 wait/io/socket/sql/client_connection send STAGE 91 +93 93 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 91 +94 110 statement/sql/select select "With a third part to make things complete" as payload NULL NULL +95 96 stage/sql/init (stage) STATEMENT 94 +96 96 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 95 +97 97 stage/sql/checking permissions (stage) STATEMENT 94 +98 98 stage/sql/Opening tables (stage) STATEMENT 94 +99 99 stage/sql/After opening tables (stage) STATEMENT 94 +100 100 stage/sql/init (stage) STATEMENT 94 +101 101 stage/sql/optimizing (stage) STATEMENT 94 +102 102 stage/sql/executing (stage) STATEMENT 94 +103 103 stage/sql/end (stage) STATEMENT 94 +104 104 stage/sql/query end (stage) STATEMENT 94 +105 105 stage/sql/closing tables (stage) STATEMENT 94 +106 106 stage/sql/freeing items (stage) STATEMENT 94 +107 107 wait/io/socket/sql/client_connection send STATEMENT 94 +108 108 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 94 +109 110 stage/sql/cleaning up (stage) STATEMENT 94 +110 110 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 109 +111 111 idle idle NULL NULL +112 130 statement/sql/select select "MARKER_END" as marker NULL NULL +113 116 stage/sql/init (stage) STATEMENT 112 +114 114 wait/io/socket/sql/client_connection recv STAGE 113 +115 115 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 113 +116 116 wait/io/file/sql/query_log write STAGE 113 +117 117 stage/sql/checking permissions (stage) STATEMENT 112 +118 118 stage/sql/Opening tables (stage) STATEMENT 112 +119 119 stage/sql/After opening tables (stage) STATEMENT 112 +120 120 stage/sql/init (stage) STATEMENT 112 +121 121 stage/sql/optimizing (stage) STATEMENT 112 +122 122 stage/sql/executing (stage) STATEMENT 112 +123 123 stage/sql/end (stage) STATEMENT 112 +124 124 stage/sql/query end (stage) STATEMENT 112 +125 125 stage/sql/closing tables (stage) STATEMENT 112 +126 126 stage/sql/freeing items (stage) STATEMENT 112 +127 127 wait/io/socket/sql/client_connection send STATEMENT 112 +128 128 wait/synch/mutex/sql/THD::LOCK_thd_data lock STATEMENT 112 +129 130 stage/sql/cleaning up (stage) STATEMENT 112 +130 130 wait/synch/mutex/sql/THD::LOCK_thd_data lock STAGE 129 disconnect con1; diff --git a/mysql-test/suite/plugins/r/cracklib_password_check.result b/mysql-test/suite/plugins/r/cracklib_password_check.result index dc31cb6d044..158a7501240 100644 --- a/mysql-test/suite/plugins/r/cracklib_password_check.result +++ b/mysql-test/suite/plugins/r/cracklib_password_check.result @@ -11,7 +11,7 @@ PLUGIN_AUTHOR Sergei Golubchik PLUGIN_DESCRIPTION Password validation via CrackLib PLUGIN_LICENSE GPL LOAD_OPTION ON -PLUGIN_MATURITY Gamma +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 grant select on *.* to foocar identified by 'foocar'; ERROR HY000: Your password does not satisfy the current policy requirements diff --git a/mysql-test/suite/plugins/r/pam_cleartext.result b/mysql-test/suite/plugins/r/pam_cleartext.result index 00e0e94618e..824e8329cc3 100644 --- a/mysql-test/suite/plugins/r/pam_cleartext.result +++ b/mysql-test/suite/plugins/r/pam_cleartext.result @@ -2,9 +2,12 @@ install plugin pam soname 'auth_pam.so'; create user test_pam identified via pam using 'mariadb_mtr'; create user pam_test; grant proxy on pam_test to test_pam; -show variables like 'pam%'; +show variables like 'pam_use_%'; Variable_name Value pam_use_cleartext_plugin ON +# +# same test as in pam.test now fails +# drop user test_pam; drop user pam_test; uninstall plugin pam; diff --git a/mysql-test/suite/plugins/r/simple_password_check.result b/mysql-test/suite/plugins/r/simple_password_check.result index bbb96bb8c38..015a26adc87 100644 --- a/mysql-test/suite/plugins/r/simple_password_check.result +++ b/mysql-test/suite/plugins/r/simple_password_check.result @@ -11,7 +11,7 @@ PLUGIN_AUTHOR Sergei Golubchik PLUGIN_DESCRIPTION Simple password strength checks PLUGIN_LICENSE GPL LOAD_OPTION ON -PLUGIN_MATURITY Gamma +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 select * from information_schema.system_variables where variable_name like 'simple_password_check%' order by 1; VARIABLE_NAME SIMPLE_PASSWORD_CHECK_DIGITS @@ -85,7 +85,11 @@ grant select on *.* to foo1; drop user foo1; set global simple_password_check_digits=3; set global simple_password_check_letters_same_case=3; +Warnings: +Warning 1292 Adjusted the value of simple_password_check_minimal_length from 8 to 10 set global simple_password_check_other_characters=3; +Warnings: +Warning 1292 Adjusted the value of simple_password_check_minimal_length from 10 to 12 show variables like 'simple_password_check_%'; Variable_name Value simple_password_check_digits 3 diff --git a/mysql-test/suite/plugins/t/pam.test b/mysql-test/suite/plugins/t/pam.test index 1871e5801a3..8a95d6baed2 100644 --- a/mysql-test/suite/plugins/t/pam.test +++ b/mysql-test/suite/plugins/t/pam.test @@ -29,5 +29,6 @@ EOF --remove_file $MYSQLTEST_VARDIR/tmp/pam_bad.txt drop user test_pam; drop user pam_test; +let $count_sessions= 1; +--source include/wait_until_count_sessions.inc uninstall plugin pam; - diff --git a/mysql-test/suite/plugins/t/pam_cleartext.test b/mysql-test/suite/plugins/t/pam_cleartext.test index 6b9bf087ce5..29ed7430649 100644 --- a/mysql-test/suite/plugins/t/pam_cleartext.test +++ b/mysql-test/suite/plugins/t/pam_cleartext.test @@ -1,13 +1,24 @@ --source pam_init.inc -show variables like 'pam%'; +show variables like 'pam_use_%'; +--write_file $MYSQLTEST_VARDIR/tmp/pam_good.txt +not very secret challenge +9225 +select user(), current_user(), database(); +EOF + +--echo # +--echo # same test as in pam.test now fails +--echo # --error 1 ---exec echo FAIL | $MYSQL_TEST -u test_pam --plugin-dir=$plugindir +--exec $MYSQL_TEST -u test_pam --plugin-dir=$plugindir < $MYSQLTEST_VARDIR/tmp/pam_good.txt + +--remove_file $MYSQLTEST_VARDIR/tmp/pam_good.txt drop user test_pam; drop user pam_test; ---disable_warnings +let $count_sessions= 1; +--source include/wait_until_count_sessions.inc uninstall plugin pam; - diff --git a/mysql-test/suite/rpl/t/rpl_mdev6020.test b/mysql-test/suite/rpl/t/rpl_mdev6020.test index 2fd342f5eda..8484e3e11c0 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev6020.test +++ b/mysql-test/suite/rpl/t/rpl_mdev6020.test @@ -1,8 +1,10 @@ +# Running this with valgrind can take > 5000 seconds with xtradb +--source include/not_valgrind.inc + --source include/have_innodb.inc --source include/have_partition.inc --source include/have_binlog_format_mixed_or_row.inc --source include/master-slave.inc - --connection slave --source include/stop_slave.inc diff --git a/mysql-test/suite/sys_vars/r/general_log_file_basic.result b/mysql-test/suite/sys_vars/r/general_log_file_basic.result index 369ef7844db..c7c24f155ca 100644 --- a/mysql-test/suite/sys_vars/r/general_log_file_basic.result +++ b/mysql-test/suite/sys_vars/r/general_log_file_basic.result @@ -12,6 +12,16 @@ SET @@global.general_log_file = mytest.log; ERROR 42000: Incorrect argument type to variable 'general_log_file' SET @@global.general_log_file = 12; ERROR 42000: Incorrect argument type to variable 'general_log_file' +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 = '/tmp/my.cnf'; +ERROR 42000: Variable 'general_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' +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.general_log_file = VARIABLE_VALUE FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES 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 index f45c568ff4a..a64666f6298 100644 --- 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 @@ -9,6 +9,16 @@ 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' +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 diff --git a/mysql-test/suite/sys_vars/r/sysvars_aria.result b/mysql-test/suite/sys_vars/r/sysvars_aria.result index f2418cf31db..461eef9ec47 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_aria.result +++ b/mysql-test/suite/sys_vars/r/sysvars_aria.result @@ -54,7 +54,7 @@ VARIABLE_COMMENT Encrypt tables (only for tables with ROW_FORMAT=PAGE (default) NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME ARIA_FORCE_START_AFTER_RECOVERY_FAILURES @@ -208,7 +208,7 @@ VARIABLE_COMMENT Maintain page checksums (can be overridden per table with PAGE_ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME ARIA_RECOVER_OPTIONS @@ -292,6 +292,6 @@ VARIABLE_COMMENT Whether temporary tables should be MyISAM or Aria NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NULL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff index 4d507126872..930fa18541f 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff @@ -111,7 +111,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY YES +COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_BUFFER_POOL_SIZE @@ -150,7 +150,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_CLEANER_FLUSH_CHUNK_SIZE @@ -343,7 +343,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_FAST_SHUTDOWN @@ -578,7 +578,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG @@ -624,7 +624,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL - ENUM_VALUE_LIST NULL + ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL -VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES @@ -695,7 +695,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_LOG_CHECKSUM_ALGORITHM @@ -850,7 +850,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_PRIORITY_IO @@ -864,7 +864,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_PRIORITY_MASTER @@ -878,7 +878,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_PRIORITY_PURGE @@ -892,7 +892,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_PURGE_BATCH_SIZE @@ -1134,7 +1134,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT NONE +VARIABLE_NAME INNODB_TRACK_REDO_LOG_NOW @@ -1148,7 +1148,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG @@ -1196,7 +1196,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_USE_MTFLUSH @@ -1217,7 +1217,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY YES +COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_USE_SYS_MALLOC @@ -1227,8 +1227,8 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.31 -+GLOBAL_VALUE 5.6.30-76.3 +-GLOBAL_VALUE 5.6.32 ++GLOBAL_VALUE 5.6.31-77.0 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff index 6d95a517b33..aafc0a9e806 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff @@ -36,7 +36,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY YES +COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_BUFFER_POOL_SIZE @@ -66,7 +66,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_CLEANER_FLUSH_CHUNK_SIZE @@ -213,7 +213,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_FAST_SHUTDOWN @@ -290,7 +290,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG @@ -311,7 +311,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_LOG_ARCH_DIR @@ -430,7 +430,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_PRIORITY_IO @@ -444,7 +444,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_PRIORITY_MASTER @@ -458,7 +458,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL +VARIABLE_NAME INNODB_PRIORITY_PURGE @@ -472,7 +472,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_PURGE_BATCH_SIZE @@ -586,7 +586,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT NONE +VARIABLE_NAME INNODB_TRACK_REDO_LOG_NOW @@ -600,7 +600,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG @@ -630,7 +630,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY NO +COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_USE_MTFLUSH @@ -651,7 +651,7 @@ +NUMERIC_MIN_VALUE NULL +NUMERIC_MAX_VALUE NULL +NUMERIC_BLOCK_SIZE NULL -+ENUM_VALUE_LIST NULL ++ENUM_VALUE_LIST OFF,ON +READ_ONLY YES +COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_USE_SYS_MALLOC @@ -661,8 +661,8 @@ COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL --GLOBAL_VALUE 5.6.31 -+GLOBAL_VALUE 5.6.30-76.3 +-GLOBAL_VALUE 5.6.32 ++GLOBAL_VALUE 5.6.31-77.0 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result index 9f92ea99437..8ef0d449042 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result +++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result @@ -16,7 +16,7 @@ VARIABLE_COMMENT Attempt flushing dirty pages to avoid IO bursts at checkpoints. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_ADAPTIVE_FLUSHING_LWM @@ -44,7 +44,7 @@ VARIABLE_COMMENT Enable InnoDB adaptive hash index (enabled by default). Disabl NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_ADAPTIVE_MAX_SLEEP_DELAY @@ -100,7 +100,7 @@ VARIABLE_COMMENT Disable row lock when direct access InnoDB through InnoDB APIs NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_API_ENABLE_BINLOG @@ -114,7 +114,7 @@ VARIABLE_COMMENT Enable binlog for applications direct access InnoDB through Inn NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_API_ENABLE_MDL @@ -128,7 +128,7 @@ VARIABLE_COMMENT Enable MDL for applications direct access InnoDB through InnoDB NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_API_TRX_LEVEL @@ -198,7 +198,7 @@ VARIABLE_COMMENT Enable scrubbing of compressed data by background threads (same NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_BACKGROUND_SCRUB_DATA_INTERVAL @@ -226,7 +226,7 @@ VARIABLE_COMMENT Enable scrubbing of uncompressed data by background threads (sa NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_BUFFER_POOL_DUMP_AT_SHUTDOWN @@ -240,7 +240,7 @@ VARIABLE_COMMENT Dump the buffer pool into a file named @@innodb_buffer_pool_fil NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_BUFFER_POOL_DUMP_NOW @@ -254,7 +254,7 @@ VARIABLE_COMMENT Trigger an immediate dump of the buffer pool into a file named NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_BUFFER_POOL_DUMP_PCT @@ -324,7 +324,7 @@ VARIABLE_COMMENT Abort a currently running load of the buffer pool NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_BUFFER_POOL_LOAD_AT_STARTUP @@ -338,7 +338,7 @@ VARIABLE_COMMENT Load the buffer pool from a file named @@innodb_buffer_pool_fil NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_BUFFER_POOL_LOAD_NOW @@ -352,7 +352,7 @@ VARIABLE_COMMENT Trigger an immediate load of the buffer pool from a file named NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_BUFFER_POOL_SIZE @@ -394,7 +394,7 @@ VARIABLE_COMMENT Force dirty page flush now NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_CHANGE_BUFFERING @@ -450,7 +450,7 @@ VARIABLE_COMMENT DEPRECATED. Use innodb_checksum_algorithm=NONE instead of setti NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_CHECKSUM_ALGORITHM @@ -478,7 +478,7 @@ VARIABLE_COMMENT Enable INFORMATION_SCHEMA.innodb_cmp_per_index, may have negati NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_COMMIT_CONCURRENCY @@ -604,7 +604,7 @@ VARIABLE_COMMENT Perform extra scrubbing to increase test exposure NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_DEFAULT_ENCRYPTION_KEY_ID @@ -632,7 +632,7 @@ VARIABLE_COMMENT Enable/disable InnoDB defragmentation (default FALSE). When set NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_DEFRAGMENT_FILL_FACTOR @@ -716,7 +716,7 @@ VARIABLE_COMMENT Disable change buffering merges by the master thread NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_DISABLE_SORT_FILE_CACHE @@ -730,7 +730,7 @@ VARIABLE_COMMENT Whether to disable OS system file cache for sort I/O NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_DOUBLEWRITE @@ -744,7 +744,7 @@ VARIABLE_COMMENT Enable InnoDB doublewrite buffer (enabled by default). Disable NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_DOUBLEWRITE_BATCH_SIZE @@ -814,7 +814,7 @@ VARIABLE_COMMENT Enable redo log encryption NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_ENCRYPT_TABLES @@ -884,7 +884,7 @@ VARIABLE_COMMENT Whether to perform system file format check. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_FILE_FORMAT_MAX @@ -912,7 +912,7 @@ VARIABLE_COMMENT Stores each InnoDB table to an .ibd file in the database dir. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_FIL_MAKE_PAGE_DIRTY_DEBUG @@ -1010,7 +1010,7 @@ VARIABLE_COMMENT Force InnoDB to load metadata of corrupted table. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_FORCE_PRIMARY_KEY @@ -1024,7 +1024,7 @@ VARIABLE_COMMENT Do not allow to create table without primary key (off by defaul NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_FORCE_RECOVERY @@ -1094,7 +1094,7 @@ VARIABLE_COMMENT Whether to enable additional FTS diagnostic printout NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_FT_ENABLE_STOPWORD @@ -1108,7 +1108,7 @@ VARIABLE_COMMENT Create FTS index with stopword. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_FT_MAX_TOKEN_SIZE @@ -1248,7 +1248,7 @@ VARIABLE_COMMENT Enable scrubbing of data NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_INSTRUMENT_SEMAPHORES @@ -1262,7 +1262,7 @@ VARIABLE_COMMENT Enable semaphore request instrumentation. This could have some NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_IO_CAPACITY @@ -1304,7 +1304,7 @@ VARIABLE_COMMENT Support large index prefix length of REC_VERSION_56_MAX_INDEX_C NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_LIMIT_OPTIMISTIC_INSERT_DEBUG @@ -1332,7 +1332,7 @@ VARIABLE_COMMENT DEPRECATED. This option may be removed in future releases. Plea NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_LOCK_WAIT_TIMEOUT @@ -1374,7 +1374,7 @@ VARIABLE_COMMENT Force checkpoint now NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES @@ -1388,7 +1388,7 @@ VARIABLE_COMMENT Enables/disables the logging of entire compressed page images. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_LOG_FILES_IN_GROUP @@ -1654,7 +1654,7 @@ VARIABLE_COMMENT Only optimize the Fulltext index of the table NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_PAGE_HASH_LOCKS @@ -1696,7 +1696,7 @@ VARIABLE_COMMENT Enable prefix optimization to sometimes avoid cluster index loo NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_PRINT_ALL_DEADLOCKS @@ -1710,7 +1710,7 @@ VARIABLE_COMMENT Print all deadlocks to MySQL error log (off by default) NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_PURGE_BATCH_SIZE @@ -1738,7 +1738,7 @@ VARIABLE_COMMENT Set purge state to RUN NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_PURGE_STOP_NOW @@ -1752,7 +1752,7 @@ VARIABLE_COMMENT Set purge state to STOP NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_PURGE_THREADS @@ -1780,7 +1780,7 @@ VARIABLE_COMMENT Whether to use read ahead for random access within an extent. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_READ_AHEAD_THRESHOLD @@ -1822,7 +1822,7 @@ VARIABLE_COMMENT Start InnoDB in read only mode (off by default) NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_REPLICATION_DELAY @@ -1850,7 +1850,7 @@ VARIABLE_COMMENT Roll back the complete transaction on lock wait timeout, for 4. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_ROLLBACK_SEGMENTS @@ -1892,7 +1892,7 @@ VARIABLE_COMMENT Enable background redo log (ib_logfile0, ib_logfile1...) scrubb NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_SCRUB_LOG_SPEED @@ -1962,7 +1962,7 @@ VARIABLE_COMMENT InnoDB automatic recalculation of persistent statistics enabled NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_STATS_METHOD @@ -2004,7 +2004,7 @@ VARIABLE_COMMENT Enable statistics gathering for metadata commands such as SHOW NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_STATS_PERSISTENT @@ -2018,7 +2018,7 @@ VARIABLE_COMMENT InnoDB persistent statistics enabled for all tables unless over NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_STATS_PERSISTENT_SAMPLE_PAGES @@ -2060,7 +2060,7 @@ VARIABLE_COMMENT Enable traditional statistic calculation based on number of con NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME INNODB_STATS_TRANSIENT_SAMPLE_PAGES @@ -2088,7 +2088,7 @@ VARIABLE_COMMENT Enable InnoDB monitor output to the error log. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_STATUS_OUTPUT_LOCKS @@ -2102,7 +2102,7 @@ VARIABLE_COMMENT Enable InnoDB lock monitor output to the error log. Requires in NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_STRICT_MODE @@ -2116,7 +2116,7 @@ VARIABLE_COMMENT Use strict mode when evaluating create options. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_SUPPORT_XA @@ -2130,7 +2130,7 @@ VARIABLE_COMMENT Enable InnoDB support for the XA two-phase commit NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_SYNC_ARRAY_SIZE @@ -2172,7 +2172,7 @@ VARIABLE_COMMENT Enable InnoDB locking in LOCK TABLES NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_THREAD_CONCURRENCY @@ -2228,7 +2228,7 @@ VARIABLE_COMMENT Pause actual purging any delete-marked records, but merely upda NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT NULL VARIABLE_NAME INNODB_TRX_RSEG_N_SLOTS_DEBUG @@ -2298,7 +2298,7 @@ VARIABLE_COMMENT Prevent partial page writes, via atomic writes.The option is us NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_USE_FALLOCATE @@ -2312,7 +2312,7 @@ VARIABLE_COMMENT Preallocate files fast, using operating system functionality. O NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_USE_MTFLUSH @@ -2326,7 +2326,7 @@ VARIABLE_COMMENT Use multi-threaded flush. Default FALSE. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_USE_SYS_MALLOC @@ -2340,7 +2340,7 @@ VARIABLE_COMMENT DEPRECATED. This option may be removed in future releases, toge NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME INNODB_USE_TRIM @@ -2354,12 +2354,12 @@ VARIABLE_COMMENT Use trim. Default FALSE. NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME INNODB_VERSION SESSION_VALUE NULL -GLOBAL_VALUE 5.6.31 +GLOBAL_VALUE 5.6.32 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL 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 6a9615e2dbc..c9cb680d534 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_embedded.result @@ -230,7 +230,7 @@ VARIABLE_COMMENT Run fast part of group commit in a single thread, to optimize k NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME BINLOG_ROW_IMAGE @@ -2302,7 +2302,7 @@ VARIABLE_COMMENT Use memory mapping for reading and writing MyISAM tables NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME MYSQL56_TEMPORAL_FORMAT @@ -2474,17 +2474,17 @@ ENUM_VALUE_LIST NULL READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_SWITCH -SESSION_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=off -GLOBAL_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=off +SESSION_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=off,condition_pushdown_for_derived=on +GLOBAL_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=off,condition_pushdown_for_derived=on GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=off +DEFAULT_VALUE index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=off,condition_pushdown_for_derived=on VARIABLE_SCOPE SESSION VARIABLE_TYPE FLAGSET VARIABLE_COMMENT Fine-tune the optimizer behavior NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,default +ENUM_VALUE_LIST index_merge,index_merge_union,index_merge_sort_union,index_merge_intersection,index_merge_sort_intersection,engine_condition_pushdown,index_condition_pushdown,derived_merge,derived_with_keys,firstmatch,loosescan,materialization,in_to_exists,semijoin,partial_match_rowid_merge,partial_match_table_scan,subquery_cache,mrr,mrr_cost_based,mrr_sort_keys,outer_join_with_cache,semijoin_with_cache,join_cache_incremental,join_cache_hashed,join_cache_bka,optimize_join_buffer_size,table_elimination,extended_keys,exists_to_in,orderby_uses_equalities,condition_pushdown_for_derived,default READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME OPTIMIZER_USE_CONDITION_SELECTIVITY 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 a62d62e563c..2775a24d85e 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -230,7 +230,7 @@ VARIABLE_COMMENT Run fast part of group commit in a single thread, to optimize k NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME BINLOG_ROW_IMAGE @@ -2498,7 +2498,7 @@ VARIABLE_COMMENT Use memory mapping for reading and writing MyISAM tables NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL -ENUM_VALUE_LIST NULL +ENUM_VALUE_LIST OFF,ON READ_ONLY NO COMMAND_LINE_ARGUMENT NONE VARIABLE_NAME MYSQL56_TEMPORAL_FORMAT diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result index f1745a1ad34..36d04afb80d 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result +++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result @@ -162,7 +162,7 @@ GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE OFF VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BOOLEAN -VARIABLE_COMMENT To use a workaround forbad autoincrement value +VARIABLE_COMMENT Enable a workaround to handle the cases where inserting a DEFAULT value into an auto-increment column could fail with duplicate key error NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL @@ -241,13 +241,13 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME WSREP_MAX_WS_ROWS SESSION_VALUE NULL -GLOBAL_VALUE 131072 +GLOBAL_VALUE 0 GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE 131072 +DEFAULT_VALUE 0 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Max number of rows in write set -NUMERIC_MIN_VALUE 1 +NUMERIC_MIN_VALUE 0 NUMERIC_MAX_VALUE 1048576 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL @@ -255,14 +255,14 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME WSREP_MAX_WS_SIZE SESSION_VALUE NULL -GLOBAL_VALUE 1073741824 +GLOBAL_VALUE 2147483647 GLOBAL_VALUE_ORIGIN COMPILE-TIME -DEFAULT_VALUE 1073741824 +DEFAULT_VALUE 2147483647 VARIABLE_SCOPE GLOBAL VARIABLE_TYPE BIGINT UNSIGNED VARIABLE_COMMENT Max write set size (bytes) NUMERIC_MIN_VALUE 1024 -NUMERIC_MAX_VALUE 4294901759 +NUMERIC_MAX_VALUE 2147483647 NUMERIC_BLOCK_SIZE 1 ENUM_VALUE_LIST NULL READ_ONLY NO @@ -367,7 +367,7 @@ READ_ONLY NO COMMAND_LINE_ARGUMENT OPTIONAL VARIABLE_NAME WSREP_PATCH_VERSION SESSION_VALUE NULL -GLOBAL_VALUE wsrep_25.13 +GLOBAL_VALUE wsrep_25.16 GLOBAL_VALUE_ORIGIN COMPILE-TIME DEFAULT_VALUE NULL VARIABLE_SCOPE GLOBAL diff --git a/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result b/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result index 52fede2f538..90925e71c32 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_desync_basic.result @@ -20,7 +20,7 @@ SET @@global.wsrep_desync=ON; Got one of the listed errors SELECT @@global.wsrep_desync; @@global.wsrep_desync -1 +0 # valid values SET @@global.wsrep_desync='OFF'; @@ -31,7 +31,7 @@ SET @@global.wsrep_desync=ON; Got one of the listed errors SELECT @@global.wsrep_desync; @@global.wsrep_desync -1 +0 SET @@global.wsrep_desync=default; SELECT @@global.wsrep_desync; @@global.wsrep_desync diff --git a/mysql-test/suite/sys_vars/r/wsrep_max_ws_rows_basic.result b/mysql-test/suite/sys_vars/r/wsrep_max_ws_rows_basic.result index 15438a2afd5..d96bc8708c5 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_max_ws_rows_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_max_ws_rows_basic.result @@ -6,7 +6,7 @@ SET @wsrep_max_ws_rows_global_saved = @@global.wsrep_max_ws_rows; # default SELECT @@global.wsrep_max_ws_rows; @@global.wsrep_max_ws_rows -131072 +0 # scope SELECT @@session.wsrep_max_ws_rows; @@ -26,11 +26,9 @@ SELECT @@global.wsrep_max_ws_rows; @@global.wsrep_max_ws_rows 131073 SET @@global.wsrep_max_ws_rows=0; -Warnings: -Warning 1292 Truncated incorrect wsrep_max_ws_rows value: '0' SELECT @@global.wsrep_max_ws_rows; @@global.wsrep_max_ws_rows -1 +0 SET @@global.wsrep_max_ws_rows=default; SELECT @global.wsrep_max_ws_rows; @global.wsrep_max_ws_rows diff --git a/mysql-test/suite/sys_vars/r/wsrep_max_ws_size_basic.result b/mysql-test/suite/sys_vars/r/wsrep_max_ws_size_basic.result index 26d8d823a5c..689da3e9cb0 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_max_ws_size_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_max_ws_size_basic.result @@ -1,39 +1,38 @@ # # wsrep_max_ws_size # -# save the initial value -SET @wsrep_max_ws_size_global_saved = @@global.wsrep_max_ws_size; # default SELECT @@global.wsrep_max_ws_size; @@global.wsrep_max_ws_size -1073741824 +2147483647 # scope SELECT @@session.wsrep_max_ws_size; ERROR HY000: Variable 'wsrep_max_ws_size' is a GLOBAL variable SET @@global.wsrep_max_ws_size=1; -Warnings: -Warning 1292 Truncated incorrect wsrep_max_ws_size value: '1' +ERROR HY000: WSREP (galera) not started SELECT @@global.wsrep_max_ws_size; @@global.wsrep_max_ws_size -1024 +2147483647 # valid values SET @@global.wsrep_max_ws_size=1073741824; +ERROR HY000: WSREP (galera) not started SELECT @@global.wsrep_max_ws_size; @@global.wsrep_max_ws_size -1073741824 +2147483647 SET @@global.wsrep_max_ws_size=1073741825; +ERROR HY000: WSREP (galera) not started SELECT @@global.wsrep_max_ws_size; @@global.wsrep_max_ws_size -1073741825 +2147483647 SET @@global.wsrep_max_ws_size=0; -Warnings: -Warning 1292 Truncated incorrect wsrep_max_ws_size value: '0' +ERROR HY000: WSREP (galera) not started SELECT @@global.wsrep_max_ws_size; @@global.wsrep_max_ws_size -1024 +2147483647 SET @@global.wsrep_max_ws_size=default; +ERROR HY000: WSREP (galera) not started SELECT @global.wsrep_max_ws_size; @global.wsrep_max_ws_size NULL @@ -47,12 +46,8 @@ SELECT @global.wsrep_max_ws_size; @global.wsrep_max_ws_size NULL SET @@global.wsrep_max_ws_size=-1; -Warnings: -Warning 1292 Truncated incorrect wsrep_max_ws_size value: '-1' +ERROR HY000: WSREP (galera) not started SELECT @global.wsrep_max_ws_size; @global.wsrep_max_ws_size NULL - -# restore the initial value -SET @@global.wsrep_max_ws_size = @wsrep_max_ws_size_global_saved; # End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result index 5ef36180de5..b2e07c55b38 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result @@ -2,6 +2,7 @@ # wsrep_provider_options # call mtr.add_suppression("WSREP: Failed to get provider options"); +SET @@global.wsrep_provider = @@global.wsrep_provider; # save the initial value SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options; # default diff --git a/mysql-test/suite/sys_vars/t/general_log_file_basic.test b/mysql-test/suite/sys_vars/t/general_log_file_basic.test index 12362fa123c..0a169b472e2 100644 --- a/mysql-test/suite/sys_vars/t/general_log_file_basic.test +++ b/mysql-test/suite/sys_vars/t/general_log_file_basic.test @@ -58,6 +58,20 @@ SET @@global.general_log_file = mytest.log; --error ER_WRONG_TYPE_FOR_VAR SET @@global.general_log_file = 12; +# +# MDEV-10465 +# +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_log_file = 'my.cnf'; +--error ER_WRONG_VALUE_FOR_VAR +SET @@global.general_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------------------------#' ############################################################################## 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 index 28fc17f6077..69ca5f21f62 100644 --- 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 @@ -56,6 +56,20 @@ 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 # diff --git a/mysql-test/suite/sys_vars/t/sysvars_wsrep.test b/mysql-test/suite/sys_vars/t/sysvars_wsrep.test index 25454191e2e..700b129fd62 100644 --- a/mysql-test/suite/sys_vars/t/sysvars_wsrep.test +++ b/mysql-test/suite/sys_vars/t/sysvars_wsrep.test @@ -3,7 +3,9 @@ --let $datadir = `SELECT @@datadir` --let $hostname = `SELECT @@hostname` ---replace_result $datadir DATADIR $hostname HOSTNAME +--replace_result $datadir DATADIR +--let $hostname_regex=/^$hostname\$/HOSTNAME/ +--replace_regex $hostname_regex --vertical_results select * from information_schema.system_variables where variable_name like 'wsrep%' diff --git a/mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test b/mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test index e7af4558f24..50506ed12df 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_max_ws_size_basic.test @@ -4,9 +4,6 @@ --echo # wsrep_max_ws_size --echo # ---echo # save the initial value -SET @wsrep_max_ws_size_global_saved = @@global.wsrep_max_ws_size; - --echo # default SELECT @@global.wsrep_max_ws_size; @@ -14,17 +11,22 @@ SELECT @@global.wsrep_max_ws_size; --echo # scope --error ER_INCORRECT_GLOBAL_LOCAL_VAR SELECT @@session.wsrep_max_ws_size; +--error ER_WRONG_ARGUMENTS SET @@global.wsrep_max_ws_size=1; SELECT @@global.wsrep_max_ws_size; --echo --echo # valid values +--error ER_WRONG_ARGUMENTS SET @@global.wsrep_max_ws_size=1073741824; SELECT @@global.wsrep_max_ws_size; +--error ER_WRONG_ARGUMENTS SET @@global.wsrep_max_ws_size=1073741825; SELECT @@global.wsrep_max_ws_size; +--error ER_WRONG_ARGUMENTS SET @@global.wsrep_max_ws_size=0; SELECT @@global.wsrep_max_ws_size; +--error ER_WRONG_ARGUMENTS SET @@global.wsrep_max_ws_size=default; SELECT @global.wsrep_max_ws_size; @@ -35,11 +37,8 @@ SET @@global.wsrep_max_ws_size=NULL; --error ER_WRONG_TYPE_FOR_VAR SET @@global.wsrep_max_ws_size='junk'; SELECT @global.wsrep_max_ws_size; +--error ER_WRONG_ARGUMENTS SET @@global.wsrep_max_ws_size=-1; SELECT @global.wsrep_max_ws_size; ---echo ---echo # restore the initial value -SET @@global.wsrep_max_ws_size = @wsrep_max_ws_size_global_saved; - --echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test index 73ec4ffc846..d2ea32a0637 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test @@ -6,6 +6,8 @@ call mtr.add_suppression("WSREP: Failed to get provider options"); +SET @@global.wsrep_provider = @@global.wsrep_provider; + --echo # save the initial value SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options; diff --git a/mysql-test/suite/vcol/r/charsets.result b/mysql-test/suite/vcol/r/charsets.result new file mode 100644 index 00000000000..aeff00d3711 --- /dev/null +++ b/mysql-test/suite/vcol/r/charsets.result @@ -0,0 +1,31 @@ +set names utf8; +create table t1 ( +a int, +b varchar(100) as (if(a,collation('й'),hex('ÑŽ'))) +) character set koi8r; +insert t1 (a) values (0),(1); +select * from t1; +a b +0 C0 +1 koi8r_general_ci +set names latin1; +select * from t1; +a b +0 C0 +1 koi8r_general_ci +flush tables; +select * from t1; +a b +0 C0 +1 koi8r_general_ci +set names koi8r; +select * from t1; +a b +0 C0 +1 koi8r_general_ci +flush tables; +select * from t1; +a b +0 C0 +1 koi8r_general_ci +drop table t1; diff --git a/mysql-test/suite/vcol/t/charsets.test b/mysql-test/suite/vcol/t/charsets.test new file mode 100644 index 00000000000..72f9b7a31a6 --- /dev/null +++ b/mysql-test/suite/vcol/t/charsets.test @@ -0,0 +1,19 @@ +# +# vcol definition, table charset, current connection charset +# +set names utf8; +create table t1 ( + a int, + b varchar(100) as (if(a,collation('й'),hex('ÑŽ'))) +) character set koi8r; +insert t1 (a) values (0),(1); +select * from t1; +set names latin1; +select * from t1; +flush tables; +select * from t1; +set names koi8r; +select * from t1; +flush tables; +select * from t1; +drop table t1; diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index 62d7f62440f..30b97e02af3 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -160,7 +160,7 @@ SELECT @@global.wsrep_slave_threads; 1 SELECT @@global.wsrep_cluster_address; @@global.wsrep_cluster_address -NULL + SHOW STATUS LIKE 'threads_connected'; Variable_name Value Threads_connected 1 @@ -173,7 +173,7 @@ SELECT @@global.wsrep_provider; libgalera_smm.so SELECT @@global.wsrep_cluster_address; @@global.wsrep_cluster_address -NULL + SHOW STATUS LIKE 'threads_connected'; Variable_name Value Threads_connected 1 diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index d77dc4e66f9..1769f567848 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -29,7 +29,7 @@ CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*") --disable_query_log eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ---let $galera_version=3.9 +--let $galera_version=25.3.17 source include/check_galera_version.inc; --enable_query_log diff --git a/mysql-test/t/alter_table.test b/mysql-test/t/alter_table.test index 1ff38e4807f..a84b22c69b6 100644 --- a/mysql-test/t/alter_table.test +++ b/mysql-test/t/alter_table.test @@ -1746,5 +1746,3 @@ DROP TABLE t1; --error ER_DUP_CONSTRAINT_NAME CREATE TABLE t1(a INT, b INT, CONSTRAINT min check (a>5), CONSTRAINT min check (b>5)); - - diff --git a/mysql-test/t/func_group.test b/mysql-test/t/func_group.test index 47477c72004..7e342928ef8 100644 --- a/mysql-test/t/func_group.test +++ b/mysql-test/t/func_group.test @@ -1567,6 +1567,37 @@ EXECUTE stmt; DROP TABLE t1,t2,t3,t4,t5,t6; --echo # +--echo # MDEV-10500 CASE/IF Statement returns multiple values and shifts further result values to the next column +--echo # + +CREATE TABLE t1 ( + id int not null AUTO_INCREMENT, + active bool not null, + data1 bigint, + data2 bigint, + data3 bigint, + primary key (id) +); +INSERT INTO t1 (active,data1,data2,data3) VALUES (1,null,100,200); +SELECT + CASE WHEN active THEN SUM(data1) END AS C_1, + SUM(data2) AS C_2, + SUM(data3) AS C_3 +FROM t1; +SELECT + IF(active, SUM(data1), 5) AS C_1, + SUM(data2) AS C_2, + SUM(data3) AS C_3 +FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-10468 Assertion `nr >= 0.0' failed in Item_sum_std::val_real() +--echo # +SELECT STDDEV_POP(f) FROM (SELECT "1e+309" AS f UNION SELECT "-1e+309" AS f) tbl; +SELECT STDDEV(f) FROM (SELECT 1.7976931348623157e+308 AS f UNION SELECT -1.7976931348623157e+308 AS f) tbl; + +--echo # --echo # MDEV-8852 Implicit or explicit CAST from MAX(string) to INT,DOUBLE,DECIMAL does not produce warnings --echo # SELECT MAX('x') << 1, CAST(MAX('x') AS DOUBLE), CAST(MAX('x') AS DECIMAL); @@ -1617,5 +1648,37 @@ SELECT companynr, AVG(fld1), AVG(fld1)<<0 AS avg1, CAST(AVG(fld1) AS UNSIGNED)<< DROP TABLE t1; --echo # +--echo # case where aggregate resolved in the local SELECT +--echo # but outer ones are checked +--echo # +create table t10 (a int , b int, c int); +insert into t10 values (0,0,0),(1,1,1); +create table t11 as select * from t10; +create table t12 as select * from t10; +explain extended select a from t10 where c<3 or a in (select c from t12 union select max(t10.b) from t11 group by t11.c); +drop table t10,t11,t12; +--echo # +--echo # MDEV-10017: Get unexpected `Empty Set` for correlated subquery +--echo # with aggregate functions +--echo # + +create table t1(c1 int, c2 int, c3 int); +insert into t1 values(1,1,1),(2,2,2),(3,3,3); +select * from t1; +create table t2(c1 int, c2 int); +insert into t2 values(2,2); +select * from t2; +--error ER_INVALID_GROUP_FUNC_USE +explain extended +select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+c) from t2 tt)); +--error ER_INVALID_GROUP_FUNC_USE +select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+c) from t2 tt)); + +explain extended +select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+tt.c1) from t2 tt)); +select c1 from t1 having c1 >= (select t.c1 as c from t2 t order by (select min(t1.c1+tt.c1) from t2 tt)); +drop table t1,t2; + +--echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index ad821645aeb..08349f007e1 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -580,11 +580,15 @@ select 5 div 2.0; select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2; --echo # ---echo # End of 5.5 tests +--echo # MDEV-10467 Assertion `nr >= 0.0' failed in Item_sum_std::val_real() --echo # +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT STDDEV_SAMP(ROUND('0', 309)) FROM t1; +DROP TABLE t1; --echo # ---echo # Start of 10.0 tests +--echo # End of 5.5 tests --echo # --echo # @@ -592,7 +596,6 @@ select 5.9 div 2, 1.23456789e3 DIV 2, 1.23456789e9 DIV 2, 1.23456789e19 DIV 2; --echo # SELECT STDDEV_POP(ROUND(0,@A:=2009)) FROM (SELECT 1 UNION SELECT 2) fake_table; - --echo # --echo # Start of 10.2 tests --echo # diff --git a/mysql-test/t/func_misc.test b/mysql-test/t/func_misc.test index f24576cc992..f931352c0e2 100644 --- a/mysql-test/t/func_misc.test +++ b/mysql-test/t/func_misc.test @@ -596,6 +596,16 @@ AND 57813X540X1723 = 'Test'; drop table t1; +# +# Bug#12735545 - PARSER STACK OVERFLOW WITH NAME_CONST +# CONTAINING OR EXPRESSION +# +--error ER_WRONG_ARGUMENTS +SELECT NAME_CONST('a', -(1 OR 2)) OR 1; +--error ER_WRONG_ARGUMENTS +SELECT NAME_CONST('a', -(1 AND 2)) OR 1; +SELECT NAME_CONST('a', -(1)) OR 1; + --echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/func_time.test b/mysql-test/t/func_time.test index 18293f31dd2..12b7c92688f 100644 --- a/mysql-test/t/func_time.test +++ b/mysql-test/t/func_time.test @@ -1712,3 +1712,77 @@ SELECT --echo # --echo # End of 10.0 tests --echo # + +--echo # +--echo # Start of 10.1 tests +--echo # + +--echo # +--echo # MDEV-10317 EXCTACT(MINUTE_MICROSECOND) truncates data +--echo # + +let $query= +SELECT + a, + EXTRACT(YEAR FROM a), + EXTRACT(YEAR_MONTH FROM a), + EXTRACT(QUARTER FROM a), + EXTRACT(MONTH FROM a), + EXTRACT(WEEK FROM a), + EXTRACT(DAY FROM a), + EXTRACT(DAY_HOUR FROM a), + EXTRACT(DAY_MINUTE FROM a), + EXTRACT(DAY_SECOND FROM a), + EXTRACT(HOUR FROM a), + EXTRACT(HOUR_MINUTE FROM a), + EXTRACT(HOUR_SECOND FROM a), + EXTRACT(MINUTE FROM a), + EXTRACT(MINUTE_SECOND FROM a), + EXTRACT(SECOND FROM a), + EXTRACT(MICROSECOND FROM a), + EXTRACT(DAY_MICROSECOND FROM a), + EXTRACT(HOUR_MICROSECOND FROM a), + EXTRACT(MINUTE_MICROSECOND FROM a), + EXTRACT(SECOND_MICROSECOND FROM a) +FROM t1; + + +CREATE TABLE t1 (a DATETIME(6)); +INSERT INTO t1 VALUES ('1999-12-31 23:59:59.999999'); + +--vertical_results +--enable_metadata +--disable_ps_protocol +--eval $query +--enable_ps_protocol +--disable_metadata +--horizontal_results + +--eval CREATE TABLE t2 AS $query +--vertical_results +SELECT * FROM t2; +--horizontal_results +SHOW CREATE TABLE t2; +DROP TABLE t1,t2; + +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES ('-838:59:59.999999'),('838:59:59.999999'); + +--vertical_results +--enable_metadata +--disable_ps_protocol +--eval $query +--enable_ps_protocol +--disable_metadata +--horizontal_results + +--eval CREATE TABLE t2 AS $query +--vertical_results +SELECT * FROM t2; +--horizontal_results +SHOW CREATE TABLE t2; +DROP TABLE t1,t2; + +--echo # +--echo # End of 10.1 tests +--echo # diff --git a/mysql-test/t/group_by.test b/mysql-test/t/group_by.test index f0007186ab2..a1a73d15e1a 100644 --- a/mysql-test/t/group_by.test +++ b/mysql-test/t/group_by.test @@ -1828,3 +1828,39 @@ select distinct a from t1 group by 'a'; insert into t1 values("2001-02-02"),("2001-02-03"); select distinct a from t1 group by 'a'; drop table t1; + +--echo # +--echo # MDEV-10324: Server crash in get_sel_arg_for_keypart or Assertion `n < size()' failed in Mem_root_array +--echo # +CREATE TABLE t1 ( + job_id int(10) unsigned NOT NULL AUTO_INCREMENT, + job_cmd varbinary(60) NOT NULL DEFAULT '', + job_namespace int(11) NOT NULL, + job_title varbinary(255) NOT NULL, + job_params blob NOT NULL, + job_timestamp varbinary(14) DEFAULT NULL, + job_random int(10) unsigned NOT NULL DEFAULT '0', + job_token varbinary(32) NOT NULL DEFAULT '', + job_token_timestamp varbinary(14) DEFAULT NULL, + job_sha1 varbinary(32) NOT NULL DEFAULT '', + job_attempts int(10) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (job_id), + KEY job_cmd (job_cmd,job_namespace,job_title,job_params(128)), + KEY job_timestamp (job_timestamp), + KEY job_sha1 (job_sha1), + KEY job_cmd_token (job_cmd,job_token,job_random), + KEY job_cmd_token_id (job_cmd,job_token,job_id) +); + +INSERT INTO t1 VALUES + (NULL, 'foo', 1, 'foo', 'foo', 'foo', 1, 'foo', 'foo', 'foo', 1), + (NULL, 'bar', 2, 'bar', 'bar', 'bar', 2, 'bar', 'bar', 'bar', 2); + +SELECT DISTINCT job_cmd FROM t1 WHERE job_cmd IN ('foobar','null'); +drop table t1; + +CREATE TABLE t1 (f1 INT NOT NULL, f2 VARCHAR(3) NOT NULL, KEY(f1), KEY(f2, f1)); +INSERT INTO t1 VALUES (0,'foo'),(1,'bar'); +SELECT 1 IN ( SELECT COUNT( DISTINCT f2 ) FROM t1 WHERE f1 <= 4 ); +drop table t1; + diff --git a/mysql-test/t/group_by_innodb.test b/mysql-test/t/group_by_innodb.test index e072a94fada..ed65e0c3e57 100644 --- a/mysql-test/t/group_by_innodb.test +++ b/mysql-test/t/group_by_innodb.test @@ -125,4 +125,34 @@ ORDER BY id DESC; DROP TABLE t1, t2; +--echo # Port of testcase: +--echo # +--echo # Bug#20819199 ASSERTION FAILED IN TEST_IF_SKIP_SORT_ORDER +--echo # + +CREATE TABLE t0 ( a INT ); +INSERT INTO t0 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); + +CREATE TABLE t1 ( + pk INT NOT NULL AUTO_INCREMENT, + a INT, + b INT, + PRIMARY KEY (pk), + KEY idx1 (a), + KEY idx2 (b, a), + KEY idx3 (a, b) +) ENGINE = InnoDB; + +INSERT INTO t1 (a, b) SELECT t01.a, t02.a FROM t0 t01, t0 t02; + +ANALYZE TABLE t1; + +let $query= +SELECT DISTINCT a, MAX(b) FROM t1 WHERE a >= 0 GROUP BY a,a; + +eval EXPLAIN $query; +eval $query; + +DROP TABLE t0, t1; + --echo # End of tests diff --git a/mysql-test/t/information_schema_stats.test b/mysql-test/t/information_schema_stats.test index 38248063d68..c7f39894ce7 100644 --- a/mysql-test/t/information_schema_stats.test +++ b/mysql-test/t/information_schema_stats.test @@ -13,6 +13,7 @@ alter table just_a_test add key IND_just_a_test_first_name_last_name(first_name, alter table just_a_test add key IND_just_a_test_state(state); select count(*) from just_a_test where first_name='fc' and last_name='lc'; select count(*) from just_a_test where state = 'California'; +--sorted_result select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; alter table just_a_test drop key IND_just_a_test_first_name_last_name; @@ -36,6 +37,7 @@ insert into just_a_test values(1,'fa','la','china_a',11111111,'fa_la@163.com','C select count(*) from just_a_test where first_name='fc' and last_name='lc'; select count(*) from just_a_test where state = 'California'; select count(*) from just_a_test where id between 2 and 4; +--sorted_result select * from information_schema.index_statistics where table_schema='test' and table_name='just_a_test'; select * from information_schema.table_statistics where table_schema='test' and table_name='just_a_test'; drop table just_a_test; diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test index 9f3a89ff948..bf94b7dd3d5 100644 --- a/mysql-test/t/innodb_ext_key.test +++ b/mysql-test/t/innodb_ext_key.test @@ -693,5 +693,90 @@ drop table t1, t2; set optimizer_switch=@save_optimizer_switch; +--echo # +--echo # MDEV-10325: Queries examines all rows of a tables when it should not +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 ( + pk int not null, + col1 varchar(32), + filler varchar(100), + key idx1(col1(10)), + primary key (pk) +)engine=innodb; + +insert into t1 +select + A.a + 10*B.a + 100*C.a, + concat('1234567890-', 1000+ A.a + 10*B.a + 100*C.a), + repeat('filler-data-', 4) +from + t0 A, t0 B, t0 C; + +let $q=explain select * from t1 where col1='1234567890-a'; +let $rows=query_get_value($q, rows, 1); +if ($rows < 2) +{ + --echo The EXPLAIN should not produce a query plan with type=ref, rows=1 + --die Fix for MDEV-10325 didnt work; +} + +drop table t0,t1; + +--echo # +--echo # MDEV-10360: Extended keys: index properties depend on index order +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 ( + index_id bigint(20) unsigned NOT NULL, + index_class varchar(265) COLLATE latin1_general_ci DEFAULT NULL , + index_object_id int(10) unsigned NOT NULL DEFAULT '0' , + index_date_updated int(10) unsigned DEFAULT NULL , + + PRIMARY KEY (index_id), + KEY object (index_class(181),index_object_id), + KEY index_date_updated (index_date_updated) +) engine=innodb; + +create table t2 ( + index_id bigint(20) unsigned NOT NULL, + index_class varchar(265) COLLATE latin1_general_ci DEFAULT NULL , + index_object_id int(10) unsigned NOT NULL DEFAULT '0' , + index_date_updated int(10) unsigned DEFAULT NULL , + + PRIMARY KEY (index_id), + KEY index_date_updated (index_date_updated), + KEY object (index_class(181),index_object_id) +) engine=innodb; + +insert into t1 select + @a:=A.a + 10*B.a + 100*C.a, + concat('val-', @a), + 123456, + A.a + 10*B.a +from + t0 A, t0 B, t0 C; + +insert into t2 select * from t1; + +--echo # This must have the same query plan as the query below it: +--echo # type=range, key=index_date_updated, key_len=13 +--replace_column 9 # +explain +select * from t1 force index(index_date_updated) +where index_date_updated= 10 and index_id < 800; + +--echo # This used to work from the start: +--replace_column 9 # +explain +select * from t2 force index(index_date_updated) +where index_date_updated= 10 and index_id < 800; + +drop table t0,t1,t2; + set optimizer_switch=@save_ext_key_optimizer_switch; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/t/loaddata.test b/mysql-test/t/loaddata.test index 35243864c04..7e529194303 100644 --- a/mysql-test/t/loaddata.test +++ b/mysql-test/t/loaddata.test @@ -612,7 +612,7 @@ disconnect con1; --echo # CREATE TABLE t1(f1 INT); -EVAL SELECT 0xE1BB30 INTO OUTFILE 't1.dat'; +EVAL SELECT 0xE1C330 INTO OUTFILE 't1.dat'; --disable_warnings LOAD DATA INFILE 't1.dat' IGNORE INTO TABLE t1 CHARACTER SET utf8; --enable_warnings @@ -658,3 +658,27 @@ SET @@sql_mode= @old_mode; --remove_file $MYSQLTEST_VARDIR/mysql DROP TABLE t1; +--echo +--echo # +--echo # Bug#23080148 - Backport of Bug#20683959. +--echo # Bug#20683959 LOAD DATA INFILE IGNORES A SPECIFIC ROW SILENTLY +--echo # UNDER DB CHARSET IS UTF8. +--echo # + +CREATE DATABASE d1 CHARSET latin1; +USE d1; +CREATE TABLE t1 (val TEXT); +LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1; +SELECT COUNT(*) FROM t1; +SELECT HEX(val) FROM t1; + +CREATE DATABASE d2 CHARSET utf8; +USE d2; +CREATE TABLE t1 (val TEXT); +LOAD DATA INFILE '../../std_data/bug20683959loaddata.txt' INTO TABLE t1; +SELECT COUNT(*) FROM t1; +SELECT HEX(val) FROM t1; + +DROP TABLE d1.t1, d2.t1; +DROP DATABASE d1; +DROP DATABASE d2; diff --git a/mysql-test/t/myisam_enable_keys-10506.test b/mysql-test/t/myisam_enable_keys-10506.test new file mode 100644 index 00000000000..8e1c058c3f0 --- /dev/null +++ b/mysql-test/t/myisam_enable_keys-10506.test @@ -0,0 +1,117 @@ +# +# MDEV-10506 Protocol::end_statement(): Assertion `0' failed upon ALTER TABLE +# +CREATE TABLE t1 ( + pk INT AUTO_INCREMENT, + i INT, + d DATE, + dt DATETIME, + v VARCHAR(1), + PRIMARY KEY (pk), + KEY (dt) +) ENGINE=MyISAM; +INSERT INTO t1 (i, d, dt, v) VALUES + (9, '2005-07-23', '2004-05-13 01:01:39', 't'), + (2, '2009-11-01', '2003-12-24 07:39:29', 'h'), + (6, NULL, '2008-07-03 05:32:22', 'l'), + (6, '2007-07-16', '2008-08-28 18:46:11', 'j'), + (5, NULL, '2001-07-12 21:27:00', 'h'), + (3, '2007-07-22', '1900-01-01 00:00:00', 'p'), + (2, '2000-11-21', '2007-05-25 11:58:54', 'g'), + (6, '1900-01-01', '2009-06-03 17:11:10', 'i'), + (2, '2008-02-10', '2001-06-15 16:20:07', 'p'), + (3, '2009-06-04', '1900-01-01 00:00:00', 'h'), + (9, '2007-04-25', '1900-01-01 00:00:00', 'e'), + (9, '2006-03-02', '1900-01-01 00:00:00', 'e'), + (1, '1900-01-01', '2002-11-08 09:33:27', 'u'), + (7, '2008-07-13', '2007-08-07 17:35:52', 'j'), + (0, '2004-11-12', '2006-05-01 00:00:00', 'e'), + (0, '1900-01-01', '2003-05-01 00:00:00', 'z'), + (1, '2009-09-02', '2007-02-12 09:30:49', 'w'), + (0, '2004-11-06', '1900-01-01 00:00:00', 't'), + (4, '2003-01-06', '2002-07-03 02:51:11', 'i'), + (6, '2006-01-14', '2008-02-26 04:57:32', 'i'), + (0, '2002-01-19', '2009-02-12 00:00:00', 'i'), + (8, '2007-02-12', '1900-01-01 00:00:00', 'b'), + (4, '1900-01-01', '2001-05-16 05:28:40', 'm'), + (2, '2005-07-16', NULL, 'j'), + (1, '2004-09-04', '2001-01-24 21:45:18', 'v'), + (3, '2009-07-01', NULL, NULL), + (2, '2009-07-21', '2002-07-24 00:00:00', 'h'), + (4, NULL, '2001-11-03 12:22:30', 'q'), + (1, '2002-06-22', '2008-06-17 03:17:59', 'f'), + (7, '2005-06-23', '2005-12-24 00:00:00', 'p'), + (6, '2001-05-20', '2008-10-23 00:00:00', NULL), + (3, '2001-10-01', '2000-10-12 16:32:35', 'o'), + (3, '2001-01-07', '2005-09-11 10:09:54', 'w'), + (6, '2007-11-02', '2009-09-10 01:44:18', 'l'), + (6, NULL, NULL, 'i'), + (9, NULL, '2002-05-18 15:21:55', 'd'), + (4, '2008-12-21', '2004-10-15 10:09:54', 'j'), + (6, '2003-10-05', '2009-07-13 03:51:02', 'e'), + (2, '2001-03-03', '1900-01-01 00:00:00', 'e'), + (2, '2007-04-04', '2001-11-08 21:14:52', 'q'), + (5, NULL, '2006-12-02 00:00:00', 'm'), + (0, '2009-01-04', '1900-01-01 00:00:00', NULL), + (8, '2008-04-03', '2005-01-01 11:55:18', 'q'), + (8, NULL, '2005-02-28 03:44:02', 'w'), + (0, '2003-08-22', NULL, 'c'), + (9, '1900-01-01', NULL, 'y'), + (NULL, NULL, '2006-08-25 16:28:09', 'g'), + (5, '2004-07-04', '2002-08-11 00:00:00', 'z'), + (1, '1900-01-01', '2007-07-22 21:19:18', 'm'), + (2, '2007-02-04', '2006-02-10 18:41:38', 't'), + (2, '1900-01-01', '2009-02-16 14:58:58', 'd'), + (7, '2001-03-14', '2007-08-14 00:00:00', 'h'), + (0, NULL, '1900-01-01 00:00:00', NULL), + (1, '2008-10-05', NULL, 'f'), + (6, '2001-11-25', '2008-12-03 06:59:23', 'l'), + (NULL, '2003-01-27', '2008-10-04 00:00:00', 'g'), + (8, '2008-08-08', '2009-07-07 07:00:21', 'v'), + (8, '2006-07-03', '2001-04-15 00:00:00', NULL), + (5, '2002-11-21', '2007-07-08 04:01:58', 'm'), + (5, '2006-04-08', '2007-09-23 00:01:35', 'i'), + (5, '2001-05-06', '2008-05-15 00:00:00', 'h'), + (7, '1900-01-01', '1900-01-01 00:00:00', 'u'), + (30, '2007-04-16', '2004-03-05 23:35:38', 'o'), + (NULL, '1900-01-01', '2007-08-25 01:32:47', 'z'), + (6, '2004-12-03', '1900-01-01 00:00:00', 'o'), + (8, '2001-06-23', '1900-01-01 00:00:00', 'f'), + (NULL, '2008-12-15', '2001-05-19 08:28:28', 'a'), + (9, '2000-02-15', '2009-09-03 06:07:22', 'd'), + (2, '2001-08-05', '2006-10-08 07:17:27', 'k'), + (5, '2004-01-17', '2003-09-06 20:36:01', 'd'), + (4, '2003-10-01', '2001-02-05 18:10:49', 'u'), + (4, '2003-07-28', '2001-01-07 16:11:37', 'h'), + (0, '1900-01-01', '2008-08-01 05:26:38', 'w'), + (9, '1900-01-01', '2001-05-08 00:00:00', 't'), + (1, '2000-04-17', '2008-07-10 21:26:28', 'i'), + (8, '2002-01-05', '2006-08-06 20:56:35', 'k'), + (9, '2001-04-10', '2003-02-17 00:00:00', 'z'), + (0, '2009-12-04', NULL, 'h'), + (7, NULL, '2004-10-27 00:29:57', 'h'), + (2, '2006-03-07', '2008-03-04 06:14:13', 'b'), + (0, '2001-10-15', '2001-03-17 00:00:00', 'm'), + (5, '1900-01-01', '2009-02-21 11:35:50', 'i'), + (4, NULL, '1900-01-01 00:00:00', 'w'), + (5, '2009-04-05', '1900-01-01 00:00:00', 'm'), + (6, '2001-03-19', '2001-04-12 00:00:00', 'q'), + (NULL, '2009-12-08', '2001-12-04 20:21:01', 'k'), + (2, '2005-02-09', '2001-05-27 08:41:01', 'l'), + (9, '2004-05-25', '2004-09-18 00:00:00', 'c'), + (3, '2005-01-17', '2002-09-12 11:18:48', 'd'), + (0, '2003-08-28', '1900-01-01 00:00:00', 'k'), + (6, '2006-10-11', '2003-10-28 03:31:02', 'a'), + (5, '1900-01-01', '2001-08-22 10:20:09', 'p'), + (8, '1900-01-01', '2008-04-24 00:00:00', 'o'), + (4, '2005-08-18', '2006-11-10 10:08:49', 'e'), + (NULL, '2007-03-12', '2007-10-16 00:00:00', 'n'), + (1, '2000-11-18', '2009-05-27 12:25:07', 't'), + (4, '2001-03-03', NULL, 'u'), + (3, '2003-09-11', '2001-09-10 18:10:10', 'f'), + (4, '2007-06-17', '1900-01-01 00:00:00', 't'), + (NULL, '2008-09-11', '2004-06-07 23:17:09', 'k'); +ALTER TABLE t1 ADD UNIQUE KEY ind1 (pk, d, i, v); +--error ER_DUP_ENTRY +ALTER TABLE t1 ADD UNIQUE KEY ind2 (d, v); +DROP TABLE t1; diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index e479a2232f0..779ea8d13d4 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -309,15 +309,36 @@ CHECK TABLE bug47205 FOR UPGRADE; DROP TABLE bug47205; + --echo # --echo #MDEV-6128:[PATCH] mysqlcheck wrongly escapes '.' in table names --echo # -CREATE TABLE test.`t.1` (id int); +create table `t.1` (id int); +create view `v.1` as select 1; --echo mysqlcheck test t.1 --exec $MYSQL_CHECK test t.1 +--echo mysqlcheck --all-in-1 test t.1 +--exec $MYSQL_CHECK --all-in-1 test t.1 +--echo mysqlcheck --all-in-1 --databases --process-views test +--exec $MYSQL_CHECK --all-in-1 --databases --process-views test + +create table `t.2`(a varchar(20) primary key) default character set utf8 collate utf8_general_ci engine=innodb; +flush table `t.2`; +--remove_file $MYSQLD_DATADIR/test/t@002e2.frm +--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/t@002e2.frm + +--copy_file std_data/bug36055.frm $MYSQLD_DATADIR/test/t@002e3.frm +--copy_file std_data/bug36055.MYD $MYSQLD_DATADIR/test/t@002e3.MYD +--copy_file std_data/bug36055.MYI $MYSQLD_DATADIR/test/t@002e3.MYI -drop table test.`t.1`; +--echo mysqlcheck --check-upgrade --auto-repair test +--exec $MYSQL_CHECK --check-upgrade --auto-repair test + +check table `t.1`, `t.2`, `t.3`; +check table `t.1`, `t.2`, `t.3` for upgrade; +drop view `v.1`; +drop table test.`t.1`, `t.2`, `t.3`; --echo # --echo # MDEV-8123 mysqlcheck: new --process-views option conflicts with --quick, --extended and such @@ -355,6 +376,28 @@ create table `#mysql50#t1``1` (a int) engine=myisam; show tables; drop table `t1``1`; +# +# MDEV-9440 mysqlcheck -A --auto-repair selects wrong database when trying to repair broken table +# +call mtr.add_suppression("ha_myisam"); +call mtr.add_suppression("Checking table"); +create database mysqltest1; +create table mysqltest1.t1 (a int) engine=myisam; +create table t2 (a int); + +let $datadir= `select @@datadir`; +remove_file $datadir/mysqltest1/t1.MYD; +write_file $datadir/mysqltest1/t1.MYD; +foo +EOF + +check table mysqltest1.t1; + +--exec $MYSQL_CHECK -A --auto-repair --fast + +drop table t2; +drop database mysqltest1; + --echo # --echo #MDEV-7384 [PATCH] add PERSISENT FOR ALL option to mysqlanalyze/mysqlcheck --echo # diff --git a/mysql-test/t/named_pipe.test b/mysql-test/t/named_pipe.test index 8dcab3329e4..af74c200e96 100644 --- a/mysql-test/t/named_pipe.test +++ b/mysql-test/t/named_pipe.test @@ -22,3 +22,12 @@ connect(pipe_con,localhost,root,,,,,PIPE); connection default; disconnect pipe_con; + +# MDEV-10383 : check that other server cannot 'bind' on the same pipe +let $MYSQLD_DATADIR= `select @@datadir`; +--error 1 +--exec $MYSQLD_CMD --enable-named-pipe --skip-networking --log-error=second-mysqld.err +let SEARCH_FILE=$MYSQLD_DATADIR/second-mysqld.err; +let SEARCH_RANGE= -50; +let SEARCH_PATTERN=\[ERROR\] Create named pipe failed; +source include/search_pattern_in_file.inc; diff --git a/mysql-test/t/openssl_1.test b/mysql-test/t/openssl_1.test index 837206e2717..eea74b5b012 100644 --- a/mysql-test/t/openssl_1.test +++ b/mysql-test/t/openssl_1.test @@ -134,8 +134,7 @@ drop table t1; # verification of servers certificate by setting both ca certificate # and ca path to NULL # ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA ---exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SHOW STATUS LIKE 'ssl_Cipher'" 2>&1 +--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1 --echo End of 5.0 tests # @@ -259,8 +258,7 @@ select 'is still running; no cipher request crashed the server' as result from d GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; FLUSH PRIVILEGES; connect(con1,localhost,bug42158,,,,,SSL); ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; disconnect con1; connection default; DROP USER bug42158@localhost; diff --git a/mysql-test/t/ps_1general.test b/mysql-test/t/ps_1general.test index 5fedc787e01..9dfab0f07ba 100644 --- a/mysql-test/t/ps_1general.test +++ b/mysql-test/t/ps_1general.test @@ -935,3 +935,10 @@ drop table t1; # Matthias # End of 4.1 tests + +# +# MDEV-10318 unset params in --ps --embedded +# +--error ER_PARSE_ERROR,2031 +select ?+1; + diff --git a/mysql-test/t/range.test b/mysql-test/t/range.test index 7f0e063124e..30f4419bd7e 100644 --- a/mysql-test/t/range.test +++ b/mysql-test/t/range.test @@ -1691,6 +1691,35 @@ select a, b from t2 where (a, b) in ((0, 0), (1, 1)); drop table t2; --echo # +--echo # MDEV-10228: Delete missing rows with OR conditions +--echo # (The example uses UPDATE, because UPDATE allows to use index hints +--echo # and so it's possible to make an example that works with any storage +--echo # engine) +--echo # + +CREATE TABLE t1 ( + key1varchar varchar(14) NOT NULL, + key2int int(11) NOT NULL DEFAULT '0', + col1 int, + PRIMARY KEY (key1varchar,key2int), + KEY key1varchar (key1varchar), + KEY key2int (key2int) +) DEFAULT CHARSET=utf8; + +insert into t1 values + ('value1',0, 0), + ('value1',1, 0), + ('value1',1000685, 0), + ('value1',1003560, 0), + ('value1',1004807, 0); + +update t1 force index (PRIMARY) set col1=12345 +where (key1varchar='value1' AND (key2int <=1 OR key2int > 1)); +--echo # The following must show col1=12345 for all rows: +select * from t1; +drop table t1; + +--echo # --echo # BUG#13731380: RANGE OPTIMIZER CALLS RECORDS_IN_RANGE() FOR OPEN RANGE --echo # diff --git a/mysql-test/t/sp-prelocking.test b/mysql-test/t/sp-prelocking.test index 966c59a5789..c1378d59196 100644 --- a/mysql-test/t/sp-prelocking.test +++ b/mysql-test/t/sp-prelocking.test @@ -388,3 +388,29 @@ DROP TABLE t1, t2; --echo End of 5.0 tests +--echo # +--echo # Bug#21142859: FUNCTION UPDATING A VIEW FAILS TO FIND TABLE THAT ACTUALLY EXISTS +--echo # + +CREATE TABLE t1 SELECT 1 AS fld1, 'A' AS fld2; +CREATE TABLE t2 (fld3 INT, fld4 CHAR(1)); + +CREATE VIEW v1 AS SELECT * FROM t1; + +CREATE TRIGGER t1_au AFTER UPDATE ON t1 +FOR EACH ROW INSERT INTO t2 VALUES (new.fld1, new.fld2); + +DELIMITER !; +CREATE FUNCTION f1() RETURNS INT +BEGIN + UPDATE v1 SET fld2='B' WHERE fld1=1; + RETURN row_count(); +END ! +DELIMITER ;! + +--echo # Without the patch, an error was getting reported. +SELECT f1(); + +DROP FUNCTION f1; +DROP VIEW v1; +DROP TABLE t1,t2; diff --git a/mysql-test/t/ssl.test b/mysql-test/t/ssl.test index 88766e7cf39..9a08b273b6b 100644 --- a/mysql-test/t/ssl.test +++ b/mysql-test/t/ssl.test @@ -11,8 +11,7 @@ connect (ssl_con,localhost,root,,,,,SSL); # Check ssl turned on ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; # Check ssl expiration SHOW STATUS LIKE 'Ssl_server_not_before'; @@ -22,8 +21,7 @@ SHOW STATUS LIKE 'Ssl_server_not_after'; -- source include/common-tests.inc # Check ssl turned on ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; # # MDEV-7697 Client reports ERROR 2006 (MySQL server has gone away) or ERROR 2013 (Lost connection to MySQL server during query) while executing AES* functions under SSL diff --git a/mysql-test/t/ssl_ca.test b/mysql-test/t/ssl_ca.test index 8e81f44e61c..8d830a75879 100644 --- a/mysql-test/t/ssl_ca.test +++ b/mysql-test/t/ssl_ca.test @@ -7,11 +7,10 @@ --echo # try to connect with wrong '--ssl-ca' path : should fail --error 1 ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/wrong-cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" 2>&1 +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/wrong-cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1 --echo # try to connect with correct '--ssl-ca' path : should connect ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" --echo # --echo # Bug#21920678: SSL-CA DOES NOT ACCEPT ~USER TILDE HOME DIRECTORY @@ -22,15 +21,12 @@ --echo # try to connect with '--ssl-ca' option using tilde home directoy --echo # path substitution : should connect ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA ---exec $MYSQL --ssl-ca$mysql_test_dir_path/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" +--exec $MYSQL --ssl-ca$mysql_test_dir_path/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" --echo # try to connect with '--ssl-key' option using tilde home directoy --echo # path substitution : should connect ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key$mysql_test_dir_path/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key$mysql_test_dir_path/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" --echo # try to connect with '--ssl-cert' option using tilde home directoy --echo # path substitution : should connect ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert$mysql_test_dir_path/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_cipher'" +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert$mysql_test_dir_path/std_data/client-cert.pem test -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" diff --git a/mysql-test/t/ssl_compress.test b/mysql-test/t/ssl_compress.test index 28f3453c23e..588d4555db8 100644 --- a/mysql-test/t/ssl_compress.test +++ b/mysql-test/t/ssl_compress.test @@ -11,8 +11,7 @@ connect (ssl_compress_con,localhost,root,,,,,SSL COMPRESS); # Check ssl turned on ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; # Check compression turned on SHOW STATUS LIKE 'Compression'; @@ -21,8 +20,7 @@ SHOW STATUS LIKE 'Compression'; -- source include/common-tests.inc # Check ssl turned on ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; # Check compression turned on SHOW STATUS LIKE 'Compression'; diff --git a/mysql-test/t/ssl_timeout.test b/mysql-test/t/ssl_timeout.test index 806b928aca0..430fe7130de 100644 --- a/mysql-test/t/ssl_timeout.test +++ b/mysql-test/t/ssl_timeout.test @@ -7,8 +7,7 @@ connect (ssl_con,localhost,root,,,,,SSL read_timeout=5); --echo # Check ssl turned on ---replace_result DHE-RSA-AES256-GCM-SHA384 DHE-RSA-AES256-SHA DHE-RSA-CHACHA20-POLY1305 DHE-RSA-AES256-SHA -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; # --error CR_SERVER_LOST --error 2013 diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test index 67af426f5fe..aaecaf020a0 100644 --- a/mysql-test/t/subselect.test +++ b/mysql-test/t/subselect.test @@ -6009,5 +6009,22 @@ SET NAMES utf8; CREATE TABLE t1 (f VARCHAR(8)) ENGINE=MyISAM; INSERT INTO t1 VALUES ('foo'); SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar' UNION SELECT 'baz' ); +SELECT f FROM t1 WHERE f > ALL ( SELECT 'bar'); drop table t1; SET NAMES default; + +--echo # +--echo # MDEV-10045: Server crashes in Time_and_counter_tracker::incr_loops +--echo # +SET NAMES utf8; + +CREATE TABLE t1 (f1 VARCHAR(3), f2 INT UNSIGNED) ENGINE=MyISAM; +CREATE TABLE t2 (f3 INT) ENGINE=MyISAM; + +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo' UNION SELECT 'bar' ); +SELECT * FROM t1, t2 WHERE f3 = f2 AND f1 > ANY ( SELECT 'foo'); + +DROP TABLE t1, t2; +SET NAMES default; + +--echo End of 10.1 tests diff --git a/mysql-test/t/subselect_sj_mat.test b/mysql-test/t/subselect_sj_mat.test index d2bafa86028..559b380a7dc 100644 --- a/mysql-test/t/subselect_sj_mat.test +++ b/mysql-test/t/subselect_sj_mat.test @@ -1925,3 +1925,15 @@ EXECUTE stmt; DROP TABLE t1,t2,t3; +--echo # +--echo # MDEV-10389: Query returns different results on a debug vs non-debug build of the same revision +--echo # +CREATE TABLE t1 (i1 INT, i2 INT NOT NULL); +INSERT INTO t1 VALUES (1,4),(2,6); + +SELECT * FROM t1 AS alias1 +WHERE alias1.i1 IN ( + SELECT i1 FROM t1 WHERE alias1.i2 IN ( SELECT i2 FROM t1 HAVING i2 <> 7 ) +); +DROP TABLE t1; + diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test index fc1b8fad514..7ba4de34ea9 100644 --- a/mysql-test/t/temp_table.test +++ b/mysql-test/t/temp_table.test @@ -321,6 +321,10 @@ REPAIR TABLE t1, t2, t3; DROP TABLES t1, t2, t3; +CREATE TEMPORARY TABLE t1 (a int); +RENAME TABLE t1 TO t2; +DROP TABLE t2; + # # CREATE TEMPORARY TEMPORARY TABLE # diff --git a/mysql-test/t/type_date.test b/mysql-test/t/type_date.test index 71b1e76ac47..63c89f318fc 100644 --- a/mysql-test/t/type_date.test +++ b/mysql-test/t/type_date.test @@ -169,18 +169,8 @@ DROP TABLE t1; # CREATE TABLE t1 (a DATE, b INT, PRIMARY KEY (a,b)); -## The current sub test could fail (difference to expected result) if we -## have just reached midnight. -## (Bug#41776 type_date.test may fail if run around midnight) -## Therefore we sleep a bit if we are too close to midnight. -## The complete test itself needs in average less than 1 second. -## Therefore a time_distance to midnight of 5 seconds should be sufficient. -if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 5)`) -{ - # We are here when CURTIME() is between '23:59:56' and '23:59:59'. - # So a sleep time of 5 seconds brings us between '00:00:01' and '00:00:04'. - --real_sleep 5 -} + +SET timestamp=UNIX_TIMESTAMP('2016-07-21 14:48:18'); INSERT INTO t1 VALUES (DATE(NOW()), 1); SELECT COUNT(*) FROM t1 WHERE a = NOW(); EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); @@ -192,6 +182,7 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW() AND b = 1; ALTER TABLE t1 DROP PRIMARY KEY; SELECT COUNT(*) FROM t1 WHERE a = NOW(); EXPLAIN SELECT COUNT(*) FROM t1 WHERE a = NOW(); +SET timestamp=DEFAULT; DROP TABLE t1; diff --git a/mysql-test/t/xtradb_mrr.test b/mysql-test/t/xtradb_mrr.test index 260eb9f3955..d994c182ccc 100644 --- a/mysql-test/t/xtradb_mrr.test +++ b/mysql-test/t/xtradb_mrr.test @@ -33,8 +33,8 @@ insert into t2 select from t1 A, t1 B, t1 C; explain -select count(length(a) + length(filler)) from t2 where a>='a-1000-a' and a <'a-1001-a'; -select count(length(a) + length(filler)) from t2 where a>='a-1000-a' and a <'a-1001-a'; +select count(length(a) + length(filler)) from t2 force index (a) where a>='a-1000-a' and a <'a-1001-a'; +select count(length(a) + length(filler)) from t2 force index (a) where a>='a-1000-a' and a <'a-1001-a'; drop table t2; # Try a very big rowid diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests new file mode 100644 index 00000000000..daba2ea8ae8 --- /dev/null +++ b/mysql-test/unstable-tests @@ -0,0 +1,355 @@ +############################################################################## +# +# List the test cases which, unlike tests from disabled.def files, +# can still be run on the current tree meaningfully, but are known +# or suspected to fail sporadically on different reasons. +# +# Most common reasons are either test failures observed in buildbot, +# or recent modifications to the tests which make their stability +# unknown. +# +# Tests included due to recent modifications are later removed from the +# list, if during a certain period they do not fail (and are not +# modified again). Tests included due to intermittent failures are +# removed when corresponding bug reports are closed. +# +# Separate the test case name and the comment with ':'. +# +# <suitename>.<testcasename> : MDEV-xxxxx - <comment> +# +# '*' wildcard in testcase names is supported. +# +# To use the list, run MTR with --skip-test-list=unstable-tests option. +# +############################################################################## + +main.analyze_stmt_slow_query_log : MDEV-7558 - wrong result +main.bootstrap : Modified on 2016-06-18 (MDEV-9969) +main.create_delayed : MDEV-10605 - failed with timeout +main.create_or_replace : Modified on 2016-06-23 (MDEV-9728) +main.ctype_recoding : Modified on 2016-06-10 (MDEV-10181) +main.ctype_utf8 : Modified on 2016-06-21 (merge) +main.ctype_utf8mb4 : Modified on 2016-06-21 (merge) +main.ctype_utf16le : MDEV-10675: timeout or extra warnings +main.events_1 : Modified on 2016-06-21 (MDEV-9524) +main.func_group : Modified on 2016-08-08 (MDEV-10468) +main.func_in : Modified on 2016-06-20 (MDEV-10020) +main.func_math : Modified on 2016-08-10 (merge) +main.func_misc : Modified on 2016-08-10 (merge) +main.grant2 : Modified on 2016-07-18 (MDEV-8569) +main.help : Modified on 2016-06-21 (MDEV-9524) +main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown +main.index_intersect_innodb : MDEV-10643 - failed with timeout +main.index_merge_innodb : MDEV-7142 - sporadic wrong execution plan +main.information_schema_stats : Modified on 2016-07-25 (MDEV-10428) +main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure +main.insert_innodb : Modified on 2016-06-14 (merge from upstream) +main.loaddata : Modified on 2016-08-10 (merge) +main.locale : Modified on 2016-06-21 (merge) +main.mdev-504 : MDEV-10607 - sporadic "can't connect" +main.mdev375 : MDEV-10607 - sporadic "can't connect" +main.merge : MDEV-10607 - sporadic "can't connect" +main.multi_update : Modified on 2016-06-20 (MDEV-5973) +main.myisam_enable_keys-10506 : New test, added on 2016-08-10 (MDEV-10506) +main.mysqlcheck : Modified on 2016-08-10 (merge) +main.mysqldump : MDEV-10512 - sporadic assertion failure +main.mysqltest : MDEV-9269 - fails on Alpha +main.named_pipe : Modified on 2016-08-02 (MDEV-10383) +main.openssl_1 : Modified on 2016-07-11 (MDEV-10211) +main.order_by_optimizer_innodb : MDEV-10683 - wrong execution plan +main.parser : Modified on 2016-06-21 (merge) +main.pool_of_threads : MDEV-10100 - sporadic error on detecting max connections +main.ps_1general : Modified on 2016-07-12 (merge) +main.range : Modified on 2016-08-10 (merge) +main.range_mrr_icp : Modified on 2016-08-10 (merge) +main.query_cache : MDEV-10611 - sporadic mutex problem +main.show_explain : MDEV-10674 - sporadic failure +main.shutdown : MDEV-10612 - sporadic crashes +main.sp-prelocking : Modified on 2016-08-10 (merge) +main.sp-security : MDEV-10607 - sporadic "can't connect" +main.ssl : MDEV-10211 - different ciphers on some platforms +main.ssl_ca : Modified on 2016-07-11 (MDEV-10211) +main.ssl_compress : Modified on 2016-07-11 (MDEV-10211) +main.ssl_timeout : Modified on 2016-07-11 (MDEV-10211) +main.stat_tables_par_innodb : MDEV-10515 - sporadic wrong results +main.status : MDEV-8510 - sporadic wrong result +main.status_user : Modified on 2016-06-20 (MDEV-8633) +main.subselect : Modified in 10.1.17 +main.subselect_innodb : MDEV-10614 - sporadic wrong results +main.subselect_sj_mat : Modified in 10.1.17 +main.temp_table : Modified on 2016-06-18 (MDEV-8569) +main.type_date : Modified on 2016-08-10 (merge) +main.type_datetime : Modified on 2016-06-16 (MDEV-9374) +main.type_datetime_hires : MDEV-10687 - timeout +main.view : Modified on 2016-08-10 (merge) +main.xtradb_mrr : Modified on 2016-08-04 (MDEV-9946) + +#---------------------------------------------------------------- + +archive.archive-big : MDEV-10615 - table is marked as crashed +archive.discover : MDEV-10510 - table is marked as crashed + +#---------------------------------------------------------------- + +binlog.binlog_commit_wait : MDEV-10150 - Error: too much time elapsed +binlog.binlog_dmls_on_tmp_tables_readonly : New test, added on 2016-05-04 (upstream) +binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint + +#---------------------------------------------------------------- + +connect.tbl : MDEV-9844, MDEV-10179 - sporadic crashes, valgrind warnings, wrong results +connect.jdbc : New test, added on 2016-07-15 +connect.jdbc-new : New test, added on 2016-07-14 +connect.jdbc-oracle : New test, added on 2016-07-13 +connect.jdbc-postgresql : New test, added on 2016-07-13 + +#---------------------------------------------------------------- + +galera.GAL-382 : New test, added in 10.1.17 +galera.MW-252 : New test, added in 10.1.17 +galera.MW-258 : New test, added in 10.1.17 +galera.MW-259 : New test, added in 10.1.17 +galera.MW-285 : New test, added in 10.1.17 +galera.MW-286 : New test, added in 10.1.17 +galera.MW-292 : New test, added in 10.1.17 +galera.MW-44 : New test, added in 10.1.17 +galera.galera#414 : New test, added in 10.1.17 +galera.galera_as_slave_autoinc : New test, added in 10.1.17 +galera.galera_as_slave_nonprim : Modified in 10.1.17 +galera.galera_bf_abort_flush_for_export : Modified in 10.1.17 +galera.galera_gcs_fc_limit : Modified in 10.1.17 +galera.galera_ist_recv_bind : New test, added in 10.1.17 +galera.galera_ist_restart_joiner : Modified in 10.1.17 +galera.galera_kill_ddl : Modified in 10.1.17 +galera.galera_parallel_simple : Modified in 10.1.17 +galera.galera_pc_ignore_sb : Modified in 10.1.17 +galera.galera_restart_nochanges : Modified in 10.1.17 +galera.galera_roles : Modified in 10.1.17 +galera.galera_rsu_wsrep_desync : Modified in 10.1.17 +galera.galera_split_brain : Modified in 10.1.17 +galera.galera_ssl_upgrade : Modified in 10.1.17 +galera.galera_suspend_slave : Modified in 10.1.17 +galera.galera_transaction_replay : Modified in 10.1.17 +galera.galera_var_dirty_reads : Modified in 10.1.17 +galera.galera_var_max_ws_rows : New test, added in 10.1.17 +galera.galera_var_max_ws_size : Modified in 10.1.17 +galera.mdev_10518 : New test, added in 10.1.17 +galera.mysql-wsrep#31 : Modified in 10.1.17 + +galera_3nodes.galera_certification_ccc : Modified in 10.1.17 +galera_3nodes.galera_innobackupex_backup : Modified in 10.1.17 +galera_3nodes.galera_ist_gcache_rollover : Modified in 10.1.17 +galera_3nodes.galera_pc_bootstrap : Modified in 10.1.17 +galera_3nodes.galera_pc_weight : Modified in 10.1.17 + +#---------------------------------------------------------------- + +encryption.create_or_replace : MDEV-9359 - Assertion failure +encryption.innodb-bad-key-shutdown : MDEV-9105 - valgrind warnings, assertion failures +encryption.innodb_encryption_discard_import : MDEV-9099 - warnings, errors, crash +encryption.innodb_encryption_filekeys : MDEV-9062 - timeouts +encryption.innodb_first_page : MDEV-10689 - crashes +encryption.innodb_onlinealter_encryption : MDEV-10099 - wrong results +encryption.innodb-page_encryption : MDEV-10641 - mutex problem + +#---------------------------------------------------------------- + +federated.federatedx : MDEV-10617 - Wrong checksum, timeouts +federated.federated_innodb : MDEV-10617, MDEV-10417 - Wrong checksum, timeouts, fails on Mips +federated.federated_partition : MDEV-10417 - Fails on Mips +federated.federated_transactions : MDEV-10617, MDEV-10417 - Wrong checksum, timeouts, fails on Mips + +#---------------------------------------------------------------- + +funcs_1.processlist_priv_no_prot : Include file modified on 2016-07-12 (merge) +funcs_1.processlist_priv_ps : Include file modified on 2016-07-12 (merge) +funcs_2.memory_charset : MDEV-10290 - timeout + +#---------------------------------------------------------------- + +innodb.binlog_consistent : MDEV-10618 - Server fails to start +innodb.innodb-alter-table : MDEV-10619 - Testcase timeout +innodb.innodb-alter-tempfile : Modified on 2016-08-09 (MDEV-10469) +innodb.innodb_blob_truncate : MDEV-10377 - Assertion failure +innodb.innodb-bug-14068765 : MDEV-9105 - valgrind warnings, assertion failures +innodb.innodb_corrupt_bit : Modified on 2016-06-21 (merge) +innodb.innodb-bug-14084530 : MDEV-9105 - valgrind warnings, assertion failures +innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan +innodb.innodb-fk-warnings : Modified on 2016-07-18 (MDEV-8569) +innodb.innodb-fkcheck : Modified on 2016-06-13 (MDEV-10083) +innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem +innodb.innodb_stats : MDEV-10682 - wrong result +innodb.innodb_sys_semaphore_waits : MDEV-10331 - wrong result +innodb.innodb-wl5522 : MDEV-9105 - valgrind warnings, assertion failures +innodb.innodb-wl5522-1 : MDEV-9105 - valgrind warnings, assertion failures +innodb.innodb-wl5522-debug-zip : MDEV-10427 - Warning: database page corruption +innodb.innodb-wl5522-zip : MDEV-9105 - valgrind warnings, assertion failures +innodb.xa_recovery : MDEV-10685 - warnings + +#---------------------------------------------------------------- + +innodb_zip.innodb_prefix_index_liftedlimit : MDEV-10686 - timeout + +#---------------------------------------------------------------- + +mroonga/storage.column_datetime_32bit_2038 : Wrong result on Alpha +mroonga/storage.column_datetime_32bit_before_unix_epoch : Wrong result on Alpha +mroonga/storage.column_datetime_32bit_max : Wrong result on Alpha +mroonga/storage.column_datetime_32bit_out_of_range : Wrong result on Alpha +mroonga/storage.index_multiple_column_unique_date_32bit_equal : Wrong result on Alpha +mroonga/storage.index_multiple_column_unique_date_order_32bit_desc : Wrong result on Alpha +mroonga/storage.index_multiple_column_unique_datetime_index_read : MDEV-8643 - valgrind warnings +mroonga/storage.repair_table_no_index_file : MDEV-9364 - wrong result + +#---------------------------------------------------------------- + +multi_source.gtid : MDEV-10620, MDEV-10417 - Timeout in wait condition, fails on Mips +multi_source.info_logs : MDEV-10042 - wrong result +multi_source.multisource : MDEV-10417 - Fails on Mips +multi_source.reset_slave : MDEV-10690 - wrong result +multi_source.simple : MDEV-4633 - Wrong slave status output +multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_heartbeats + +#---------------------------------------------------------------- + +parts.partition_float_myisam : MDEV-10621 - Testcase timeout +parts.partition_int_myisam : MDEV-10621 - Testcase timeout + +#---------------------------------------------------------------- + +perfschema.digest_table_full : Modified on 2016-06-21 (merge) +perfschema.func_file_io : MDEV-5708 - fails for s390x +perfschema.func_mutex : MDEV-5708 - fails for s390x +perfschema.rpl_gtid_func : Modified on 2016-06-21 (merge) +perfschema.setup_actors : MDEV-10679 - rare crash +perfschema.sizing_low : Modified on 2016-04-26 (5.6.30 merge) +perfschema.socket_summary_by_event_name_func : MDEV-10622 - Socket summary tables do not match +perfschema.start_server_low_digest : Modified on 2016-06-21 (merge) +perfschema.statement_digest : Modified on 2016-06-21 (merge) +perfschema.statement_digest_consumers : Modified on 2016-06-21 (merge) +perfschema.statement_digest_long_query : Modified on 2016-06-21 (merge) +perfschema.table_name : New test, added on 2016-04-26 (5.6.30 merge) +perfschema.threads_mysql : MDEV-10677 - sporadic wrong result + +#---------------------------------------------------------------- + +plugins.feedback_plugin_send : MDEV-7932 - ssl failed for url +plugins.pam : Modified on 2016-08-03 (MDEV-7329) +plugins.pam_cleartext : Modified on 2016-08-03 +plugins.server_audit : MDEV-9562 - crashes on sol10-sparc +plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc + +#---------------------------------------------------------------- + +roles.rpl_grant_revoke_current_role-8638 : New test, added on 2016-06-20 (MDEV-8638) +roles.set_role-9614 : New test, added on 2016-05-30 (MDEV-9614) + +#---------------------------------------------------------------- + +rpl.last_insert_id : MDEV-10625 - warnings in error log +rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips +rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips +rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log +rpl.rpl_binlog_index : MDEV-9501 - Warning: failed registering on master +rpl.rpl_checksum_cache : MDEV-10626 - Testcase timeout +rpl.rpl_circular_for_4_hosts : MDEV-10627 - Testcase timeout +rpl.rpl_ddl : MDEV-10417 - Fails on Mips +rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result +rpl.rpl_gtid_basic : MDEV-10681 - server startup problem +rpl.rpl_gtid_crash : MDEV-9501 - Warning: failed registering on master +rpl.rpl_gtid_master_promote : MDEV-10628 - Timeout in sync_with_master +rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings +rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown +rpl.rpl_gtid_until : MDEV-10625 - warnings in error log +rpl.rpl_ignore_table : Modified on 2016-06-22 +rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips +rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x +rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x +rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips +rpl.rpl_mdev6020 : MDEV-10630, MDEV-10417 - Timeouts, fails on Mips +rpl.rpl_mdev6386 : MDEV-10631 - Wrong result on slave +rpl.rpl_parallel : MDEV-10632, MDEV-10653 - Failures to sync, timeouts +rpl.rpl_parallel_optimistic : MDEV-10511 - timeout +rpl.rpl_parallel_temptable : MDEV-10356 - Crash in close_thread_tables +rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips +rpl.rpl_row_drop_create_temp_table : MDEV-10626 - Testcase timeout +rpl.rpl_row_log_innodb : MDEV-10688 - Wrong result +rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x +rpl.rpl_show_slave_hosts : MDEV-10681 - server startup problem +rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status +rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock +rpl.rpl_switch_stm_row_mixed : MDEV-10611 - Wrong usage of mutex +rpl.rpl_sync : MDEV-10633 - Database page corruption +rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries +rpl.sec_behind_master-5114 : MDEV-8518 - Wrong value of Seconds_Behind_Master +rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha + +#---------------------------------------------------------------- + +spider.* : MDEV-9329 - tests are too memory-consuming + +spider/bg.direct_aggregate : MDEV-7098 - Trying to unlock mutex that wasn't locked +spider/bg.direct_aggregate_part : MDEV-7098 - Trying to unlock mutex that wasn't locked +spider/bg.ha : MDEV-7914, MDEV-9329 - Crash, failures on s390x +spider/bg.ha_part : MDEV-9329 - Fails on Ubuntu/s390x +spider/bg.spider_fixes : MDEV-7098, MDEV-9329 - Mutex problem, failures on s390x +spider/bg.vp_fixes : MDEV-9329 - Fails on Ubuntu/s390x + +#---------------------------------------------------------------- + +stress.ddl_innodb : MDEV-10635 - Testcase timeout + +#---------------------------------------------------------------- + +sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x +sys_vars.general_log_file_basic : Modified on 2016-08-09 (MDEV-10465) +sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout +sys_vars.slow_query_log_file_basic : Modified on 2016-08-09 (MDEV-10465) +sys_vars.sysvars_innodb : MDEV-6958 - error-prone rdiffs +sys_vars.sysvars_server_embedded : MDEV-6958 - error-prone rdiffs +sys_vars.innodb_buffer_pool_dump_pct_basic : MDEV-10651 - sporadic failure on file_exists +sys_vars.innodb_fatal_semaphore_wait_threshold : MDEV-10513 - crashes +sys_vars.sysvars_wsrep : Modified in 10.1.17 +sys_vars.wsrep_max_ws_size_basic : Modified in 10.1.17 + +#---------------------------------------------------------------- + +tokudb.background_job_manager : MDEV-10327 - Assertion failure on server shutdown +tokudb.cluster_filter : MDEV-10678 - Wrong execution plan +tokudb.cluster_filter_hidden : MDEV-10678 - Wrong execution plan +tokudb.cluster_filter_unpack_varchar : MDEV-10636 - Wrong execution plan +tokudb.i_s_tokudb_lock_waits_released : Modified in 10.1.17 +tokudb.i_s_tokudb_locks_released : Modified in 10.1.17 +tokudb.* : MDEV-9891 - massive crashes on shutdown + +tokudb_alter_table.* : MDEV-9891 - massive crashes on shutdown + +tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output +tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output +tokudb_bugs.* : MDEV-9891 - massive crashes on shutdown + +tokudb_parts.* : MDEV-9891 - massive crashes on shutdown + +rpl-tokudb.* : MDEV-9891 - massive crashes on shutdown, also modified on 2016-06-10 (Merge) + +tokudb_add_index.* : MDEV-9891 - massive crashes on shutdown +tokudb_backup.* : MDEV-9891 - massive crashes on shutdown +tokudb_mariadb.* : MDEV-9891 - massive crashes on shutdown +tokudb_sys_vars.* : MDEV-9891 - massive crashes on shutdown +tokudb_rpl.* : MDEV-9891 - massive crashes on shutdown + +#---------------------------------------------------------------- + +unit.ma_test_loghandler : MDEV-10638 - record read not ok + +#---------------------------------------------------------------- + +vcol.charsets : Added on 2016-06-23 +vcol.not_supported : MDEV-10639 - Testcase timeout +vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout + +#---------------------------------------------------------------- + +wsrep.* : MDEV-10041 - server crashes sporadically during bootstrap + + diff --git a/mysql-test/valgrind.supp b/mysql-test/valgrind.supp index c3e7d1c65ec..b2b264e17fa 100644 --- a/mysql-test/valgrind.supp +++ b/mysql-test/valgrind.supp @@ -1223,25 +1223,6 @@ } { - GitHub codership/mysql-wsrep#176 - Memcheck:Leak - fun:_Z16wsrep_get_paramsRKN6galera10ReplicatorE - fun:galera_parameters_get - fun:_ZL24refresh_provider_optionsv - fun:_Z29wsrep_provider_options_updateP7sys_varP3THD13enum_var_type - fun:_ZN7sys_var6updateEP3THDP7set_var - fun:_ZN7set_var6updateEP3THD - fun:_Z17sql_set_variablesP3THDP4ListI12set_var_baseE - fun:_Z21mysql_execute_commandP3THD - fun:_Z11mysql_parseP3THDPcjP12Parser_state - fun:_ZL17wsrep_mysql_parseP3THDPcjP12Parser_state - fun:_Z16dispatch_command19enum_server_commandP3THDPcj - fun:_Z10do_commandP3THD - fun:_Z24do_handle_one_connectionP3THD - fun:handle_one_connection -} - -{ GitHub codership/galera#330 Memcheck:Leak match-leak-kinds: reachable @@ -1337,31 +1318,6 @@ g codership/mysql-wsrep/issues#176 { codership/mysql-wsrep/issues#176 Memcheck:Leak - fun:_Z16wsrep_get_paramsRKN6galera10ReplicatorE -} - -{ - codership/mysql-wsrep/issues#176 - Memcheck:Leak - fun:_Z16wsrep_get_paramsRKN6galera10ReplicatorE - fun:galera_parameters_get - fun:_ZL24refresh_provider_optionsv - fun:_Z21wsrep_provider_updateP7sys_varP3THD13enum_var_type - fun:_ZN7sys_var6updateEP3THDP7set_var - fun:_ZN7set_var6updateEP3THD - fun:_Z17sql_set_variablesP3THDP4ListI12set_var_baseE - fun:_Z21mysql_execute_commandP3THD - fun:_Z11mysql_parseP3THDPcjP12Parser_state - fun:_ZL17wsrep_mysql_parseP3THDPcjP12Parser_state - fun:_Z16dispatch_command19enum_server_commandP3THDPcj - fun:_Z10do_commandP3THD - fun:_Z24do_handle_one_connectionP3THD - fun:handle_one_connection -} - -{ - codership/mysql-wsrep/issues#176 - Memcheck:Leak match-leak-kinds: reachable fun:malloc fun:DbugMalloc @@ -1470,72 +1426,6 @@ g codership/mysql-wsrep/issues#176 } { - codership/mysql-wsrep/issues#176 - Memcheck:Leak - match-leak-kinds: possible - fun:malloc - fun:strdup - fun:_Z16wsrep_get_paramsRKN6galera10ReplicatorE - fun:galera_parameters_get - fun:_ZL24refresh_provider_optionsv - fun:_Z29wsrep_provider_options_updateP7sys_varP3THD13enum_var_type - fun:_ZN7sys_var6updateEP3THDP7set_var - fun:_ZN7set_var6updateEP3THD - fun:_Z17sql_set_variablesP3THDP4ListI12set_var_baseE - fun:_Z21mysql_execute_commandP3THD - fun:_Z11mysql_parseP3THDPcjP12Parser_state - fun:_ZL17wsrep_mysql_parseP3THDPcjP12Parser_state - fun:_Z16dispatch_command19enum_server_commandP3THDPcj - fun:_Z10do_commandP3THD - fun:_Z24do_handle_one_connectionP3THD - fun:handle_one_connection -} - -{ - codership/mysql-wsrep/issues#176 - Memcheck:Leak - match-leak-kinds: definite - fun:malloc - fun:strdup - fun:_Z16wsrep_get_paramsRKN6galera10ReplicatorE - fun:galera_parameters_get - fun:_ZL24refresh_provider_optionsv - fun:_Z29wsrep_provider_options_updateP7sys_varP3THD13enum_var_type - fun:_ZN7sys_var6updateEP3THDP7set_var - fun:_ZN7set_var6updateEP3THD - fun:_Z17sql_set_variablesP3THDP4ListI12set_var_baseE - fun:_Z21mysql_execute_commandP3THD - fun:_Z11mysql_parseP3THDPcjP12Parser_state - fun:_ZL17wsrep_mysql_parseP3THDPcjP12Parser_state - fun:_Z16dispatch_command19enum_server_commandP3THDPcj - fun:_Z10do_commandP3THD - fun:_Z24do_handle_one_connectionP3THD - fun:handle_one_connection -} - -{ - codership/mysql-wsrep/issues#176 - Memcheck:Leak - match-leak-kinds: definite - fun:malloc - fun:strdup - fun:_Z16wsrep_get_paramsRKN6galera10ReplicatorE - fun:galera_parameters_get - fun:_ZL24refresh_provider_optionsv - fun:_Z21wsrep_provider_updateP7sys_varP3THD13enum_var_type - fun:_ZN7sys_var6updateEP3THDP7set_var - fun:_ZN7set_var6updateEP3THD - fun:_Z17sql_set_variablesP3THDP4ListI12set_var_baseE - fun:_Z21mysql_execute_commandP3THD - fun:_Z11mysql_parseP3THDPcjP12Parser_state - fun:_ZL17wsrep_mysql_parseP3THDPcjP12Parser_state - fun:_Z16dispatch_command19enum_server_commandP3THDPcj - fun:_Z10do_commandP3THD - fun:_Z24do_handle_one_connectionP3THD - fun:handle_one_connection -} - -{ codership/galera#331 Memcheck:Leak match-leak-kinds: reachable diff --git a/mysys/my_context.c b/mysys/my_context.c index fd9415afc94..1368739ac35 100644 --- a/mysys/my_context.c +++ b/mysys/my_context.c @@ -696,30 +696,27 @@ my_context_destroy(struct my_context *c) int my_context_spawn(struct my_context *c, void (*f)(void *), void *d) { - void *current_fiber; c->user_func= f; c->user_arg= d; + return my_context_continue(c); +} + +int +my_context_continue(struct my_context *c) +{ /* This seems to be a common trick to run ConvertThreadToFiber() only on the first occurence in a thread, in a way that works on multiple Windows versions. */ - current_fiber= GetCurrentFiber(); + void *current_fiber= GetCurrentFiber(); if (current_fiber == NULL || current_fiber == (void *)0x1e00) current_fiber= ConvertThreadToFiber(c); c->app_fiber= current_fiber; DBUG_SWAP_CODE_STATE(&c->dbug_state); SwitchToFiber(c->lib_fiber); DBUG_SWAP_CODE_STATE(&c->dbug_state); - return c->return_value; -} -int -my_context_continue(struct my_context *c) -{ - DBUG_SWAP_CODE_STATE(&c->dbug_state); - SwitchToFiber(c->lib_fiber); - DBUG_SWAP_CODE_STATE(&c->dbug_state); return c->return_value; } diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 4cc767f924d..395659238b3 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -129,13 +129,32 @@ static int safe_print_str(const char *addr, int max_len) #endif -void my_safe_print_str(const char* val, int max_len) +/* + Attempt to print a char * pointer as a string. + + SYNOPSIS + Prints either until the end of string ('\0'), or max_len characters have + been printed. + + RETURN VALUE + 0 Pointer was within the heap address space. + The string was printed fully, or until the end of the heap address space. + 1 Pointer is outside the heap address space. Printed as invalid. + + NOTE + On some systems, we can have valid pointers outside the heap address space. + This is through the use of mmap inside malloc calls. When this function + returns 1, it does not mean 100% that the pointer is corrupted. +*/ + +int my_safe_print_str(const char* val, int max_len) { char *heap_end; #ifdef __linux__ + // Try and make use of /proc filesystem to safely print memory contents. if (!safe_print_str(val, max_len)) - return; + return 0; #endif heap_end= (char*) sbrk(0); @@ -143,12 +162,14 @@ void my_safe_print_str(const char* val, int max_len) if (!PTR_SANE(val)) { my_safe_printf_stderr("%s", "is an invalid pointer"); - return; + return 1; } for (; max_len && PTR_SANE(val) && *val; --max_len) my_write_stderr((val++), 1); my_safe_printf_stderr("%s", "\n"); + + return 0; } #if defined(HAVE_PRINTSTACK) @@ -727,7 +748,7 @@ void my_write_core(int unused) } -void my_safe_print_str(const char *val, int len) +int my_safe_print_str(const char *val, int len) { __try { @@ -737,6 +758,7 @@ void my_safe_print_str(const char *val, int len) { my_safe_printf_stderr("%s", "is an invalid string pointer"); } + return 0; } #endif /*__WIN__*/ diff --git a/plugin/auth_pam/auth_pam.c b/plugin/auth_pam/auth_pam.c index 3e3462d3ba0..ac1b3b2da09 100644 --- a/plugin/auth_pam/auth_pam.c +++ b/plugin/auth_pam/auth_pam.c @@ -17,6 +17,7 @@ #define _GNU_SOURCE 1 /* for strndup */ #include <mysql/plugin_auth.h> +#include <stdio.h> #include <string.h> #include <security/pam_appl.h> #include <security/pam_modules.h> @@ -44,6 +45,13 @@ char *strndup(const char *from, size_t length) } #endif +#ifndef DBUG_OFF +static char pam_debug = 0; +#define PAM_DEBUG(X) do { if (pam_debug) { fprintf X; } } while(0) +#else +#define PAM_DEBUG(X) /* no-op */ +#endif + static int conv(int n, const struct pam_message **msg, struct pam_response **resp, void *data) { @@ -91,12 +99,17 @@ static int conv(int n, const struct pam_message **msg, 4 means "password-like input, echo disabled" C'est la vie. */ param->buf[0] = msg[i]->msg_style == PAM_PROMPT_ECHO_ON ? 2 : 4; + PAM_DEBUG((stderr, "PAM: conv: send(%.*s)\n", (int)(param->ptr - param->buf - 1), param->buf)); if (param->vio->write_packet(param->vio, param->buf, param->ptr - param->buf - 1)) return PAM_CONV_ERR; pkt_len = param->vio->read_packet(param->vio, &pkt); if (pkt_len < 0) + { + PAM_DEBUG((stderr, "PAM: conv: recv() ERROR\n")); return PAM_CONV_ERR; + } + PAM_DEBUG((stderr, "PAM: conv: recv(%.*s)\n", pkt_len, pkt)); /* allocate and copy the reply to the response array */ if (!((*resp)[i].resp= strndup((char*) pkt, pkt_len))) return PAM_CONV_ERR; @@ -134,9 +147,16 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) param.ptr = param.buf + 1; param.vio = vio; + PAM_DEBUG((stderr, "PAM: pam_start(%s, %s)\n", service, info->user_name)); DO( pam_start(service, info->user_name, &pam_start_arg, &pamh) ); + + PAM_DEBUG((stderr, "PAM: pam_authenticate(0)\n")); DO( pam_authenticate (pamh, 0) ); + + PAM_DEBUG((stderr, "PAM: pam_acct_mgmt(0)\n")); DO( pam_acct_mgmt(pamh, 0) ); + + PAM_DEBUG((stderr, "PAM: pam_get_item(PAM_USER)\n")); DO( pam_get_item(pamh, PAM_USER, (pam_get_item_3_arg) &new_username) ); if (new_username && strcmp(new_username, info->user_name)) @@ -145,6 +165,7 @@ static int pam_auth(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info) end: pam_end(pamh, status); + PAM_DEBUG((stderr, "PAM: status = %d user = %s\n", status, new_username)); return status == PAM_SUCCESS ? CR_OK : CR_ERROR; } @@ -163,8 +184,17 @@ static MYSQL_SYSVAR_BOOL(use_cleartext_plugin, use_cleartext_plugin, "supports simple PAM policies that don't require anything besides " "a password", NULL, NULL, 0); +#ifndef DBUG_OFF +static MYSQL_SYSVAR_BOOL(debug, pam_debug, PLUGIN_VAR_OPCMDARG, + "Log all PAM activity", NULL, NULL, 0); +#endif + + static struct st_mysql_sys_var* vars[] = { MYSQL_SYSVAR(use_cleartext_plugin), +#ifndef DBUG_OFF + MYSQL_SYSVAR(debug), +#endif NULL }; diff --git a/plugin/aws_key_management/aws_key_management_plugin.cc b/plugin/aws_key_management/aws_key_management_plugin.cc index 3913d2c3145..f4d3c7a52bc 100644 --- a/plugin/aws_key_management/aws_key_management_plugin.cc +++ b/plugin/aws_key_management/aws_key_management_plugin.cc @@ -582,6 +582,6 @@ maria_declare_plugin(aws_key_management) NULL, settings, "1.0", - MariaDB_PLUGIN_MATURITY_EXPERIMENTAL + MariaDB_PLUGIN_MATURITY_BETA } maria_declare_plugin_end; diff --git a/plugin/cracklib_password_check/cracklib_password_check.c b/plugin/cracklib_password_check/cracklib_password_check.c index c593173942d..7861d5fd83e 100644 --- a/plugin/cracklib_password_check/cracklib_password_check.c +++ b/plugin/cracklib_password_check/cracklib_password_check.c @@ -78,6 +78,6 @@ maria_declare_plugin(cracklib_password_check) NULL, sysvars, "1.0", - MariaDB_PLUGIN_MATURITY_GAMMA, + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/file_key_management/file_key_management_plugin.cc b/plugin/file_key_management/file_key_management_plugin.cc index 77344bc57ee..a1f1ed1fad4 100644 --- a/plugin/file_key_management/file_key_management_plugin.cc +++ b/plugin/file_key_management/file_key_management_plugin.cc @@ -192,6 +192,6 @@ maria_declare_plugin(file_key_management) NULL, /* status variables */ settings, "1.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/query_response_time/mysql-test/query_response_time/basic.result b/plugin/query_response_time/mysql-test/query_response_time/basic.result index 673201266ec..d2de1b23e5f 100644 --- a/plugin/query_response_time/mysql-test/query_response_time/basic.result +++ b/plugin/query_response_time/mysql-test/query_response_time/basic.result @@ -24,4 +24,4 @@ PLUGIN_TYPE AUDIT PLUGIN_AUTHOR Percona and Sergey Vojtovich PLUGIN_DESCRIPTION Query Response Time Distribution Audit Plugin PLUGIN_LICENSE GPL -PLUGIN_MATURITY Gamma +PLUGIN_MATURITY Stable diff --git a/plugin/query_response_time/plugin.cc b/plugin/query_response_time/plugin.cc index 37d52c3ce85..17d0cfe4138 100644 --- a/plugin/query_response_time/plugin.cc +++ b/plugin/query_response_time/plugin.cc @@ -159,6 +159,6 @@ maria_declare_plugin(query_response_time) NULL, NULL, "1.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/simple_password_check/simple_password_check.c b/plugin/simple_password_check/simple_password_check.c index 7ad8bfc811a..8b460c5ed9d 100644 --- a/plugin/simple_password_check/simple_password_check.c +++ b/plugin/simple_password_check/simple_password_check.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#include <my_sys.h> +#include <mysqld_error.h> #include <mysql/plugin_password_validation.h> #include <ctype.h> #include <string.h> @@ -49,15 +51,21 @@ static int validate(MYSQL_LEX_STRING *username, MYSQL_LEX_STRING *password) others < min_others; } - -static void -fix_min_length(MYSQL_THD thd __attribute__((unused)), - struct st_mysql_sys_var *var __attribute__((unused)), - void *var_ptr, const void *save) +static void fix_min_length(MYSQL_THD thd __attribute__((unused)), + struct st_mysql_sys_var *var __attribute__((unused)), + void *var_ptr, const void *save) { + uint new_min_length; *((unsigned int *)var_ptr)= *((unsigned int *)save); - if (min_length < min_digits + 2 * min_letters + min_others) - min_length= min_digits + 2 * min_letters + min_others; + new_min_length= min_digits + 2 * min_letters + min_others; + if (min_length < new_min_length) + { + my_printf_error(ER_TRUNCATED_WRONG_VALUE, + "Adjusted the value of simple_password_check_minimal_length " + "from %u to %u", ME_JUST_WARNING, + min_length, new_min_length); + min_length= new_min_length; + } } @@ -104,6 +112,6 @@ maria_declare_plugin(simple_password_check) NULL, sysvars, "1.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/userstat/userstat.cc b/plugin/userstat/userstat.cc index 69832f817c1..96d926ac908 100644 --- a/plugin/userstat/userstat.cc +++ b/plugin/userstat/userstat.cc @@ -61,7 +61,7 @@ maria_declare_plugin(userstat) NULL, NULL, "2.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, @@ -76,7 +76,7 @@ maria_declare_plugin(userstat) NULL, NULL, "2.0", - MariaDB_PLUGIN_MATURITY_GAMMA + MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/plugin/wsrep_info/plugin.cc b/plugin/wsrep_info/plugin.cc index f9843cb6f39..023011f1d24 100644 --- a/plugin/wsrep_info/plugin.cc +++ b/plugin/wsrep_info/plugin.cc @@ -245,7 +245,7 @@ maria_declare_plugin(wsrep_info) NULL, /* Status variables */ NULL, /* System variables */ "1.0", /* Version (string) */ - MariaDB_PLUGIN_MATURITY_GAMMA /* Maturity */ + MariaDB_PLUGIN_MATURITY_STABLE /* Maturity */ }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, @@ -260,7 +260,7 @@ maria_declare_plugin(wsrep_info) NULL, /* Status variables */ NULL, /* System variables */ "1.0", /* Version (string) */ - MariaDB_PLUGIN_MATURITY_GAMMA /* Maturity */ + MariaDB_PLUGIN_MATURITY_STABLE /* Maturity */ } maria_declare_plugin_end; diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index dd642487ede..2ef2a1758f7 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -242,6 +242,14 @@ ELSE() wsrep_sst_xtrabackup-v2 ) ENDIF() + IF (NOT WITHOUT_SERVER) + SET(SERVER_SCRIPTS + mysql_fix_extensions + mysqld_multi + mysqld_safe + mysqldumpslow + ) + ENDIF() # Configure this one, for testing, but do not install it. CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/mysql_config.pl.in ${CMAKE_CURRENT_BINARY_DIR}/mysql_config.pl ESCAPE_QUOTES @ONLY) @@ -249,7 +257,6 @@ ELSE() SET(BIN_SCRIPTS msql2mysql mysql_config - mysql_fix_extensions mysql_setpermission mysql_secure_installation mysqlaccess @@ -257,9 +264,7 @@ ELSE() mysql_find_rows mytop mysqlhotcopy - mysqldumpslow - mysqld_multi - mysqld_safe + ${SERVER_SCRIPTS} ${WSREP_BINARIES} ${SYSTEMD_SCRIPTS} ) diff --git a/scripts/galera_recovery.sh b/scripts/galera_recovery.sh index 0e5a42b1676..d734ceb7ac7 100644 --- a/scripts/galera_recovery.sh +++ b/scripts/galera_recovery.sh @@ -68,7 +68,8 @@ parse_arguments() { wsrep_recover_position() { # Redirect server's error log to the log file. - eval /usr/sbin/mysqld $cmdline_args --user=$user --wsrep_recover 2> "$log_file" + eval /usr/sbin/mysqld $cmdline_args --user=$user --wsrep_recover \ + --log-error="$log_file" ret=$? if [ $ret -ne 0 ]; then # Something went wrong, let us also print the error log so that it diff --git a/scripts/mysql_secure_installation.pl.in b/scripts/mysql_secure_installation.pl.in index 188a6bd7104..32331c3d601 100644 --- a/scripts/mysql_secure_installation.pl.in +++ b/scripts/mysql_secure_installation.pl.in @@ -217,7 +217,7 @@ sub remove_remote_root { sub remove_test_database { print " - Dropping test database...\n"; - if (do_query("DROP DATABASE test;")) { + if (do_query("DROP DATABASE IF EXISTS test;")) { print " ... Success!\n"; } else { print " ... Failed! Not critical, keep moving...\n"; diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh index 82ea1b60a17..2c3b2f8dc8c 100644 --- a/scripts/mysql_secure_installation.sh +++ b/scripts/mysql_secure_installation.sh @@ -332,7 +332,7 @@ remove_remote_root() { remove_test_database() { echo " - Dropping test database..." - do_query "DROP DATABASE test;" + do_query "DROP DATABASE IF EXISTS test;" if [ $? -eq 0 ]; then echo " ... Success!" else diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index 5f67507b577..f173a861e85 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -188,7 +188,7 @@ wsrep_log_info() wsrep_cleanup_progress_file() { - [ -n "$SST_PROGRESS_FILE" ] && rm -f "$SST_PROGRESS_FILE" 2>/dev/null + [ -n "${SST_PROGRESS_FILE:-}" ] && rm -f "$SST_PROGRESS_FILE" 2>/dev/null || true } wsrep_check_program() diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index 7e895aa4eb2..10d6896accd 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -222,7 +222,8 @@ then [ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo) [ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ] && count=$(sysctl -n hw.ncpu) - find . -maxdepth 1 -mindepth 1 -type d -print0 | xargs -I{} -0 -P $count \ + find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" -print0 | \ + xargs -I{} -0 -P $count \ rsync --owner --group --perms --links --specials \ --ignore-times --inplace --recursive --delete --quiet \ $WHOLE_FILE_OPT --exclude '*/ib_logfile*' "$WSREP_SST_OPT_DATA"/{}/ \ diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh index a836d5e0edd..63febe556da 100644 --- a/scripts/wsrep_sst_xtrabackup-v2.sh +++ b/scripts/wsrep_sst_xtrabackup-v2.sh @@ -689,6 +689,7 @@ then if [ $WSREP_SST_OPT_BYPASS -eq 0 ] then + usrst=0 if [[ -z $sst_ver ]];then wsrep_log_error "Upgrade joiner to 5.6.21 or higher for backup locks support" wsrep_log_error "The joiner is not supported for this version of donor" @@ -704,13 +705,14 @@ then itmpdir=$(mktemp -d) wsrep_log_info "Using $itmpdir as innobackupex temporary directory" - if [ "$WSREP_SST_OPT_USER" != "(null)" ]; then + if [[ -n "${WSREP_SST_OPT_USER:-}" && "$WSREP_SST_OPT_USER" != "(null)" ]]; then INNOEXTRA+=" --user=$WSREP_SST_OPT_USER" + usrst=1 fi if [ -n "${WSREP_SST_OPT_PSWD:-}" ]; then INNOEXTRA+=" --password=$WSREP_SST_OPT_PSWD" - else + elif [[ $usrst -eq 1 ]];then # Empty password, used for testing, debugging etc. INNOEXTRA+=" --password=" fi diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh index 2247edec7fd..22923ab3e88 100644 --- a/scripts/wsrep_sst_xtrabackup.sh +++ b/scripts/wsrep_sst_xtrabackup.sh @@ -436,15 +436,17 @@ then if [ $WSREP_SST_OPT_BYPASS -eq 0 ] then + usrst=0 TMPDIR="${TMPDIR:-/tmp}" - if [ "$WSREP_SST_OPT_USER" != "(null)" ]; then + if [[ -n "${WSREP_SST_OPT_USER:-}" && "$WSREP_SST_OPT_USER" != "(null)" ]]; then INNOEXTRA+=" --user=$WSREP_SST_OPT_USER" + usrst=1 fi if [ -n "${WSREP_SST_OPT_PSWD:-}" ]; then INNOEXTRA+=" --password=$WSREP_SST_OPT_PSWD" - else + elif [[ $usrst -eq 1 ]];then # Empty password, used for testing, debugging etc. INNOEXTRA+=" --password=" fi diff --git a/sql-bench/server-cfg.sh b/sql-bench/server-cfg.sh index 892d301c70d..7e83b7365e3 100644 --- a/sql-bench/server-cfg.sh +++ b/sql-bench/server-cfg.sh @@ -204,6 +204,11 @@ sub new $limits{'max_temporary_tables'}= $limits{"max_tables"}; $self->{'transactions'} = 1; # Transactions enabled } + if (defined($main::opt_create_options) && + $main::opt_create_options =~ /engine=tokudb/i) + { + $self->{'transactions'} = 1; # Transactions enabled + } return $self; } diff --git a/sql-bench/test-table-elimination.sh b/sql-bench/test-table-elimination.sh index 7772cab42b0..de440fc0633 100755 --- a/sql-bench/test-table-elimination.sh +++ b/sql-bench/test-table-elimination.sh @@ -305,6 +305,7 @@ if ($opt_lock_tables) if (!$opt_skip_delete) { do_query($dbh,"drop table elim_facts, elim_attr1, elim_attr2" . $server->{'drop_attr'}); + $dbh->do("drop view elim_current_facts"); } if ($opt_fast && defined($server->{vacuum})) diff --git a/sql-common/client.c b/sql-common/client.c index fdb17a63ba5..e73d9bdbe0b 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -3643,6 +3643,9 @@ error: /* Free alloced memory */ end_server(mysql); mysql_close_free(mysql); + if (!(client_flag & CLIENT_REMEMBER_OPTIONS) && + !mysql->options.extension->async_context) + mysql_close_free_options(mysql); } DBUG_RETURN(0); } @@ -3713,7 +3716,7 @@ my_bool mysql_reconnect(MYSQL *mysql) } if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd, mysql->db, mysql->port, mysql->unix_socket, - mysql->client_flag)) + mysql->client_flag | CLIENT_REMEMBER_OPTIONS)) { if (ctxt) my_context_install_suspend_resume_hook(ctxt, NULL, NULL); diff --git a/sql-common/my_time.c b/sql-common/my_time.c index 28757a2c96c..7cf8692a3f6 100644 --- a/sql-common/my_time.c +++ b/sql-common/my_time.c @@ -224,7 +224,7 @@ my_bool check_datetime_range(const MYSQL_TIME *ltime) ltime->minute > 59 || ltime->second > 59 || ltime->second_part > TIME_MAX_SECOND_PART || (ltime->hour > - (ltime->time_type == MYSQL_TIMESTAMP_TIME ? TIME_MAX_HOUR : 23)); + (uint) (ltime->time_type == MYSQL_TIMESTAMP_TIME ? TIME_MAX_HOUR : 23)); } @@ -237,7 +237,7 @@ static void get_microseconds(ulong *val, MYSQL_TIME_STATUS *status, if (get_digits(&tmp, number_of_fields, str, end, 6)) status->warnings|= MYSQL_TIME_WARN_TRUNCATED; if ((status->precision= (*str - start)) < 6) - *val= tmp * log_10_int[6 - (*str - start)]; + *val= (ulong) (tmp * log_10_int[6 - (*str - start)]); else *val= tmp; if (skip_digits(str, end)) diff --git a/sql-common/mysql_async.c b/sql-common/mysql_async.c index 80b4f390641..decf48e0e69 100644 --- a/sql-common/mysql_async.c +++ b/sql-common/mysql_async.c @@ -455,7 +455,11 @@ MK_ASYNC_START_BODY( parms.db= db; parms.port= port; parms.unix_socket= unix_socket; - parms.client_flags= client_flags; + /* + async wrapper enforce the CLIENT_REMEMBER_OPTIONS flag to be + functional (otherwise it can't operate) + */ + parms.client_flags= client_flags | CLIENT_REMEMBER_OPTIONS; }, NULL, r_ptr, diff --git a/sql/contributors.h b/sql/contributors.h index 76674d654e5..f52d3243453 100644 --- a/sql/contributors.h +++ b/sql/contributors.h @@ -36,17 +36,16 @@ struct show_table_contributors_st { */ struct show_table_contributors_st show_table_contributors[]= { - /* MariaDB foundation members, in contribution, size , time order */ - {"Booking.com", "http://www.booking.com", "Founding member of the MariaDB Foundation"}, - {"MariaDB Corporation", "https://mariadb.com", "Founding member of the MariaDB Foundation"}, - {"Auttomattic", "http://automattic.com", "Member of the MariaDB Foundation"}, - {"Visma", "http://visma.com", "Member of the MariaDB Foundation"}, - {"Nexedi", "http://www.nexedi.com", "Member of the MariaDB Foundation"}, - {"Acronis", "http://www.acronis.com", "Member of the MariaDB Foundation"}, - - /* Smaller sponsors, newer per year */ - {"Verkkokauppa.com", "Finland", "Sponsor of the MariaDB Foundation"}, - {"Virtuozzo", "https://virtuozzo.com/", "Sponsor of the MariaDB Foundation"}, + /* MariaDB foundation sponsors, in contribution, size , time order */ + {"Booking.com", "http://www.booking.com", "Founding member, Platinum Sponsor of the MariaDB Foundation"}, + {"MariaDB Corporation", "https://mariadb.com", "Founding member, Gold Sponsor of the MariaDB Foundation"}, + {"Visma", "http://visma.com", "Gold Sponsor of the MariaDB Foundation"}, + {"DBS", "http://dbs.com", "Gold Sponsor of the MariaDB Foundation"}, + {"Nexedi", "https://www.nexedi.com", "Silver Sponsor of the MariaDB Foundation"}, + {"Acronis", "http://www.acronis.com", "Silver Sponsor of the MariaDB Foundation"}, + {"Auttomattic", "https://automattic.com", "Bronze Sponsor of the MariaDB Foundation"}, + {"Verkkokauppa.com", "https://virtuozzo.com", "Bronze Sponsor of the MariaDB Foundation"}, + {"Virtuozzo", "https://virtuozzo.com/", "Bronze Sponsor of the MariaDB Foundation"}, /* Sponsors of important features */ {"Google", "USA", "Sponsoring encryption, parallel replication and GTID"}, diff --git a/sql/handler.cc b/sql/handler.cc index 3fbd1b3a71a..589106dfe93 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -1357,7 +1357,8 @@ int ha_commit_trans(THD *thd, bool all) uint rw_ha_count= ha_check_and_coalesce_trx_read_only(thd, ha_info, all); /* rw_trans is TRUE when we in a transaction changing data */ - bool rw_trans= is_real_trans && (rw_ha_count > 0); + bool rw_trans= is_real_trans && + (rw_ha_count > !thd->is_current_stmt_binlog_disabled()); MDL_request mdl_request; DBUG_PRINT("info", ("is_real_trans: %d rw_trans: %d rw_ha_count: %d", is_real_trans, rw_trans, rw_ha_count)); @@ -2733,6 +2734,15 @@ int handler::ha_index_next_same(uchar *buf, const uchar *key, uint keylen) return result; } + +bool handler::ha_was_semi_consistent_read() +{ + bool result= was_semi_consistent_read(); + if (result) + increment_statistics(&SSV::ha_read_retry_count); + return result; +} + /* Initialize handler for random reading, with error handling */ int handler::ha_rnd_init_with_error(bool scan) @@ -5876,6 +5886,26 @@ int handler::ha_reset() } +static int check_wsrep_max_ws_rows() +{ +#ifdef WITH_WSREP + if (wsrep_max_ws_rows) + { + THD *thd= current_thd; + thd->wsrep_affected_rows++; + if (thd->wsrep_exec_mode != REPL_RECV && + thd->wsrep_affected_rows > wsrep_max_ws_rows) + { + trans_rollback_stmt(thd) || trans_rollback(thd); + my_message(ER_ERROR_DURING_COMMIT, "wsrep_max_ws_rows exceeded", MYF(0)); + return ER_ERROR_DURING_COMMIT; + } + } +#endif /* WITH_WSREP */ + return 0; +} + + int handler::ha_write_row(uchar *buf) { int error; @@ -5899,7 +5929,7 @@ int handler::ha_write_row(uchar *buf) error= binlog_log_row(table, 0, buf, log_func); } DEBUG_SYNC_C("ha_write_row_end"); - DBUG_RETURN(error); + DBUG_RETURN(error ? error : check_wsrep_max_ws_rows()); } @@ -5930,7 +5960,7 @@ int handler::ha_update_row(const uchar *old_data, uchar *new_data) rows_changed++; error= binlog_log_row(table, old_data, new_data, log_func); } - return error; + return error ? error : check_wsrep_max_ws_rows(); } int handler::ha_delete_row(const uchar *buf) @@ -5957,7 +5987,7 @@ int handler::ha_delete_row(const uchar *buf) rows_changed++; error= binlog_log_row(table, buf, 0, log_func); } - return error; + return error ? error : check_wsrep_max_ws_rows(); } @@ -6088,7 +6118,10 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) DBUG_RETURN(0); } - THD_TRANS *trans= &victim_thd->transaction.all; + /* Try statement transaction if standard one is not set. */ + THD_TRANS *trans= (victim_thd->transaction.all.ha_list) ? + &victim_thd->transaction.all : &victim_thd->transaction.stmt; + Ha_trx_info *ha_info= trans->ha_list, *ha_info_next; for (; ha_info; ha_info= ha_info_next) @@ -6096,8 +6129,8 @@ int ha_abort_transaction(THD *bf_thd, THD *victim_thd, my_bool signal) handlerton *hton= ha_info->ht(); if (!hton->abort_transaction) { - /* Skip warning for binlog SE */ - if (hton->db_type != DB_TYPE_BINLOG) + /* Skip warning for binlog & wsrep. */ + if (hton->db_type != DB_TYPE_BINLOG && hton != wsrep_hton) { WSREP_WARN("Cannot abort transaction."); } diff --git a/sql/handler.h b/sql/handler.h index cae95ea4ae6..ef0c2f78915 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -3233,6 +3233,7 @@ public: If this method returns nonzero, it will also signal the storage engine that the next read will be a locking re-read of the row. */ + bool ha_was_semi_consistent_read(); virtual bool was_semi_consistent_read() { return 0; } /** Tell the engine whether it should avoid unnecessary lock waits. diff --git a/sql/item.cc b/sql/item.cc index 6a6ace4c844..f79509faed7 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -57,6 +57,17 @@ bool cmp_items(Item *a, Item *b) } +/** + Set max_sum_func_level if it is needed +*/ +inline void set_max_sum_func_level(THD *thd, SELECT_LEX *select) +{ + if (thd->lex->in_sum_func && + thd->lex->in_sum_func->nest_level >= select->nest_level) + set_if_bigger(thd->lex->in_sum_func->max_sum_func_level, + select->nest_level - 1); +} + /***************************************************************************** ** Item functions *****************************************************************************/ @@ -5031,6 +5042,11 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) if (rf->fix_fields(thd, reference) || rf->check_cols(1)) return -1; + /* + We can not "move" aggregate function in the place where + its arguments are not defined. + */ + set_max_sum_func_level(thd, select); mark_as_dependent(thd, last_checked_context->select_lex, context->select_lex, rf, rf); @@ -5039,6 +5055,11 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) } else { + /* + We can not "move" aggregate function in the place where + its arguments are not defined. + */ + set_max_sum_func_level(thd, select); mark_as_dependent(thd, last_checked_context->select_lex, context->select_lex, this, (Item_ident*)*reference); @@ -5170,6 +5191,11 @@ bool Item_field::fix_fields(THD *thd, Item **reference) return(1); } + /* + We can not "move" aggregate function in the place where + its arguments are not defined. + */ + set_max_sum_func_level(thd, thd->lex->current_select); set_field(new_field); return 0; } @@ -5194,6 +5220,11 @@ bool Item_field::fix_fields(THD *thd, Item **reference) select->parsing_place == IN_GROUP_BY && alias_name_used ? *rf->ref : rf); + /* + We can not "move" aggregate function in the place where + its arguments are not defined. + */ + set_max_sum_func_level(thd, thd->lex->current_select); return FALSE; } } diff --git a/sql/item_func.cc b/sql/item_func.cc index f02c6ca3940..3b98dd0d345 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -2273,15 +2273,6 @@ longlong Item_func_bit_neg::val_int() // Conversion functions -void Item_func_integer::fix_length_and_dec() -{ - max_length=args[0]->max_length - args[0]->decimals+1; - uint tmp=float_length(decimals); - set_if_smaller(max_length,tmp); - decimals=0; -} - - void Item_func_int_val::fix_length_and_dec() { DBUG_ENTER("Item_func_int_val::fix_length_and_dec"); @@ -3885,7 +3876,7 @@ longlong Item_master_pos_wait::val_int() longlong timeout = (arg_count>=3) ? args[2]->val_int() : 0 ; String connection_name_buff; LEX_STRING connection_name; - Master_info *mi; + Master_info *mi= NULL; if (arg_count >= 4) { String *con; @@ -3905,8 +3896,9 @@ longlong Item_master_pos_wait::val_int() connection_name= thd->variables.default_master_connection; mysql_mutex_lock(&LOCK_active_mi); - mi= master_info_index->get_master_info(&connection_name, - Sql_condition::WARN_LEVEL_WARN); + if (master_info_index) // master_info_index is set to NULL on shutdown. + mi= master_info_index->get_master_info(&connection_name, + Sql_condition::WARN_LEVEL_WARN); mysql_mutex_unlock(&LOCK_active_mi); if (!mi) goto err; diff --git a/sql/item_func.h b/sql/item_func.h index 44ad4e8a543..ca7c4819012 100644 --- a/sql/item_func.h +++ b/sql/item_func.h @@ -1021,13 +1021,6 @@ public: { return get_item_copy<Item_func_cot>(thd, mem_root, this); } }; -class Item_func_integer :public Item_int_func -{ -public: - inline Item_func_integer(THD *thd, Item *a): Item_int_func(thd, a) {} - void fix_length_and_dec(); -}; - class Item_func_int_val :public Item_func_num1 { diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 8faf3b43229..21c633333f1 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -564,6 +564,21 @@ void Item_subselect::recalc_used_tables(st_select_lex *new_parent, bool Item_subselect::is_expensive() { double examined_rows= 0; + bool all_are_simple= true; + + /* check extremely simple select */ + if (!unit->first_select()->next_select()) // no union + { + /* + such single selects works even without optimization because + can not makes loops + */ + SELECT_LEX *sl= unit->first_select(); + JOIN *join = sl->join; + if (join && !join->tables_list && !sl->first_inner_unit()) + return false; + } + for (SELECT_LEX *sl= unit->first_select(); sl; sl= sl->next_select()) { @@ -573,23 +588,27 @@ bool Item_subselect::is_expensive() if (!cur_join) return true; - /* very simple subquery */ - if (!cur_join->tables_list && !sl->first_inner_unit()) - return false; - /* If the subquery is not optimised or in the process of optimization it supposed to be expensive */ - if (!cur_join->optimized) + if (cur_join->optimization_state != JOIN::OPTIMIZATION_DONE) return true; + if (!cur_join->tables_list && !sl->first_inner_unit()) + continue; + /* Subqueries whose result is known after optimization are not expensive. Such subqueries have all tables optimized away, thus have no join plan. */ if ((cur_join->zero_result_cause || !cur_join->tables_list)) - return false; + continue; + + /* + This is not simple SELECT in union so we can not go by simple condition + */ + all_are_simple= false; /* If a subquery is not optimized we cannot estimate its cost. A subquery is @@ -610,7 +629,8 @@ bool Item_subselect::is_expensive() examined_rows+= cur_join->get_examined_rows(); } - return (examined_rows > thd->variables.expensive_subquery_limit); + return !all_are_simple && + (examined_rows > thd->variables.expensive_subquery_limit); } @@ -3680,7 +3700,7 @@ int subselect_single_select_engine::exec() SELECT_LEX *save_select= thd->lex->current_select; thd->lex->current_select= select_lex; - if (!join->optimized) + if (join->optimization_state == JOIN::NOT_OPTIMIZED) { SELECT_LEX_UNIT *unit= select_lex->master_unit(); @@ -5322,7 +5342,8 @@ int subselect_hash_sj_engine::exec() */ thd->lex->current_select= materialize_engine->select_lex; /* The subquery should be optimized, and materialized only once. */ - DBUG_ASSERT(materialize_join->optimized && !is_materialized); + DBUG_ASSERT(materialize_join->optimization_state == JOIN::OPTIMIZATION_DONE && + !is_materialized); materialize_join->exec(); if ((res= MY_TEST(materialize_join->error || thd->is_fatal_error || thd->is_error()))) diff --git a/sql/item_sum.cc b/sql/item_sum.cc index cc7a76213f0..c656d6678fc 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -381,6 +381,16 @@ bool Item_sum::register_sum_func(THD *thd, Item **ref) sl->master_unit()->item->with_sum_func= 1; } thd->lex->current_select->mark_as_dependent(thd, aggr_sel, NULL); + + if ((thd->lex->describe & DESCRIBE_EXTENDED) && aggr_sel) + { + push_warning_printf(thd, Sql_condition::WARN_LEVEL_NOTE, + ER_WARN_AGGFUNC_DEPENDENCE, + ER_THD(thd, ER_WARN_AGGFUNC_DEPENDENCE), + func_name(), + thd->lex->current_select->select_number, + aggr_sel->select_number); + } return FALSE; } @@ -1422,7 +1432,7 @@ my_decimal *Item_sum_sum::val_decimal(my_decimal *val) if (aggr) aggr->endup(); if (Item_sum_sum::result_type() == DECIMAL_RESULT) - return (dec_buffs + curr_dec_buff); + return null_value ? NULL : (dec_buffs + curr_dec_buff); return val_decimal_from_real(val); } @@ -1756,6 +1766,8 @@ double Item_sum_std::val_real() { DBUG_ASSERT(fixed == 1); double nr= Item_sum_variance::val_real(); + if (my_isinf(nr)) + return DBL_MAX; DBUG_ASSERT(nr >= 0.0); return sqrt(nr); } diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index a4a694fe5eb..41dc96717fe 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -2201,26 +2201,26 @@ void Item_extract::fix_length_and_dec() { maybe_null=1; // If wrong date switch (int_type) { - case INTERVAL_YEAR: max_length=4; date_value=1; break; - case INTERVAL_YEAR_MONTH: max_length=6; date_value=1; break; - case INTERVAL_QUARTER: max_length=2; date_value=1; break; - case INTERVAL_MONTH: max_length=2; date_value=1; break; - case INTERVAL_WEEK: max_length=2; date_value=1; break; - case INTERVAL_DAY: max_length=2; date_value=1; break; - case INTERVAL_DAY_HOUR: max_length=9; date_value=0; break; - case INTERVAL_DAY_MINUTE: max_length=11; date_value=0; break; - case INTERVAL_DAY_SECOND: max_length=13; date_value=0; break; - case INTERVAL_HOUR: max_length=2; date_value=0; break; - case INTERVAL_HOUR_MINUTE: max_length=4; date_value=0; break; - case INTERVAL_HOUR_SECOND: max_length=6; date_value=0; break; - case INTERVAL_MINUTE: max_length=2; date_value=0; break; - case INTERVAL_MINUTE_SECOND: max_length=4; date_value=0; break; - case INTERVAL_SECOND: max_length=2; date_value=0; break; - case INTERVAL_MICROSECOND: max_length=2; date_value=0; break; - case INTERVAL_DAY_MICROSECOND: max_length=20; date_value=0; break; - case INTERVAL_HOUR_MICROSECOND: max_length=13; date_value=0; break; - case INTERVAL_MINUTE_MICROSECOND: max_length=11; date_value=0; break; - case INTERVAL_SECOND_MICROSECOND: max_length=9; date_value=0; break; + case INTERVAL_YEAR: set_date_length(4); break; // YYYY + case INTERVAL_YEAR_MONTH: set_date_length(6); break; // YYYYMM + case INTERVAL_QUARTER: set_date_length(2); break; // 1..4 + case INTERVAL_MONTH: set_date_length(2); break; // MM + case INTERVAL_WEEK: set_date_length(2); break; // 0..52 + case INTERVAL_DAY: set_date_length(2); break; // DD + case INTERVAL_DAY_HOUR: set_time_length(4); break; // DDhh + case INTERVAL_DAY_MINUTE: set_time_length(6); break; // DDhhmm + case INTERVAL_DAY_SECOND: set_time_length(8); break; // DDhhmmss + case INTERVAL_HOUR: set_time_length(2); break; // hh + case INTERVAL_HOUR_MINUTE: set_time_length(4); break; // hhmm + case INTERVAL_HOUR_SECOND: set_time_length(6); break; // hhmmss + case INTERVAL_MINUTE: set_time_length(2); break; // mm + case INTERVAL_MINUTE_SECOND: set_time_length(4); break; // mmss + case INTERVAL_SECOND: set_time_length(2); break; // ss + case INTERVAL_MICROSECOND: set_time_length(6); break; // ffffff + case INTERVAL_DAY_MICROSECOND: set_time_length(14); break; // DDhhmmssffffff + case INTERVAL_HOUR_MICROSECOND: set_time_length(12); break; // hhmmssffffff + case INTERVAL_MINUTE_MICROSECOND: set_time_length(10); break; // mmssffffff + case INTERVAL_SECOND_MICROSECOND: set_time_length(8); break; // ssffffff case INTERVAL_LAST: DBUG_ASSERT(0); break; /* purecov: deadcode */ } } diff --git a/sql/item_timefunc.h b/sql/item_timefunc.h index d9de9b9311a..a853c63128d 100644 --- a/sql/item_timefunc.h +++ b/sql/item_timefunc.h @@ -923,10 +923,57 @@ public: class Item_extract :public Item_int_func { bool date_value; + void set_date_length(uint32 length) + { + /* + Although DATE components (e.g. YEAR, YEAR_MONTH, QUARTER, MONTH, WEEK) + cannot have a sign, we should probably still add +1, + because all around the code we assume that max_length is sign inclusive. + Another options is to set unsigned_flag to "true". + */ + max_length= length; //QQ: see above + date_value= true; + } + void set_time_length(uint32 length) + { + max_length= length + 1/*sign*/; + date_value= false; + } public: const interval_type int_type; // keep it public Item_extract(THD *thd, interval_type type_arg, Item *a): Item_int_func(thd, a), int_type(type_arg) {} + enum_field_types field_type() const + { + switch (int_type) { + case INTERVAL_YEAR: + case INTERVAL_YEAR_MONTH: + case INTERVAL_QUARTER: + case INTERVAL_MONTH: + case INTERVAL_WEEK: + case INTERVAL_DAY: + case INTERVAL_DAY_HOUR: + case INTERVAL_DAY_MINUTE: + case INTERVAL_DAY_SECOND: + case INTERVAL_HOUR: + case INTERVAL_HOUR_MINUTE: + case INTERVAL_HOUR_SECOND: + case INTERVAL_MINUTE: + case INTERVAL_MINUTE_SECOND: + case INTERVAL_SECOND: + case INTERVAL_MICROSECOND: + case INTERVAL_SECOND_MICROSECOND: + return MYSQL_TYPE_LONG; + case INTERVAL_DAY_MICROSECOND: + case INTERVAL_HOUR_MICROSECOND: + case INTERVAL_MINUTE_MICROSECOND: + return MYSQL_TYPE_LONGLONG; + case INTERVAL_LAST: + break; + } + DBUG_ASSERT(0); + return MYSQL_TYPE_LONGLONG; + } longlong val_int(); enum Functype functype() const { return EXTRACT_FUNC; } const char *func_name() const { return "extract"; } @@ -971,6 +1018,9 @@ class Item_extract :public Item_int_func } return true; } + Field *create_field_for_create_select(TABLE *table) + { return tmp_table_field_from_field_type(table, false, false); } + Item *get_copy(THD *thd, MEM_ROOT *mem_root) { return get_item_copy<Item_extract>(thd, mem_root, this); } }; diff --git a/sql/lock.cc b/sql/lock.cc index 07286324fc5..8aebc1f30d9 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1073,10 +1073,21 @@ void Global_read_lock::unlock_global_read_lock(THD *thd) thd->mdl_context.release_lock(m_mdl_blocks_commits_lock); m_mdl_blocks_commits_lock= NULL; #ifdef WITH_WSREP - if (WSREP_ON) + if (WSREP(thd) || wsrep_node_is_donor()) { wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; wsrep->resume(wsrep); + /* resync here only if we did implicit desync earlier */ + if (!wsrep_desync && wsrep_node_is_synced()) + { + int ret = wsrep->resync(wsrep); + if (ret != WSREP_OK) + { + WSREP_WARN("resync failed %d for FTWRL: db: %s, query: %s", ret, + (thd->db ? thd->db : "(null)"), thd->query()); + DBUG_VOID_RETURN; + } + } } #endif /* WITH_WSREP */ } @@ -1116,14 +1127,11 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd) DBUG_RETURN(0); #ifdef WITH_WSREP - if (WSREP_ON && m_mdl_blocks_commits_lock) + if (WSREP(thd) && m_mdl_blocks_commits_lock) { WSREP_DEBUG("GRL was in block commit mode when entering " "make_global_read_lock_block_commit"); - thd->mdl_context.release_lock(m_mdl_blocks_commits_lock); - m_mdl_blocks_commits_lock= NULL; - wsrep_locked_seqno= WSREP_SEQNO_UNDEFINED; - wsrep->resume(wsrep); + DBUG_RETURN(FALSE); } #endif /* WITH_WSREP */ @@ -1137,7 +1145,43 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd) m_state= GRL_ACQUIRED_AND_BLOCKS_COMMIT; #ifdef WITH_WSREP - if (WSREP_ON) + /* Native threads should bail out before wsrep oprations to follow. + Donor servicing thread is an exception, it should pause provider but not desync, + as it is already desynced in donor state + */ + if (!WSREP(thd) && !wsrep_node_is_donor()) + { + DBUG_RETURN(FALSE); + } + + /* if already desynced or donor, avoid double desyncing + if not in PC and synced, desyncing is not possible either + */ + if (wsrep_desync || !wsrep_node_is_synced()) + { + WSREP_DEBUG("desync set upfont, skipping implicit desync for FTWRL: %d", + wsrep_desync); + } + else + { + int rcode; + WSREP_DEBUG("running implicit desync for node"); + rcode = wsrep->desync(wsrep); + if (rcode != WSREP_OK) + { + WSREP_WARN("FTWRL desync failed %d for schema: %s, query: %s", + rcode, (thd->db ? thd->db : "(null)"), thd->query()); + my_message(ER_LOCK_DEADLOCK, "wsrep desync failed for FTWRL", MYF(0)); + DBUG_RETURN(TRUE); + } + } + + long long ret = wsrep->pause(wsrep); + if (ret >= 0) + { + wsrep_locked_seqno= ret; + } + else if (ret != -ENOSYS) /* -ENOSYS - no provider */ { long long ret = wsrep->pause(wsrep); if (ret >= 0) diff --git a/sql/log.cc b/sql/log.cc index fa8f10e5464..569942ac485 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -3144,6 +3144,22 @@ const char *MYSQL_LOG::generate_name(const char *log_name, } +/* + Print some additional information about addition/removal of + XID list entries. + TODO: Remove once MDEV-9510 is fixed. +*/ +#ifdef WITH_WSREP +#define WSREP_XID_LIST_ENTRY(X, Y) \ + if (wsrep_debug) \ + { \ + char buf[FN_REFLEN]; \ + strmake(buf, Y->binlog_name, Y->binlog_name_len); \ + WSREP_DEBUG(X, buf, Y->binlog_id); \ + } +#else +#define WSREP_XID_LIST_ENTRY(X, Y) do { } while(0) +#endif MYSQL_BIN_LOG::MYSQL_BIN_LOG(uint *sync_period) :reset_master_pending(0), mark_xid_done_waiting(0), @@ -3212,6 +3228,8 @@ void MYSQL_BIN_LOG::cleanup() */ DBUG_ASSERT(b->xid_count == 0); DBUG_ASSERT(!binlog_xid_count_list.head()); + WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::cleanup(): Removing xid_list_entry " + "for %s (%lu)", b); my_free(b); } @@ -3702,7 +3720,14 @@ bool MYSQL_BIN_LOG::open(const char *log_name, new_xid_list_entry->binlog_id= current_binlog_id; /* Remove any initial entries with no pending XIDs. */ while ((b= binlog_xid_count_list.head()) && b->xid_count == 0) + { + WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::open(): Removing xid_list_entry for " + "%s (%lu)", b); my_free(binlog_xid_count_list.get()); + } + mysql_cond_broadcast(&COND_xid_list); + WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::open(): Adding new xid_list_entry for " + "%s (%lu)", new_xid_list_entry); binlog_xid_count_list.push_back(new_xid_list_entry); mysql_mutex_unlock(&LOCK_xid_list); @@ -4237,8 +4262,11 @@ err: if (b->binlog_id == current_binlog_id) break; DBUG_ASSERT(b->xid_count == 0); + WSREP_XID_LIST_ENTRY("MYSQL_BIN_LOG::reset_logs(): Removing " + "xid_list_entry for %s (%lu)", b); my_free(binlog_xid_count_list.get()); } + mysql_cond_broadcast(&COND_xid_list); reset_master_pending--; mysql_mutex_unlock(&LOCK_xid_list); } @@ -4249,6 +4277,26 @@ err: } +void MYSQL_BIN_LOG::wait_for_last_checkpoint_event() +{ + mysql_mutex_lock(&LOCK_xid_list); + for (;;) + { + if (binlog_xid_count_list.is_last(binlog_xid_count_list.head())) + break; + mysql_cond_wait(&COND_xid_list, &LOCK_xid_list); + } + mysql_mutex_unlock(&LOCK_xid_list); + + /* + LOCK_xid_list and LOCK_log are chained, so the LOCK_log will only be + obtained after mark_xid_done() has written the last checkpoint event. + */ + mysql_mutex_lock(&LOCK_log); + mysql_mutex_unlock(&LOCK_log); +} + + /** Delete relay log files prior to rli->group_relay_log_name (i.e. all logs which are not involved in a non-finished group @@ -7699,7 +7747,7 @@ MYSQL_BIN_LOG::trx_group_commit_leader(group_commit_entry *leader) last= current->next == NULL; if (!current->error && RUN_HOOK(binlog_storage, after_sync, - (current->thd, log_file_name, + (current->thd, current->cache_mngr->last_commit_pos_file, current->cache_mngr->last_commit_pos_offset, first, last))) { @@ -9405,7 +9453,7 @@ TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint) */ if (unlikely(reset_master_pending)) { - mysql_cond_signal(&COND_xid_list); + mysql_cond_broadcast(&COND_xid_list); mysql_mutex_unlock(&LOCK_xid_list); DBUG_VOID_RETURN; } @@ -9443,8 +9491,7 @@ TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint) mysql_mutex_lock(&LOCK_log); mysql_mutex_lock(&LOCK_xid_list); --mark_xid_done_waiting; - if (unlikely(reset_master_pending)) - mysql_cond_signal(&COND_xid_list); + mysql_cond_broadcast(&COND_xid_list); /* We need to reload current_binlog_id due to release/re-take of lock. */ current= current_binlog_id; @@ -9459,6 +9506,8 @@ TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint) DBUG_ASSERT(b); if (b->binlog_id == current || b->xid_count > 0) break; + WSREP_XID_LIST_ENTRY("TC_LOG_BINLOG::mark_xid_done(): Removing " + "xid_list_entry for %s (%lu)", b); my_free(binlog_xid_count_list.get()); } diff --git a/sql/log.h b/sql/log.h index a74a01f9c67..8ddf8641cfa 100644 --- a/sql/log.h +++ b/sql/log.h @@ -791,6 +791,7 @@ public: bool reset_logs(THD* thd, bool create_new_log, rpl_gtid *init_state, uint32 init_state_len, ulong next_log_number); + void wait_for_last_checkpoint_event(); void close(uint exiting); void clear_inuse_flag_when_closing(File file); diff --git a/sql/log_event.cc b/sql/log_event.cc index b1cf6a9024a..9515e5c04a7 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -6025,7 +6025,6 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi, new_db.str= (char *) rpl_filter->get_rewrite_db(db, &new_db.length); thd->set_db(new_db.str, new_db.length); DBUG_ASSERT(thd->query() == 0); - thd->reset_query_inner(); // Should not be needed thd->is_slave_error= 0; clear_all_errors(thd, const_cast<Relay_log_info*>(rli)); diff --git a/sql/mdl.cc b/sql/mdl.cc index 8fec368e3be..1d6b4f6ffc3 100644 --- a/sql/mdl.cc +++ b/sql/mdl.cc @@ -17,6 +17,7 @@ #include "sql_class.h" #include "debug_sync.h" #include "sql_array.h" +#include "rpl_rli.h" #include <lf.h> #include <mysqld_error.h> #include <mysql/plugin.h> @@ -506,6 +507,10 @@ public: bitmap_t hog_lock_types_bitmap() const { return m_strategy->hog_lock_types_bitmap(); } +#ifndef DBUG_OFF + bool check_if_conflicting_replication_locks(MDL_context *ctx); +#endif + /** List of granted tickets for this lock. */ Ticket_list m_granted; /** Tickets for contexts waiting to acquire a lock. */ @@ -1977,6 +1982,55 @@ MDL_context::clone_ticket(MDL_request *mdl_request) /** + Check if there is any conflicting lock that could cause this thread + to wait for another thread which is not ready to commit. + This is always an error, as the upper level of parallel replication + should not allow a scheduling of a conflicting DDL until all earlier + transactions has commited. + + This function is only called for a slave using parallel replication + and trying to get an exclusive lock for the table. +*/ + +#ifndef DBUG_OFF +bool MDL_lock::check_if_conflicting_replication_locks(MDL_context *ctx) +{ + Ticket_iterator it(m_granted); + MDL_ticket *conflicting_ticket; + rpl_group_info *rgi_slave= ctx->get_thd()->rgi_slave; + + if (!rgi_slave->gtid_sub_id) + return 0; + + while ((conflicting_ticket= it++)) + { + if (conflicting_ticket->get_ctx() != ctx) + { + MDL_context *conflicting_ctx= conflicting_ticket->get_ctx(); + rpl_group_info *conflicting_rgi_slave; + conflicting_rgi_slave= conflicting_ctx->get_thd()->rgi_slave; + + /* + If the conflicting thread is another parallel replication + thread for the same master and it's not in commit stage, then + the current transaction has started too early and something is + seriously wrong. + */ + if (conflicting_rgi_slave && + conflicting_rgi_slave->gtid_sub_id && + conflicting_rgi_slave->rli == rgi_slave->rli && + conflicting_rgi_slave->current_gtid.domain_id == + rgi_slave->current_gtid.domain_id && + !conflicting_rgi_slave->did_mark_start_commit) + return 1; // Fatal error + } + } + return 0; +} +#endif + + +/** Acquire one lock with waiting for conflicting locks to go away if needed. @param mdl_request [in/out] Lock request object for lock to be acquired @@ -2036,6 +2090,19 @@ MDL_context::acquire_lock(MDL_request *mdl_request, double lock_wait_timeout) if (lock->needs_notification(ticket) && lock_wait_timeout) lock->notify_conflicting_locks(this); + /* + Ensure that if we are trying to get an exclusive lock for a slave + running parallel replication, then we are not blocked by another + parallel slave thread that is not committed. This should never happen as + the parallel replication scheduler should never schedule a DDL while + DML's are still running. + */ + DBUG_ASSERT((mdl_request->type != MDL_INTENTION_EXCLUSIVE && + mdl_request->type != MDL_EXCLUSIVE) || + !(get_thd()->rgi_slave && + get_thd()->rgi_slave->is_parallel_exec && + lock->check_if_conflicting_replication_locks(this))); + mysql_prlock_unlock(&lock->m_rwlock); will_wait_for(ticket); diff --git a/sql/multi_range_read.cc b/sql/multi_range_read.cc index 6e8428f1aad..5de9b4a9eec 100644 --- a/sql/multi_range_read.cc +++ b/sql/multi_range_read.cc @@ -261,7 +261,7 @@ int handler::multi_range_read_next(range_id_t *range_info) } else { - if (was_semi_consistent_read()) + if (ha_was_semi_consistent_read()) { /* The following assignment is redundant, but for extra safety and to diff --git a/sql/my_json_writer.cc b/sql/my_json_writer.cc index e97db210da7..d36fdd1192a 100644 --- a/sql/my_json_writer.cc +++ b/sql/my_json_writer.cc @@ -330,6 +330,8 @@ void Single_line_formatting_helper::flush_on_one_line() ptr++; } owner->output.append(']'); + /* We've printed out the contents of the buffer, mark it as empty */ + buf_ptr= buffer; } diff --git a/sql/mysqld.cc b/sql/mysqld.cc index ea7bb2b5dcf..ded87d59249 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2761,26 +2761,17 @@ static void network_init(void) saPipeSecurity.lpSecurityDescriptor = &sdPipeDescriptor; saPipeSecurity.bInheritHandle = FALSE; if ((hPipe= CreateNamedPipe(pipe_name, - PIPE_ACCESS_DUPLEX|FILE_FLAG_OVERLAPPED, - PIPE_TYPE_BYTE | - PIPE_READMODE_BYTE | - PIPE_WAIT, - PIPE_UNLIMITED_INSTANCES, - (int) global_system_variables.net_buffer_length, - (int) global_system_variables.net_buffer_length, - NMPWAIT_USE_DEFAULT_WAIT, - &saPipeSecurity)) == INVALID_HANDLE_VALUE) - { - LPVOID lpMsgBuf; - int error=GetLastError(); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM, - NULL, error, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, 0, NULL ); - sql_perror((char *)lpMsgBuf); - LocalFree(lpMsgBuf); - unireg_abort(1); - } + PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED | FILE_FLAG_FIRST_PIPE_INSTANCE, + PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT, + PIPE_UNLIMITED_INSTANCES, + (int) global_system_variables.net_buffer_length, + (int) global_system_variables.net_buffer_length, + NMPWAIT_USE_DEFAULT_WAIT, + &saPipeSecurity)) == INVALID_HANDLE_VALUE) + { + sql_perror("Create named pipe failed"); + unireg_abort(1); + } } #endif @@ -7771,7 +7762,10 @@ static int show_slaves_running(THD *thd, SHOW_VAR *var, char *buff) var->value= buff; mysql_mutex_lock(&LOCK_active_mi); - *((longlong *)buff)= master_info_index->any_slave_sql_running(); + if (master_info_index) + *((longlong *)buff)= master_info_index->any_slave_sql_running(); + else + *((longlong *)buff)= 0; mysql_mutex_unlock(&LOCK_active_mi); return 0; @@ -8405,6 +8399,7 @@ SHOW_VAR status_vars[]= { {"Delayed_errors", (char*) &delayed_insert_errors, SHOW_LONG}, {"Delayed_insert_threads", (char*) &delayed_insert_threads, SHOW_LONG_NOFLUSH}, {"Delayed_writes", (char*) &delayed_insert_writes, SHOW_LONG}, + {"Delete_scan", (char*) offsetof(STATUS_VAR, delete_scan_count), SHOW_LONG_STATUS}, {"Empty_queries", (char*) offsetof(STATUS_VAR, empty_queries), SHOW_LONG_STATUS}, {"Executed_events", (char*) &executed_events, SHOW_LONG_NOFLUSH }, {"Executed_triggers", (char*) offsetof(STATUS_VAR, executed_triggers), SHOW_LONG_STATUS}, @@ -8434,6 +8429,7 @@ SHOW_VAR status_vars[]= { {"Handler_read_last", (char*) offsetof(STATUS_VAR, ha_read_last_count), SHOW_LONG_STATUS}, {"Handler_read_next", (char*) offsetof(STATUS_VAR, ha_read_next_count), SHOW_LONG_STATUS}, {"Handler_read_prev", (char*) offsetof(STATUS_VAR, ha_read_prev_count), SHOW_LONG_STATUS}, + {"Handler_read_retry", (char*) offsetof(STATUS_VAR, ha_read_retry_count), SHOW_LONG_STATUS}, {"Handler_read_rnd", (char*) offsetof(STATUS_VAR, ha_read_rnd_count), SHOW_LONG_STATUS}, {"Handler_read_rnd_deleted", (char*) offsetof(STATUS_VAR, ha_read_rnd_deleted_count), SHOW_LONG_STATUS}, {"Handler_read_rnd_next", (char*) offsetof(STATUS_VAR, ha_read_rnd_next_count), SHOW_LONG_STATUS}, @@ -8555,6 +8551,7 @@ SHOW_VAR status_vars[]= { {"Threads_connected", (char*) &connection_count, SHOW_INT}, {"Threads_created", (char*) &thread_created, SHOW_LONG_NOFLUSH}, {"Threads_running", (char*) &thread_running, SHOW_INT}, + {"Update_scan", (char*) offsetof(STATUS_VAR, update_scan_count), SHOW_LONG_STATUS}, {"Uptime", (char*) &show_starttime, SHOW_SIMPLE_FUNC}, #ifdef ENABLED_PROFILING {"Uptime_since_flush_status",(char*) &show_flushstatustime, SHOW_SIMPLE_FUNC}, @@ -10161,11 +10158,6 @@ PSI_stage_info stage_waiting_for_the_next_event_in_relay_log= { 0, "Waiting for PSI_stage_info stage_waiting_for_the_slave_thread_to_advance_position= { 0, "Waiting for the slave SQL thread to advance position", 0}; PSI_stage_info stage_waiting_to_finalize_termination= { 0, "Waiting to finalize termination", 0}; PSI_stage_info stage_waiting_to_get_readlock= { 0, "Waiting to get readlock", 0}; -PSI_stage_info stage_slave_waiting_workers_to_exit= { 0, "Waiting for workers to exit", 0}; -PSI_stage_info stage_slave_waiting_worker_to_release_partition= { 0, "Waiting for Slave Worker to release partition", 0}; -PSI_stage_info stage_slave_waiting_worker_to_free_events= { 0, "Waiting for Slave Workers to free pending events", 0}; -PSI_stage_info stage_slave_waiting_worker_queue= { 0, "Waiting for Slave Worker queue", 0}; -PSI_stage_info stage_slave_waiting_event_from_coordinator= { 0, "Waiting for an event from Coordinator", 0}; PSI_stage_info stage_binlog_waiting_background_tasks= { 0, "Waiting for background binlog tasks", 0}; PSI_stage_info stage_binlog_processing_checkpoint_notify= { 0, "Processing binlog checkpoint notification", 0}; PSI_stage_info stage_binlog_stopping_background_thread= { 0, "Stopping binlog background thread", 0}; @@ -10261,11 +10253,6 @@ PSI_stage_info *all_server_stages[]= & stage_setup, & stage_show_explain, & stage_slave_has_read_all_relay_log, - & stage_slave_waiting_event_from_coordinator, - & stage_slave_waiting_worker_queue, - & stage_slave_waiting_worker_to_free_events, - & stage_slave_waiting_worker_to_release_partition, - & stage_slave_waiting_workers_to_exit, & stage_sorting, & stage_sorting_for_group, & stage_sorting_for_order, diff --git a/sql/mysqld.h b/sql/mysqld.h index 602cc258943..3356372d3d3 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -475,11 +475,6 @@ extern PSI_stage_info stage_waiting_for_the_next_event_in_relay_log; extern PSI_stage_info stage_waiting_for_the_slave_thread_to_advance_position; extern PSI_stage_info stage_waiting_to_finalize_termination; extern PSI_stage_info stage_waiting_to_get_readlock; -extern PSI_stage_info stage_slave_waiting_worker_to_release_partition; -extern PSI_stage_info stage_slave_waiting_worker_to_free_events; -extern PSI_stage_info stage_slave_waiting_worker_queue; -extern PSI_stage_info stage_slave_waiting_event_from_coordinator; -extern PSI_stage_info stage_slave_waiting_workers_to_exit; extern PSI_stage_info stage_binlog_waiting_background_tasks; extern PSI_stage_info stage_binlog_processing_checkpoint_notify; extern PSI_stage_info stage_binlog_stopping_background_thread; diff --git a/sql/net_serv.cc b/sql/net_serv.cc index dc97d5e8e54..fccc947f3f1 100644 --- a/sql/net_serv.cc +++ b/sql/net_serv.cc @@ -552,7 +552,7 @@ net_write_buff(NET *net, const uchar *packet, ulong len) left_length= (ulong) (net->buff_end - net->write_pos); #ifdef DEBUG_DATA_PACKETS - DBUG_DUMP("data", packet, len); + DBUG_DUMP("data_written", packet, len); #endif if (len > left_length) { @@ -641,7 +641,8 @@ net_real_write(NET *net,const uchar *packet, size_t len) } memcpy(b+header_length,packet,len); - if (my_compress(b+header_length, &len, &complen)) + /* Don't compress error packets (compress == 2) */ + if (net->compress == 2 || my_compress(b+header_length, &len, &complen)) complen=0; int3store(&b[NET_HEADER_SIZE],complen); int3store(b,len); @@ -652,7 +653,7 @@ net_real_write(NET *net,const uchar *packet, size_t len) #endif /* HAVE_COMPRESS */ #ifdef DEBUG_DATA_PACKETS - DBUG_DUMP("data", packet, len); + DBUG_DUMP("data_written", packet, len); #endif #ifndef NO_ALARM @@ -842,6 +843,7 @@ my_real_read(NET *net, size_t *complen, size_t length; uint i,retry_count=0; ulong len=packet_error; + my_bool expect_error_packet __attribute__((unused))= 0; thr_alarm_t alarmed; #ifndef NO_ALARM ALARM alarm_buff; @@ -890,6 +892,7 @@ my_real_read(NET *net, size_t *complen, if (i== 0 && thd_net_is_killed()) { + DBUG_PRINT("info", ("thd is killed")); len= packet_error; net->error= 0; net->last_errno= ER_CONNECTION_KILLED; @@ -959,39 +962,34 @@ my_real_read(NET *net, size_t *complen, pos+= length; update_statistics(thd_increment_bytes_received(net->thd, length)); } + +#ifdef DEBUG_DATA_PACKETS + DBUG_DUMP("data_read", net->buff+net->where_b, length); +#endif if (i == 0) { /* First parts is packet length */ ulong helping; +#ifndef DEBUG_DATA_PACKETS DBUG_DUMP("packet_header", net->buff+net->where_b, NET_HEADER_SIZE); +#endif if (net->buff[net->where_b + 3] != (uchar) net->pkt_nr) - { - if (net->buff[net->where_b] != (uchar) 255) - { - DBUG_PRINT("error", - ("Packets out of order (Found: %d, expected %u)", - (int) net->buff[net->where_b + 3], - net->pkt_nr)); - /* - We don't make noise server side, since the client is expected - to break the protocol for e.g. --send LOAD DATA .. LOCAL where - the server expects the client to send a file, but the client - may reply with a new command instead. - */ + { #ifndef MYSQL_SERVER - EXTRA_DEBUG_fflush(stdout); - EXTRA_DEBUG_fprintf(stderr,"Error: Packets out of order (Found: %d, expected %d)\n", - (int) net->buff[net->where_b + 3], - (uint) (uchar) net->pkt_nr); - EXTRA_DEBUG_fflush(stderr); + if (net->buff[net->where_b + 3] == (uchar) (net->pkt_nr -1)) + { + /* + If the server was killed then the server may have missed the + last sent client packet and the packet numbering may be one off. + */ + DBUG_PRINT("warning", ("Found possible out of order packets")); + expect_error_packet= 1; + } + else #endif - } - len= packet_error; - /* Not a NET error on the client. XXX: why? */ - MYSQL_SERVER_my_error(ER_NET_PACKETS_OUT_OF_ORDER, MYF(0)); - goto end; - } - net->compress_pkt_nr= ++net->pkt_nr; + goto packets_out_of_order; + } + net->compress_pkt_nr= ++net->pkt_nr; #ifdef HAVE_COMPRESS if (net->compress) { @@ -1039,6 +1037,21 @@ my_real_read(NET *net, size_t *complen, } #endif } +#ifndef MYSQL_SERVER + else if (expect_error_packet) + { + /* + This check is safe both for compressed and not compressed protocol + as for the compressed protocol errors are not compressed anymore. + */ + if (net->buff[net->where_b] != (uchar) 255) + { + /* Restore pkt_nr to original value */ + net->pkt_nr--; + goto packets_out_of_order; + } + } +#endif } end: @@ -1052,7 +1065,7 @@ end: net->reading_or_writing=0; #ifdef DEBUG_DATA_PACKETS if (len != packet_error) - DBUG_DUMP("data", net->buff+net->where_b, len); + DBUG_DUMP("data_read", net->buff+net->where_b, len); #endif #ifdef MYSQL_SERVER if (server_extension != NULL) @@ -1063,9 +1076,35 @@ end: } #endif return(len); + +packets_out_of_order: + { + DBUG_PRINT("error", + ("Packets out of order (Found: %d, expected %u)", + (int) net->buff[net->where_b + 3], + net->pkt_nr)); + DBUG_ASSERT(0); + /* + We don't make noise server side, since the client is expected + to break the protocol for e.g. --send LOAD DATA .. LOCAL where + the server expects the client to send a file, but the client + may reply with a new command instead. + */ +#ifndef MYSQL_SERVER + EXTRA_DEBUG_fflush(stdout); + EXTRA_DEBUG_fprintf(stderr,"Error: Packets out of order (Found: %d, expected %d)\n", + (int) net->buff[net->where_b + 3], + (uint) (uchar) net->pkt_nr); + EXTRA_DEBUG_fflush(stderr); +#endif + len= packet_error; + MYSQL_SERVER_my_error(ER_NET_PACKETS_OUT_OF_ORDER, MYF(0)); + goto end; + } } + /* Old interface. See my_net_read_packet() for function description */ #undef my_net_read diff --git a/sql/opt_range.cc b/sql/opt_range.cc index bd191f715e0..3ea9f4e5db9 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -2428,8 +2428,6 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, scan_time= read_time= DBL_MAX; if (limit < records) read_time= (double) records + scan_time + 1; // Force to use index - else if (read_time <= 2.0 && !force_quick_range) - DBUG_RETURN(0); /* No need for quick select */ possible_keys.clear_all(); @@ -2699,7 +2697,6 @@ int SQL_SELECT::test_quick_select(THD *thd, key_map keys_to_use, thd->no_errors=0; } - DBUG_EXECUTE("info", print_quick(quick, &needed_reg);); /* @@ -10377,8 +10374,10 @@ get_quick_keys(PARAM *param,QUICK_RANGE_SELECT *quick,KEY_PART *key, KEY *table_key=quick->head->key_info+quick->index; flag=EQ_RANGE; if ((table_key->flags & HA_NOSAME) && + min_part == key_tree->part && key_tree->part == table_key->user_defined_key_parts-1) { + DBUG_ASSERT(min_part == max_part); if ((table_key->flags & HA_NULL_PART_KEY) && null_part_in_key(key, param->min_key, @@ -11904,8 +11903,6 @@ void QUICK_ROR_UNION_SELECT::add_used_key_part_to_set(MY_BITMAP *col_set) *******************************************************************************/ static inline uint get_field_keypart(KEY *index, Field *field); -static inline SEL_ARG * get_index_range_tree(uint index, SEL_TREE* range_tree, - PARAM *param, uint *param_idx); static bool get_sel_arg_for_keypart(Field *field, SEL_ARG *index_range_tree, SEL_ARG **cur_range); static bool get_constant_key_infix(KEY *index_info, SEL_ARG *index_range_tree, @@ -12179,8 +12176,6 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) (GA1,GA2) are all TRUE. If there is more than one such index, select the first one. Here we set the variables: group_prefix_len and index_info. */ - KEY *cur_index_info= table->key_info; - KEY *cur_index_info_end= cur_index_info + table->s->keys; /* Cost-related variables for the best index so far. */ double best_read_cost= DBL_MAX; ha_rows best_records= 0; @@ -12192,11 +12187,12 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) uint max_key_part; SEL_ARG *cur_index_tree= NULL; ha_rows cur_quick_prefix_records= 0; - uint cur_param_idx=MAX_KEY; - for (uint cur_index= 0 ; cur_index_info != cur_index_info_end ; - cur_index_info++, cur_index++) + // We go through allowed indexes + for (uint cur_param_idx= 0; cur_param_idx < param->keys ; ++cur_param_idx) { + const uint cur_index= param->real_keynr[cur_param_idx]; + KEY *const cur_index_info= &table->key_info[cur_index]; KEY_PART_INFO *cur_part; KEY_PART_INFO *end_part; /* Last part for loops. */ /* Last index part. */ @@ -12219,7 +12215,8 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) (was also: "Exclude UNIQUE indexes ..." but this was removed because there are cases Loose Scan over a multi-part index is useful). */ - if (!table->covering_keys.is_set(cur_index)) + if (!table->covering_keys.is_set(cur_index) || + !table->keys_in_use_for_group_by.is_set(cur_index)) continue; /* @@ -12398,9 +12395,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) { if (tree) { - uint dummy; - SEL_ARG *index_range_tree= get_index_range_tree(cur_index, tree, param, - &dummy); + SEL_ARG *index_range_tree= tree->keys[cur_param_idx]; if (!get_constant_key_infix(cur_index_info, index_range_tree, first_non_group_part, min_max_arg_part, last_part, thd, cur_key_infix, @@ -12464,9 +12459,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) */ if (tree && min_max_arg_item) { - uint dummy; - SEL_ARG *index_range_tree= get_index_range_tree(cur_index, tree, param, - &dummy); + SEL_ARG *index_range_tree= tree->keys[cur_param_idx]; SEL_ARG *cur_range= NULL; if (get_sel_arg_for_keypart(min_max_arg_part->field, index_range_tree, &cur_range) || @@ -12484,9 +12477,7 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time) /* Compute the cost of using this index. */ if (tree) { - /* Find the SEL_ARG sub-tree that corresponds to the chosen index. */ - cur_index_tree= get_index_range_tree(cur_index, tree, param, - &cur_param_idx); + cur_index_tree= tree->keys[cur_param_idx]; /* Check if this range tree can be used for prefix retrieval. */ Cost_estimate dummy_cost; uint mrr_flags= HA_MRR_USE_DEFAULT_IMPL; @@ -13020,44 +13011,6 @@ get_field_keypart(KEY *index, Field *field) /* - Find the SEL_ARG sub-tree that corresponds to the chosen index. - - SYNOPSIS - get_index_range_tree() - index [in] The ID of the index being looked for - range_tree[in] Tree of ranges being searched - param [in] PARAM from SQL_SELECT::test_quick_select - param_idx [out] Index in the array PARAM::key that corresponds to 'index' - - DESCRIPTION - - A SEL_TREE contains range trees for all usable indexes. This procedure - finds the SEL_ARG sub-tree for 'index'. The members of a SEL_TREE are - ordered in the same way as the members of PARAM::key, thus we first find - the corresponding index in the array PARAM::key. This index is returned - through the variable param_idx, to be used later as argument of - check_quick_select(). - - RETURN - Pointer to the SEL_ARG subtree that corresponds to index. -*/ - -SEL_ARG * get_index_range_tree(uint index, SEL_TREE* range_tree, PARAM *param, - uint *param_idx) -{ - uint idx= 0; /* Index nr in param->key_parts */ - while (idx < param->keys) - { - if (index == param->real_keynr[idx]) - break; - idx++; - } - *param_idx= idx; - return(range_tree->keys[idx]); -} - - -/* Compute the cost of a quick_group_min_max_select for a particular index. SYNOPSIS diff --git a/sql/opt_range_mrr.cc b/sql/opt_range_mrr.cc index 729c491a6f1..fbccb7c4e1d 100644 --- a/sql/opt_range_mrr.cc +++ b/sql/opt_range_mrr.cc @@ -278,14 +278,14 @@ walk_up_n_right: (1) - range analysis is used for estimating condition selectivity (2) - This is a unique key, and we have conditions for all its user-defined key parts. - (3) - The table uses extended keys, and we have conditions for - all key parts. + (3) - The table uses extended keys, this key covers all components, + and we have conditions for all key parts. */ if (!(cur->min_key_flag & ~NULL_RANGE) && !cur->max_key_flag && (!key_info || // (1) ((uint)key_tree->part+1 == key_info->user_defined_key_parts && // (2) key_info->flags & HA_NOSAME) || // (2) - (seq->param->table->s->use_ext_keys && // (3) + ((key_info->flags & HA_EXT_NOSAME) && // (3) (uint)key_tree->part+1 == key_info->ext_key_parts) // (3) ) && range->start_key.length == range->end_key.length && diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc index ef05b768b69..a09826ac2f0 100644 --- a/sql/opt_subselect.cc +++ b/sql/opt_subselect.cc @@ -1560,7 +1560,12 @@ static bool convert_subq_to_sj(JOIN *parent_join, Item_in_subselect *subq_pred) { tl->set_tablenr(table_no); if (tl->is_jtbm()) + { tl->jtbm_table_no= table_no; + Item *dummy= tl->jtbm_subselect; + tl->jtbm_subselect->fix_after_pullout(parent_lex, &dummy); + DBUG_ASSERT(dummy == tl->jtbm_subselect); + } SELECT_LEX *old_sl= tl->select_lex; tl->select_lex= parent_join->select_lex; for (TABLE_LIST *emb= tl->embedding; diff --git a/sql/protocol.cc b/sql/protocol.cc index 9ad9269f3b5..be73c94c9b2 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -426,7 +426,8 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err, uint error; char converted_err[MYSQL_ERRMSG_SIZE]; char buff[2+1+SQLSTATE_LENGTH+MYSQL_ERRMSG_SIZE], *pos; - + my_bool ret; + uint8 save_compress; DBUG_ENTER("send_error_packet"); if (net->vio == 0) @@ -454,8 +455,16 @@ bool net_send_error_packet(THD *thd, uint sql_errno, const char *err, /* Converted error message is always null-terminated. */ length= (uint) (strmake(pos, converted_err, MYSQL_ERRMSG_SIZE - 1) - buff); - DBUG_RETURN(net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) buff, - length)); + /* + Ensure that errors are not compressed. This is to ensure we can + detect out of bands error messages in the client + */ + if ((save_compress= net->compress)) + net->compress= 2; + ret= net_write_command(net,(uchar) 255, (uchar*) "", 0, (uchar*) buff, + length); + net->compress= save_compress; + DBUG_RETURN(ret); } #endif /* EMBEDDED_LIBRARY */ diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc index 02dbac46eb5..6048d26998b 100644 --- a/sql/rpl_mi.cc +++ b/sql/rpl_mi.cc @@ -1233,8 +1233,6 @@ Master_info_index::get_master_info(const LEX_STRING *connection_name, connection_name->str)); mysql_mutex_assert_owner(&LOCK_active_mi); - if (!this) // master_info_index is set to NULL on server shutdown - DBUG_RETURN(NULL); /* Make name lower case for comparison */ res= strmake(buff, connection_name->str, connection_name->length); @@ -1388,8 +1386,6 @@ bool Master_info_index::give_error_if_slave_running() { DBUG_ENTER("give_error_if_slave_running"); mysql_mutex_assert_owner(&LOCK_active_mi); - if (!this) // master_info_index is set to NULL on server shutdown - DBUG_RETURN(TRUE); for (uint i= 0; i< master_info_hash.records; ++i) { @@ -1420,8 +1416,7 @@ uint Master_info_index::any_slave_sql_running() { uint count= 0; DBUG_ENTER("any_slave_sql_running"); - if (!this) // master_info_index is set to NULL on server shutdown - DBUG_RETURN(count); + mysql_mutex_assert_owner(&LOCK_active_mi); for (uint i= 0; i< master_info_hash.records; ++i) { diff --git a/sql/rpl_rli.cc b/sql/rpl_rli.cc index c1a1c440922..de6e37aecaf 100644 --- a/sql/rpl_rli.cc +++ b/sql/rpl_rli.cc @@ -1939,8 +1939,8 @@ rpl_group_info::mark_start_commit_no_lock() { if (did_mark_start_commit) return; - mark_start_commit_inner(parallel_entry, gco, this); did_mark_start_commit= true; + mark_start_commit_inner(parallel_entry, gco, this); } @@ -1951,12 +1951,12 @@ rpl_group_info::mark_start_commit() if (did_mark_start_commit) return; + did_mark_start_commit= true; e= this->parallel_entry; mysql_mutex_lock(&e->LOCK_parallel_entry); mark_start_commit_inner(e, gco, this); mysql_mutex_unlock(&e->LOCK_parallel_entry); - did_mark_start_commit= true; } @@ -1999,12 +1999,12 @@ rpl_group_info::unmark_start_commit() if (!did_mark_start_commit) return; + did_mark_start_commit= false; e= this->parallel_entry; mysql_mutex_lock(&e->LOCK_parallel_entry); --e->count_committing_event_groups; mysql_mutex_unlock(&e->LOCK_parallel_entry); - did_mark_start_commit= false; } diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 3082508613c..4efc1bdcc43 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -7139,6 +7139,10 @@ ER_KILL_QUERY_DENIED_ERROR ER_NO_EIS_FOR_FIELD eng "Engine-independent statistics are not collected for column '%s'" ukr "Ðезалежна від типу таблиці ÑтатиÑтика не збираєтьÑÑ Ð´Ð»Ñ ÑÑ‚Ð¾Ð²Ð±Ñ†Ñ '%s'" +ER_WARN_AGGFUNC_DEPENDENCE + eng "Aggregate function '%-.192s)' of SELECT #%d belongs to SELECT #%d" + ukr "Ðгрегатна Ñ„ÑƒÐ½ÐºÑ†Ñ–Ñ '%-.192s)' з SELECTу #%d належить до SELECTу #%d" + # # Internal errors, not used # diff --git a/sql/signal_handler.cc b/sql/signal_handler.cc index ae49e65bb1d..f9478134ab4 100644 --- a/sql/signal_handler.cc +++ b/sql/signal_handler.cc @@ -65,6 +65,12 @@ extern "C" sig_handler handle_fatal_signal(int sig) #ifdef HAVE_STACKTRACE THD *thd; #endif + /* + This flag remembers if the query pointer was found invalid. + We will try and print the query at the end of the signal handler, in case + we're wrong. + */ + bool print_invalid_query_pointer= false; if (segfaulted) { @@ -201,7 +207,12 @@ extern "C" sig_handler handle_fatal_signal(int sig) "Some pointers may be invalid and cause the dump to abort.\n"); my_safe_printf_stderr("Query (%p): ", thd->query()); - my_safe_print_str(thd->query(), MY_MIN(65536U, thd->query_length())); + if (my_safe_print_str(thd->query(), MY_MIN(65536U, thd->query_length()))) + { + // Query was found invalid. We will try to print it at the end. + print_invalid_query_pointer= true; + } + my_safe_printf_stderr("\nConnection ID (thread ID): %lu\n", (ulong) thd->thread_id); my_safe_printf_stderr("Status: %s\n\n", kreason); @@ -265,6 +276,16 @@ extern "C" sig_handler handle_fatal_signal(int sig) "\"mlockall\" bugs.\n"); } + if (print_invalid_query_pointer) + { + my_safe_printf_stderr( + "\nWe think the query pointer is invalid, but we will try " + "to print it anyway. \n" + "Query: "); + my_write_stderr(thd->query(), MY_MIN(65536U, thd->query_length())); + my_safe_printf_stderr("\n\n"); + } + #ifdef HAVE_WRITE_CORE if (test_flags & TEST_CORE_ON_SIGNAL) { diff --git a/sql/slave.cc b/sql/slave.cc index 078307274b0..f0613d048a9 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -647,6 +647,7 @@ int terminate_slave_threads(Master_info* mi,int thread_mask,bool skip_lock) mysql_mutex_unlock(log_lock); } if (opt_slave_parallel_threads > 0 && + master_info_index &&// master_info_index is set to NULL on server shutdown !master_info_index->any_slave_sql_running()) rpl_parallel_inactivate_pool(&global_rpl_thread_pool); if (thread_mask & (SLAVE_IO|SLAVE_FORCE_ALL)) @@ -6205,9 +6206,9 @@ static int connect_to_master(THD* thd, MYSQL* mysql, Master_info* mi, #ifndef DBUG_OFF mi->events_till_disconnect = disconnect_slave_event_count; #endif - ulong client_flag= 0; + ulong client_flag= CLIENT_REMEMBER_OPTIONS; if (opt_slave_compressed_protocol) - client_flag=CLIENT_COMPRESS; /* We will use compression */ + client_flag|= CLIENT_COMPRESS; /* We will use compression */ mysql_options(mysql, MYSQL_OPT_CONNECT_TIMEOUT, (char *) &slave_net_timeout); mysql_options(mysql, MYSQL_OPT_READ_TIMEOUT, (char *) &slave_net_timeout); diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index fe8e8eea83f..f0f96d340cc 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -31,7 +31,7 @@ #include "sql_base.h" // close_mysql_tables #include "key.h" // key_copy, key_cmp_if_same, key_restore #include "sql_show.h" // append_identifier -#include "sql_table.h" // build_table_filename +#include "sql_table.h" // write_bin_log #include "hash_filo.h" #include "sql_parse.h" // check_access #include "sql_view.h" // VIEW_ANY_ACL @@ -2795,7 +2795,7 @@ bool change_password(THD *thd, LEX_USER *user) if (WSREP(thd) && !IF_WSREP(thd->wsrep_applier, 0)) { - thd->set_query_inner(buff, query_length, system_charset_info); + thd->set_query(buff, query_length, system_charset_info); WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL); } @@ -2856,7 +2856,7 @@ error: // this label is used in WSREP_TO_ISOLATION_BEGIN { WSREP_TO_ISOLATION_END; - thd->set_query_inner(query_save); + thd->set_query(query_save); thd->wsrep_exec_mode = LOCAL_STATE; } #endif /* WITH_WSREP */ @@ -2920,7 +2920,7 @@ int acl_set_default_role(THD *thd, const char *host, const char *user, if (WSREP(thd) && !IF_WSREP(thd->wsrep_applier, 0)) { - thd->set_query_inner(buff, query_length, system_charset_info); + thd->set_query(buff, query_length, system_charset_info); WSREP_TO_ISOLATION_BEGIN(WSREP_MYSQL_DB, (char*)"user", NULL); } @@ -3007,7 +3007,7 @@ error: // this label is used in WSREP_TO_ISOLATION_END { WSREP_TO_ISOLATION_END; - thd->set_query_inner(query_save); + thd->set_query(query_save); thd->wsrep_exec_mode = LOCAL_STATE; } #endif /* WITH_WSREP */ diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 7757068b265..9cd8b10331d 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2015, Oracle and/or its affiliates. +/* Copyright (c) 2000, 2016, Oracle and/or its affiliates. Copyright (c) 2010, 2016, MariaDB This program is free software; you can redistribute it and/or modify @@ -4211,6 +4211,15 @@ handle_view(THD *thd, Query_tables_list *prelocking_ctx, &table_list->view->sroutines_list, table_list->top_table()); } + + /* + If a trigger was defined on one of the associated tables then assign the + 'trg_event_map' value of the view to the next table in table_list. When a + Stored function is invoked, all the associated tables including the tables + associated with the trigger are prelocked. + */ + if (table_list->trg_event_map && table_list->next_global) + table_list->next_global->trg_event_map= table_list->trg_event_map; return FALSE; } diff --git a/sql/sql_class.cc b/sql/sql_class.cc index 54bc4b9959f..c21f8245efc 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1018,6 +1018,7 @@ THD::THD(my_thread_id id, bool is_wsrep_applier) wsrep_TOI_pre_query_len = 0; wsrep_info[sizeof(wsrep_info) - 1] = '\0'; /* make sure it is 0-terminated */ wsrep_sync_wait_gtid = WSREP_GTID_UNDEFINED; + wsrep_affected_rows = 0; #endif /* Call to init() below requires fully initialized Open_tables_state. */ reset_open_tables_state(this); @@ -1448,6 +1449,7 @@ void THD::init(void) wsrep_TOI_pre_query = NULL; wsrep_TOI_pre_query_len = 0; wsrep_sync_wait_gtid = WSREP_GTID_UNDEFINED; + wsrep_affected_rows = 0; #endif /* WITH_WSREP */ if (variables.sql_log_bin) @@ -2311,6 +2313,8 @@ void THD::cleanup_after_query() #ifdef WITH_WSREP wsrep_sync_wait_gtid= WSREP_GTID_UNDEFINED; + if (!in_active_multi_stmt_transaction()) + wsrep_affected_rows= 0; #endif /* WITH_WSREP */ DBUG_VOID_RETURN; @@ -5282,7 +5286,11 @@ 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 { definer->user = invoker_user; definer->host= invoker_host; diff --git a/sql/sql_class.h b/sql/sql_class.h index 02a0523bee2..c316c12549c 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -730,9 +730,11 @@ typedef struct system_status_var ulong ha_read_key_count; ulong ha_read_next_count; ulong ha_read_prev_count; + ulong ha_read_retry_count; ulong ha_read_rnd_count; ulong ha_read_rnd_next_count; ulong ha_read_rnd_deleted_count; + /* This number doesn't include calls to the default implementation and calls made by range access. The intent is to count only calls made by @@ -766,6 +768,8 @@ typedef struct system_status_var ulong select_range_count_; ulong select_range_check_count_; ulong select_scan_count_; + ulong update_scan_count; + ulong delete_scan_count; ulong executed_triggers; ulong long_query_count; ulong filesort_merge_passes_; @@ -3183,12 +3187,12 @@ public: set_start_time(); start_utime= utime_after_lock= microsecond_interval_timer(); } - inline void set_time(my_hrtime_t t) + inline void set_time(my_hrtime_t t) { user_time= t; set_time(); } - inline void set_time(my_time_t t, ulong sec_part) + inline void set_time(my_time_t t, ulong sec_part) { my_hrtime_t hrtime= { hrtime_from_time(t) + sec_part }; set_time(hrtime); @@ -4209,6 +4213,7 @@ public: */ bool wsrep_ignore_table; wsrep_gtid_t wsrep_sync_wait_gtid; + ulong wsrep_affected_rows; #endif /* WITH_WSREP */ /* Handling of timeouts for commands */ diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc index 95aee805c7f..4f9afca2f6d 100644 --- a/sql/sql_delete.cc +++ b/sql/sql_delete.cc @@ -27,7 +27,6 @@ #include "sql_delete.h" #include "sql_cache.h" // query_cache_* #include "sql_base.h" // open_temprary_table -#include "sql_table.h" // build_table_filename #include "lock.h" // unlock_table_name #include "sql_view.h" // check_key_in_view, mysql_frm_type #include "sql_parse.h" // mysql_init_select @@ -488,6 +487,9 @@ bool mysql_delete(THD *thd, TABLE_LIST *table_list, COND *conds, DBUG_EXECUTE_IF("show_explain_probe_delete_exec_start", dbug_serve_apcs(thd, 1);); + if (!(select && select->quick)) + status_var_increment(thd->status_var.delete_scan_count); + if (query_plan.using_filesort) { diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 13943ce8d3c..3025c6e36dc 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -3348,6 +3348,7 @@ bool Delayed_insert::handle_inserts(void) max_rows= 0; // For DBUG output #endif /* Remove all not used rows */ + mysql_mutex_lock(&mutex); while ((row=rows.get())) { if (table->s->blob_fields) @@ -3364,7 +3365,6 @@ bool Delayed_insert::handle_inserts(void) } DBUG_PRINT("error", ("dropped %lu rows after an error", max_rows)); thread_safe_increment(delayed_insert_errors, &LOCK_delayed_status); - mysql_mutex_lock(&mutex); DBUG_RETURN(1); } #endif /* EMBEDDED_LIBRARY */ diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 3d123837b99..72630822ad4 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -768,6 +768,7 @@ void init_update_queries(void) sql_command_flags[SQLCOM_INSERT_SELECT]|= CF_PREOPEN_TMP_TABLES; sql_command_flags[SQLCOM_DELETE]|= CF_PREOPEN_TMP_TABLES; sql_command_flags[SQLCOM_DELETE_MULTI]|= CF_PREOPEN_TMP_TABLES; + sql_command_flags[SQLCOM_RENAME_TABLE]|= CF_PREOPEN_TMP_TABLES; sql_command_flags[SQLCOM_REPLACE_SELECT]|= CF_PREOPEN_TMP_TABLES; sql_command_flags[SQLCOM_SELECT]|= CF_PREOPEN_TMP_TABLES; sql_command_flags[SQLCOM_SET_OPTION]|= CF_PREOPEN_TMP_TABLES; @@ -7232,6 +7233,7 @@ bool check_stack_overrun(THD *thd, long margin, if ((stack_used=used_stack(thd->thread_stack,(char*) &stack_used)) >= (long) (my_thread_stack_size - margin)) { + thd->is_fatal_error= 1; /* Do not use stack for the message buffer to ensure correct behaviour in cases we have close to no stack left. @@ -7320,10 +7322,13 @@ void THD::reset_for_next_command() /* Autoinc variables should be adjusted only for locally executed transactions. Appliers and replayers are either processing ROW - events or get autoinc variable values from Query_log_event. + events or get autoinc variable values from Query_log_event and + mysql slave may be processing STATEMENT format events, but he should + use autoinc values passed in binlog events, not the values forced by + the cluster. */ if (WSREP(thd) && thd->wsrep_exec_mode == LOCAL_STATE && - wsrep_auto_increment_control) + !thd->slave_thread && wsrep_auto_increment_control) { thd->variables.auto_increment_offset= global_system_variables.auto_increment_offset; @@ -7738,10 +7743,9 @@ void mysql_parse(THD *thd, char *rawbuf, uint length, PROCESSLIST. */ if (found_semicolon && (ulong) (found_semicolon - thd->query())) - thd->set_query_inner(thd->query(), - (uint32) (found_semicolon - - thd->query() - 1), - thd->charset()); + thd->set_query(thd->query(), + (uint32) (found_semicolon - thd->query() - 1), + thd->charset()); /* Actually execute the query */ if (found_semicolon) { diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index b715e33ae62..ce46a76d103 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -2977,6 +2977,70 @@ static st_bookmark *register_var(const char *plugin, const char *name, return result; } + +void sync_dynamic_session_variables(THD* thd, bool global_lock) +{ + uint idx; + + thd->variables.dynamic_variables_ptr= (char*) + my_realloc(thd->variables.dynamic_variables_ptr, + global_variables_dynamic_size, + MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); + + if (global_lock) + mysql_mutex_lock(&LOCK_global_system_variables); + + mysql_mutex_assert_owner(&LOCK_global_system_variables); + + memcpy(thd->variables.dynamic_variables_ptr + + thd->variables.dynamic_variables_size, + global_system_variables.dynamic_variables_ptr + + thd->variables.dynamic_variables_size, + global_system_variables.dynamic_variables_size - + thd->variables.dynamic_variables_size); + + /* + now we need to iterate through any newly copied 'defaults' + and if it is a string type with MEMALLOC flag, we need to strdup + */ + for (idx= 0; idx < bookmark_hash.records; idx++) + { + sys_var_pluginvar *pi; + sys_var *var; + st_bookmark *v= (st_bookmark*) my_hash_element(&bookmark_hash,idx); + + if (v->version <= thd->variables.dynamic_variables_version) + continue; /* already in thd->variables */ + + if (!(var= intern_find_sys_var(v->key + 1, v->name_len)) || + !(pi= var->cast_pluginvar()) || + v->key[0] != plugin_var_bookmark_key(pi->plugin_var->flags)) + continue; + + /* Here we do anything special that may be required of the data types */ + + if ((pi->plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR && + pi->plugin_var->flags & PLUGIN_VAR_MEMALLOC) + { + int offset= ((thdvar_str_t *)(pi->plugin_var))->offset; + char **pp= (char**) (thd->variables.dynamic_variables_ptr + offset); + if (*pp) + *pp= my_strdup(*pp, MYF(MY_WME|MY_FAE)); + } + } + + if (global_lock) + mysql_mutex_unlock(&LOCK_global_system_variables); + + thd->variables.dynamic_variables_version= + global_system_variables.dynamic_variables_version; + thd->variables.dynamic_variables_head= + global_system_variables.dynamic_variables_head; + thd->variables.dynamic_variables_size= + global_system_variables.dynamic_variables_size; +} + + /* returns a pointer to the memory which holds the thd-local variable or a pointer to the global variable if thd==null. @@ -2998,67 +3062,8 @@ static uchar *intern_sys_var_ptr(THD* thd, int offset, bool global_lock) if (!thd->variables.dynamic_variables_ptr || (uint)offset > thd->variables.dynamic_variables_head) { - uint idx; - mysql_rwlock_rdlock(&LOCK_system_variables_hash); - - thd->variables.dynamic_variables_ptr= (char*) - my_realloc(thd->variables.dynamic_variables_ptr, - global_variables_dynamic_size, - MYF(MY_WME | MY_FAE | MY_ALLOW_ZERO_PTR)); - - if (global_lock) - mysql_mutex_lock(&LOCK_global_system_variables); - - mysql_mutex_assert_owner(&LOCK_global_system_variables); - - memcpy(thd->variables.dynamic_variables_ptr + - thd->variables.dynamic_variables_size, - global_system_variables.dynamic_variables_ptr + - thd->variables.dynamic_variables_size, - global_system_variables.dynamic_variables_size - - thd->variables.dynamic_variables_size); - - /* - now we need to iterate through any newly copied 'defaults' - and if it is a string type with MEMALLOC flag, we need to strdup - */ - for (idx= 0; idx < bookmark_hash.records; idx++) - { - sys_var_pluginvar *pi; - sys_var *var; - st_bookmark *v= (st_bookmark*) my_hash_element(&bookmark_hash,idx); - - if (v->version <= thd->variables.dynamic_variables_version) - continue; /* already in thd->variables */ - - if (!(var= intern_find_sys_var(v->key + 1, v->name_len)) || - !(pi= var->cast_pluginvar()) || - v->key[0] != plugin_var_bookmark_key(pi->plugin_var->flags)) - continue; - - /* Here we do anything special that may be required of the data types */ - - if ((pi->plugin_var->flags & PLUGIN_VAR_TYPEMASK) == PLUGIN_VAR_STR && - pi->plugin_var->flags & PLUGIN_VAR_MEMALLOC) - { - int offset= ((thdvar_str_t *)(pi->plugin_var))->offset; - char **pp= (char**) (thd->variables.dynamic_variables_ptr + offset); - if (*pp) - *pp= my_strdup(*pp, MYF(MY_WME|MY_FAE)); - } - } - - if (global_lock) - mysql_mutex_unlock(&LOCK_global_system_variables); - - thd->variables.dynamic_variables_version= - global_system_variables.dynamic_variables_version; - thd->variables.dynamic_variables_head= - global_system_variables.dynamic_variables_head; - thd->variables.dynamic_variables_size= - global_system_variables.dynamic_variables_size; - + sync_dynamic_session_variables(thd, global_lock); mysql_rwlock_unlock(&LOCK_system_variables_hash); } DBUG_RETURN((uchar*)thd->variables.dynamic_variables_ptr + offset); @@ -3592,6 +3597,7 @@ void plugin_opt_set_limits(struct my_option *options, case PLUGIN_VAR_BOOL: options->var_type= GET_BOOL; options->def_value= ((sysvar_bool_t*) opt)->def_val; + options->typelib= &bool_typelib; break; case PLUGIN_VAR_STR: options->var_type= ((opt->flags & PLUGIN_VAR_MEMALLOC) ? @@ -3640,6 +3646,7 @@ void plugin_opt_set_limits(struct my_option *options, case PLUGIN_VAR_BOOL | PLUGIN_VAR_THDLOCAL: options->var_type= GET_BOOL; options->def_value= ((thdvar_bool_t*) opt)->def_val; + options->typelib= &bool_typelib; break; case PLUGIN_VAR_STR | PLUGIN_VAR_THDLOCAL: options->var_type= ((opt->flags & PLUGIN_VAR_MEMALLOC) ? diff --git a/sql/sql_plugin.h b/sql/sql_plugin.h index 47c3af83bdf..317ccf482b6 100644 --- a/sql/sql_plugin.h +++ b/sql/sql_plugin.h @@ -189,9 +189,13 @@ typedef my_bool (plugin_foreach_func)(THD *thd, #define plugin_foreach(A,B,C,D) plugin_foreach_with_mask(A,B,C,PLUGIN_IS_READY,D) extern bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func, int type, uint state_mask, void *arg); +extern void sync_dynamic_session_variables(THD* thd, bool global_lock); + extern bool plugin_dl_foreach(THD *thd, const LEX_STRING *dl, plugin_foreach_func *func, void *arg); sys_var *find_sys_var_ex(THD *thd, const char *str, size_t length, bool throw_error, bool locked); + +extern void sync_dynamic_session_variables(THD* thd, bool global_lock); #endif diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index 2fef615831b..2d72d1052d2 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -155,6 +155,12 @@ bool reload_acl_and_cache(THD *thd, unsigned long long options, { if (mysql_bin_log.rotate_and_purge(true)) *write_to_binlog= -1; + + if (WSREP_ON) + { + /* Wait for last binlog checkpoint event to be logged. */ + mysql_bin_log.wait_for_last_checkpoint_event(); + } } } if (options & REFRESH_RELAY_LOG) diff --git a/sql/sql_rename.cc b/sql/sql_rename.cc index b312077898f..1588644f0e1 100644 --- a/sql/sql_rename.cc +++ b/sql/sql_rename.cc @@ -24,7 +24,7 @@ #include "unireg.h" #include "sql_rename.h" #include "sql_cache.h" // query_cache_* -#include "sql_table.h" // build_table_filename +#include "sql_table.h" // write_bin_log #include "sql_view.h" // mysql_frm_type, mysql_rename_view #include "sql_trigger.h" #include "sql_base.h" // tdc_remove_table, lock_table_names, @@ -211,6 +211,28 @@ static TABLE_LIST *reverse_table_list(TABLE_LIST *table_list) } +static bool +do_rename_temporary(THD *thd, TABLE_LIST *ren_table, TABLE_LIST *new_table, + bool skip_error) +{ + const char *new_alias; + DBUG_ENTER("do_rename_temporary"); + + new_alias= (lower_case_table_names == 2) ? new_table->alias : + new_table->table_name; + + if (is_temporary_table(new_table)) + { + my_error(ER_TABLE_EXISTS_ERROR, MYF(0), new_alias); + DBUG_RETURN(1); // This can't be skipped + } + + + DBUG_RETURN(thd->rename_temporary_table(ren_table->table, + new_table->db, new_alias)); +} + + /* Rename a single table or a view @@ -316,6 +338,8 @@ do_rename(THD *thd, TABLE_LIST *ren_table, char *new_db, char *new_table_name, DBUG_RETURN(0); } + + /* Rename all tables in list; Return pointer to wrong entry if something goes wrong. Note that the table_list may be empty! @@ -350,8 +374,11 @@ rename_tables(THD *thd, TABLE_LIST *table_list, bool skip_error) for (ren_table= table_list; ren_table; ren_table= new_table->next_local) { new_table= ren_table->next_local; - if (do_rename(thd, ren_table, new_table->db, new_table->table_name, - new_table->alias, skip_error)) + + if (is_temporary_table(ren_table) ? + do_rename_temporary(thd, ren_table, new_table, skip_error) : + do_rename(thd, ren_table, new_table->db, new_table->table_name, + new_table->alias, skip_error)) DBUG_RETURN(ren_table); } DBUG_RETURN(0); diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 9bc195074ab..49bc6199d4b 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -695,7 +695,7 @@ JOIN::prepare(TABLE_LIST *tables_init, DBUG_ENTER("JOIN::prepare"); // to prevent double initialization on EXPLAIN - if (optimized) + if (optimization_state != JOIN::NOT_OPTIMIZED) DBUG_RETURN(0); conds= conds_init; @@ -1068,24 +1068,13 @@ err: int JOIN::optimize() { - bool was_optimized= optimized; + // to prevent double initialization on EXPLAIN + if (optimization_state != JOIN::NOT_OPTIMIZED) + return FALSE; + optimization_state= JOIN::OPTIMIZATION_IN_PROGRESS; + int res= optimize_inner(); - /* - If we're inside a non-correlated subquery, this function may be - called for the second time after the subquery has been executed - and deleted. The second call will not produce a valid query plan, it will - short-circuit because optimized==TRUE. - - "was_optimized != optimized" is here to handle this case: - - first optimization starts, gets an error (from a const. cheap - subquery), returns 1 - - another JOIN::optimize() call made, and now join->optimize() will - return 0, even though we never had a query plan. - - Can have QEP_NOT_PRESENT_YET for degenerate queries (for example, - SELECT * FROM tbl LIMIT 0) - */ - if (was_optimized != optimized && !res && have_query_plan != QEP_DELETED) + if (!res && have_query_plan != QEP_DELETED) { create_explain_query_if_not_exists(thd->lex, thd->mem_root); have_query_plan= QEP_AVAILABLE; @@ -1112,6 +1101,7 @@ int JOIN::optimize() } } + optimization_state= JOIN::OPTIMIZATION_DONE; return res; } @@ -1139,10 +1129,7 @@ JOIN::optimize_inner() JOIN_TAB *tab; DBUG_ENTER("JOIN::optimize"); do_send_rows = (unit->select_limit_cnt) ? 1 : 0; - // to prevent double initialization on EXPLAIN - if (optimized) - DBUG_RETURN(0); - optimized= 1; + DEBUG_SYNC(thd, "before_join_optimize"); THD_STAGE_INFO(thd, stage_optimizing); @@ -3190,6 +3177,7 @@ void JOIN::exec_inner() { List<Item> *columns_list= &fields_list; DBUG_ENTER("JOIN::exec_inner"); + DBUG_ASSERT(optimization_state == JOIN::OPTIMIZATION_DONE); THD_STAGE_INFO(thd, stage_executing); @@ -15778,7 +15766,7 @@ Field *Item::create_tmp_field(bool group, TABLE *table, uint convert_int_length) Field_double(max_length, maybe_null, name, decimals, TRUE); break; case INT_RESULT: - /* + /* Select an integer type with the minimal fit precision. convert_int_length is sign inclusive, don't consider the sign. */ @@ -15794,7 +15782,6 @@ Field *Item::create_tmp_field(bool group, TABLE *table, uint convert_int_length) break; case STRING_RESULT: DBUG_ASSERT(collation.collation); - /* GEOMETRY fields have STRING_RESULT result type. To preserve type they needed to be handled separately. diff --git a/sql/sql_select.h b/sql/sql_select.h index cde6209cb7e..fb3f71c0769 100644 --- a/sql/sql_select.h +++ b/sql/sql_select.h @@ -1370,7 +1370,8 @@ public: enum join_optimization_state { NOT_OPTIMIZED=0, OPTIMIZATION_IN_PROGRESS=1, OPTIMIZATION_DONE=2}; - bool optimized; ///< flag to avoid double optimization in EXPLAIN + // state of JOIN optimization + enum join_optimization_state optimization_state; bool initialized; ///< flag to avoid double init_execution calls Explain_select *explain; @@ -1450,7 +1451,7 @@ public: items2.reset(); items3.reset(); zero_result_cause= 0; - optimized= 0; + optimization_state= JOIN::NOT_OPTIMIZED; have_query_plan= QEP_NOT_PRESENT_YET; initialized= 0; cleaned= 0; diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 25af6fe07cc..2aa006d5d69 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -7261,6 +7261,17 @@ int fill_variables(THD *thd, TABLE_LIST *tables, COND *cond) COND *partial_cond= make_cond_for_info_schema(thd, cond, tables); mysql_rwlock_rdlock(&LOCK_system_variables_hash); + + /* + Avoid recursive LOCK_system_variables_hash acquisition in + intern_sys_var_ptr() by pre-syncing dynamic session variables. + */ + if (scope == OPT_SESSION && + (!thd->variables.dynamic_variables_ptr || + global_system_variables.dynamic_variables_head > + thd->variables.dynamic_variables_head)) + sync_dynamic_session_variables(thd, true); + res= show_status_array(thd, wild, enumerate_sys_vars(thd, sorted_vars, scope), scope, NULL, "", tables->table, upper_case_names, partial_cond); diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 80fadde714f..0adb21dcb43 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2687,14 +2687,15 @@ bool log_drop_table(THD *thd, const char *db_name, size_t db_name_length, */ bool quick_rm_table(THD *thd, handlerton *base, const char *db, - const char *table_name, uint flags) + const char *table_name, uint flags, const char *table_path) { char path[FN_REFLEN + 1]; bool error= 0; DBUG_ENTER("quick_rm_table"); - uint path_length= build_table_filename(path, sizeof(path) - 1, - db, table_name, reg_ext, flags); + uint path_length= table_path ? + (strxnmov(path, sizeof(path) - 1, table_path, reg_ext, NullS) - path) : + build_table_filename(path, sizeof(path)-1, db, table_name, reg_ext, flags); if (mysql_file_delete(key_file_frm, path, MYF(0))) error= 1; /* purecov: inspected */ path[path_length - reg_ext_length]= '\0'; // Remove reg_ext @@ -9540,7 +9541,8 @@ err_new_table_cleanup: else (void) quick_rm_table(thd, new_db_type, alter_ctx.new_db, alter_ctx.tmp_name, - (FN_IS_TMP | (no_ha_table ? NO_HA_TABLE : 0))); + (FN_IS_TMP | (no_ha_table ? NO_HA_TABLE : 0)), + alter_ctx.get_tmp_path()); /* No default value was provided for a DATE/DATETIME field, the diff --git a/sql/sql_table.h b/sql/sql_table.h index 109da541a28..628c51f678f 100644 --- a/sql/sql_table.h +++ b/sql/sql_table.h @@ -248,7 +248,8 @@ bool log_drop_table(THD *thd, const char *db_name, size_t db_name_length, const char *table_name, size_t table_name_length, bool temporary_table); bool quick_rm_table(THD *thd, handlerton *base, const char *db, - const char *table_name, uint flags); + const char *table_name, uint flags, + const char *table_path=0); void close_cached_table(THD *thd, TABLE *table); void sp_prepare_create_field(THD *thd, Column_definition *sql_field); int prepare_create_field(Column_definition *sql_field, diff --git a/sql/sql_update.cc b/sql/sql_update.cc index d59b8b7e048..b452e4fe6ae 100644 --- a/sql/sql_update.cc +++ b/sql/sql_update.cc @@ -526,6 +526,9 @@ int mysql_update(THD *thd, DBUG_EXECUTE_IF("show_explain_probe_update_exec_start", dbug_serve_apcs(thd, 1);); + if (!(select && select->quick)) + status_var_increment(thd->status_var.update_scan_count); + if (query_plan.using_filesort || query_plan.using_io_buffer) { /* @@ -583,6 +586,7 @@ int mysql_update(THD *thd, close_cached_file(&tempfile); goto err; } + table->file->try_semi_consistent_read(1); /* @@ -621,7 +625,7 @@ int mysql_update(THD *thd, thd->inc_examined_row_count(1); if (!select || (error= select->skip_record(thd)) > 0) { - if (table->file->was_semi_consistent_read()) + if (table->file->ha_was_semi_consistent_read()) continue; /* repeat the read of the same row if it still exists */ explain->buf_tracker.on_record_after_where(); @@ -740,7 +744,7 @@ int mysql_update(THD *thd, thd->inc_examined_row_count(1); if (!select || select->skip_record(thd) > 0) { - if (table->file->was_semi_consistent_read()) + if (table->file->ha_was_semi_consistent_read()) continue; /* repeat the read of the same row if it still exists */ explain->tracker.on_record_after_where(); diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index b0a4b3f99d2..ffc7bb36567 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -1594,7 +1594,8 @@ Sys_var_gtid_slave_pos::do_check(THD *thd, set_var *var) } mysql_mutex_lock(&LOCK_active_mi); - running= master_info_index->give_error_if_slave_running(); + running= (!master_info_index || + master_info_index->give_error_if_slave_running()); mysql_mutex_unlock(&LOCK_active_mi); if (running) return true; @@ -1634,7 +1635,7 @@ Sys_var_gtid_slave_pos::global_update(THD *thd, set_var *var) mysql_mutex_unlock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_active_mi); - if (master_info_index->give_error_if_slave_running()) + if (!master_info_index || master_info_index->give_error_if_slave_running()) err= true; else err= rpl_gtid_pos_update(thd, var->save_result.string_value.str, @@ -1823,7 +1824,8 @@ check_slave_parallel_threads(sys_var *self, THD *thd, set_var *var) bool running; mysql_mutex_lock(&LOCK_active_mi); - running= master_info_index->give_error_if_slave_running(); + running= (!master_info_index || + master_info_index->give_error_if_slave_running()); mysql_mutex_unlock(&LOCK_active_mi); if (running) return true; @@ -1838,7 +1840,8 @@ fix_slave_parallel_threads(sys_var *self, THD *thd, enum_var_type type) mysql_mutex_unlock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_active_mi); - err= master_info_index->give_error_if_slave_running(); + err= (!master_info_index || + master_info_index->give_error_if_slave_running()); mysql_mutex_unlock(&LOCK_active_mi); mysql_mutex_lock(&LOCK_global_system_variables); @@ -1874,7 +1877,8 @@ check_slave_domain_parallel_threads(sys_var *self, THD *thd, set_var *var) bool running; mysql_mutex_lock(&LOCK_active_mi); - running= master_info_index->give_error_if_slave_running(); + running= (!master_info_index || + master_info_index->give_error_if_slave_running()); mysql_mutex_unlock(&LOCK_active_mi); if (running) return true; @@ -1889,7 +1893,8 @@ fix_slave_domain_parallel_threads(sys_var *self, THD *thd, enum_var_type type) mysql_mutex_unlock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_active_mi); - running= master_info_index->give_error_if_slave_running(); + running= (!master_info_index || + master_info_index->give_error_if_slave_running()); mysql_mutex_unlock(&LOCK_active_mi); mysql_mutex_lock(&LOCK_global_system_variables); @@ -2039,7 +2044,8 @@ check_gtid_ignore_duplicates(sys_var *self, THD *thd, set_var *var) bool running; mysql_mutex_lock(&LOCK_active_mi); - running= master_info_index->give_error_if_slave_running(); + running= (!master_info_index || + master_info_index->give_error_if_slave_running()); mysql_mutex_unlock(&LOCK_active_mi); if (running) return true; @@ -2054,7 +2060,8 @@ fix_gtid_ignore_duplicates(sys_var *self, THD *thd, enum_var_type type) mysql_mutex_unlock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_active_mi); - running= master_info_index->give_error_if_slave_running(); + running= (!master_info_index || + master_info_index->give_error_if_slave_running()); mysql_mutex_unlock(&LOCK_active_mi); mysql_mutex_lock(&LOCK_global_system_variables); @@ -2960,7 +2967,7 @@ Sys_var_replicate_events_marked_for_skip::global_update(THD *thd, set_var *var) mysql_mutex_unlock(&LOCK_global_system_variables); mysql_mutex_lock(&LOCK_active_mi); - if (!master_info_index->give_error_if_slave_running()) + if (master_info_index && !master_info_index->give_error_if_slave_running()) result= Sys_var_enum::global_update(thd, var); mysql_mutex_unlock(&LOCK_active_mi); mysql_mutex_lock(&LOCK_global_system_variables); @@ -4011,14 +4018,16 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var) if (!var->save_result.string_value.str) return true; - if (var->save_result.string_value.length > FN_REFLEN) + LEX_STRING *val= &var->save_result.string_value; + + if (val->length > FN_REFLEN) { // path is too long my_error(ER_PATH_LENGTH, MYF(0), self->name.str); return true; } char path[FN_REFLEN]; - size_t path_length= unpack_filename(path, var->save_result.string_value.str); + size_t path_length= unpack_filename(path, val->str); if (!path_length) return true; @@ -4031,6 +4040,17 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var) return true; } + static const LEX_CSTRING my_cnf= { STRING_WITH_LEN("my.cnf") }; + static const LEX_CSTRING my_ini= { STRING_WITH_LEN("my.ini") }; + if (path_length >= my_cnf.length) + { + if (strcasecmp(path + path_length - my_cnf.length, my_cnf.str) == 0) + return true; // log file name ends with "my.cnf" + DBUG_ASSERT(my_cnf.length == my_ini.length); + if (strcasecmp(path + path_length - my_ini.length, my_ini.str) == 0) + return true; // log file name ends with "my.ini" + } + MY_STAT f_stat; if (my_stat(path, &f_stat, MYF(0))) @@ -4040,9 +4060,9 @@ static bool check_log_path(sys_var *self, THD *thd, set_var *var) return false; } - (void) dirname_part(path, var->save_result.string_value.str, &path_length); + (void) dirname_part(path, val->str, &path_length); - if (var->save_result.string_value.length - path_length >= FN_LEN) + if (val->length - path_length >= FN_LEN) { // filename is too long my_error(ER_PATH_LENGTH, MYF(0), self->name.str); return true; @@ -4805,9 +4825,10 @@ static Sys_var_mybool Sys_wsrep_auto_increment_control( CMD_LINE(OPT_ARG), DEFAULT(TRUE)); static Sys_var_mybool Sys_wsrep_drupal_282555_workaround( - "wsrep_drupal_282555_workaround", "To use a workaround for" - "bad autoincrement value", - GLOBAL_VAR(wsrep_drupal_282555_workaround), + "wsrep_drupal_282555_workaround", "Enable a workaround to handle the " + "cases where inserting a DEFAULT value into an auto-increment column " + "could fail with duplicate key error", + GLOBAL_VAR(wsrep_drupal_282555_workaround), CMD_LINE(OPT_ARG), DEFAULT(FALSE)); static Sys_var_charptr sys_wsrep_sst_method( @@ -4866,13 +4887,14 @@ static Sys_var_charptr Sys_wsrep_start_position ( static Sys_var_ulong Sys_wsrep_max_ws_size ( "wsrep_max_ws_size", "Max write set size (bytes)", GLOBAL_VAR(wsrep_max_ws_size), CMD_LINE(REQUIRED_ARG), - /* Upper limit is 65K short of 4G to avoid overlows on 32-bit systems */ - VALID_RANGE(1024, WSREP_MAX_WS_SIZE), DEFAULT(1073741824UL), BLOCK_SIZE(1)); + VALID_RANGE(1024, WSREP_MAX_WS_SIZE), DEFAULT(WSREP_MAX_WS_SIZE), + BLOCK_SIZE(1), NO_MUTEX_GUARD, NOT_IN_BINLOG, + ON_CHECK(wsrep_max_ws_size_check), ON_UPDATE(wsrep_max_ws_size_update)); static Sys_var_ulong Sys_wsrep_max_ws_rows ( "wsrep_max_ws_rows", "Max number of rows in write set", GLOBAL_VAR(wsrep_max_ws_rows), CMD_LINE(REQUIRED_ARG), - VALID_RANGE(1, 1048576), DEFAULT(131072), BLOCK_SIZE(1)); + VALID_RANGE(0, 1048576), DEFAULT(0), BLOCK_SIZE(1)); static Sys_var_charptr Sys_wsrep_notify_cmd( "wsrep_notify_cmd", "", diff --git a/sql/sys_vars.ic b/sql/sys_vars.ic index 6f17e768d95..c7f148afd39 100644 --- a/sql/sys_vars.ic +++ b/sql/sys_vars.ic @@ -96,7 +96,6 @@ enum charset_enum {IN_SYSTEM_CHARSET, IN_FS_CHARSET}; static const char *bool_values[3]= {"OFF", "ON", 0}; TYPELIB bool_typelib={ array_elements(bool_values)-1, "", bool_values, 0 }; -extern const char *encrypt_algorithm_names[]; /** A small wrapper class to pass getopt arguments as a pair diff --git a/sql/table.cc b/sql/table.cc index 42ed08233af..a8a47e7080c 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1948,6 +1948,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, { KEY_PART_INFO *new_key_part= (keyinfo-1)->key_part + (keyinfo-1)->ext_key_parts; + uint add_keyparts_for_this_key= add_first_key_parts; /* Do not extend the key that contains a component @@ -1959,19 +1960,20 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, if (share->field[fieldnr-1]->key_length() != keyinfo->key_part[i].length) { - add_first_key_parts= 0; + add_keyparts_for_this_key= 0; break; } } - if (add_first_key_parts < keyinfo->ext_key_parts-keyinfo->user_defined_key_parts) + if (add_keyparts_for_this_key < (keyinfo->ext_key_parts - + keyinfo->user_defined_key_parts)) { share->ext_key_parts-= keyinfo->ext_key_parts; key_part_map ext_key_part_map= keyinfo->ext_key_part_map; keyinfo->ext_key_parts= keyinfo->user_defined_key_parts; keyinfo->ext_key_flags= keyinfo->flags; keyinfo->ext_key_part_map= 0; - for (i= 0; i < add_first_key_parts; i++) + for (i= 0; i < add_keyparts_for_this_key; i++) { if (ext_key_part_map & 1<<i) { diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc index a7996efc382..d6c343dc04e 100644 --- a/sql/threadpool_common.cc +++ b/sql/threadpool_common.cc @@ -164,9 +164,8 @@ THD* threadpool_add_connection(CONNECT *connect, void *scheduler_data) if (!setup_connection_thread_globals(thd)) { - if (!login_connection(thd)) + if (!thd_prepare_connection(thd)) { - prepare_new_connection_state(thd); /* Check if THD is ok, as prepare_new_connection_state() diff --git a/sql/wsrep_applier.cc b/sql/wsrep_applier.cc index b4557cfe1b7..059aabe7b46 100644 --- a/sql/wsrep_applier.cc +++ b/sql/wsrep_applier.cc @@ -39,15 +39,9 @@ static Log_event* wsrep_read_log_event( const char *error= 0; Log_event *res= 0; - if (data_len > wsrep_max_ws_size) - { - error = "Event too big"; - goto err; - } - - res= Log_event::read_log_event(buf, data_len, &error, description_event, true); + res= Log_event::read_log_event(buf, data_len, &error, description_event, + true); -err: if (!res) { DBUG_ASSERT(error != 0); diff --git a/sql/wsrep_binlog.h b/sql/wsrep_binlog.h index 1e820529211..864813d5c98 100644 --- a/sql/wsrep_binlog.h +++ b/sql/wsrep_binlog.h @@ -19,7 +19,7 @@ #include "sql_class.h" // THD, IO_CACHE #define HEAP_PAGE_SIZE 65536 /* 64K */ -#define WSREP_MAX_WS_SIZE (0xFFFFFFFFUL - HEAP_PAGE_SIZE) +#define WSREP_MAX_WS_SIZE 2147483647 /* 2GB */ /* Write the contents of a cache to a memory buffer. diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc index fa34a5bbc55..2a93484002e 100644 --- a/sql/wsrep_hton.cc +++ b/sql/wsrep_hton.cc @@ -34,11 +34,14 @@ extern "C" int thd_binlog_format(const MYSQL_THD thd); */ void wsrep_cleanup_transaction(THD *thd) { + if (!WSREP(thd)) return; + if (wsrep_emulate_bin_log) thd_binlog_trx_reset(thd); thd->wsrep_ws_handle.trx_id= WSREP_UNDEFINED_TRX_ID; thd->wsrep_trx_meta.gtid= WSREP_GTID_UNDEFINED; thd->wsrep_trx_meta.depends_on= WSREP_SEQNO_UNDEFINED; thd->wsrep_exec_mode= LOCAL_STATE; + thd->wsrep_affected_rows= 0; return; } @@ -109,13 +112,7 @@ void wsrep_register_hton(THD* thd, bool all) */ void wsrep_post_commit(THD* thd, bool all) { - /* - TODO: It can perhaps be fixed in a more elegant fashion by turning off - wsrep_emulate_binlog if wsrep_on=0 on server start. - https://github.com/codership/mysql-wsrep/issues/112 - */ - if (!WSREP_ON) - return; + if (!WSREP(thd)) return; switch (thd->wsrep_exec_mode) { diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 75e15db0b8d..a8253ddf3ad 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -184,7 +184,7 @@ static PSI_file_info wsrep_files[]= my_bool wsrep_inited = 0; // initialized ? -static const wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED; +static wsrep_uuid_t cluster_uuid = WSREP_UUID_UNDEFINED; static char cluster_uuid_str[40]= { 0, }; static const char* cluster_status_str[WSREP_VIEW_MAX] = { @@ -591,8 +591,7 @@ int wsrep_init() WSREP_ERROR("wsrep_load(%s) failed: %s (%d). Reverting to no provider.", wsrep_provider, strerror(rcode), rcode); strcpy((char*)wsrep_provider, WSREP_NONE); // damn it's a dirty hack - (void) wsrep_init(); - return rcode; + return wsrep_init(); } else /* this is for recursive call above */ { @@ -804,6 +803,9 @@ void wsrep_init_startup (bool first) wsrep_debug, wsrep_convert_LOCK_to_trx, (wsrep_on_fun)wsrep_on); + /* Skip replication start if dummy wsrep provider is loaded */ + if (!strcmp(wsrep_provider, WSREP_NONE)) return; + /* Skip replication start if no cluster address */ if (!wsrep_cluster_address || wsrep_cluster_address[0] == 0) return; @@ -1419,6 +1421,12 @@ static int wsrep_TOI_begin(THD *thd, char *db_, char *table_, case SQLCOM_ALTER_EVENT: buf_err= wsrep_alter_event_query(thd, &buf, &buf_len); break; + case SQLCOM_CREATE_ROLE: + if (sp_process_definer(thd)) + { + WSREP_WARN("Failed to set CREATE ROLE definer for TOI."); + } + /* fallthrough */ default: buf_err= wsrep_to_buf_helper(thd, thd->query(), thd->query_length(), &buf, &buf_len); @@ -1493,19 +1501,15 @@ static int wsrep_RSU_begin(THD *thd, char *db_, char *table_) WSREP_DEBUG("RSU BEGIN: %lld, %d : %s", (long long)wsrep_thd_trx_seqno(thd), thd->wsrep_exec_mode, thd->query() ); - if (!wsrep_desync) + ret = wsrep->desync(wsrep); + if (ret != WSREP_OK) { - ret = wsrep->desync(wsrep); - if (ret != WSREP_OK) - { - WSREP_WARN("RSU desync failed %d for schema: %s, query: %s", - ret, (thd->db ? thd->db : "(null)"), thd->query()); - my_error(ER_LOCK_DEADLOCK, MYF(0)); - return(ret); - } + WSREP_WARN("RSU desync failed %d for schema: %s, query: %s", + ret, (thd->db ? thd->db : "(null)"), thd->query()); + my_error(ER_LOCK_DEADLOCK, MYF(0)); + return(ret); } - else - WSREP_DEBUG("RSU desync skipped: %d", wsrep_desync); + mysql_mutex_lock(&LOCK_wsrep_replaying); wsrep_replaying++; mysql_mutex_unlock(&LOCK_wsrep_replaying); @@ -1520,15 +1524,13 @@ static int wsrep_RSU_begin(THD *thd, char *db_, char *table_) wsrep_replaying--; mysql_mutex_unlock(&LOCK_wsrep_replaying); - if (!wsrep_desync) + ret = wsrep->resync(wsrep); + if (ret != WSREP_OK) { - ret = wsrep->resync(wsrep); - if (ret != WSREP_OK) - { - WSREP_WARN("resync failed %d for schema: %s, query: %s", - ret, (thd->db ? thd->db : "(null)"), thd->query()); - } + WSREP_WARN("resync failed %d for schema: %s, query: %s", + ret, (thd->db ? thd->db : "(null)"), thd->query()); } + my_error(ER_LOCK_DEADLOCK, MYF(0)); return(1); } @@ -1564,18 +1566,15 @@ static void wsrep_RSU_end(THD *thd) (thd->db ? thd->db : "(null)"), thd->query()); } - if (!wsrep_desync) + + ret = wsrep->resync(wsrep); + if (ret != WSREP_OK) { - ret = wsrep->resync(wsrep); - if (ret != WSREP_OK) - { - WSREP_WARN("resync failed %d for schema: %s, query: %s", ret, - (thd->db ? thd->db : "(null)"), thd->query()); - return; - } + WSREP_WARN("resync failed %d for schema: %s, query: %s", ret, + (thd->db ? thd->db : "(null)"), thd->query()); + return; } - else - WSREP_DEBUG("RSU resync skipped: %d", wsrep_desync); + thd->variables.wsrep_on = 1; } @@ -2655,3 +2654,13 @@ void wsrep_aborting_thd_enqueue(THD *thd) aborting->next = wsrep_aborting_thd; wsrep_aborting_thd = aborting; } + +bool wsrep_node_is_donor() +{ + return (WSREP_ON) ? (wsrep_config_state->get_status() == 2) : false; +} + +bool wsrep_node_is_synced() +{ + return (WSREP_ON) ? (wsrep_config_state->get_status() == 4) : false; +} diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h index ea81384da75..04ccc1a7e45 100644 --- a/sql/wsrep_mysqld.h +++ b/sql/wsrep_mysqld.h @@ -50,6 +50,7 @@ struct wsrep_thd_shadow { ulong tx_isolation; char *db; size_t db_length; + my_hrtime_t user_time; }; // Global wsrep parameters @@ -168,9 +169,14 @@ extern void wsrep_prepend_PATH (const char* path); /* Other global variables */ extern wsrep_seqno_t wsrep_locked_seqno; -#define WSREP_ON \ +#define WSREP_ON \ (global_system_variables.wsrep_on) +#define WSREP_ON_NEW \ + ((global_system_variables.wsrep_on) && \ + wsrep_provider && \ + strcmp(wsrep_provider, WSREP_NONE)) + #define WSREP(thd) \ (WSREP_ON && wsrep && (thd && thd->variables.wsrep_on)) @@ -307,6 +313,8 @@ void wsrep_replay_transaction(THD *thd); bool wsrep_create_like_table(THD* thd, TABLE_LIST* table, TABLE_LIST* src_table, HA_CREATE_INFO *create_info); +bool wsrep_node_is_donor(); +bool wsrep_node_is_synced(); #else /* WITH_WSREP */ diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index ba6bb18bf37..50f54fddc95 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -528,7 +528,7 @@ static void* sst_joiner_thread (void* a) } else { // Scan state ID first followed by wsrep_gtid_domain_id. char uuid[512]; - long int domain_id; + unsigned long int domain_id; size_t len= pos - out + 1; if (len > sizeof(uuid)) goto err; // safety check @@ -542,11 +542,11 @@ static void* sst_joiner_thread (void* a) else if (wsrep_gtid_mode) { errno= 0; /* Reset the errno */ - domain_id= strtol(pos + 1, NULL, 10); + domain_id= strtoul(pos + 1, NULL, 10); err= errno; /* Check if we received a valid gtid_domain_id. */ - if (err == EINVAL || err == ERANGE || domain_id < 0x0 || domain_id > 0xFFFF) + if (err == EINVAL || err == ERANGE) { WSREP_ERROR("Failed to get donor wsrep_gtid_domain_id."); err= EINVAL; @@ -1171,6 +1171,16 @@ wait_signal: if (!err) { sst_disallow_writes (thd.ptr, true); + /* + Lets also keep statements that modify binary logs (like RESET LOGS, + RESET MASTER) from proceeding until the files have been transferred + to the joiner node. + */ + if (mysql_bin_log.is_open()) + { + mysql_mutex_lock(mysql_bin_log.get_log_lock()); + } + locked= true; goto wait_signal; } @@ -1179,6 +1189,11 @@ wait_signal: { if (locked) { + if (mysql_bin_log.is_open()) + { + mysql_mutex_assert_owner(mysql_bin_log.get_log_lock()); + mysql_mutex_unlock(mysql_bin_log.get_log_lock()); + } sst_disallow_writes (thd.ptr, false); thd.ptr->global_read_lock.unlock_global_read_lock (thd.ptr); locked= false; @@ -1211,6 +1226,11 @@ wait_signal: if (locked) // don't forget to unlock server before return { + if (mysql_bin_log.is_open()) + { + mysql_mutex_assert_owner(mysql_bin_log.get_log_lock()); + mysql_mutex_unlock(mysql_bin_log.get_log_lock()); + } sst_disallow_writes (thd.ptr, false); thd.ptr->global_read_lock.unlock_global_read_lock (thd.ptr); } diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc index 36768a37973..a810a5a44ae 100644 --- a/sql/wsrep_thd.cc +++ b/sql/wsrep_thd.cc @@ -143,6 +143,9 @@ static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow) shadow->wsrep_exec_mode = thd->wsrep_exec_mode; shadow->vio = thd->net.vio; + // Disable general logging on applier threads + thd->variables.option_bits |= OPTION_LOG_OFF; + // Enable binlogging if opt_log_slave_updates is set if (opt_log_slave_updates) thd->variables.option_bits|= OPTION_BIN_LOG; else @@ -164,6 +167,7 @@ static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow) shadow->db = thd->db; shadow->db_length = thd->db_length; + shadow->user_time = thd->user_time; thd->reset_db(NULL, 0); } @@ -174,6 +178,7 @@ static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow) thd->wsrep_exec_mode = shadow->wsrep_exec_mode; thd->net.vio = shadow->vio; thd->variables.tx_isolation = shadow->tx_isolation; + thd->user_time = shadow->user_time; thd->reset_db(shadow->db, shadow->db_length); delete thd->system_thread_info.rpl_sql_info; @@ -187,6 +192,7 @@ static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow) void wsrep_replay_transaction(THD *thd) { + DBUG_ENTER("wsrep_replay_transaction"); /* checking if BF trx must be replayed */ if (thd->wsrep_conflict_state== MUST_REPLAY) { DBUG_ASSERT(wsrep_thd_trx_seqno(thd)); @@ -195,6 +201,13 @@ void wsrep_replay_transaction(THD *thd) { WSREP_ERROR("replay issue, thd has reported status already"); } + + /* + PS reprepare observer should have been removed already. + open_table() will fail if we have dangling observer here. + */ + DBUG_ASSERT(thd->m_reprepare_observer == NULL); + thd->get_stmt_da()->reset_diagnostics_area(); thd->wsrep_conflict_state= REPLAYING; @@ -301,6 +314,7 @@ void wsrep_replay_transaction(THD *thd) mysql_mutex_unlock(&LOCK_wsrep_replaying); } } + DBUG_VOID_RETURN; } static void wsrep_replication_process(THD *thd) diff --git a/sql/wsrep_var.cc b/sql/wsrep_var.cc index f48f08852dc..bb5ee7baa57 100644 --- a/sql/wsrep_var.cc +++ b/sql/wsrep_var.cc @@ -193,16 +193,46 @@ bool wsrep_start_position_init (const char* val) return false; } +static int get_provider_option_value(const char* opts, + const char* opt_name, + ulong* opt_value) +{ + int ret= 1; + ulong opt_value_tmp; + char *opt_value_str, *s, *opts_copy= my_strdup(opts, MYF(MY_WME)); + + if ((opt_value_str= strstr(opts_copy, opt_name)) == NULL) + goto end; + opt_value_str= strtok_r(opt_value_str, "=", &s); + if (opt_value_str == NULL) goto end; + opt_value_str= strtok_r(NULL, ";", &s); + if (opt_value_str == NULL) goto end; + + opt_value_tmp= strtoul(opt_value_str, NULL, 10); + if (errno == ERANGE) goto end; + + *opt_value= opt_value_tmp; + ret= 0; + +end: + my_free(opts_copy); + return ret; +} + static bool refresh_provider_options() { + DBUG_ASSERT(wsrep); + WSREP_DEBUG("refresh_provider_options: %s", (wsrep_provider_options) ? wsrep_provider_options : "null"); char* opts= wsrep->options_get(wsrep); if (opts) { - if (wsrep_provider_options) my_free((void *)wsrep_provider_options); - wsrep_provider_options = (char*)my_memdup(opts, strlen(opts) + 1, - MYF(MY_WME)); + wsrep_provider_options_init(opts); + get_provider_option_value(wsrep_provider_options, + (char*)"repl.max_ws_size", + &wsrep_max_ws_size); + free(opts); } else { @@ -317,17 +347,17 @@ void wsrep_provider_init (const char* value) bool wsrep_provider_options_check(sys_var *self, THD* thd, set_var* var) { - return 0; -} - -bool wsrep_provider_options_update(sys_var *self, THD* thd, enum_var_type type) -{ if (wsrep == NULL) { my_message(ER_WRONG_ARGUMENTS, "WSREP (galera) not started", MYF(0)); return true; } + return false; +} +bool wsrep_provider_options_update(sys_var *self, THD* thd, enum_var_type type) +{ + DBUG_ASSERT(wsrep); wsrep_status_t ret= wsrep->options_set(wsrep, wsrep_provider_options); if (ret != WSREP_OK) { @@ -520,6 +550,12 @@ bool wsrep_slave_threads_update (sys_var *self, THD* thd, enum_var_type type) bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var) { + if (wsrep == NULL) + { + my_message(ER_WRONG_ARGUMENTS, "WSREP (galera) not started", MYF(0)); + return true; + } + bool new_wsrep_desync= (bool) var->save_result.ulonglong_value; if (wsrep_desync == new_wsrep_desync) { if (new_wsrep_desync) { @@ -531,20 +567,10 @@ bool wsrep_desync_check (sys_var *self, THD* thd, set_var* var) ER_WRONG_VALUE_FOR_VAR, "'wsrep_desync' is already OFF."); } + return false; } - return 0; -} - -bool wsrep_desync_update (sys_var *self, THD* thd, enum_var_type type) -{ - if (wsrep == NULL) - { - my_message(ER_WRONG_ARGUMENTS, "WSREP (galera) not started", MYF(0)); - return true; - } - wsrep_status_t ret(WSREP_WARNING); - if (wsrep_desync) { + if (new_wsrep_desync) { ret = wsrep->desync (wsrep); if (ret != WSREP_OK) { WSREP_WARN ("SET desync failed %d for schema: %s, query: %s", ret, @@ -566,6 +592,39 @@ bool wsrep_desync_update (sys_var *self, THD* thd, enum_var_type type) return false; } +bool wsrep_desync_update (sys_var *self, THD* thd, enum_var_type type) +{ + DBUG_ASSERT(wsrep); + return false; +} + +bool wsrep_max_ws_size_check(sys_var *self, THD* thd, set_var* var) +{ + if (wsrep == NULL) + { + my_message(ER_WRONG_ARGUMENTS, "WSREP (galera) not started", MYF(0)); + return true; + } + return false; +} + +bool wsrep_max_ws_size_update (sys_var *self, THD *thd, enum_var_type) +{ + DBUG_ASSERT(wsrep); + + char max_ws_size_opt[128]; + my_snprintf(max_ws_size_opt, sizeof(max_ws_size_opt), + "repl.max_ws_size=%d", wsrep_max_ws_size); + wsrep_status_t ret= wsrep->options_set(wsrep, max_ws_size_opt); + if (ret != WSREP_OK) + { + WSREP_ERROR("Set options returned %d", ret); + refresh_provider_options(); + return true; + } + return refresh_provider_options(); +} + static SHOW_VAR wsrep_status_vars[]= { {"connected", (char*) &wsrep_connected, SHOW_BOOL}, diff --git a/sql/wsrep_var.h b/sql/wsrep_var.h index 0eccf64edb8..1509fc7d589 100644 --- a/sql/wsrep_var.h +++ b/sql/wsrep_var.h @@ -91,6 +91,9 @@ extern bool wsrep_slave_threads_update UPDATE_ARGS; extern bool wsrep_desync_check CHECK_ARGS; extern bool wsrep_desync_update UPDATE_ARGS; +extern bool wsrep_max_ws_size_check CHECK_ARGS; +extern bool wsrep_max_ws_size_update UPDATE_ARGS; + #else /* WITH_WSREP */ #define WSREP_NONE diff --git a/storage/connect/ApacheInterface.java b/storage/connect/ApacheInterface.java new file mode 100644 index 00000000000..b4c8a4e9885 --- /dev/null +++ b/storage/connect/ApacheInterface.java @@ -0,0 +1,58 @@ +package wrappers; + +import java.sql.*; +import java.util.Hashtable; +import org.apache.commons.dbcp2.BasicDataSource; + +public class ApacheInterface extends JdbcInterface { + static Hashtable<String,BasicDataSource> pool = new Hashtable<String, BasicDataSource>(); + + public ApacheInterface() { + this(true); + } // end of default constructor + + public ApacheInterface(boolean b) { + super(b); + } // end of constructor + + @Override + public int JdbcConnect(String[] parms, int fsize, boolean scrollable) { + int rc = 0; + String url = parms[1]; + BasicDataSource ds = null; + + if (DEBUG) + System.out.println("Connecting to Apache data source"); + + try { + CheckURL(url, null); + + if ((ds = pool.get(url)) == null) { + ds = new BasicDataSource(); + ds.setDriverClassName(parms[0]); + ds.setUrl(url); + ds.setUsername(parms[2]); + ds.setPassword(parms[3]); + pool.put(url, ds); + } // endif ds + + // Get a connection from the data source + conn = ds.getConnection(); + + // Get the data base meta data object + dbmd = conn.getMetaData(); + + // Get a statement from the connection + stmt = GetStmt(fsize, scrollable); + } catch (SQLException se) { + SetErrmsg(se); + rc = -2; + } catch (Exception e) { + SetErrmsg(e); + rc = -3; + } // end try/catch + + return rc; + } // end of JdbcConnect + +} // end of class ApacheInterface diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index c6b808acc60..95d88538119 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -235,25 +235,29 @@ ENDIF(CONNECT_WITH_ODBC) # # JDBC # - -OPTION(CONNECT_WITH_JDBC "Compile CONNECT storage engine with JDBC support" ON) +IF(APPLE) + OPTION(CONNECT_WITH_JDBC "some comment" OFF) +ELSE() + OPTION(CONNECT_WITH_JDBC "some comment" ON) +ENDIF() IF(CONNECT_WITH_JDBC) - # TODO: detect Java SDK and the presence of JDBC connectors - # TODO: Find how to compile and install the java wrapper class - # Find required libraries and include directories - FIND_PACKAGE(Java 1.6) FIND_PACKAGE(JNI) IF (JAVA_FOUND AND JNI_FOUND) + INCLUDE(UseJava) INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH}) INCLUDE_DIRECTORIES(${JAVA_INCLUDE_PATH2}) - # SET(JDBC_LIBRARY ${JAVA_JVM_LIBRARY}) - SET(CONNECT_SOURCES ${CONNECT_SOURCES} - JdbcInterface.java JdbcInterface.class - JdbcDSInterface.java JdbcDSInterface.class - JdbcApacheInterface.java JdbcApacheInterface.class - jdbconn.cpp tabjdbc.cpp jdbconn.h tabjdbc.h jdbccat.h) + # SET(JDBC_LIBRARY ${JAVA_JVM_LIBRARY}) will be dynamically linked + SET(CONNECT_SOURCES ${CONNECT_SOURCES} + jdbconn.cpp tabjdbc.cpp jdbconn.h tabjdbc.h jdbccat.h + JdbcInterface.java ApacheInterface.java MariadbInterface.java + MysqlInterface.java OracleInterface.java PostgresqlInterface.java) + # TODO: Find how to compile and install the java wrapper classes + # Find required libraries and include directories + SET (JAVA_SOURCES JdbcInterface.java) + add_jar(JdbcInterface ${JAVA_SOURCES}) + install_jar(JdbcInterface DESTINATION ${INSTALL_PLUGINDIR} COMPONENT connect-engine) add_definitions(-DJDBC_SUPPORT) ELSE() SET(JDBC_LIBRARY "") diff --git a/storage/connect/Client.java b/storage/connect/Client.java new file mode 100644 index 00000000000..aaf1b7bf2f8 --- /dev/null +++ b/storage/connect/Client.java @@ -0,0 +1,183 @@ +package wrappers; + +import java.io.BufferedReader; +import java.io.Console; +import java.io.IOException; +import java.io.InputStreamReader; + +public class Client { + static boolean DEBUG = true; + static final Console c = System.console(); + static JdbcInterface jdi = null; + + public static void main(String[] args) { + int rc, n, ncol, i = 0, fsize = 0; + boolean scrollable = false; + String s; + String[] parms = new String[4]; + + if (args.length > 0) + try { + i = Integer.parseInt(args[i]); + } catch (NumberFormatException e) { + i = 0; + } // end try/catch + + switch (i) { + case 1: + jdi = new ApacheInterface(DEBUG); + break; + case 2: + jdi = new MysqlInterface(DEBUG); + break; + case 3: + jdi = new MariadbInterface(DEBUG); + break; + case 4: + jdi = new OracleInterface(DEBUG); + break; + case 5: + jdi = new PostgresqlInterface(DEBUG); + break; + default: + jdi = new JdbcInterface(DEBUG); + } // endswitch i + + parms[0] = getLine("Driver: ", false); + parms[1] = getLine("URL: ", false); + parms[2] = getLine("User: ", false); + parms[3] = getLine("Password: ", true); + s = getLine("Fsize: ", false); + fsize = (s != null) ? Integer.parseInt(s) : 0; + s = getLine("Scrollable: ", false); + scrollable = (s != null) ? s.toLowerCase().charAt(0) != 'n' : false; + + rc = jdi.JdbcConnect(parms, fsize, scrollable); + + if (rc == 0) { + String query; + System.out.println("Successfully connected to " + parms[1]); + + while ((query = getLine("Query: ", false)) != null) { + n = jdi.Execute(query); + System.out.println("Returned n = " + n); + + if ((ncol = jdi.GetResult()) > 0) + PrintResult(ncol); + else + System.out.println("Affected rows = " + n); + + } // endwhile + + rc = jdi.JdbcDisconnect(); + System.out.println("Disconnect returned " + rc); + } else + System.out.println(jdi.GetErrmsg() + " rc=" + rc); + + } // end of main + + private static void PrintResult(int ncol) { + // Get result set meta data + int i; + String columnName; + + // Get the column names; column indices start from 1 + for (i = 1; i <= ncol; i++) { + columnName = jdi.ColumnName(i); + + if (columnName == null) + return; + + // Get the name of the column's table name + //String tableName = rsmd.getTableName(i); + + if (i > 1) + System.out.print("\t"); + + System.out.print(columnName); + } // endfor i + + System.out.println(); + + // Loop through the result set + while (jdi.ReadNext() > 0) { + for (i = 1; i <= ncol; i++) { + if (i > 1) + System.out.print("\t"); + + if (DEBUG) + System.out.print("(" + jdi.ColumnType(i, null) + ")"); + + switch (jdi.ColumnType(i, null)) { + case java.sql.Types.VARCHAR: + case java.sql.Types.LONGVARCHAR: + case java.sql.Types.CHAR: + System.out.print(jdi.StringField(i, null)); + break; + case java.sql.Types.INTEGER: + System.out.print(jdi.IntField(i, null)); + break; + case java.sql.Types.BIGINT: + System.out.print(jdi.BigintField(i, null)); + break; + case java.sql.Types.TIMESTAMP: + System.out.print(jdi.TimestampField(i, null)); + break; + case java.sql.Types.TIME: + System.out.print(jdi.TimeField(i, null)); + break; + case java.sql.Types.DATE: + System.out.print(jdi.DateField(i, null)); + break; + case java.sql.Types.SMALLINT: + System.out.print(jdi.IntField(i, null)); + break; + case java.sql.Types.DOUBLE: + case java.sql.Types.REAL: + case java.sql.Types.FLOAT: + case java.sql.Types.DECIMAL: + System.out.print(jdi.DoubleField(i, null)); + break; + case java.sql.Types.BOOLEAN: + System.out.print(jdi.BooleanField(i, null)); + default: + break; + } // endswitch Type + + } // endfor i + + System.out.println(); + } // end while rs + + } // end of PrintResult + + // ================================================================== + private static String getLine(String p, boolean b) { + String response; + + if (c != null) { + // Standard console mode + if (b) { + response = new String(c.readPassword(p)); + } else + response = c.readLine(p); + + } else { + // For instance when testing from Eclipse + BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); + + System.out.print(p); + + try { + // Cannot suppress echo for password entry + response = in.readLine(); + } catch (IOException e) { + response = ""; + } // end of try/catch + + } // endif c + + return (response.isEmpty()) ? null : response; + } // end of getLine + +} // end of class Client diff --git a/storage/connect/JdbcApacheInterface.class b/storage/connect/JdbcApacheInterface.class Binary files differdeleted file mode 100644 index acd4258e3d3..00000000000 --- a/storage/connect/JdbcApacheInterface.class +++ /dev/null diff --git a/storage/connect/JdbcApacheInterface.java b/storage/connect/JdbcApacheInterface.java deleted file mode 100644 index fdbc5bff203..00000000000 --- a/storage/connect/JdbcApacheInterface.java +++ /dev/null @@ -1,709 +0,0 @@ -import java.math.*; -import java.sql.*; -import java.util.Collections; -import java.util.Hashtable; -import java.util.List; - -import org.apache.commons.dbcp2.BasicDataSource; - -public class JdbcApacheInterface { - boolean DEBUG = false; - String Errmsg = "No error"; - Connection conn = null; - DatabaseMetaData dbmd = null; - Statement stmt = null; - PreparedStatement pstmt = null; - ResultSet rs = null; - ResultSetMetaData rsmd = null; - static Hashtable<String,BasicDataSource> pool = new Hashtable<String, BasicDataSource>(); - - // === Constructors/finalize ========================================= - public JdbcApacheInterface() { - this(true); - } // end of default constructor - - public JdbcApacheInterface(boolean b) { - DEBUG = b; - } // end of constructor - - private void SetErrmsg(Exception e) { - if (DEBUG) - System.out.println(e.getMessage()); - - Errmsg = e.toString(); - } // end of SetErrmsg - - private void SetErrmsg(String s) { - if (DEBUG) - System.out.println(s); - - Errmsg = s; - } // end of SetErrmsg - - public String GetErrmsg() { - String err = Errmsg; - - Errmsg = "No error"; - return err; - } // end of GetErrmsg - - public int JdbcConnect(String[] parms, int fsize, boolean scrollable) { - int rc = 0; - String url = parms[1]; - BasicDataSource ds = null; - - if (url == null) { - SetErrmsg("URL cannot be null"); - return -1; - } // endif url - - try { - if ((ds = pool.get(url)) == null) { - ds = new BasicDataSource(); - ds.setDriverClassName(parms[0]); - ds.setUrl(url); - ds.setUsername(parms[2]); - ds.setPassword(parms[3]); - pool.put(url, ds); - } // endif ds - - // Get a connection from the data source - conn = ds.getConnection(); - - // Get the data base meta data object - dbmd = conn.getMetaData(); - - // Get a statement from the connection - if (scrollable) - stmt = conn.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY); - else - stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); - - if (DEBUG) - System.out.println("Statement type = " + stmt.getResultSetType() - + " concurrency = " + stmt.getResultSetConcurrency()); - - if (DEBUG) // Get the fetch size of a statement - System.out.println("Default fetch size = " + stmt.getFetchSize()); - - if (fsize != 0) { - // Set the fetch size - stmt.setFetchSize(fsize); - - if (DEBUG) - System.out.println("New fetch size = " + stmt.getFetchSize()); - - } // endif fsize - - } catch (SQLException se) { - SetErrmsg(se); - rc = -2; - } catch( Exception e ) { - SetErrmsg(e); - rc = -3; - } // end try/catch - - return rc; - } // end of JdbcConnect - - public int CreatePrepStmt(String sql) { - int rc = 0; - - try { - pstmt = conn.prepareStatement(sql); - } catch (SQLException se) { - SetErrmsg(se); - rc = -1; - } catch (Exception e) { - SetErrmsg(e); - rc = -2; - } // end try/catch - - return rc; - } // end of CreatePrepStmt - - public void SetStringParm(int i, String s) { - try { - pstmt.setString(i, s); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetStringParm - - public void SetIntParm(int i, int n) { - try { - pstmt.setInt(i, n); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetIntParm - - public void SetShortParm(int i, short n) { - try { - pstmt.setShort(i, n); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetShortParm - - public void SetBigintParm(int i, long n) { - try { - pstmt.setLong(i, n); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetBigintParm - - public void SetFloatParm(int i, float f) { - try { - pstmt.setFloat(i, f); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetFloatParm - - public void SetDoubleParm(int i, double d) { - try { - pstmt.setDouble(i, d); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetDoubleParm - - public void SetTimestampParm(int i, Timestamp t) { - try { - pstmt.setTimestamp(i, t); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetTimestampParm - - public int ExecutePrep() { - int n = -3; - - if (pstmt != null) try { - n = pstmt.executeUpdate(); - } catch (SQLException se) { - SetErrmsg(se); - n = -1; - } catch (Exception e) { - SetErrmsg(e); - n = -2; - } //end try/catch - - return n; - } // end of ExecutePrep - - public boolean ClosePrepStmt() { - boolean b = false; - - if (pstmt != null) try { - pstmt.close(); - pstmt = null; - } catch (SQLException se) { - SetErrmsg(se); - b = true; - } catch (Exception e) { - SetErrmsg(e); - b = true; - } // end try/catch - - return b; - } // end of ClosePrepStmt - - public int JdbcDisconnect() { - int rc = 0; - - // Cancel pending statement - if (stmt != null) - try { - System.out.println("Cancelling statement"); - stmt.cancel(); - } catch(SQLException se) { - SetErrmsg(se); - rc += 1; - } // nothing more we can do - - // Close the statement and the connection - if (rs != null) - try { - if (DEBUG) - System.out.println("Closing result set"); - - rs.close(); - } catch(SQLException se) { - SetErrmsg(se); - rc = 2; - } // nothing more we can do - - if (stmt != null) - try { - if (DEBUG) - System.out.println("Closing statement"); - - stmt.close(); - } catch(SQLException se) { - SetErrmsg(se); - rc += 4; - } // nothing more we can do - - ClosePrepStmt(); - - if (conn != null) - try { - if (DEBUG) - System.out.println("Closing connection"); - - conn.close(); - } catch (SQLException se) { - SetErrmsg(se); - rc += 8; - } //end try/catch - - if (DEBUG) - System.out.println("All closed"); - - return rc; - } // end of JdbcDisconnect - - public int GetMaxValue(int n) { - int m = 0; - - try { - switch (n) { - case 1: // Max columns in table - m = dbmd.getMaxColumnsInTable(); - break; - case 2: // Max catalog name length - m = dbmd.getMaxCatalogNameLength(); - break; - case 3: // Max schema name length - m = dbmd.getMaxSchemaNameLength(); - break; - case 4: // Max table name length - m = dbmd.getMaxTableNameLength(); - break; - case 5: // Max column name length - m = dbmd.getMaxColumnNameLength(); - break; - } // endswitch n - - } catch(Exception e) { - SetErrmsg(e); - m = -1; - } // end try/catch - - return m; - } // end of GetMaxValue - - public int GetColumns(String[] parms) { - int ncol = 0; - - try { - if (rs != null) rs.close(); - rs = dbmd.getColumns(parms[0], parms[1], parms[2], parms[3]); - - if (rs != null) { - rsmd = rs.getMetaData(); - ncol = rsmd.getColumnCount(); - } // endif rs - - } catch(SQLException se) { - SetErrmsg(se); - } // end try/catch - - return ncol; - } // end of GetColumns - - public int GetTables(String[] parms) { - int ncol = 0; - String[] typ = null; - - if (parms[3] != null) { - typ = new String[1]; - typ[0] = parms[3]; - } // endif parms - - try { - if (rs != null) rs.close(); - rs = dbmd.getTables(parms[0], parms[1], parms[2], typ); - - if (rs != null) { - rsmd = rs.getMetaData(); - ncol = rsmd.getColumnCount(); - } // endif rs - - } catch(SQLException se) { - SetErrmsg(se); - } // end try/catch - - return ncol; - } // end of GetColumns - - public int Execute(String query) { - int n = 0; - - if (DEBUG) - System.out.println("Executing '" + query + "'"); - - try { - boolean b = stmt.execute(query); - - if (b == false) { - n = stmt.getUpdateCount(); - if (rs != null) rs.close(); - } // endif b - - if (DEBUG) - System.out.println("Query '" + query + "' executed: n = " + n); - - } catch (SQLException se) { - SetErrmsg(se); - n = -1; - } catch (Exception e) { - SetErrmsg(e); - n = -2; - } //end try/catch - - return n; - } // end of Execute - - public int GetResult() { - int ncol = 0; - - try { - rs = stmt.getResultSet(); - - if (rs != null) { - rsmd = rs.getMetaData(); - ncol = rsmd.getColumnCount(); - - if (DEBUG) - System.out.println("Result set has " + rsmd.getColumnCount() + " column(s)"); - - } // endif rs - - } catch (SQLException se) { - SetErrmsg(se); - ncol = -1; - } catch (Exception e) { - SetErrmsg(e); - ncol = -2; - } //end try/catch - - return ncol; - } // end of GetResult - - public int ExecuteQuery(String query) { - int ncol = 0; - - if (DEBUG) - System.out.println("Executing query '" + query + "'"); - - try { - rs = stmt.executeQuery(query); - rsmd = rs.getMetaData(); - ncol = rsmd.getColumnCount(); - - if (DEBUG) { - System.out.println("Query '" + query + "' executed successfully"); - System.out.println("Result set has " + rsmd.getColumnCount() + " column(s)"); - } // endif DEBUG - - } catch (SQLException se) { - SetErrmsg(se); - ncol = -1; - } catch (Exception e) { - SetErrmsg(e); - ncol = -2; - } //end try/catch - - return ncol; - } // end of ExecuteQuery - - public int ExecuteUpdate(String query) { - int n = 0; - - if (DEBUG) - System.out.println("Executing update query '" + query + "'"); - - try { - n = stmt.executeUpdate(query); - - if (DEBUG) - System.out.println("Update Query '" + query + "' executed: n = " + n); - - } catch (SQLException se) { - SetErrmsg(se); - n = -1; - } catch (Exception e) { - SetErrmsg(e); - n = -2; - } //end try/catch - - return n; - } // end of ExecuteUpdate - - public int ReadNext() { - if (rs != null) { - try { - return rs.next() ? 1 : 0; - } catch (SQLException se) { - SetErrmsg(se); - return -1; - } //end try/catch - - } else - return 0; - - } // end of ReadNext - - public boolean Fetch(int row) { - if (rs != null) { - try { - return rs.absolute(row); - } catch (SQLException se) { - SetErrmsg(se); - return false; - } //end try/catch - - } else - return false; - - } // end of Fetch - - public String ColumnName(int n) { - if (rsmd == null) { - System.out.println("No result metadata"); - } else try { - return rsmd.getColumnLabel(n); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of ColumnName - - public int ColumnType(int n, String name) { - if (rsmd == null) { - System.out.println("No result metadata"); - } else try { - if (n == 0) - n = rs.findColumn(name); - - return rsmd.getColumnType(n); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return 666; // Not a type - } // end of ColumnType - - public String ColumnDesc(int n, int[] val) { - if (rsmd == null) { - System.out.println("No result metadata"); - return null; - } else try { - val[0] = rsmd.getColumnType(n); - val[1] = rsmd.getPrecision(n); - val[2] = rsmd.getScale(n); - val[3] = rsmd.isNullable(n); - return rsmd.getColumnLabel(n); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of ColumnDesc - - public String StringField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getString(n) : rs.getString(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of StringField - - public int IntField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getInt(n) : rs.getInt(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return 0; - } // end of IntField - - public long BigintField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - BigDecimal bigDecimal = (n > 0) ? rs.getBigDecimal(n) : rs.getBigDecimal(name); - return bigDecimal != null ? bigDecimal.longValue() : 0; - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return 0; - } // end of BiginttField - - public double DoubleField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getDouble(n) : rs.getDouble(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return 0.; - } // end of DoubleField - - public float FloatField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getFloat(n) : rs.getFloat(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return 0; - } // end of FloatField - - public boolean BooleanField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getBoolean(n) : rs.getBoolean(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return false; - } // end of BooleanField - - public Date DateField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getDate(n) : rs.getDate(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of DateField - - public Time TimeField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getTime(n) : rs.getTime(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of TimeField - - public Timestamp TimestampField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getTimestamp(n) : rs.getTimestamp(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of TimestampField - - public String ObjectField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getObject(n).toString() : rs.getObject(name).toString(); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of ObjectField - - public int GetDrivers(String[] s, int mxs) { - int n = 0; - List<Driver> drivers = Collections.list(DriverManager.getDrivers()); - int size = Math.min(mxs, drivers.size()); - - for (int i = 0; i < size; i++) { - Driver driver = (Driver)drivers.get(i); - - // Get name of driver - s[n++] = driver.getClass().getName(); - - // Get version info - s[n++] = driver.getMajorVersion() + "." + driver.getMinorVersion(); - s[n++] = driver.jdbcCompliant() ? "Yes" : "No"; - s[n++] = driver.toString(); - } // endfor i - - return size; - } // end of GetDrivers - - /** - * Adds the specified path to the java library path - * from Fahd Shariff blog - * - * @param pathToAdd the path to add - static public int addLibraryPath(String pathToAdd) { - System.out.println("jpath = " + pathToAdd); - - try { - Field usrPathsField = ClassLoader.class.getDeclaredField("usr_paths"); - usrPathsField.setAccessible(true); - - //get array of paths - String[] paths = (String[])usrPathsField.get(null); - - //check if the path to add is already present - for (String path : paths) { - System.out.println("path = " + path); - - if (path.equals(pathToAdd)) - return -5; - - } // endfor path - - //add the new path - String[] newPaths = Arrays.copyOf(paths, paths.length + 1); - newPaths[paths.length] = pathToAdd; - usrPathsField.set(null, newPaths); - System.setProperty("java.library.path", - System.getProperty("java.library.path") + File.pathSeparator + pathToAdd); - Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); - fieldSysPath.setAccessible(true); - fieldSysPath.set(null, null); - } catch (Exception e) { - SetErrmsg(e); - return -1; - } // end try/catch - - return 0; - } // end of addLibraryPath - */ - -} // end of class JdbcApacheInterface diff --git a/storage/connect/JdbcDSInterface.class b/storage/connect/JdbcDSInterface.class Binary files differdeleted file mode 100644 index d56c04bd81f..00000000000 --- a/storage/connect/JdbcDSInterface.class +++ /dev/null diff --git a/storage/connect/JdbcDSInterface.java b/storage/connect/JdbcDSInterface.java deleted file mode 100644 index 09f545bfb74..00000000000 --- a/storage/connect/JdbcDSInterface.java +++ /dev/null @@ -1,743 +0,0 @@ -import java.math.*; -import java.sql.*; -import java.util.Collections; -import java.util.Hashtable; -import java.util.List; - -import javax.sql.DataSource; - -import org.mariadb.jdbc.MariaDbDataSource; -import org.postgresql.jdbc2.optional.PoolingDataSource; -import com.mysql.cj.jdbc.MysqlDataSource; -import oracle.jdbc.pool.OracleDataSource; - -public class JdbcDSInterface { - boolean DEBUG = false; - String Errmsg = "No error"; - Connection conn = null; - DatabaseMetaData dbmd = null; - Statement stmt = null; - PreparedStatement pstmt = null; - ResultSet rs = null; - ResultSetMetaData rsmd = null; - Hashtable<String,DataSource> dst = null; - - // === Constructors/finalize ========================================= - public JdbcDSInterface() { - this(true); - } // end of default constructor - - public JdbcDSInterface(boolean b) { - DEBUG = b; - dst = new Hashtable<String, DataSource>(); - } // end of constructor - - private void SetErrmsg(Exception e) { - if (DEBUG) - System.out.println(e.getMessage()); - - Errmsg = e.toString(); - } // end of SetErrmsg - - private void SetErrmsg(String s) { - if (DEBUG) - System.out.println(s); - - Errmsg = s; - } // end of SetErrmsg - - public String GetErrmsg() { - String err = Errmsg; - - Errmsg = "No error"; - return err; - } // end of GetErrmsg - - public int JdbcConnect(String[] parms, int fsize, boolean scrollable) { - int rc = 0; - String url = parms[1]; - DataSource ds = null; - MysqlDataSource mds = null; - MariaDbDataSource ads = null; - OracleDataSource ods = null; - PoolingDataSource pds = null; - - if (url == null) { - SetErrmsg("URL cannot be null"); - return -1; - } // endif driver - - try { - if ((ds = dst.get(url)) == null) { - if (url.toLowerCase().contains("mysql")) { - mds = new MysqlDataSource(); - mds.setURL(url); - mds.setUser(parms[2]); - mds.setPassword(parms[3]); - ds = mds; - } else if (url.toLowerCase().contains("mariadb")) { - ads = new MariaDbDataSource(); - ads.setUrl(url); - ads.setUser(parms[2]); - ads.setPassword(parms[3]); - ds = ads; - } else if (url.toLowerCase().contains("oracle")) { - ods = new OracleDataSource(); - ods.setURL(url); - ods.setUser(parms[2]); - ods.setPassword(parms[3]); - ds = ods; - } else if (url.toLowerCase().contains("postgresql")) { - pds = new PoolingDataSource(); - pds.setUrl(url); - pds.setUser(parms[2]); - pds.setPassword(parms[3]); - ds = pds; - } else { - SetErrmsg("Unsupported driver"); - return -4; - } // endif driver - - dst.put(url, ds); - } // endif ds - - // Get a connection from the data source - conn = ds.getConnection(); - - // Get the data base meta data object - dbmd = conn.getMetaData(); - - // Get a statement from the connection - if (scrollable) - stmt = conn.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY); - else - stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); - - if (DEBUG) - System.out.println("Statement type = " + stmt.getResultSetType() - + " concurrency = " + stmt.getResultSetConcurrency()); - - if (DEBUG) // Get the fetch size of a statement - System.out.println("Default fetch size = " + stmt.getFetchSize()); - - if (fsize != 0) { - // Set the fetch size - stmt.setFetchSize(fsize); - - if (DEBUG) - System.out.println("New fetch size = " + stmt.getFetchSize()); - - } // endif fsize - - } catch (SQLException se) { - SetErrmsg(se); - rc = -2; - } catch( Exception e ) { - SetErrmsg(e); - rc = -3; - } // end try/catch - - return rc; - } // end of JdbcConnect - - public int CreatePrepStmt(String sql) { - int rc = 0; - - try { - pstmt = conn.prepareStatement(sql); - } catch (SQLException se) { - SetErrmsg(se); - rc = -1; - } catch (Exception e) { - SetErrmsg(e); - rc = -2; - } // end try/catch - - return rc; - } // end of CreatePrepStmt - - public void SetStringParm(int i, String s) { - try { - pstmt.setString(i, s); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetStringParm - - public void SetIntParm(int i, int n) { - try { - pstmt.setInt(i, n); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetIntParm - - public void SetShortParm(int i, short n) { - try { - pstmt.setShort(i, n); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetShortParm - - public void SetBigintParm(int i, long n) { - try { - pstmt.setLong(i, n); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetBigintParm - - public void SetFloatParm(int i, float f) { - try { - pstmt.setFloat(i, f); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetFloatParm - - public void SetDoubleParm(int i, double d) { - try { - pstmt.setDouble(i, d); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetDoubleParm - - public void SetTimestampParm(int i, Timestamp t) { - try { - pstmt.setTimestamp(i, t); - } catch (Exception e) { - SetErrmsg(e); - } // end try/catch - - } // end of SetTimestampParm - - public int ExecutePrep() { - int n = -3; - - if (pstmt != null) try { - n = pstmt.executeUpdate(); - } catch (SQLException se) { - SetErrmsg(se); - n = -1; - } catch (Exception e) { - SetErrmsg(e); - n = -2; - } //end try/catch - - return n; - } // end of ExecutePrep - - public boolean ClosePrepStmt() { - boolean b = false; - - if (pstmt != null) try { - pstmt.close(); - pstmt = null; - } catch (SQLException se) { - SetErrmsg(se); - b = true; - } catch (Exception e) { - SetErrmsg(e); - b = true; - } // end try/catch - - return b; - } // end of ClosePrepStmt - - public int JdbcDisconnect() { - int rc = 0; - - // Cancel pending statement - if (stmt != null) - try { - System.out.println("Cancelling statement"); - stmt.cancel(); - } catch(SQLException se) { - SetErrmsg(se); - rc += 1; - } // nothing more we can do - - // Close the statement and the connection - if (rs != null) - try { - if (DEBUG) - System.out.println("Closing result set"); - - rs.close(); - } catch(SQLException se) { - SetErrmsg(se); - rc = 2; - } // nothing more we can do - - if (stmt != null) - try { - if (DEBUG) - System.out.println("Closing statement"); - - stmt.close(); - } catch(SQLException se) { - SetErrmsg(se); - rc += 4; - } // nothing more we can do - - ClosePrepStmt(); - - if (conn != null) - try { - if (DEBUG) - System.out.println("Closing connection"); - - conn.close(); - } catch (SQLException se) { - SetErrmsg(se); - rc += 8; - } //end try/catch - - if (DEBUG) - System.out.println("All closed"); - - return rc; - } // end of JdbcDisconnect - - public int GetMaxValue(int n) { - int m = 0; - - try { - switch (n) { - case 1: // Max columns in table - m = dbmd.getMaxColumnsInTable(); - break; - case 2: // Max catalog name length - m = dbmd.getMaxCatalogNameLength(); - break; - case 3: // Max schema name length - m = dbmd.getMaxSchemaNameLength(); - break; - case 4: // Max table name length - m = dbmd.getMaxTableNameLength(); - break; - case 5: // Max column name length - m = dbmd.getMaxColumnNameLength(); - break; - } // endswitch n - - } catch(Exception e) { - SetErrmsg(e); - m = -1; - } // end try/catch - - return m; - } // end of GetMaxValue - - public int GetColumns(String[] parms) { - int ncol = 0; - - try { - if (rs != null) rs.close(); - rs = dbmd.getColumns(parms[0], parms[1], parms[2], parms[3]); - - if (rs != null) { - rsmd = rs.getMetaData(); - ncol = rsmd.getColumnCount(); - } // endif rs - - } catch(SQLException se) { - SetErrmsg(se); - } // end try/catch - - return ncol; - } // end of GetColumns - - public int GetTables(String[] parms) { - int ncol = 0; - String[] typ = null; - - if (parms[3] != null) { - typ = new String[1]; - typ[0] = parms[3]; - } // endif parms - - try { - if (rs != null) rs.close(); - rs = dbmd.getTables(parms[0], parms[1], parms[2], typ); - - if (rs != null) { - rsmd = rs.getMetaData(); - ncol = rsmd.getColumnCount(); - } // endif rs - - } catch(SQLException se) { - SetErrmsg(se); - } // end try/catch - - return ncol; - } // end of GetColumns - - public int Execute(String query) { - int n = 0; - - if (DEBUG) - System.out.println("Executing '" + query + "'"); - - try { - boolean b = stmt.execute(query); - - if (b == false) { - n = stmt.getUpdateCount(); - if (rs != null) rs.close(); - } // endif b - - if (DEBUG) - System.out.println("Query '" + query + "' executed: n = " + n); - - } catch (SQLException se) { - SetErrmsg(se); - n = -1; - } catch (Exception e) { - SetErrmsg(e); - n = -2; - } //end try/catch - - return n; - } // end of Execute - - public int GetResult() { - int ncol = 0; - - try { - rs = stmt.getResultSet(); - - if (rs != null) { - rsmd = rs.getMetaData(); - ncol = rsmd.getColumnCount(); - - if (DEBUG) - System.out.println("Result set has " + rsmd.getColumnCount() + " column(s)"); - - } // endif rs - - } catch (SQLException se) { - SetErrmsg(se); - ncol = -1; - } catch (Exception e) { - SetErrmsg(e); - ncol = -2; - } //end try/catch - - return ncol; - } // end of GetResult - - public int ExecuteQuery(String query) { - int ncol = 0; - - if (DEBUG) - System.out.println("Executing query '" + query + "'"); - - try { - rs = stmt.executeQuery(query); - rsmd = rs.getMetaData(); - ncol = rsmd.getColumnCount(); - - if (DEBUG) { - System.out.println("Query '" + query + "' executed successfully"); - System.out.println("Result set has " + rsmd.getColumnCount() + " column(s)"); - } // endif DEBUG - - } catch (SQLException se) { - SetErrmsg(se); - ncol = -1; - } catch (Exception e) { - SetErrmsg(e); - ncol = -2; - } //end try/catch - - return ncol; - } // end of ExecuteQuery - - public int ExecuteUpdate(String query) { - int n = 0; - - if (DEBUG) - System.out.println("Executing update query '" + query + "'"); - - try { - n = stmt.executeUpdate(query); - - if (DEBUG) - System.out.println("Update Query '" + query + "' executed: n = " + n); - - } catch (SQLException se) { - SetErrmsg(se); - n = -1; - } catch (Exception e) { - SetErrmsg(e); - n = -2; - } //end try/catch - - return n; - } // end of ExecuteUpdate - - public int ReadNext() { - if (rs != null) { - try { - return rs.next() ? 1 : 0; - } catch (SQLException se) { - SetErrmsg(se); - return -1; - } //end try/catch - - } else - return 0; - - } // end of ReadNext - - public boolean Fetch(int row) { - if (rs != null) { - try { - return rs.absolute(row); - } catch (SQLException se) { - SetErrmsg(se); - return false; - } //end try/catch - - } else - return false; - - } // end of Fetch - - public String ColumnName(int n) { - if (rsmd == null) { - System.out.println("No result metadata"); - } else try { - return rsmd.getColumnLabel(n); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of ColumnName - - public int ColumnType(int n, String name) { - if (rsmd == null) { - System.out.println("No result metadata"); - } else try { - if (n == 0) - n = rs.findColumn(name); - - return rsmd.getColumnType(n); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return 666; // Not a type - } // end of ColumnType - - public String ColumnDesc(int n, int[] val) { - if (rsmd == null) { - System.out.println("No result metadata"); - return null; - } else try { - val[0] = rsmd.getColumnType(n); - val[1] = rsmd.getPrecision(n); - val[2] = rsmd.getScale(n); - val[3] = rsmd.isNullable(n); - return rsmd.getColumnLabel(n); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of ColumnDesc - - public String StringField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getString(n) : rs.getString(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of StringField - - public int IntField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getInt(n) : rs.getInt(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return 0; - } // end of IntField - - public long BigintField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - BigDecimal bigDecimal = (n > 0) ? rs.getBigDecimal(n) : rs.getBigDecimal(name); - return bigDecimal != null ? bigDecimal.longValue() : 0; - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return 0; - } // end of BiginttField - - public double DoubleField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getDouble(n) : rs.getDouble(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return 0.; - } // end of DoubleField - - public float FloatField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getFloat(n) : rs.getFloat(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return 0; - } // end of FloatField - - public boolean BooleanField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getBoolean(n) : rs.getBoolean(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return false; - } // end of BooleanField - - public Date DateField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getDate(n) : rs.getDate(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of DateField - - public Time TimeField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getTime(n) : rs.getTime(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of TimeField - - public Timestamp TimestampField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getTimestamp(n) : rs.getTimestamp(name); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of TimestampField - - public String ObjectField(int n, String name) { - if (rs == null) { - System.out.println("No result set"); - } else try { - return (n > 0) ? rs.getObject(n).toString() : rs.getObject(name).toString(); - } catch (SQLException se) { - SetErrmsg(se); - } //end try/catch - - return null; - } // end of ObjectField - - public int GetDrivers(String[] s, int mxs) { - int n = 0; - List<Driver> drivers = Collections.list(DriverManager.getDrivers()); - int size = Math.min(mxs, drivers.size()); - - for (int i = 0; i < size; i++) { - Driver driver = (Driver)drivers.get(i); - - // Get name of driver - s[n++] = driver.getClass().getName(); - - // Get version info - s[n++] = driver.getMajorVersion() + "." + driver.getMinorVersion(); - s[n++] = driver.jdbcCompliant() ? "Yes" : "No"; - s[n++] = driver.toString(); - } // endfor i - - return size; - } // end of GetDrivers - - /** - * Adds the specified path to the java library path - * from Fahd Shariff blog - * - * @param pathToAdd the path to add - static public int addLibraryPath(String pathToAdd) { - System.out.println("jpath = " + pathToAdd); - - try { - Field usrPathsField = ClassLoader.class.getDeclaredField("usr_paths"); - usrPathsField.setAccessible(true); - - //get array of paths - String[] paths = (String[])usrPathsField.get(null); - - //check if the path to add is already present - for (String path : paths) { - System.out.println("path = " + path); - - if (path.equals(pathToAdd)) - return -5; - - } // endfor path - - //add the new path - String[] newPaths = Arrays.copyOf(paths, paths.length + 1); - newPaths[paths.length] = pathToAdd; - usrPathsField.set(null, newPaths); - System.setProperty("java.library.path", - System.getProperty("java.library.path") + File.pathSeparator + pathToAdd); - Field fieldSysPath = ClassLoader.class.getDeclaredField("sys_paths"); - fieldSysPath.setAccessible(true); - fieldSysPath.set(null, null); - } catch (Exception e) { - SetErrmsg(e); - return -1; - } // end try/catch - - return 0; - } // end of addLibraryPath - */ - -} // end of class JdbcDSInterface diff --git a/storage/connect/JdbcInterface.class b/storage/connect/JdbcInterface.class Binary files differdeleted file mode 100644 index 51a0e69bad5..00000000000 --- a/storage/connect/JdbcInterface.class +++ /dev/null diff --git a/storage/connect/JdbcInterface.java b/storage/connect/JdbcInterface.java index 8c4db1db8c3..f765052915d 100644 --- a/storage/connect/JdbcInterface.java +++ b/storage/connect/JdbcInterface.java @@ -1,13 +1,19 @@ +package wrappers; + import java.math.*; import java.sql.*; -//import java.util.Arrays; import java.util.Collections; +import java.util.Hashtable; import java.util.List; -//import java.io.File; -//import java.lang.reflect.Field; + +import javax.sql.DataSource; public class JdbcInterface { + // This is used by DS classes + static Hashtable<String,DataSource> dst = null; + boolean DEBUG = false; + boolean CatisSchema = false; String Errmsg = "No error"; Connection conn = null; DatabaseMetaData dbmd = null; @@ -18,14 +24,14 @@ public class JdbcInterface { // === Constructors/finalize ========================================= public JdbcInterface() { - this(true); + this(false); } // end of default constructor public JdbcInterface(boolean b) { DEBUG = b; } // end of constructor - private void SetErrmsg(Exception e) { + protected void SetErrmsg(Exception e) { if (DEBUG) System.out.println(e.getMessage()); @@ -38,6 +44,22 @@ public class JdbcInterface { Errmsg = "No error"; return err; } // end of GetErrmsg + + protected void CheckURL(String url, String vendor) throws Exception { + if (url == null) + throw new Exception("URL cannot be null"); + + String[] tk = url.split(":", 3); + + if (!tk[0].equals("jdbc") || tk[1] == null) + throw new Exception("Invalid URL"); + + if (vendor != null && !tk[1].equals(vendor)) + throw new Exception("Wrong URL for this wrapper"); + + // Some drivers use Catalog as Schema + CatisSchema = tk[1].equals("mysql") || tk[1].equals("mariadb"); + } // end of CatalogIsSchema public int JdbcConnect(String[] parms, int fsize, boolean scrollable) { int rc = 0; @@ -58,6 +80,8 @@ public class JdbcInterface { if (DEBUG) System.out.println("URL=" + parms[1]); + + CheckURL(parms[1], null); if (parms[2] != null && !parms[2].isEmpty()) { if (DEBUG) @@ -74,27 +98,7 @@ public class JdbcInterface { dbmd = conn.getMetaData(); // Get a statement from the connection - if (scrollable) - stmt = conn.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY); - else - stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); - - if (DEBUG) - System.out.println("Statement type = " + stmt.getResultSetType() - + " concurrency = " + stmt.getResultSetConcurrency()); - - if (DEBUG) // Get the fetch size of a statement - System.out.println("Default fetch size = " + stmt.getFetchSize()); - - if (fsize != 0) { - // Set the fetch size - stmt.setFetchSize(fsize); - - if (DEBUG) - System.out.println("New fetch size = " + stmt.getFetchSize()); - - } // endif fsize - + stmt = GetStmt(fsize, scrollable); } catch(ClassNotFoundException e) { SetErrmsg(e); rc = -1; @@ -109,6 +113,34 @@ public class JdbcInterface { return rc; } // end of JdbcConnect + protected Statement GetStmt(int fsize, boolean scrollable) throws SQLException, Exception { + Statement stmt = null; + + if (scrollable) + stmt = conn.createStatement(java.sql.ResultSet.TYPE_SCROLL_INSENSITIVE, java.sql.ResultSet.CONCUR_READ_ONLY); + else + stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); + + if (DEBUG) + System.out.println("Statement type = " + stmt.getResultSetType() + + " concurrency = " + stmt.getResultSetConcurrency()); + + if (DEBUG) // Get the fetch size of a statement + System.out.println("Default fetch size = " + stmt.getFetchSize()); + + if (fsize != 0) { + // Set the fetch size + stmt.setFetchSize(fsize); + + if (DEBUG) + System.out.println("New fetch size = " + stmt.getFetchSize()); + + } // endif fsize + + return stmt; + } // end of GetStmt + + public int CreatePrepStmt(String sql) { int rc = 0; @@ -227,7 +259,9 @@ public class JdbcInterface { // Cancel pending statement if (stmt != null) try { - System.out.println("Cancelling statement"); + if (DEBUG) + System.out.println("Cancelling statement"); + stmt.cancel(); } catch(SQLException se) { SetErrmsg(se); @@ -311,7 +345,11 @@ public class JdbcInterface { try { if (rs != null) rs.close(); - rs = dbmd.getColumns(parms[0], parms[1], parms[2], parms[3]); + + if (CatisSchema) + rs = dbmd.getColumns(parms[1], null, parms[2], parms[3]); + else + rs = dbmd.getColumns(parms[0], parms[1], parms[2], parms[3]); if (rs != null) { rsmd = rs.getMetaData(); @@ -326,7 +364,7 @@ public class JdbcInterface { } // end of GetColumns public int GetTables(String[] parms) { - int ncol = 0; + int ncol = -1; String[] typ = null; if (parms[3] != null) { @@ -336,7 +374,11 @@ public class JdbcInterface { try { if (rs != null) rs.close(); - rs = dbmd.getTables(parms[0], parms[1], parms[2], typ); + + if (CatisSchema) + rs = dbmd.getTables(parms[1], null, parms[2], typ); + else + rs = dbmd.getTables(parms[0], parms[1], parms[2], typ); if (rs != null) { rsmd = rs.getMetaData(); @@ -599,40 +641,43 @@ public class JdbcInterface { return false; } // end of BooleanField - public Date DateField(int n, String name) { + public int DateField(int n, String name) { if (rs == null) { System.out.println("No result set"); } else try { - return (n > 0) ? rs.getDate(n) : rs.getDate(name); + Date d = (n > 0) ? rs.getDate(n) : rs.getDate(name); + return (d != null) ? (int)(d.getTime() / 1000) : 0; } catch (SQLException se) { SetErrmsg(se); } //end try/catch - return null; + return 0; } // end of DateField - public Time TimeField(int n, String name) { + public int TimeField(int n, String name) { if (rs == null) { System.out.println("No result set"); } else try { - return (n > 0) ? rs.getTime(n) : rs.getTime(name); + Time t = (n > 0) ? rs.getTime(n) : rs.getTime(name); + return (t != null) ? (int)(t.getTime() / 1000) : 0; } catch (SQLException se) { SetErrmsg(se); } //end try/catch - return null; + return 0; } // end of TimeField - public Timestamp TimestampField(int n, String name) { + public int TimestampField(int n, String name) { if (rs == null) { System.out.println("No result set"); } else try { - return (n > 0) ? rs.getTimestamp(n) : rs.getTimestamp(name); + Timestamp ts = (n > 0) ? rs.getTimestamp(n) : rs.getTimestamp(name); + return (ts != null) ? (int)(ts.getTime() / 1000) : 0; } catch (SQLException se) { SetErrmsg(se); } //end try/catch - return null; + return 0; } // end of TimestampField public String ObjectField(int n, String name) { @@ -710,3 +755,4 @@ public class JdbcInterface { */ } // end of class JdbcInterface + diff --git a/storage/connect/MariadbInterface.java b/storage/connect/MariadbInterface.java new file mode 100644 index 00000000000..26ff7a82301 --- /dev/null +++ b/storage/connect/MariadbInterface.java @@ -0,0 +1,69 @@ +package wrappers; + +import java.sql.*; +import java.util.Hashtable; + +import javax.sql.DataSource; +import org.mariadb.jdbc.MariaDbDataSource; + +public class MariadbInterface extends JdbcInterface { + public MariadbInterface() { + this(true); + } // end of default constructor + + public MariadbInterface(boolean b) { + super(b); + + if (dst == null) + dst = new Hashtable<String, DataSource>(); + + } // end of default constructor + + @Override + public int JdbcConnect(String[] parms, int fsize, boolean scrollable) { + int rc = 0; + String url = parms[1]; + DataSource ds = null; + MariaDbDataSource ads = null; + + if (DEBUG) + System.out.println("Connecting to MariaDB data source"); + + try { + CheckURL(url, "mariadb"); + + if ((ds = dst.get(url)) == null) { + ads = new MariaDbDataSource(); + ads.setUrl(url); + + if (parms[2] != null) + ads.setUser(parms[2]); + + if (parms[3] != null) + ads.setPassword(parms[3]); + + ds = ads; + + dst.put(url, ds); + } // endif ds + + // Get a connection from the data source + conn = ds.getConnection(); + + // Get the data base meta data object + dbmd = conn.getMetaData(); + + // Get a statement from the connection + stmt = GetStmt(fsize, scrollable); + } catch (SQLException se) { + SetErrmsg(se); + rc = -2; + } catch( Exception e ) { + SetErrmsg(e); + rc = -3; + } // end try/catch + + return rc; + } // end of JdbcConnect + +} diff --git a/storage/connect/MysqlInterface.java b/storage/connect/MysqlInterface.java new file mode 100644 index 00000000000..a13020e30b0 --- /dev/null +++ b/storage/connect/MysqlInterface.java @@ -0,0 +1,69 @@ +package wrappers; + +import java.sql.*; +import java.util.Hashtable; + +import javax.sql.DataSource; +import com.mysql.cj.jdbc.MysqlDataSource; + +public class MysqlInterface extends JdbcInterface { + public MysqlInterface() { + this(true); + } // end of default constructor + + public MysqlInterface(boolean b) { + super(b); + + if (dst == null) + dst = new Hashtable<String, DataSource>(); + + } // end of default constructor + + @Override + public int JdbcConnect(String[] parms, int fsize, boolean scrollable) { + int rc = 0; + String url = parms[1]; + DataSource ds = null; + MysqlDataSource mds = null; + + if (DEBUG) + System.out.println("Connecting to MySQL data source"); + + try { + CheckURL(url, "mysql"); + + if ((ds = dst.get(url)) == null) { + mds = new MysqlDataSource(); + mds.setUrl(url); + + if (parms[2] != null) + mds.setUser(parms[2]); + + if (parms[3] != null) + mds.setPassword(parms[3]); + + ds = mds; + + dst.put(url, ds); + } // endif ds + + // Get a connection from the data source + conn = ds.getConnection(); + + // Get the data base meta data object + dbmd = conn.getMetaData(); + + // Get a statement from the connection + stmt = GetStmt(fsize, scrollable); + } catch (SQLException se) { + SetErrmsg(se); + rc = -2; + } catch( Exception e ) { + SetErrmsg(e); + rc = -3; + } // end try/catch + + return rc; + } // end of JdbcConnect + +} // end of class MysqlInterface diff --git a/storage/connect/OracleInterface.java b/storage/connect/OracleInterface.java new file mode 100644 index 00000000000..0bfdd20e032 --- /dev/null +++ b/storage/connect/OracleInterface.java @@ -0,0 +1,69 @@ +package wrappers; + +import java.sql.*; +import java.util.Hashtable; + +import javax.sql.DataSource; +import oracle.jdbc.pool.OracleDataSource; + +public class OracleInterface extends JdbcInterface { + public OracleInterface() { + this(true); + } // end of OracleInterface constructor + + public OracleInterface(boolean b) { + super(b); + + if (dst == null) + dst = new Hashtable<String, DataSource>(); + + } // end of OracleInterface constructor + + @Override + public int JdbcConnect(String[] parms, int fsize, boolean scrollable) { + int rc = 0; + String url = parms[1]; + DataSource ds = null; + OracleDataSource ods = null; + + if (DEBUG) + System.out.println("Connecting to Oracle data source"); + + try { + CheckURL(url, "oracle"); + + if ((ds = dst.get(url)) == null) { + ods = new OracleDataSource(); + ods.setURL(url); + + if (parms[2] != null) + ods.setUser(parms[2]); + + if (parms[3] != null) + ods.setPassword(parms[3]); + + ds = ods; + + dst.put(url, ds); + } // endif ds + + // Get a connection from the data source + conn = ds.getConnection(); + + // Get the data base meta data object + dbmd = conn.getMetaData(); + + // Get a statement from the connection + stmt = GetStmt(fsize, scrollable); + } catch (SQLException se) { + SetErrmsg(se); + rc = -2; + } catch( Exception e ) { + SetErrmsg(e); + rc = -3; + } // end try/catch + + return rc; + } // end of JdbcConnect + +} // end of class OracleInterface diff --git a/storage/connect/PostgresqlInterface.java b/storage/connect/PostgresqlInterface.java new file mode 100644 index 00000000000..adce0616a1b --- /dev/null +++ b/storage/connect/PostgresqlInterface.java @@ -0,0 +1,69 @@ +package wrappers; + +import java.sql.*; +import java.util.Hashtable; + +import javax.sql.DataSource; +import org.postgresql.jdbc2.optional.PoolingDataSource; + +public class PostgresqlInterface extends JdbcInterface { + public PostgresqlInterface() { + this(true); + } // end of constructor + + public PostgresqlInterface(boolean b) { + super(b); + + if (dst == null) + dst = new Hashtable<String, DataSource>(); + + } // end of constructor + + @Override + public int JdbcConnect(String[] parms, int fsize, boolean scrollable) { + int rc = 0; + String url = parms[1]; + DataSource ds = null; + PoolingDataSource pds = null; + + if (DEBUG) + System.out.println("Connecting to Postgresql data source"); + + try { + CheckURL(url, "postgresql"); + + if ((ds = dst.get(url)) == null) { + pds = new PoolingDataSource(); + pds.setUrl(url); + + if (parms[2] != null) + pds.setUser(parms[2]); + + if (parms[3] != null) + pds.setPassword(parms[3]); + + ds = pds; + + dst.put(url, ds); + } // endif ds + + // Get a connection from the data source + conn = ds.getConnection(); + + // Get the data base meta data object + dbmd = conn.getMetaData(); + + // Get a statement from the connection + stmt = GetStmt(fsize, scrollable); + } catch (SQLException se) { + SetErrmsg(se); + rc = -2; + } catch( Exception e ) { + SetErrmsg(e); + rc = -3; + } // end try/catch + + return rc; + } // end of JdbcConnect + +} // end of class PostgresqlInterface diff --git a/storage/connect/connect.h b/storage/connect/connect.h index b877f1ffb6c..ce4cf9bf8b9 100644 --- a/storage/connect/connect.h +++ b/storage/connect/connect.h @@ -57,7 +57,6 @@ class DOXDEF: public DOSDEF { /* This is the DOS/UNIX Access Method base class declaration. */ /***********************************************************************/ class TDBDOX: public TDBDOS { - TDBDOX(): TDBDOS((PGLOBAL)0,(PTDBDOS) 0) {} /* Never called */ friend int MakeIndex(PGLOBAL, PTDB, PIXDEF); friend int CntCloseTable(PGLOBAL, PTDB, bool, bool); friend int CntIndexInit(PGLOBAL, PTDB, int, bool); @@ -66,7 +65,8 @@ class TDBDOX: public TDBDOS { friend int CntIndexRange(PGLOBAL, PTDB, const uchar**, uint*, bool*, key_part_map*); friend class ha_connect; - }; // end of class TDBDOX + TDBDOX() : TDBDOS((PGLOBAL)0, (PTDBDOS)0) {} /* Never called */ +}; // end of class TDBDOX class XKPDEF: public KPARTDEF { friend class TDBDOX; diff --git a/storage/connect/csort.cpp b/storage/connect/csort.cpp index e89c5ecdbc9..13f325d8f3f 100644 --- a/storage/connect/csort.cpp +++ b/storage/connect/csort.cpp @@ -5,7 +5,7 @@ /* */ /* COPYRIGHT: */ /* ---------- */ -/* (C) Copyright to the author Olivier Bertrand 1995-2012 */ +/* (C) Copyright to the author Olivier Bertrand 1995-2016 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ @@ -721,8 +721,8 @@ int CSORT::Qsortc(void) void CSORT::Qstc(int *base, int *max) { register int *i, *j, *jj, *lt, *eq, *gt, *mid; - int c= 0, lo, hi, rc; - size_t zlo, zhi, cnm; + int c = 0, lo, hi, rc; + size_t zlo, zhi, cnm; zlo = zhi = cnm = 0; // Avoid warning message @@ -774,12 +774,11 @@ void CSORT::Qstc(int *base, int *max) /*****************************************************************/ /* Small group. Do special quicker processing. */ /*****************************************************************/ - if ((rc = Qcompare(base, (i = base + 1))) > 0) - { - c = *base; - *base = *i; - *i = c; - } + if ((rc = Qcompare(base, (i = base + 1))) > 0) { + c = *base; + *base = *i; + *i = c; + } // endif rc if (Pof) Pof[base - Pex] = Pof[i - Pex] = (rc) ? 1 : 2; diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index dd347dca73a..5fe75fd0f59 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -171,9 +171,9 @@ #define JSONMAX 10 // JSON Default max grp size extern "C" { - char version[]= "Version 1.04.0006 May 08, 2016"; + char version[]= "Version 1.04.0008 August 10, 2016"; #if defined(__WIN__) - char compver[]= "Version 1.04.0006 " __DATE__ " " __TIME__; + char compver[]= "Version 1.04.0008 " __DATE__ " " __TIME__; char slash= '\\'; #else // !__WIN__ char slash= '/'; @@ -195,7 +195,6 @@ extern "C" { #if defined(JDBC_SUPPORT) char *JvmPath; char *ClassPath; - char *Wrapper; #endif // JDBC_SUPPORT #if defined(__WIN__) @@ -211,7 +210,7 @@ PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info); PQRYRES VirColumns(PGLOBAL g, bool info); PQRYRES JSONColumns(PGLOBAL g, char *db, PTOS topt, bool info); PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info); -int TranslateJDBCType(int stp, int prec, int& len, char& v); +int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v); void PushWarning(PGLOBAL g, THD *thd, int level); bool CheckSelf(PGLOBAL g, TABLE_SHARE *s, const char *host, const char *db, char *tab, const char *src, int port); @@ -220,6 +219,7 @@ USETEMP UseTemp(void); int GetConvSize(void); TYPCONV GetTypeConv(void); uint GetJsonGrpSize(void); +char *GetJavaWrapper(void); uint GetWorkSize(void); void SetWorkSize(uint); extern "C" const char *msglang(void); @@ -332,6 +332,15 @@ static MYSQL_THDVAR_UINT(json_grp_size, "max number of rows for JSON aggregate functions.", NULL, NULL, JSONMAX, 1, INT_MAX, 1); +#if defined(JDBC_SUPPORT) +// Default java wrapper to use with JDBC tables +static MYSQL_THDVAR_STR(java_wrapper, + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, + "Java wrapper class name", + // check_class_path, update_class_path, + NULL, NULL, "wrappers/JdbcInterface"); +#endif // JDBC_SUPPORT + #if defined(XMSG) || defined(NEWMSG) const char *language_names[]= { @@ -384,6 +393,12 @@ extern "C" const char *msglang(void) return language_names[THDVAR(current_thd, msg_lang)]; } // end of msglang #else // !XMSG && !NEWMSG + +#if defined(JDBC_SUPPORT) +char *GetJavaWrapper(void) +{return connect_hton ? THDVAR(current_thd, java_wrapper) : (char*)"wrappers/JdbcInterface";} +#endif // JDBC_SUPPORT + extern "C" const char *msglang(void) { #if defined(FRENCH) @@ -5632,6 +5647,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, } else { char *schem= NULL; + char *tn= NULL; // Not a catalog table if (!qrp->Nblin) { @@ -5648,7 +5664,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, typ= len= prec= dec= 0; tm= NOT_NULL_FLAG; cnm= (char*)"noname"; - dft= xtra= key= fmt= NULL; + dft= xtra= key= fmt= tn= NULL; v= ' '; rem= NULL; @@ -5668,7 +5684,10 @@ static int connect_assisted_discovery(handlerton *, THD* thd, typ= crp->Kdata->GetIntValue(i); v = (crp->Nulls) ? crp->Nulls[i] : 0; break; - case FLD_PREC: + case FLD_TYPENAME: + tn= crp->Kdata->GetCharValue(i); + break; + case FLD_PREC: // PREC must be always before LENGTH len= prec= crp->Kdata->GetIntValue(i); break; @@ -5712,8 +5731,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd, break; case FLD_SCHEM: -#if defined(ODBC_SUPPORT) - if (ttp == TAB_ODBC && crp->Kdata) { +#if defined(ODBC_SUPPORT) || defined(JDBC_SUPPORT) + if ((ttp == TAB_ODBC || ttp == TAB_JDBC) && crp->Kdata) { if (schem && stricmp(schem, crp->Kdata->GetCharValue(i))) { sprintf(g->Message, "Several %s tables found, specify DBNAME", tab); @@ -5723,7 +5742,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, schem= crp->Kdata->GetCharValue(i); } // endif ttp -#endif // ODBC_SUPPORT +#endif // ODBC_SUPPORT || JDBC_SUPPORT default: break; // Ignore } // endswitch Fld @@ -5776,7 +5795,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, int plgtyp; // typ must be PLG type, not SQL type - if (!(plgtyp= TranslateJDBCType(typ, dec, prec, v))) { + if (!(plgtyp= TranslateJDBCType(typ, tn, dec, prec, v))) { if (GetTypeConv() == TPC_SKIP) { // Skip this column sprintf(g->Message, "Column %s skipped (unsupported type %d)", @@ -6874,12 +6893,6 @@ static MYSQL_SYSVAR_STR(class_path, ClassPath, "Java class path", // check_class_path, update_class_path, NULL, NULL, NULL); - -static MYSQL_SYSVAR_STR(java_wrapper, Wrapper, - PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC, - "Java wrapper class", - // check_class_path, update_class_path, - NULL, NULL, "JdbcInterface"); #endif // JDBC_SUPPORT @@ -6921,7 +6934,7 @@ maria_declare_plugin(connect) 0x0104, /* version number (1.04) */ NULL, /* status variables */ connect_system_variables, /* system variables */ - "1.04.0006", /* string version */ + "1.04.0008", /* string version */ MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ } maria_declare_plugin_end; diff --git a/storage/connect/jdbconn.cpp b/storage/connect/jdbconn.cpp index 9b479277df2..3b8de3e975b 100644 --- a/storage/connect/jdbconn.cpp +++ b/storage/connect/jdbconn.cpp @@ -6,6 +6,13 @@ /* This file contains the JDBC connection classes functions. */ /***********************************************************************/ +#if defined(__WIN__) +// This is needed for RegGetValue +#define _WINVER 0x0601 +#undef _WIN32_WINNT +#define _WIN32_WINNT 0x0601 +#endif // __WIN__ + /***********************************************************************/ /* Include relevant MariaDB header file. */ /***********************************************************************/ @@ -52,10 +59,12 @@ extern "C" HINSTANCE s_hModule; // Saved module handle #define nullptr 0 #endif // !__WIN__ +TYPCONV GetTypeConv(); int GetConvSize(); extern char *JvmPath; // The connect_jvm_path global variable value extern char *ClassPath; // The connect_class_path global variable value -extern char *Wrapper; // The connect_java_wrapper global variable value + +char *GetJavaWrapper(void); // The connect_java_wrapper variable value /***********************************************************************/ /* Static JDBConn objects. */ @@ -79,7 +88,7 @@ GETDEF JDBConn::GetDefaultJavaVMInitArgs = NULL; #endif // !_DEBUG // To avoid gcc warning -int TranslateJDBCType(int stp, int prec, int& len, char& v); +int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v); /***********************************************************************/ /* GetJDBCType: returns the SQL_TYPE corresponding to a PLG type. */ @@ -107,13 +116,16 @@ static short GetJDBCType(int type) /***********************************************************************/ /* TranslateJDBCType: translate a JDBC Type to a PLG type. */ /***********************************************************************/ -int TranslateJDBCType(int stp, int prec, int& len, char& v) +int TranslateJDBCType(int stp, char *tn, int prec, int& len, char& v) { int type; switch (stp) { case -1: // LONGVARCHAR - len = MY_MIN(abs(len), GetConvSize()); + if (GetTypeConv() != TPC_YES) + return TYPE_ERROR; + else + len = MY_MIN(abs(len), GetConvSize()); case 12: // VARCHAR v = 'V'; case 1: // CHAR @@ -139,17 +151,24 @@ int TranslateJDBCType(int stp, int prec, int& len, char& v) case 8: // DOUBLE type = TYPE_DOUBLE; break; - case 93: // TIMESTAMP + case 93: // TIMESTAMP, DATETIME type = TYPE_DATE; len = 19 + ((prec) ? (prec+1) : 0); - v = 'S'; + v = (tn && toupper(tn[0]) == 'T') ? 'S' : 'E'; break; - case 91: // TYPE_DATE + case 91: // DATE, YEAR type = TYPE_DATE; - len = 10; - v = 'D'; + + if (!tn || toupper(tn[0]) != 'Y') { + len = 10; + v = 'D'; + } else { + len = 4; + v = 'Y'; + } // endif len + break; - case 92: // TYPE_TIME + case 92: // TIME type = TYPE_DATE; len = 8 + ((prec) ? (prec+1) : 0); v = 'T'; @@ -270,7 +289,7 @@ PQRYRES JDBCColumns(PGLOBAL g, char *db, char *table, char *colpat, return NULL; // Colpat cannot be null or empty for some drivers - cap->Pat = (colpat && *colpat) ? colpat : "%"; + cap->Pat = (colpat && *colpat) ? colpat : PlugDup(g, "%"); /************************************************************************/ /* Now get the results into blocks. */ @@ -378,7 +397,9 @@ PQRYRES JDBCTables(PGLOBAL g, char *db, char *tabpat, char *tabtyp, if (info || !qrp) return qrp; - if (!(cap = AllocCatInfo(g, CAT_TAB, db, tabpat, qrp))) + // Tabpat cannot be null or empty for some drivers + if (!(cap = AllocCatInfo(g, CAT_TAB, db, + (tabpat && *tabpat) ? tabpat : PlugDup(g, "%"), qrp))) return NULL; cap->Pat = tabtyp; @@ -629,11 +650,20 @@ JDBConn::JDBConn(PGLOBAL g, TDBJDBC *tdbp) job = nullptr; // The java wrapper class object xqid = xuid = xid = grs = readid = fetchid = typid = errid = nullptr; prepid = xpid = pcid = nullptr; - chrfldid = intfldid = dblfldid = fltfldid = datfldid = bigfldid = nullptr; -//m_LoginTimeout = DEFAULT_LOGIN_TIMEOUT; + chrfldid = intfldid = dblfldid = fltfldid = bigfldid = nullptr; + datfldid = timfldid = tspfldid = nullptr; + //m_LoginTimeout = DEFAULT_LOGIN_TIMEOUT; //m_QueryTimeout = DEFAULT_QUERY_TIMEOUT; //m_UpdateOptions = 0; Msg = NULL; + m_Wrap = (tdbp && tdbp->WrapName) ? tdbp->WrapName : GetJavaWrapper(); + + if (!strchr(m_Wrap, '/')) { + // Add the wrapper package name + char *wn = (char*)PlugSubAlloc(g, NULL, strlen(m_Wrap) + 10); + m_Wrap = strcat(strcpy(wn, "wrappers/"), m_Wrap); + } // endif m_Wrap + m_Driver = NULL; m_Url = NULL; m_User = NULL; @@ -809,17 +839,52 @@ void JDBConn::ResetJVM(void) /***********************************************************************/ bool JDBConn::GetJVM(PGLOBAL g) { + int ntry; + if (!LibJvm) { char soname[512]; #if defined(__WIN__) - if (JvmPath) - strcat(strcpy(soname, JvmPath), "\\jvm.dll"); - else - strcpy(soname, "jvm.dll"); + for (ntry = 0; !LibJvm && ntry < 3; ntry++) { + if (!ntry && JvmPath) { + strcat(strcpy(soname, JvmPath), "\\jvm.dll"); + ntry = 3; // No other try + } else if (ntry < 2 && getenv("JAVA_HOME")) { + strcpy(soname, getenv("JAVA_HOME")); - // Load the desired shared library - if (!(LibJvm = LoadLibrary(soname))) { + if (ntry == 1) + strcat(soname, "\\jre"); + + strcat(soname, "\\bin\\client\\jvm.dll"); + } else { + // Try to find it through the registry + char version[16]; + char javaKey[64] = "SOFTWARE\\JavaSoft\\Java Runtime Environment"; + LONG rc; + DWORD BufferSize = 16; + + strcpy(soname, "jvm.dll"); // In case it fails + + if ((rc = RegGetValue(HKEY_LOCAL_MACHINE, javaKey, "CurrentVersion", + RRF_RT_ANY, NULL, (PVOID)&version, &BufferSize)) == ERROR_SUCCESS) { + strcat(strcat(javaKey, "\\"), version); + BufferSize = sizeof(soname); + + if ((rc = RegGetValue(HKEY_LOCAL_MACHINE, javaKey, "RuntimeLib", + RRF_RT_ANY, NULL, (PVOID)&soname, &BufferSize)) != ERROR_SUCCESS) + printf("RegGetValue: rc=%ld\n", rc); + + } // endif rc + + ntry = 3; // Try this only once + } // endelse + + // Load the desired shared library + LibJvm = LoadLibrary(soname); + } // endfor ntry + + // Get the needed entries + if (!LibJvm) { char buf[256]; DWORD rc = GetLastError(); @@ -850,13 +915,23 @@ bool JDBConn::GetJVM(PGLOBAL g) #else // !__WIN__ const char *error = NULL; - if (JvmPath) - strcat(strcpy(soname, JvmPath), "/libjvm.so"); - else - strcpy(soname, "libjvm.so"); + for (ntry = 0; !LibJvm && ntry < 2; ntry++) { + if (!ntry && JvmPath) { + strcat(strcpy(soname, JvmPath), "/libjvm.so"); + ntry = 2; + } else if (!ntry && getenv("JAVA_HOME")) { + // TODO: Replace i386 by a better guess + strcat(strcpy(soname, getenv("JAVA_HOME")), "/jre/lib/i386/client/libjvm.so"); + } else { // Will need LD_LIBRARY_PATH to be set + strcpy(soname, "libjvm.so"); + ntry = 2; + } // endelse + + LibJvm = dlopen(soname, RTLD_LAZY); + } // endfor ntry // Load the desired shared library - if (!(LibJvm = dlopen(soname, RTLD_LAZY))) { + if (!LibJvm) { error = dlerror(); sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error)); } else if (!(CreateJavaVM = (CRTJVM)dlsym(LibJvm, "JNI_CreateJavaVM"))) { @@ -890,7 +965,9 @@ bool JDBConn::GetJVM(PGLOBAL g) /***********************************************************************/ int JDBConn::Open(PJPARM sop) { + bool err = false; + jboolean jt = (trace > 0); PGLOBAL& g = m_G; // Link or check whether jvm library was linked @@ -930,6 +1007,11 @@ int JDBConn::Open(PJPARM sop) #define N 1 #endif + // Java source will be compiled as ajar file installed in the plugin dir + jpop->Append(sep); + jpop->Append(GetPluginDir()); + jpop->Append("JdbcInterface.jar"); + //================== prepare loading of Java VM ============================ JavaVMInitArgs vm_args; // Initialization arguments JavaVMOption* options = new JavaVMOption[N]; // JVM invocation options @@ -1000,19 +1082,16 @@ int JDBConn::Open(PJPARM sop) return RC_FX; } // endswitch rc + //=============== Display JVM version =============== + jint ver = env->GetVersion(); + printf("JVM Version %d.%d\n", ((ver>>16)&0x0f), (ver&0x0f)); } // endif rc - //=============== Display JVM version ======================================= -#if defined(_DEBUG) - jint ver = env->GetVersion(); - printf("JVM Version %d.%d\n", ((ver>>16)&0x0f), (ver&0x0f)); -#endif //_DEBUG - // try to find the java wrapper class - jdi = env->FindClass(Wrapper); + jdi = env->FindClass(m_Wrap); if (jdi == nullptr) { - sprintf(g->Message, "ERROR: class %s not found!", Wrapper); + sprintf(g->Message, "ERROR: class %s not found!", m_Wrap); return RC_FX; } // endif jdi @@ -1055,19 +1134,19 @@ int JDBConn::Open(PJPARM sop) #endif // 0 // if class found, continue - jmethodID ctor = env->GetMethodID(jdi, "<init>", "()V"); + jmethodID ctor = env->GetMethodID(jdi, "<init>", "(Z)V"); if (ctor == nullptr) { - sprintf(g->Message, "ERROR: %s constructor not found!", Wrapper); + sprintf(g->Message, "ERROR: %s constructor not found!", m_Wrap); return RC_FX; } else - job = env->NewObject(jdi, ctor); + job = env->NewObject(jdi, ctor, jt); // If the object is successfully constructed, // we can then search for the method we want to call, // and invoke it for the object: if (job == nullptr) { - sprintf(g->Message, "%s class object not constructed!", Wrapper); + sprintf(g->Message, "%s class object not constructed!", m_Wrap); return RC_FX; } // endif job @@ -1268,9 +1347,7 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) { PGLOBAL& g = m_G; jint ctyp; - jlong dtv; jstring cn, jn = nullptr; - jobject dob; if (rank == 0) if (!name || (jn = env->NewStringUTF(name)) == nullptr) { @@ -1333,31 +1410,22 @@ void JDBConn::SetColumnValue(int rank, PSZ name, PVAL val) break; case 91: // DATE - case 92: // TIME - case 93: // TIMESTAMP - if (!gmID(g, datfldid, "TimestampField", - "(ILjava/lang/String;)Ljava/sql/Timestamp;")) { - dob = env->CallObjectMethod(job, datfldid, (jint)rank, jn); - - if (dob) { - jclass jts = env->FindClass("java/sql/Timestamp"); - - if (env->ExceptionCheck()) { - val->Reset(); - } else { - jmethodID getTime = env->GetMethodID(jts, "getTime", "()J"); - - if (getTime != nullptr) { - dtv = env->CallLongMethod(dob, getTime); - val->SetValue((int)(dtv / 1000)); - } else - val->Reset(); - - } // endif check + if (!gmID(g, datfldid, "DateField", "(ILjava/lang/String;)I")) { + val->SetValue((int)env->CallIntMethod(job, datfldid, (jint)rank, jn)); + } else + val->Reset(); - } else - val->Reset(); + break; + case 92: // TIME + if (!gmID(g, timfldid, "TimeField", "(ILjava/lang/String;)I")) { + val->SetValue((int)env->CallIntMethod(job, timfldid, (jint)rank, jn)); + } else + val->Reset(); + break; + case 93: // TIMESTAMP + if (!gmID(g, tspfldid, "TimestampField", "(ILjava/lang/String;)I")) { + val->SetValue((int)env->CallIntMethod(job, tspfldid, (jint)rank, jn)); } else val->Reset(); diff --git a/storage/connect/jdbconn.h b/storage/connect/jdbconn.h index abec3919e52..095b1565bd2 100644 --- a/storage/connect/jdbconn.h +++ b/storage/connect/jdbconn.h @@ -24,7 +24,7 @@ //efine MAX_FNAME_LEN 256 // Max size of field names //efine MAX_STRING_INFO 256 // Max size of string from SQLGetInfo //efine MAX_DNAME_LEN 256 // Max size of Recordset names -#define MAX_CONNECT_LEN 512 // Max size of Connect string +//efine MAX_CONNECT_LEN 512 // Max size of Connect string //efine MAX_CURSOR_NAME 18 // Max size of a cursor name #define DEFAULT_FIELD_TYPE 0 // TYPE_NULL @@ -169,12 +169,15 @@ protected: jmethodID intfldid; // The IntField method ID jmethodID dblfldid; // The DoubleField method ID jmethodID fltfldid; // The FloatField method ID - jmethodID datfldid; // The TimestampField method ID + jmethodID datfldid; // The DateField method ID + jmethodID timfldid; // The TimeField method ID + jmethodID tspfldid; // The TimestampField method ID jmethodID bigfldid; // The BigintField method ID //DWORD m_LoginTimeout; //DWORD m_QueryTimeout; //DWORD m_UpdateOptions; char *Msg; + char *m_Wrap; char m_IDQuoteChar[2]; PSZ m_Driver; PSZ m_Url; diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp index d99a021cdc9..c45630129f1 100644 --- a/storage/connect/json.cpp +++ b/storage/connect/json.cpp @@ -767,7 +767,7 @@ bool JOUTSTR::Escape(const char *s) { WriteChr('"'); - for (unsigned int i = 0; i < strlen(s); i++) + for (unsigned int i = 0; s[i]; i++) switch (s[i]) { case '"': case '\\': @@ -816,7 +816,7 @@ bool JOUTFILE::Escape(const char *s) // This is temporary fputc('"', Stream); - for (unsigned int i = 0; i < strlen(s); i++) + for (unsigned int i = 0; s[i]; i++) switch (s[i]) { case '"': fputs("\\\"", Stream); break; case '\\': fputs("\\\\", Stream); break; diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 43bb6edf748..88931ea6c13 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -30,6 +30,10 @@ uint GetJsonGrpSize(void); static int IsJson(UDF_ARGS *args, uint i); static PSZ MakePSZ(PGLOBAL g, UDF_ARGS *args, int i); +static char *handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, + unsigned long *res_length, char *is_null, char *error); +static char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, + unsigned long *res_length, char *is_null, char *error); static uint JsonGrpSize = 10; @@ -1302,7 +1306,7 @@ static my_bool CalcLen(UDF_ARGS *args, my_bool obj, { char fn[_MAX_PATH]; unsigned long i, k, m, n; - long fl= 0, j = -1; + long fl = 0, j = -1; reslen = args->arg_count + 2; @@ -2125,7 +2129,7 @@ my_bool json_object_nonull_init(UDF_INIT *initid, UDF_ARGS *args, char *json_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *res_length, char *, char *) { - char *str= 0; + char *str = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; if (!g->Xchk) { @@ -2698,7 +2702,7 @@ char *json_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endif Xchk if (!CheckMemory(g, initid, args, 2, false, false, true)) { - PJSON top= 0; + PJSON top = NULL; PJVAL jvp; PJSON jsp[2] = {NULL, NULL}; @@ -4898,7 +4902,7 @@ static char *bin_handle_item(UDF_INIT *initid, UDF_ARGS *args, char *result, my_bool b = true; PJSON jsp; PJSNX jsx; - PJVAL jvp= 0; + PJVAL jvp = NULL; PBSON bsp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; PGLOBAL gb = GetMemPtr(g, args, 0); diff --git a/storage/connect/mysql-test/connect/r/jdbc.result b/storage/connect/mysql-test/connect/r/jdbc.result index 5e844bc9900..895b4070d70 100644 --- a/storage/connect/mysql-test/connect/r/jdbc.result +++ b/storage/connect/mysql-test/connect/r/jdbc.result @@ -1,3 +1,4 @@ +SET GLOBAL time_zone='+1:00'; CREATE DATABASE connect; USE connect; CREATE TABLE t2 ( @@ -99,8 +100,8 @@ George San Jose 1981-08-10 2010-06-02 Sam Chicago 1979-11-22 2007-10-10 James Dallas 1992-05-13 2009-12-14 Bill Boston 1986-09-11 2008-02-10 -Donald Atlanta 1999-04-01 2016-03-31 -Mick New York 1980-01-20 2002-09-11 +Donald Atlanta 1999-03-31 2016-03-30 +Mick New York 1980-01-20 2002-09-10 Tom Seatle 2002-03-15 1970-01-01 DROP TABLE t3; # @@ -110,7 +111,7 @@ CREATE TABLE t3 ( name CHAR(9) NOT NULL, city CHAR(12) NOT NULL, age INT(2)) -engine=CONNECT table_type=FIX file_name='girls.txt'; +ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='girls.txt' ENDING=1; SELECT g.name, b.name, g.city FROM t3 g STRAIGHT_JOIN connect.boys b where g.city = b.city; name name city Mary John Boston @@ -167,8 +168,11 @@ serialno name sex title manager department secretary salary 00137 BROWNY 1 ENGINEER 40567 0319 12345 10500.00 73111 WHEELFOR 1 SALESMAN 70012 0318 24888 10030.00 00023 MARTIN 1 ENGINEER 40567 0319 12345 10000.00 +# +# Option Driver is required to find the Driver class inside the executable jar file +# USE test; -CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC TABNAME=emp CONNECTION='jdbc:mariadb://localhost:PORT/connect?user=root'; +CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC TABNAME=emp CONNECTION='jdbc:mariadb://localhost:PORT/connect?user=root' OPTION_LIST='Driver=org.mariadb.jdbc.Driver'; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -180,7 +184,7 @@ t1 CREATE TABLE `t1` ( `department` char(4) NOT NULL, `secretary` char(5) NOT NULL, `salary` double(12,2) NOT NULL -) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mariadb://localhost:PORT/connect?user=root' `TABLE_TYPE`='JDBC' `TABNAME`='emp' +) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mariadb://localhost:PORT/connect?user=root' `TABLE_TYPE`='JDBC' `TABNAME`='emp' `OPTION_LIST`='Driver=org.mariadb.jdbc.Driver' SELECT * FROM t1; serialno name sex title manager department secretary salary 74200 BANCROFT 2 SALESMAN 70012 0318 24888 9600.00 @@ -260,10 +264,8 @@ DROP TABLE t2; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables CONNECTION='jdbc:mariadb://localhost:PORT/connect' option_list='User=root,Maxres=50'; SELECT * FROM t1; Table_Cat Table_Schema Table_Name Table_Type Remark -connect NULL tx1 BASE TABLE +connect NULL tx1 TABLE DROP TABLE t1; DROP TABLE connect.tx1; DROP DATABASE connect; -SET GLOBAL connect_jvm_path=NULL; -SET GLOBAL connect_class_path=NULL; -SET GLOBAL time_zone = SYSTEM; +SET GLOBAL time_zone=SYSTEM; diff --git a/storage/connect/mysql-test/connect/r/jdbc_new.result b/storage/connect/mysql-test/connect/r/jdbc_new.result index e5356edd5d8..14381b0b11f 100644 --- a/storage/connect/mysql-test/connect/r/jdbc_new.result +++ b/storage/connect/mysql-test/connect/r/jdbc_new.result @@ -1,3 +1,4 @@ +SET GLOBAL time_zone='+1:00'; CREATE TABLE t1 (a int, b char(10)); INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03'); SELECT * FROM t1; @@ -10,6 +11,7 @@ NULL NULL # # Testing errors # +SET GLOBAL time_zone='+1:00'; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=unknown'; SELECT * FROM t1; @@ -32,15 +34,13 @@ t1 CREATE TABLE `t1` ( `y` char(10) DEFAULT NULL ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root' `TABLE_TYPE`=JDBC SELECT * FROM t1; -ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Unknown column 'x' in 'field list' -Query is : SELECT x, y FROM t1' from CONNECT +ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Unknown column 'x' in 'field list'' from CONNECT DROP TABLE t1; CREATE TABLE t1 (a int, b char(10)) ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root'; ALTER TABLE t1 RENAME t1backup; SELECT * FROM t1; -ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Table 'test.t1' doesn't exist -Query is : SELECT a, b FROM t1' from CONNECT +ERROR HY000: Got error 174 'ExecuteQuery: java.sql.SQLSyntaxErrorException: Table 'test.t1' doesn't exist' from CONNECT ALTER TABLE t1backup RENAME t1; DROP TABLE t1; # @@ -201,16 +201,15 @@ SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( `a` date DEFAULT NULL, - `b` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `b` datetime DEFAULT NULL, `c` time DEFAULT NULL, - `d` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `e` date DEFAULT NULL + `d` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + `e` year(4) DEFAULT NULL ) ENGINE=CONNECT DEFAULT CHARSET=latin1 CONNECTION='jdbc:mysql://127.0.0.1:SLAVE_PORT/test?user=root' `TABLE_TYPE`='JDBC' SELECT * FROM t1; a b c d e -2003-05-27 2003-05-27 10:45:23 10:45:23 2003-05-27 10:45:23 1970-01-01 +2003-05-27 2003-05-27 11:45:23 10:45:23 2003-05-27 10:45:23 2003 DROP TABLE t1; DROP TABLE t1; -SET GLOBAL connect_jvm_path=NULL; -SET GLOBAL connect_class_path=NULL; -SET GLOBAL time_zone = SYSTEM; +SET GLOBAL time_zone=SYSTEM; +SET GLOBAL time_zone=SYSTEM; diff --git a/storage/connect/mysql-test/connect/std_data/JdbcMariaDB.jar b/storage/connect/mysql-test/connect/std_data/JdbcMariaDB.jar Binary files differnew file mode 100644 index 00000000000..81f91e4465a --- /dev/null +++ b/storage/connect/mysql-test/connect/std_data/JdbcMariaDB.jar diff --git a/storage/connect/mysql-test/connect/t/jdbc.test b/storage/connect/mysql-test/connect/t/jdbc.test index 9389747ad9c..41fd298776b 100644 --- a/storage/connect/mysql-test/connect/t/jdbc.test +++ b/storage/connect/mysql-test/connect/t/jdbc.test @@ -1,4 +1,5 @@ -- source jdbconn.inc +SET GLOBAL time_zone='+1:00'; let $MYSQLD_DATADIR= `select @@datadir`; --copy_file $MTR_SUITE_DIR/std_data/girls.txt $MYSQLD_DATADIR/test/girls.txt @@ -80,7 +81,7 @@ CREATE TABLE t3 ( name CHAR(9) NOT NULL, city CHAR(12) NOT NULL, age INT(2)) -engine=CONNECT table_type=FIX file_name='girls.txt'; +ENGINE=CONNECT TABLE_TYPE=FIX FILE_NAME='girls.txt' ENDING=1; SELECT g.name, b.name, g.city FROM t3 g STRAIGHT_JOIN connect.boys b where g.city = b.city; SELECT g.name, b.name, g.city FROM t3 g STRAIGHT_JOIN t1 b where g.city = b.city; DROP TABLE t1, t3, connect.boys; @@ -102,9 +103,12 @@ CREATE TABLE emp ( ENGINE=connect TABLE_TYPE=fix FILE_NAME='employee.dat' ENDING=1; SELECT * FROM emp; +--echo # +--echo # Option Driver is required to find the Driver class inside the executable jar file +--echo # USE test; --replace_result $PORT PORT ---eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC TABNAME=emp CONNECTION='jdbc:mariadb://localhost:$PORT/connect?user=root' +--eval CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC TABNAME=emp CONNECTION='jdbc:mariadb://localhost:$PORT/connect?user=root' OPTION_LIST='Driver=org.mariadb.jdbc.Driver' --replace_result $PORT PORT --eval SHOW CREATE TABLE t1 SELECT * FROM t1; @@ -113,7 +117,7 @@ SELECT name, title, salary FROM t1 WHERE sex = 1; DROP TABLE t1, connect.emp; # -# Testing remote command execution +# Testing remote command execution (Driver option is no more necessary) # --replace_result $PORT PORT --eval CREATE TABLE t2 (command varchar(128) not null,number int(5) not null flag=1,message varchar(255) flag=2) ENGINE=CONNECT TABLE_TYPE=JDBC CONNECTION='jdbc:mariadb://localhost:$PORT/connect' OPTION_LIST='User=root,Execsrc=1' @@ -139,5 +143,5 @@ DROP TABLE connect.tx1; --remove_file $MYSQLD_DATADIR/connect/employee.dat DROP DATABASE connect; --remove_file $MYSQLD_DATADIR/test/girls.txt - +SET GLOBAL time_zone=SYSTEM; -- source jdbconn_cleanup.inc diff --git a/storage/connect/mysql-test/connect/t/jdbc_new.test b/storage/connect/mysql-test/connect/t/jdbc_new.test index 33ec1b343cc..d1ad5117b72 100644 --- a/storage/connect/mysql-test/connect/t/jdbc_new.test +++ b/storage/connect/mysql-test/connect/t/jdbc_new.test @@ -8,6 +8,8 @@ connection master; -- source jdbconn.inc connection slave; +SET GLOBAL time_zone='+1:00'; + CREATE TABLE t1 (a int, b char(10)); INSERT INTO t1 VALUES (NULL,NULL),(0,'test00'),(1,'test01'),(2,'test02'),(3,'test03'); SELECT * FROM t1; @@ -16,6 +18,7 @@ SELECT * FROM t1; --echo # Testing errors --echo # connection master; +SET GLOBAL time_zone='+1:00'; # Bad user name # Suppress "mysql_real_connect failed:" (printed in _DEBUG build) @@ -173,7 +176,9 @@ DROP TABLE t1; connection slave; DROP TABLE t1; +SET GLOBAL time_zone=SYSTEM; connection master; +SET GLOBAL time_zone=SYSTEM; -- source jdbconn_cleanup.inc diff --git a/storage/connect/mysql-test/connect/t/jdbconn.inc b/storage/connect/mysql-test/connect/t/jdbconn.inc index 0bac0b35fc4..05122f51924 100644 --- a/storage/connect/mysql-test/connect/t/jdbconn.inc +++ b/storage/connect/mysql-test/connect/t/jdbconn.inc @@ -12,19 +12,20 @@ if (!`SELECT count(*) FROM INFORMATION_SCHEMA.TABLES } DROP TABLE t1; -# This is specific and explains why this test is disabled. -# You should edit this file to reflect what is the required files location on your machine. +# You cand edit this file to reflect what is the required files location on your machine. # This is the path to the JVM library (dll or so) -SET GLOBAL connect_jvm_path='C:\\Program Files\\Java\\jdk1.8.0_77\\jre\\bin\\client'; +# If not set CONNECT will try to use the JAVA_HOME environment variable +# and if not found try to find it in the registers (Windows only) +#SET GLOBAL connect_jvm_path='C:\\Program Files\\Java\\jdk1.8.0_77\\jre\\bin\\client'; # The complete class path send when creating the Java Virtual Machine is, in that order: # 1 - The current directory. # 2 - The paths of the connect_class_path global variable. # 3 - The paths of the CLASSPATH environment variable. -# These are the paths to the needed classes or jar files. The Apache ones are only for the JdbcApacheInterface wrapper. -SET GLOBAL connect_class_path='E:\\MariaDB-10.1\\Connect\\storage\\connect;E:\\MariaDB-10.1\\Connect\\sql\\data\\postgresql-9.4.1208.jar;E:\\Oracle\\ojdbc6.jar;E:\\Apache\\commons-dbcp2-2.1.1\\commons-dbcp2-2.1.1.jar;E:\\Apache\\commons-pool2-2.4.2\\commons-pool2-2.4.2.jar;E:\\Apache\\commons-logging-1.2\\commons-logging-1.2.jar'; +# In this test we use an executable jar file that contains all what is needed. +eval SET GLOBAL connect_class_path='$MTR_SUITE_DIR/std_data/JdbcMariaDB.jar'; -# On my machine, paths to the JDK classes and to the MySQL and MariaDB drivers are defined in the CLASSPATH environment variable +# Paths to the JDK classes and to the MySQL and MariaDB drivers can be defined in the CLASSPATH environment variable #CREATE FUNCTION envar RETURNS STRING SONAME 'ha_connect.dll'; #SELECT envar('CLASSPATH'); diff --git a/storage/connect/mysql-test/connect/t/jdbconn_cleanup.inc b/storage/connect/mysql-test/connect/t/jdbconn_cleanup.inc index 48e321495ad..d70e594df63 100644 --- a/storage/connect/mysql-test/connect/t/jdbconn_cleanup.inc +++ b/storage/connect/mysql-test/connect/t/jdbconn_cleanup.inc @@ -1,6 +1,8 @@ +--disable_query_log --disable_warnings #DROP FUNCTION envar; SET GLOBAL connect_jvm_path=NULL; SET GLOBAL connect_class_path=NULL; SET GLOBAL time_zone = SYSTEM; --enable_warnings +--enable_query_log diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index 3ed4e9af393..7320f4cc1d9 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -53,6 +53,7 @@ extern "C" HINSTANCE s_hModule; // Saved module handle #endif // __WIN__ +TYPCONV GetTypeConv(); int GetConvSize(); /***********************************************************************/ @@ -135,9 +136,13 @@ int TranslateSQLType(int stp, int prec, int& len, char& v, bool& w) case SQL_WLONGVARCHAR: // (-10) w = true; case SQL_LONGVARCHAR: // (-1) - v = 'V'; - type = TYPE_STRING; - len = MY_MIN(abs(len), GetConvSize()); + if (GetTypeConv() == TPC_YES) { + v = 'V'; + type = TYPE_STRING; + len = MY_MIN(abs(len), GetConvSize()); + } else + type = TYPE_ERROR; + break; case SQL_NUMERIC: // 2 case SQL_DECIMAL: // 3 @@ -1752,7 +1757,7 @@ bool ODBConn::BindParam(ODBCCOL *colp) void *buf; int buftype = colp->GetResultType(); SQLUSMALLINT n = colp->GetRank(); - SQLSMALLINT ct, sqlt, dec, nul __attribute__((unused)); + SQLSMALLINT ct, sqlt, dec, nul __attribute__((unused)); SQLULEN colsize; SQLLEN len; SQLLEN *strlen = colp->GetStrLen(); diff --git a/storage/connect/odbconn.h b/storage/connect/odbconn.h index 6a24334f08c..063985218ec 100644 --- a/storage/connect/odbconn.h +++ b/storage/connect/odbconn.h @@ -25,7 +25,7 @@ //efine MAX_FNAME_LEN 256 // Max size of field names #define MAX_STRING_INFO 256 // Max size of string from SQLGetInfo //efine MAX_DNAME_LEN 256 // Max size of Recordset names -#define MAX_CONNECT_LEN 512 // Max size of Connect string +#define MAX_CONNECT_LEN 1024 // Max size of Connect string //efine MAX_CURSOR_NAME 18 // Max size of a cursor name #define DEFAULT_FIELD_TYPE SQL_TYPE_NULL // pick "C" data type to match SQL data type diff --git a/storage/connect/tabjdbc.cpp b/storage/connect/tabjdbc.cpp index e6782e71753..86fd831b262 100644 --- a/storage/connect/tabjdbc.cpp +++ b/storage/connect/tabjdbc.cpp @@ -96,7 +96,7 @@ bool ExactInfo(void); /***********************************************************************/ JDBCDEF::JDBCDEF(void) { - Driver = Url = Tabname = Tabschema = Username = Colpat = NULL; + Driver = Url = Wrapname =Tabname = Tabschema = Username = Colpat = NULL; Password = Tabcat = Tabtype = Srcdef = Qchar = Qrystr = Sep = NULL; Options = Quoted = Maxerr = Maxres = Memory = 0; Scrollable = Xsrc = false; @@ -233,6 +233,7 @@ bool JDBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL))) Read_Only = true; + Wrapname = GetStringCatInfo(g, "Wrapper", NULL); Tabcat = GetStringCatInfo(g, "Qualifier", NULL); Tabcat = GetStringCatInfo(g, "Catalog", Tabcat); Tabschema = GetStringCatInfo(g, "Dbname", NULL); @@ -331,6 +332,7 @@ TDBJDBC::TDBJDBC(PJDBCDEF tdp) : TDBASE(tdp) if (tdp) { Ops.Driver = tdp->Driver; Ops.Url = tdp->Url; + WrapName = tdp->Wrapname; TableName = tdp->Tabname; Schema = tdp->Tabschema; Ops.User = tdp->Username; @@ -347,6 +349,7 @@ TDBJDBC::TDBJDBC(PJDBCDEF tdp) : TDBASE(tdp) Memory = tdp->Memory; Ops.Scrollable = tdp->Scrollable; } else { + WrapName = NULL; TableName = NULL; Schema = NULL; Ops.Driver = NULL; @@ -392,6 +395,7 @@ TDBJDBC::TDBJDBC(PTDBJDBC tdbp) : TDBASE(tdbp) { Jcp = tdbp->Jcp; // is that right ? Cnp = tdbp->Cnp; + WrapName = tdbp->WrapName; TableName = tdbp->TableName; Schema = tdbp->Schema; Ops = tdbp->Ops; @@ -518,9 +522,10 @@ bool TDBJDBC::MakeSQL(PGLOBAL g, bool cnt) if (Catalog && *Catalog) catp = Catalog; - if (tablep->GetSchema()) - schmp = (char*)tablep->GetSchema(); - else if (Schema && *Schema) + //if (tablep->GetSchema()) + // schmp = (char*)tablep->GetSchema(); + //else + if (Schema && *Schema) schmp = Schema; if (catp) { @@ -602,9 +607,10 @@ bool TDBJDBC::MakeInsert(PGLOBAL g) if (catp) len += strlen(catp) + 1; - if (tablep->GetSchema()) - schmp = (char*)tablep->GetSchema(); - else if (Schema && *Schema) + //if (tablep->GetSchema()) + // schmp = (char*)tablep->GetSchema(); + //else + if (Schema && *Schema) schmp = Schema; if (schmp) diff --git a/storage/connect/tabjdbc.h b/storage/connect/tabjdbc.h index cf5e662c9d1..7244ebd3832 100644 --- a/storage/connect/tabjdbc.h +++ b/storage/connect/tabjdbc.h @@ -54,6 +54,7 @@ protected: PSZ Driver; /* JDBC driver */ PSZ Url; /* JDBC driver URL */ PSZ Tabname; /* External table name */ + PSZ Wrapname; /* Java wrapper name */ PSZ Tabschema; /* External table schema */ PSZ Username; /* User connect name */ PSZ Password; /* Password connect info */ @@ -133,6 +134,7 @@ protected: JDBCCOL *Cnp; // Points to count(*) column JDBCPARM Ops; // Additional parameters PSTRG Query; // Constructed SQL query + char *WrapName; // Points to Java wrapper name char *TableName; // Points to JDBC table name char *Schema; // Points to JDBC table Schema char *User; // User connect info diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index e76d9c46bd3..f3ffc99ac15 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -458,9 +458,14 @@ bool TDBODBC::MakeSQL(PGLOBAL g, bool cnt) if (Catalog && *Catalog) catp = Catalog; - if (tablep->GetSchema()) - schmp = (char*)tablep->GetSchema(); - else if (Schema && *Schema) + // Following lines are commented because of MSDEV-10520 + // Indeed the schema in the tablep is the local table database and + // is normally not related to the remote table database. + // TODO: Try to remember why this was done and if it was useful in some case. + //if (tablep->GetSchema()) + // schmp = (char*)tablep->GetSchema(); + //else + if (Schema && *Schema) schmp = Schema; if (catp) { @@ -541,9 +546,10 @@ bool TDBODBC::MakeInsert(PGLOBAL g) if (catp) len += strlen(catp) + 1; - if (tablep->GetSchema()) - schmp = (char*)tablep->GetSchema(); - else if (Schema && *Schema) + //if (tablep->GetSchema()) + // schmp = (char*)tablep->GetSchema(); + //else + if (Schema && *Schema) schmp = Schema; if (schmp) diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp index 69aa7e2c20e..56312630278 100755 --- a/storage/connect/xindex.cpp +++ b/storage/connect/xindex.cpp @@ -1198,7 +1198,7 @@ bool XINDEX::MapInit(PGLOBAL g) const char *ftype; BYTE *mbase; char fn[_MAX_PATH]; - int *nv, k, n, id = -1; + int *nv, nv0, k, n, id = -1; bool estim; PCOL colp; PXCOL prev = NULL, kcp = NULL; @@ -1288,25 +1288,26 @@ bool XINDEX::MapInit(PGLOBAL g) if (nv[0] >= MAX_INDX) { // New index format Srtd = nv[7] != 0; - nv[0] -= MAX_INDX; + nv0 = nv[0] - MAX_INDX; mbase += NZ * sizeof(int); } else { Srtd = false; mbase += (NZ - 1) * sizeof(int); + nv0 = nv[0]; } // endif nv if (trace) htrc("nv=%d %d %d %d %d %d %d %d\n", - nv[0], nv[1], nv[2], nv[3], nv[4], nv[5], nv[6], Srtd); + nv0, nv[1], nv[2], nv[3], nv[4], nv[5], nv[6], Srtd); // The test on ID was suppressed because MariaDB can change an index ID // when other indexes are added or deleted - if (/*nv[0] != ID ||*/ nv[1] != Nk) { + if (/*nv0 != ID ||*/ nv[1] != Nk) { // Not this index sprintf(g->Message, MSG(BAD_INDEX_FILE), fn); if (trace) - htrc("nv[0]=%d ID=%d nv[1]=%d Nk=%d\n", nv[0], ID, nv[1], Nk); + htrc("nv0=%d ID=%d nv[1]=%d Nk=%d\n", nv0, ID, nv[1], Nk); goto err; } // endif nv diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 7b0cf339ef1..b3eaf4bf5a9 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -637,7 +637,7 @@ buf_page_is_corrupted( "InnoDB: " REFMAN "forcing-innodb-recovery.html\n" "InnoDB: for more information.\n", - (ulong) mach_read_from_4( + (ulint) mach_read_from_4( read_buf + FIL_PAGE_OFFSET), (lsn_t) mach_read_from_8( read_buf + FIL_PAGE_LSN), @@ -828,7 +828,7 @@ buf_page_print( ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Page dump in ascii and hex (%lu bytes):\n", - (ulong) size); + size); ut_print_buf(stderr, read_buf, size); fputs("\nInnoDB: End of page dump\n", stderr); } @@ -2472,9 +2472,9 @@ buf_zip_decompress( } fprintf(stderr, - "InnoDB: unable to decompress space %lu page %lu\n", - (ulong) block->page.space, - (ulong) block->page.offset); + "InnoDB: unable to decompress space %u page %u\n", + block->page.space, + block->page.offset); return(FALSE); case FIL_PAGE_TYPE_ALLOCATED: @@ -3806,8 +3806,8 @@ buf_page_init( fprintf(stderr, "InnoDB: Error: page %lu %lu already found" " in the hash table: %p, %p\n", - (ulong) space, - (ulong) offset, + space, + offset, (const void*) hash_page, (const void*) block); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG mutex_exit(&block->mutex); @@ -4170,7 +4170,7 @@ buf_page_create( #ifdef UNIV_DEBUG if (buf_debug_prints) { fprintf(stderr, "Creating space %lu page %lu to buffer\n", - (ulong) space, (ulong) offset); + space, offset); } #endif /* UNIV_DEBUG */ @@ -4571,10 +4571,10 @@ buf_page_io_complete( ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: Error: reading page %lu\n" + " InnoDB: Error: reading page %u\n" "InnoDB: which is in the" " doublewrite buffer!\n", - (ulong) bpage->offset); + bpage->offset); } else if (!read_space_id && !read_page_no) { /* This is likely an uninitialized page. */ } else if ((bpage->space @@ -4590,10 +4590,11 @@ buf_page_io_complete( " InnoDB: Error: space id and page n:o" " stored in the page\n" "InnoDB: read in are %lu:%lu," - " should be %lu:%lu!\n", - (ulong) read_space_id, (ulong) read_page_no, - (ulong) bpage->space, - (ulong) bpage->offset); + " should be %u:%u!\n", + read_space_id, + read_page_no, + bpage->space, + bpage->offset); } /* From version 3.23.38 up we store the page checksum @@ -4624,10 +4625,10 @@ corrupt: "Database page corruption on disk" " or a failed"); ib_logf(IB_LOG_LEVEL_ERROR, - "Space %lu file %s read of page %lu.", + "Space %lu file %s read of page %u.", (ulint)bpage->space, space ? space->name : "NULL", - (ulong) bpage->offset); + bpage->offset); ib_logf(IB_LOG_LEVEL_ERROR, "You may have to recover" " from a backup."); @@ -4803,8 +4804,8 @@ corrupt: if (buf_debug_prints) { fprintf(stderr, "Has %s page space %lu page no %lu\n", io_type == BUF_IO_READ ? "read" : "written", - (ulong) buf_page_get_space(bpage), - (ulong) buf_page_get_page_no(bpage)); + buf_page_get_space(bpage), + buf_page_get_page_no(bpage)); } #endif /* UNIV_DEBUG */ @@ -4836,11 +4837,21 @@ buf_all_freed_instance( const buf_block_t* block = buf_chunk_not_freed(chunk); if (UNIV_LIKELY_NULL(block)) { - if (block->page.key_version == 0) { - fprintf(stderr, - "Page %lu %lu still fixed or dirty\n", - (ulong) block->page.space, - (ulong) block->page.offset); + if (block->page.key_version == 0) { + fil_space_t* space = fil_space_get(block->page.space); + ib_logf(IB_LOG_LEVEL_ERROR, + "Page %u %u still fixed or dirty.", + block->page.space, + block->page.offset); + ib_logf(IB_LOG_LEVEL_ERROR, + "Page oldest_modification %lu fix_count %d io_fix %d.", + block->page.oldest_modification, + block->page.buf_fix_count, + buf_page_get_io_fix(&block->page)); + ib_logf(IB_LOG_LEVEL_ERROR, + "Page space_id %u name %s.", + block->page.space, + (space && space->name) ? space->name : "NULL"); ut_error; } } @@ -5141,16 +5152,16 @@ assert_s_latched: if (n_lru + n_free > buf_pool->curr_size + n_zip) { fprintf(stderr, "n LRU %lu, n free %lu, pool %lu zip %lu\n", - (ulong) n_lru, (ulong) n_free, - (ulong) buf_pool->curr_size, (ulong) n_zip); + n_lru, n_free, + buf_pool->curr_size, n_zip); ut_error; } ut_a(UT_LIST_GET_LEN(buf_pool->LRU) == n_lru); if (UT_LIST_GET_LEN(buf_pool->free) != n_free) { fprintf(stderr, "Free list len %lu, free blocks %lu\n", - (ulong) UT_LIST_GET_LEN(buf_pool->free), - (ulong) n_free); + UT_LIST_GET_LEN(buf_pool->free), + n_free); ut_error; } @@ -5229,20 +5240,20 @@ buf_print_instance( "n pending flush LRU %lu list %lu single page %lu\n" "pages made young %lu, not young %lu\n" "pages read %lu, created %lu, written %lu\n", - (ulong) size, - (ulong) UT_LIST_GET_LEN(buf_pool->LRU), - (ulong) UT_LIST_GET_LEN(buf_pool->free), - (ulong) UT_LIST_GET_LEN(buf_pool->flush_list), - (ulong) buf_pool->n_pend_unzip, - (ulong) buf_pool->n_pend_reads, - (ulong) buf_pool->n_flush[BUF_FLUSH_LRU], - (ulong) buf_pool->n_flush[BUF_FLUSH_LIST], - (ulong) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE], - (ulong) buf_pool->stat.n_pages_made_young, - (ulong) buf_pool->stat.n_pages_not_made_young, - (ulong) buf_pool->stat.n_pages_read, - (ulong) buf_pool->stat.n_pages_created, - (ulong) buf_pool->stat.n_pages_written); + (ulint) size, + (ulint) UT_LIST_GET_LEN(buf_pool->LRU), + (ulint) UT_LIST_GET_LEN(buf_pool->free), + (ulint) UT_LIST_GET_LEN(buf_pool->flush_list), + (ulint) buf_pool->n_pend_unzip, + (ulint) buf_pool->n_pend_reads, + (ulint) buf_pool->n_flush[BUF_FLUSH_LRU], + (ulint) buf_pool->n_flush[BUF_FLUSH_LIST], + (ulint) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE], + (ulint) buf_pool->stat.n_pages_made_young, + (ulint) buf_pool->stat.n_pages_not_made_young, + (ulint) buf_pool->stat.n_pages_read, + (ulint) buf_pool->stat.n_pages_created, + (ulint) buf_pool->stat.n_pages_written); buf_flush_list_mutex_exit(buf_pool); @@ -5293,7 +5304,7 @@ buf_print_instance( fprintf(stderr, "Block count for index %llu in buffer is about %lu", (ullint) index_ids[i], - (ulong) counts[i]); + (ulint) counts[i]); if (index) { putc(' ', stderr); @@ -5741,10 +5752,10 @@ buf_print_io_instance( fprintf(file, "Buffer pool hit rate %lu / 1000," " young-making rate %lu / 1000 not %lu / 1000\n", - (ulong) hit_rate, - (ulong) (1000 * pool_info->young_making_delta + (ulint) hit_rate, + (ulint) (1000 * pool_info->young_making_delta / pool_info->n_page_get_delta), - (ulong) (1000 * pool_info->not_young_making_delta + (ulint) (1000 * pool_info->not_young_making_delta / pool_info->n_page_get_delta)); } else { fputs("No buffer pool page gets since the last printout\n", diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index e9e164e5e1a..b92ac02da10 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -1397,6 +1397,28 @@ fil_space_free( /*******************************************************************//** Returns a pointer to the file_space_t that is in the memory cache +associated with a space id. +@return file_space_t pointer, NULL if space not found */ +fil_space_t* +fil_space_get( +/*==========*/ + ulint id) /*!< in: space id */ +{ + fil_space_t* space; + + ut_ad(fil_system); + + mutex_enter(&fil_system->mutex); + + space = fil_space_get_by_id(id); + + mutex_exit(&fil_system->mutex); + + return (space); +} + +/*******************************************************************//** +Returns a pointer to the file_space_t that is in the memory cache associated with a space id. The caller must lock fil_system->mutex. @return file_space_t pointer, NULL if space not found */ UNIV_INLINE diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 0337cf6dfe7..1457417d5dc 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -265,13 +265,15 @@ FTS auxiliary INDEX table and clear the cache at the end. @param[in,out] sync sync state @param[in] unlock_cache whether unlock cache lock when write node @param[in] wait whether wait when a sync is in progress +@param[in] has_dict whether has dict operation lock @return DB_SUCCESS if all OK */ static dberr_t fts_sync( fts_sync_t* sync, bool unlock_cache, - bool wait); + bool wait, + bool has_dict); /****************************************************************//** Release all resources help by the words rb tree e.g., the node ilist. */ @@ -3567,7 +3569,7 @@ fts_add_doc_by_id( DBUG_EXECUTE_IF( "fts_instrument_sync_debug", - fts_sync(cache->sync, true, true); + fts_sync(cache->sync, true, true, false); ); DEBUG_SYNC_C("fts_instrument_sync_request"); @@ -4379,13 +4381,11 @@ fts_sync_index( } /** Check if index cache has been synced completely -@param[in,out] sync sync state @param[in,out] index_cache index cache @return true if index is synced, otherwise false. */ static bool fts_sync_index_check( - fts_sync_t* sync, fts_index_cache_t* index_cache) { const ib_rbt_node_t* rbt_node; @@ -4408,14 +4408,36 @@ fts_sync_index_check( return(true); } -/*********************************************************************//** -Commit the SYNC, change state of processed doc ids etc. +/** Reset synced flag in index cache when rollback +@param[in,out] index_cache index cache */ +static +void +fts_sync_index_reset( + fts_index_cache_t* index_cache) +{ + const ib_rbt_node_t* rbt_node; + + for (rbt_node = rbt_first(index_cache->words); + rbt_node != NULL; + rbt_node = rbt_next(index_cache->words, rbt_node)) { + + fts_tokenizer_word_t* word; + word = rbt_value(fts_tokenizer_word_t, rbt_node); + + fts_node_t* fts_node; + fts_node = static_cast<fts_node_t*>(ib_vector_last(word->nodes)); + + fts_node->synced = false; + } +} + +/** Commit the SYNC, change state of processed doc ids etc. +@param[in,out] sync sync state @return DB_SUCCESS if all OK */ static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_sync_commit( -/*============*/ - fts_sync_t* sync) /*!< in: sync state */ + fts_sync_t* sync) { dberr_t error; trx_t* trx = sync->trx; @@ -4468,6 +4490,8 @@ fts_sync_commit( (double) n_nodes/ (double) elapsed_time); } + /* Avoid assertion in trx_free(). */ + trx->dict_operation_lock_mode = 0; trx_free_for_background(trx); return(error); @@ -4490,6 +4514,10 @@ fts_sync_rollback( index_cache = static_cast<fts_index_cache_t*>( ib_vector_get(cache->indexes, i)); + /* Reset synced flag so nodes will not be skipped + in the next sync, see fts_sync_write_words(). */ + fts_sync_index_reset(index_cache); + for (j = 0; fts_index_selector[j].value; ++j) { if (index_cache->ins_graph[j] != NULL) { @@ -4515,6 +4543,9 @@ fts_sync_rollback( rw_lock_x_unlock(&cache->lock); fts_sql_rollback(trx); + + /* Avoid assertion in trx_free(). */ + trx->dict_operation_lock_mode = 0; trx_free_for_background(trx); } @@ -4523,13 +4554,15 @@ FTS auxiliary INDEX table and clear the cache at the end. @param[in,out] sync sync state @param[in] unlock_cache whether unlock cache lock when write node @param[in] wait whether wait when a sync is in progress +@param[in] has_dict whether has dict operation lock @return DB_SUCCESS if all OK */ static dberr_t fts_sync( fts_sync_t* sync, bool unlock_cache, - bool wait) + bool wait, + bool has_dict) { ulint i; dberr_t error = DB_SUCCESS; @@ -4558,6 +4591,12 @@ fts_sync( DEBUG_SYNC_C("fts_sync_begin"); fts_sync_begin(sync); + /* When sync in background, we hold dict operation lock + to prevent DDL like DROP INDEX, etc. */ + if (has_dict) { + sync->trx->dict_operation_lock_mode = RW_S_LATCH; + } + begin_sync: if (cache->total_size > fts_max_cache_size) { /* Avoid the case: sync never finish when @@ -4598,7 +4637,7 @@ begin_sync: ib_vector_get(cache->indexes, i)); if (index_cache->index->to_be_dropped - || fts_sync_index_check(sync, index_cache)) { + || fts_sync_index_check(index_cache)) { continue; } @@ -4613,6 +4652,7 @@ end_sync: } rw_lock_x_lock(&cache->lock); + sync->interrupted = false; sync->in_progress = false; os_event_set(sync->event); rw_lock_x_unlock(&cache->lock); @@ -4636,20 +4676,23 @@ FTS auxiliary INDEX table and clear the cache at the end. @param[in,out] table fts table @param[in] unlock_cache whether unlock cache when write node @param[in] wait whether wait for existing sync to finish +@param[in] has_dict whether has dict operation lock @return DB_SUCCESS on success, error code on failure. */ UNIV_INTERN dberr_t fts_sync_table( dict_table_t* table, bool unlock_cache, - bool wait) + bool wait, + bool has_dict) { dberr_t err = DB_SUCCESS; ut_ad(table->fts); if (!dict_table_is_discarded(table) && table->fts->cache) { - err = fts_sync(table->fts->cache->sync, unlock_cache, wait); + err = fts_sync(table->fts->cache->sync, + unlock_cache, wait, has_dict); } return(err); diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index d9f2532578e..ea937c20752 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -2986,7 +2986,7 @@ fts_optimize_sync_table( if (table) { if (dict_table_has_fts_index(table) && table->fts->cache) { - fts_sync_table(table, true, false); + fts_sync_table(table, true, false, true); } dict_table_close(table, FALSE, FALSE); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 82c6289ebd8..6f364b9dcbd 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7822,6 +7822,7 @@ dberr_t ha_innobase::innobase_lock_autoinc(void) /*====================================*/ { + DBUG_ENTER("ha_innobase::innobase_lock_autoinc"); dberr_t error = DB_SUCCESS; ut_ad(!srv_read_only_mode); @@ -7861,6 +7862,8 @@ ha_innobase::innobase_lock_autoinc(void) /* Fall through to old style locking. */ case AUTOINC_OLD_STYLE_LOCKING: + DBUG_EXECUTE_IF("die_if_autoinc_old_lock_style_used", + ut_ad(0);); error = row_lock_table_autoinc_for_mysql(prebuilt); if (error == DB_SUCCESS) { @@ -7874,7 +7877,7 @@ ha_innobase::innobase_lock_autoinc(void) ut_error; } - return(error); + DBUG_RETURN(error); } /********************************************************************//** @@ -13733,7 +13736,7 @@ ha_innobase::optimize( if (innodb_optimize_fulltext_only) { if (prebuilt->table->fts && prebuilt->table->fts->cache && !dict_table_is_discarded(prebuilt->table)) { - fts_sync_table(prebuilt->table, false, true); + fts_sync_table(prebuilt->table, false, true, false); fts_optimize_table(prebuilt->table); } return(HA_ADMIN_OK); @@ -19970,7 +19973,7 @@ maria_declare_plugin(innobase) innodb_status_variables_export,/* status variables */ innobase_system_variables, /* system variables */ INNODB_VERSION_STR, /* string version */ - MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ + MariaDB_PLUGIN_MATURITY_STABLE /* maturity */ }, i_s_innodb_trx, i_s_innodb_locks, diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 29d49dcce9f..ed2fb497a3b 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -230,7 +230,7 @@ innobase_need_rebuild( & Alter_inplace_info::ADD_INDEX) || (ha_alter_info->handler_flags & Alter_inplace_info::ADD_FOREIGN_KEY))) { - for (ulint i = 0; i < ha_alter_info->key_count; i++) { + for (ulint i = 0; i < ha_alter_info->index_add_count; i++) { const KEY* key = &ha_alter_info->key_info_buffer[ ha_alter_info->index_add_buffer[i]]; @@ -241,13 +241,13 @@ innobase_need_rebuild( /* Field used on added index is renamed on this same alter table. We need table rebuild. */ - if (field->flags & FIELD_IS_RENAMED) { + if (field && field->flags & FIELD_IS_RENAMED) { return (true); } } } } - + return(!!(ha_alter_info->handler_flags & INNOBASE_ALTER_REBUILD)); } diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 0bb10f435af..d1e6e3ed808 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2007, 2015, Oracle and/or its affiliates. +Copyright (c) 2007, 2016, Oracle and/or its affiliates. Copyrigth (c) 2014, 2016, MariaDB Corporation This program is free software; you can redistribute it and/or modify it under @@ -783,7 +783,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_trx = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */ @@ -1043,7 +1043,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_locks = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */ @@ -1226,7 +1226,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /*******************************************************************//** @@ -1562,7 +1562,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset = @@ -1612,7 +1612,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic tables @@ -1912,7 +1912,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index_reset = @@ -1962,7 +1962,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_per_index_reset = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table information_schema.innodb_cmpmem. */ @@ -2205,7 +2205,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset = @@ -2255,7 +2255,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_metrics */ @@ -2779,7 +2779,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_metrics = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_ft_default_stopword */ static ST_FIELD_INFO i_s_stopword_fields_info[] = @@ -2892,7 +2892,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_default_stopword = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_DELETED @@ -2941,15 +2941,26 @@ i_s_fts_deleted_generic_fill( DBUG_RETURN(0); } - deleted = fts_doc_ids_create(); + /* Prevent DDL to drop fts aux tables. */ + rw_lock_s_lock(&dict_operation_lock); user_table = dict_table_open_on_name( fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE); if (!user_table) { + rw_lock_s_unlock(&dict_operation_lock); + + DBUG_RETURN(0); + } else if (!dict_table_has_fts_index(user_table)) { + dict_table_close(user_table, FALSE, FALSE); + + rw_lock_s_unlock(&dict_operation_lock); + DBUG_RETURN(0); } + deleted = fts_doc_ids_create(); + trx = trx_allocate_for_background(); trx->op_info = "Select for FTS DELETE TABLE"; @@ -2977,6 +2988,8 @@ i_s_fts_deleted_generic_fill( dict_table_close(user_table, FALSE, FALSE); + rw_lock_s_unlock(&dict_operation_lock); + DBUG_RETURN(0); } @@ -3060,7 +3073,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_deleted = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /*******************************************************************//** @@ -3143,7 +3156,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_being_deleted = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHED and @@ -3350,6 +3363,12 @@ i_s_fts_index_cache_fill( DBUG_RETURN(0); } + if (user_table->fts == NULL || user_table->fts->cache == NULL) { + dict_table_close(user_table, FALSE, FALSE); + + DBUG_RETURN(0); + } + cache = user_table->fts->cache; ut_a(cache); @@ -3432,7 +3451,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_index_cache = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /*******************************************************************//** @@ -3784,10 +3803,15 @@ i_s_fts_index_table_fill( DBUG_RETURN(0); } + /* Prevent DDL to drop fts aux tables. */ + rw_lock_s_lock(&dict_operation_lock); + user_table = dict_table_open_on_name( fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE); if (!user_table) { + rw_lock_s_unlock(&dict_operation_lock); + DBUG_RETURN(0); } @@ -3800,6 +3824,8 @@ i_s_fts_index_table_fill( dict_table_close(user_table, FALSE, FALSE); + rw_lock_s_unlock(&dict_operation_lock); + DBUG_RETURN(0); } @@ -3867,7 +3893,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_index_table = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_CONFIG */ @@ -3935,14 +3961,21 @@ i_s_fts_config_fill( fields = table->field; + /* Prevent DDL to drop fts aux tables. */ + rw_lock_s_lock(&dict_operation_lock); + user_table = dict_table_open_on_name( fts_internal_tbl_name, FALSE, FALSE, DICT_ERR_IGNORE_NONE); if (!user_table) { + rw_lock_s_unlock(&dict_operation_lock); + DBUG_RETURN(0); } else if (!dict_table_has_fts_index(user_table)) { dict_table_close(user_table, FALSE, FALSE); + rw_lock_s_unlock(&dict_operation_lock); + DBUG_RETURN(0); } @@ -3998,6 +4031,8 @@ i_s_fts_config_fill( dict_table_close(user_table, FALSE, FALSE); + rw_lock_s_unlock(&dict_operation_lock); + DBUG_RETURN(0); } @@ -4065,7 +4100,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_ft_config = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */ @@ -4614,7 +4649,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_stats = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INNODB_BUFFER_POOL_PAGE. */ @@ -5326,7 +5361,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = @@ -5873,7 +5908,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page_lru = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /*******************************************************************//** @@ -6167,7 +6202,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tables = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_TABLESTATS ***********************************************/ @@ -6457,7 +6492,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablestats = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_INDEXES **************************************************/ @@ -6709,7 +6744,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_indexes = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_COLUMNS **************************************************/ @@ -6946,7 +6981,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_columns = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_FIELDS ***************************************************/ @@ -7156,7 +7191,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_fields = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_FOREIGN ********************************************/ @@ -7381,7 +7416,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_FOREIGN_COLS ********************************************/ @@ -7598,7 +7633,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign_cols = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_TABLESPACES ********************************************/ @@ -7866,7 +7901,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablespaces = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_DATAFILES ************************************************/ @@ -8055,7 +8090,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_datafiles = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** TABLESPACES_ENCRYPTION ********************************************/ @@ -8349,7 +8384,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_encryption = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA) + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE) }; /** TABLESPACES_SCRUBBING ********************************************/ @@ -8648,7 +8683,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_scrubbing = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA) + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE) }; /** INNODB_MUTEXES *********************************************/ @@ -8862,7 +8897,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_mutexes = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_SEMAPHORE_WAITS ************************************************/ @@ -9139,5 +9174,5 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_semaphore_waits = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 0c7ed7b3ab0..c97143235bc 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -1261,6 +1261,14 @@ fil_space_flags( /*===========*/ fil_space_t* space); /*!< in: space */ +/*******************************************************************//** +Returns a pointer to the file_space_t that is in the memory cache +associated with a space id. +@return file_space_t pointer, NULL if space not found */ +fil_space_t* +fil_space_get( +/*==========*/ + ulint id); /*!< in: space id */ #endif /* !UNIV_INNOCHECKSUM */ /****************************************************************//** diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index 68d4d333245..87b5787d416 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -840,13 +840,15 @@ FTS auxiliary INDEX table and clear the cache at the end. @param[in,out] table fts table @param[in] unlock_cache whether unlock cache when write node @param[in] wait whether wait for existing sync to finish +@param[in] has_dict whether has dict operation lock @return DB_SUCCESS on success, error code on failure. */ UNIV_INTERN dberr_t fts_sync_table( dict_table_t* table, bool unlock_cache, - bool wait); + bool wait, + bool has_dict); /****************************************************************//** Free the query graph but check whether dict_sys->mutex is already diff --git a/storage/innobase/include/os0sync.h b/storage/innobase/include/os0sync.h index 1cf4e9ce501..0754210c47a 100644 --- a/storage/innobase/include/os0sync.h +++ b/storage/innobase/include/os0sync.h @@ -479,20 +479,13 @@ os_atomic_test_and_set(volatile lock_word_t* ptr) } /** Do an atomic release. - -In theory __sync_lock_release should be used to release the lock. -Unfortunately, it does not work properly alone. The workaround is -that more conservative __sync_lock_test_and_set is used instead. - -Performance regression was observed at some conditions for Intel -architecture. Disable release barrier on Intel architecture for now. @param[in,out] ptr Memory location to write to @return the previous value */ inline -lock_word_t +void os_atomic_clear(volatile lock_word_t* ptr) { - return(__sync_lock_test_and_set(ptr, 0)); + __sync_lock_release(ptr); } # elif defined(HAVE_IB_GCC_ATOMIC_TEST_AND_SET) @@ -856,15 +849,7 @@ for synchronization */ } while (0); /** barrier definitions for memory ordering */ -#ifdef IB_STRONG_MEMORY_MODEL -/* Performance regression was observed at some conditions for Intel -architecture. Disable memory barrier for Intel architecture for now. */ -# define os_rmb do { } while(0) -# define os_wmb do { } while(0) -# define os_isync do { } while(0) -# define IB_MEMORY_BARRIER_STARTUP_MSG \ - "Memory barrier is not used" -#elif defined(HAVE_IB_GCC_ATOMIC_THREAD_FENCE) +#if defined(HAVE_IB_GCC_ATOMIC_THREAD_FENCE) # define HAVE_MEMORY_BARRIER # define os_rmb __atomic_thread_fence(__ATOMIC_ACQUIRE) # define os_wmb __atomic_thread_fence(__ATOMIC_RELEASE) diff --git a/storage/innobase/include/sync0sync.ic b/storage/innobase/include/sync0sync.ic index 85c7f7505cd..3d1f098826e 100644 --- a/storage/innobase/include/sync0sync.ic +++ b/storage/innobase/include/sync0sync.ic @@ -178,6 +178,11 @@ mutex_exit_func( to wake up possible hanging threads if they are missed in mutex_signal_object. */ + /* We add a memory barrier to prevent reading of the + number of waiters before releasing the lock. */ + + os_mb; + if (mutex_get_waiters(mutex) != 0) { mutex_signal_object(mutex); diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index cd379f0fadd..8557f74f756 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -45,7 +45,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 6 -#define INNODB_VERSION_BUGFIX 31 +#define INNODB_VERSION_BUGFIX 32 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index 437940be0d8..e045470d1fd 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -1681,6 +1681,10 @@ wsrep_kill_victim( { ut_ad(lock_mutex_own()); ut_ad(trx_mutex_own(lock->trx)); + + /* quit for native mysql */ + if (!wsrep_on(trx->mysql_thd)) return; + my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE); my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE); @@ -1767,9 +1771,11 @@ lock_rec_other_has_conflicting( #ifdef WITH_WSREP if (lock_rec_has_to_wait(TRUE, trx, mode, lock, is_supremum)) { - trx_mutex_enter(lock->trx); - wsrep_kill_victim(trx, lock); - trx_mutex_exit(lock->trx); + if (wsrep_on(trx->mysql_thd)) { + trx_mutex_enter(lock->trx); + wsrep_kill_victim(trx, lock); + trx_mutex_exit(lock->trx); + } #else if (lock_rec_has_to_wait(trx, mode, lock, is_supremum)) { #endif /* WITH_WSREP */ @@ -2063,7 +2069,9 @@ lock_rec_create( ut_ad(index->table->n_ref_count > 0 || !index->table->can_be_evicted); #ifdef WITH_WSREP - if (c_lock && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { + if (c_lock && + wsrep_on(trx->mysql_thd) && + wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { lock_t *hash = (lock_t *)c_lock->hash; lock_t *prev = NULL; @@ -4671,10 +4679,10 @@ lock_table_create( trx_mutex_exit(c_lock->trx); } } else { - UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock); - } -#else +#endif /* WITH_WSREP */ UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock); +#ifdef WITH_WSREP + } #endif /* WITH_WSREP */ if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) { diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index 97405261392..76e4c2aed9b 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -1055,6 +1055,26 @@ use_heap: insert_rec = rec_copy(insert_buf, rec, offsets); rec_offs_make_valid(insert_rec, index, offsets); + /* This is because assertion below is debug assertion */ +#ifdef UNIV_DEBUG + if (UNIV_UNLIKELY(current_rec == insert_rec)) { + ulint extra_len, data_len; + extra_len = rec_offs_extra_size(offsets); + data_len = rec_offs_data_size(offsets); + + fprintf(stderr, "InnoDB: Error: current_rec == insert_rec " + " extra_len %lu data_len %lu insert_buf %p rec %p\n", + extra_len, data_len, insert_buf, rec); + fprintf(stderr, "InnoDB; Physical record: \n"); + rec_print(stderr, rec, index); + fprintf(stderr, "InnoDB: Inserted record: \n"); + rec_print(stderr, insert_rec, index); + fprintf(stderr, "InnoDB: Current record: \n"); + rec_print(stderr, current_rec, index); + ut_a(current_rec != insert_rec); + } +#endif /* UNIV_DEBUG */ + /* 4. Insert the record in the linked list of records */ ut_ad(current_rec != insert_rec); diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index dbca52f820c..d8baef8040f 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -2170,7 +2170,7 @@ wait_again: /* Sync fts cache for other fts indexes to keep all fts indexes consistent in sync_doc_id. */ err = fts_sync_table(const_cast<dict_table_t*>(new_table), - false, true); + false, true, false); if (err == DB_SUCCESS) { fts_update_next_doc_id( diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index 85cd0e6d172..60b490228b1 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -412,7 +412,7 @@ wsrep_row_upd_check_foreign_constraints( dict_table_open_on_name( foreign->referenced_table_name_lookup, FALSE, FALSE, DICT_ERR_IGNORE_NONE); - opened = TRUE; + opened = (foreign->referenced_table) ? TRUE : FALSE; } if (foreign->referenced_table) { @@ -435,7 +435,7 @@ wsrep_row_upd_check_foreign_constraints( ->n_foreign_key_checks_running); if (opened == TRUE) { - dict_table_close(foreign->referenced_table, TRUE, FALSE); + dict_table_close(foreign->referenced_table, FALSE, FALSE); opened = FALSE; } } diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc index 1d6a4c008e8..3375ea40658 100644 --- a/storage/innobase/srv/srv0mon.cc +++ b/storage/innobase/srv/srv0mon.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2010, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. Copyright (c) 2013, 2016, MariaDB Corporation @@ -1493,7 +1493,10 @@ srv_mon_set_module_control( module */ set_current_module = FALSE; } else if (module_id == MONITOR_ALL_COUNTER) { - continue; + if (!(innodb_counter_info[ix].monitor_type + & MONITOR_GROUP_MODULE)) { + continue; + } } else { /* Hitting the next module, stop */ break; diff --git a/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris10.inc b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris10.inc new file mode 100644 index 00000000000..7cee5c38c53 --- /dev/null +++ b/storage/mroonga/mysql-test/mroonga/include/mroonga/skip_solaris10.inc @@ -0,0 +1,3 @@ +if (`SELECT @@version_compile_os='solaris10'`) { + skip This test is not for Solaris 10; +} diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test index 246500b4498..433e239c301 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/column_datetime_64bit_before_unix_epoch.test @@ -17,6 +17,7 @@ --source ../../include/mroonga/skip_freebsd.inc --source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/skip_solaris10.inc --source ../../include/mroonga/have_64bit.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test index e84147d6041..010611ee3ec 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_64bit_equal.test @@ -18,6 +18,7 @@ --source ../../include/mroonga/skip_freebsd.inc --source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/skip_solaris10.inc --source ../../include/mroonga/have_64bit.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test index 7a0ec41f07a..ef7066164fd 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_asc.test @@ -18,6 +18,7 @@ --source ../../include/mroonga/skip_freebsd.inc --source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/skip_solaris10.inc --source ../../include/mroonga/have_64bit.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test index db434bca061..d34d29a224b 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_date_order_64bit_desc.test @@ -18,6 +18,7 @@ --source ../../include/mroonga/skip_freebsd.inc --source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/skip_solaris10.inc --source ../../include/mroonga/have_64bit.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test index 2b7ea97133e..66e0a4d6a9f 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_index_read.test @@ -19,6 +19,7 @@ --source ../../include/mroonga/have_64bit.inc --source ../../include/mroonga/skip_freebsd.inc --source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/skip_solaris10.inc --source ../../include/mroonga/have_mroonga.inc --disable_warnings diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test index c2ebff516d0..c28fcd86a2a 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_asc.test @@ -18,6 +18,7 @@ --source ../../include/mroonga/skip_freebsd.inc --source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/skip_solaris10.inc --source ../../include/mroonga/have_64bit.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test index 6a60b00087e..b5b3545cc9d 100644 --- a/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test +++ b/storage/mroonga/mysql-test/mroonga/storage/t/index_multiple_column_unique_datetime_order_desc.test @@ -18,6 +18,7 @@ --source ../../include/mroonga/skip_freebsd.inc --source ../../include/mroonga/skip_osx.inc +--source ../../include/mroonga/skip_solaris10.inc --source ../../include/mroonga/have_64bit.inc --source ../../include/mroonga/have_mroonga.inc diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 9df1ec832a8..b5371a2b0c3 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1456,6 +1456,7 @@ int ha_myisam::enable_indexes(uint mode) else if (mode == HA_KEY_SWITCH_NONUNIQ_SAVE) { THD *thd= table->in_use; + int was_error= thd->is_error(); HA_CHECK ¶m= *(HA_CHECK*) thd->alloc(sizeof(param)); const char *save_proc_info=thd->proc_info; @@ -1501,7 +1502,7 @@ int ha_myisam::enable_indexes(uint mode) might have been set by the first repair. They can still be seen with SHOW WARNINGS then. */ - if (! error) + if (! error && ! was_error) thd->clear_error(); } info(HA_STATUS_CONST); diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index 2a87ffba999..7c85431c57c 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -225,7 +225,7 @@ maria_declare_plugin(perfschema) 0x0001, pfs_status_vars, NULL, - "5.6.29", + "5.6.32", MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/storage/perfschema/table_events_statements.cc b/storage/perfschema/table_events_statements.cc index fc912cfdc9b..0d0ea02974d 100644 --- a/storage/perfschema/table_events_statements.cc +++ b/storage/perfschema/table_events_statements.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2016, 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 @@ -249,11 +249,17 @@ void table_events_statements_common::make_row_part_1(PFS_events_statements *stat CHARSET_INFO *cs= get_charset(statement->m_sqltext_cs_number, MYF(0)); size_t valid_length= statement->m_sqltext_length; - if (cs->mbmaxlen > 1) + if (cs != NULL) { - int well_formed_error; - valid_length= cs->cset->well_formed_len(cs, statement->m_sqltext, statement->m_sqltext + valid_length, - valid_length, &well_formed_error); + if (cs->mbmaxlen > 1) + { + int well_formed_error; + valid_length= cs->cset->well_formed_len(cs, + statement->m_sqltext, + statement->m_sqltext + valid_length, + valid_length, + &well_formed_error); + } } m_row.m_sqltext.set_charset(cs); diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt index f9754639bd9..765e6733a98 100644 --- a/storage/tokudb/CMakeLists.txt +++ b/storage/tokudb/CMakeLists.txt @@ -1,4 +1,4 @@ -SET(TOKUDB_VERSION 5.6.30-76.3) +SET(TOKUDB_VERSION 5.6.31-77.0) # PerconaFT only supports x86-64 and cmake-2.8.9+ IF(CMAKE_VERSION VERSION_LESS "2.8.9") MESSAGE(STATUS "CMake 2.8.9 or higher is required by TokuDB") @@ -79,10 +79,6 @@ IF(DEFINED TOKUDB_NOPATCH_CONFIG) ADD_DEFINITIONS("-DTOKUDB_NOPATCH_CONFIG=${TOKUDB_NOPATCH_CONFIG}") ENDIF() -IF(DEFINED TOKUDB_CHECK_JEMALLOC) - ADD_DEFINITIONS("-DTOKUDB_CHECK_JEMALLOC=${TOKUDB_CHECK_JEMALLOC}") -ENDIF() - MY_CHECK_AND_SET_COMPILER_FLAG(-Wno-missing-field-initializers) IF (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/PerconaFT/") diff --git a/storage/tokudb/PerconaFT/buildheader/make_tdb.cc b/storage/tokudb/PerconaFT/buildheader/make_tdb.cc index 5c29209e19d..4b62703480f 100644 --- a/storage/tokudb/PerconaFT/buildheader/make_tdb.cc +++ b/storage/tokudb/PerconaFT/buildheader/make_tdb.cc @@ -420,6 +420,8 @@ static void print_db_env_struct (void) { "int (*set_client_pool_threads)(DB_ENV *, uint32_t)", "int (*set_cachetable_pool_threads)(DB_ENV *, uint32_t)", "int (*set_checkpoint_pool_threads)(DB_ENV *, uint32_t)", + "void (*set_check_thp)(DB_ENV *, bool new_val)", + "bool (*get_check_thp)(DB_ENV *)", NULL}; sort_and_dump_fields("db_env", true, extra); diff --git a/storage/tokudb/PerconaFT/src/ydb-internal.h b/storage/tokudb/PerconaFT/src/ydb-internal.h index 3737a1caf99..462a2a3d861 100644 --- a/storage/tokudb/PerconaFT/src/ydb-internal.h +++ b/storage/tokudb/PerconaFT/src/ydb-internal.h @@ -132,6 +132,7 @@ struct __toku_db_env_internal { int datadir_lockfd; int logdir_lockfd; int tmpdir_lockfd; + bool check_thp; // if set check if transparent huge pages are disables uint64_t (*get_loader_memory_size_callback)(void); uint64_t default_lock_timeout_msec; uint64_t (*get_lock_timeout_callback)(uint64_t default_lock_timeout_msec); diff --git a/storage/tokudb/PerconaFT/src/ydb.cc b/storage/tokudb/PerconaFT/src/ydb.cc index 1b977599c0c..bde479a9ed6 100644 --- a/storage/tokudb/PerconaFT/src/ydb.cc +++ b/storage/tokudb/PerconaFT/src/ydb.cc @@ -624,32 +624,39 @@ ydb_recover_log_exists(DB_ENV *env) { } // Validate that all required files are present, no side effects. -// Return 0 if all is well, ENOENT if some files are present but at least one is missing, +// Return 0 if all is well, ENOENT if some files are present but at least one is +// missing, // other non-zero value if some other error occurs. // Set *valid_newenv if creating a new environment (all files missing). -// (Note, if special dictionaries exist, then they were created transactionally and log should exist.) -static int -validate_env(DB_ENV * env, bool * valid_newenv, bool need_rollback_cachefile) { +// (Note, if special dictionaries exist, then they were created transactionally +// and log should exist.) +static int validate_env(DB_ENV *env, + bool *valid_newenv, + bool need_rollback_cachefile) { int r; - bool expect_newenv = false; // set true if we expect to create a new env + bool expect_newenv = false; // set true if we expect to create a new env toku_struct_stat buf; - char* path = NULL; + char *path = NULL; // Test for persistent environment - path = toku_construct_full_name(2, env->i->dir, toku_product_name_strings.environmentdictionary); + path = toku_construct_full_name( + 2, env->i->dir, toku_product_name_strings.environmentdictionary); assert(path); r = toku_stat(path, &buf); if (r == 0) { expect_newenv = false; // persistent info exists - } - else { + } else { int stat_errno = get_error_errno(); if (stat_errno == ENOENT) { expect_newenv = true; r = 0; - } - else { - r = toku_ydb_do_error(env, stat_errno, "Unable to access persistent environment\n"); + } else { + r = toku_ydb_do_error( + env, + stat_errno, + "Unable to access persistent environment [%s] in [%s]\n", + toku_product_name_strings.environmentdictionary, + env->i->dir); assert(r); } } @@ -657,23 +664,40 @@ validate_env(DB_ENV * env, bool * valid_newenv, bool need_rollback_cachefile) { // Test for existence of rollback cachefile if it is expected to exist if (r == 0 && need_rollback_cachefile) { - path = toku_construct_full_name(2, env->i->dir, toku_product_name_strings.rollback_cachefile); + path = toku_construct_full_name( + 2, env->i->dir, toku_product_name_strings.rollback_cachefile); assert(path); r = toku_stat(path, &buf); - if (r == 0) { - if (expect_newenv) // rollback cachefile exists, but persistent env is missing - r = toku_ydb_do_error(env, ENOENT, "Persistent environment is missing\n"); - } - else { + if (r == 0) { + if (expect_newenv) // rollback cachefile exists, but persistent env + // is missing + r = toku_ydb_do_error( + env, + ENOENT, + "Persistent environment is missing while looking for " + "rollback cachefile [%s] in [%s]\n", + toku_product_name_strings.rollback_cachefile, env->i->dir); + } else { int stat_errno = get_error_errno(); if (stat_errno == ENOENT) { - if (!expect_newenv) // rollback cachefile is missing but persistent env exists - r = toku_ydb_do_error(env, ENOENT, "rollback cachefile directory is missing\n"); - else - r = 0; // both rollback cachefile and persistent env are missing - } - else { - r = toku_ydb_do_error(env, stat_errno, "Unable to access rollback cachefile\n"); + if (!expect_newenv) // rollback cachefile is missing but + // persistent env exists + r = toku_ydb_do_error( + env, + ENOENT, + "rollback cachefile [%s] is missing from [%s]\n", + toku_product_name_strings.rollback_cachefile, + env->i->dir); + else + r = 0; // both rollback cachefile and persistent env are + // missing + } else { + r = toku_ydb_do_error( + env, + stat_errno, + "Unable to access rollback cachefile [%s] in [%s]\n", + toku_product_name_strings.rollback_cachefile, + env->i->dir); assert(r); } } @@ -682,23 +706,41 @@ validate_env(DB_ENV * env, bool * valid_newenv, bool need_rollback_cachefile) { // Test for fileops directory if (r == 0) { - path = toku_construct_full_name(2, env->i->dir, toku_product_name_strings.fileopsdirectory); + path = toku_construct_full_name( + 2, env->i->dir, toku_product_name_strings.fileopsdirectory); assert(path); r = toku_stat(path, &buf); - if (r == 0) { - if (expect_newenv) // fileops directory exists, but persistent env is missing - r = toku_ydb_do_error(env, ENOENT, "Persistent environment is missing\n"); - } - else { + if (r == 0) { + if (expect_newenv) // fileops directory exists, but persistent env + // is missing + r = toku_ydb_do_error( + env, + ENOENT, + "Persistent environment is missing while looking for " + "fileops directory [%s] in [%s]\n", + toku_product_name_strings.fileopsdirectory, + env->i->dir); + } else { int stat_errno = get_error_errno(); if (stat_errno == ENOENT) { - if (!expect_newenv) // fileops directory is missing but persistent env exists - r = toku_ydb_do_error(env, ENOENT, "Fileops directory is missing\n"); - else - r = 0; // both fileops directory and persistent env are missing - } - else { - r = toku_ydb_do_error(env, stat_errno, "Unable to access fileops directory\n"); + if (!expect_newenv) // fileops directory is missing but + // persistent env exists + r = toku_ydb_do_error( + env, + ENOENT, + "Fileops directory [%s] is missing from [%s]\n", + toku_product_name_strings.fileopsdirectory, + env->i->dir); + else + r = 0; // both fileops directory and persistent env are + // missing + } else { + r = toku_ydb_do_error( + env, + stat_errno, + "Unable to access fileops directory [%s] in [%s]\n", + toku_product_name_strings.fileopsdirectory, + env->i->dir); assert(r); } } @@ -710,16 +752,26 @@ validate_env(DB_ENV * env, bool * valid_newenv, bool need_rollback_cachefile) { // if using transactions, test for existence of log r = ydb_recover_log_exists(env); // return 0 or ENOENT if (expect_newenv && (r != ENOENT)) - r = toku_ydb_do_error(env, ENOENT, "Persistent environment information is missing (but log exists)\n"); + r = toku_ydb_do_error(env, + ENOENT, + "Persistent environment information is " + "missing (but log exists) while looking for " + "recovery log files in [%s]\n", + env->i->real_log_dir); else if (!expect_newenv && r == ENOENT) - r = toku_ydb_do_error(env, ENOENT, "Recovery log is missing (persistent environment information is present)\n"); + r = toku_ydb_do_error(env, + ENOENT, + "Recovery log is missing (persistent " + "environment information is present) while " + "looking for recovery log files in [%s]\n", + env->i->real_log_dir); else r = 0; } if (r == 0) *valid_newenv = expect_newenv; - else + else *valid_newenv = false; return r; } @@ -769,7 +821,7 @@ env_open(DB_ENV * env, const char *home, uint32_t flags, int mode) { goto cleanup; } - if (toku_os_huge_pages_enabled()) { + if (env->get_check_thp(env) && toku_os_huge_pages_enabled()) { r = toku_ydb_do_error(env, TOKUDB_HUGE_PAGES_ENABLED, "Huge pages are enabled, disable them before continuing\n"); goto cleanup; @@ -1235,6 +1287,18 @@ env_set_checkpoint_pool_threads(DB_ENV * env, uint32_t threads) { return 0; } +static void +env_set_check_thp(DB_ENV * env, bool new_val) { + assert(env); + env->i->check_thp = new_val; +} + +static bool +env_get_check_thp(DB_ENV * env) { + assert(env); + return env->i->check_thp; +} + static int env_dbremove(DB_ENV * env, DB_TXN *txn, const char *fname, const char *dbname, uint32_t flags); static int @@ -2635,6 +2699,8 @@ toku_env_create(DB_ENV ** envp, uint32_t flags) { USENV(get_loader_memory_size); USENV(set_killed_callback); USENV(do_backtrace); + USENV(set_check_thp); + USENV(get_check_thp); #undef USENV // unlocked methods @@ -2660,6 +2726,8 @@ toku_env_create(DB_ENV ** envp, uint32_t flags) { env_fs_init(result); env_fsync_log_init(result); + result->i->check_thp = true; + result->i->bt_compare = toku_builtin_compare_fun; r = toku_logger_create(&result->i->logger); diff --git a/storage/tokudb/hatoku_defines.h b/storage/tokudb/hatoku_defines.h index 44ad3184f63..8c7ebfa62de 100644 --- a/storage/tokudb/hatoku_defines.h +++ b/storage/tokudb/hatoku_defines.h @@ -71,10 +71,6 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved. #if 100000 <= MYSQL_VERSION_ID -#if !defined(TOKUDB_CHECK_JEMALLOC) -#define TOKUDB_CHECK_JEMALLOC 1 -#endif - // mariadb 10.0 #define TOKU_USE_DB_TYPE_TOKUDB 1 #define TOKU_INCLUDE_ALTER_56 1 diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc index e62836c5ed4..6a32f35479e 100644 --- a/storage/tokudb/hatoku_hton.cc +++ b/storage/tokudb/hatoku_hton.cc @@ -266,7 +266,6 @@ static int tokudb_init_func(void *p) { db_env = NULL; tokudb_hton = (handlerton *) p; -#if TOKUDB_CHECK_JEMALLOC if (tokudb::sysvars::check_jemalloc) { typedef int (*mallctl_type)( const char*, @@ -293,7 +292,6 @@ static int tokudb_init_func(void *p) { goto error; } } -#endif r = tokudb_set_product_name(); if (r) { @@ -538,6 +536,8 @@ static int tokudb_init_func(void *p) { db_env, tokudb_get_loader_memory_size_callback); + db_env->set_check_thp(db_env, tokudb::sysvars::check_jemalloc); + r = db_env->open( db_env, tokudb_home, diff --git a/storage/tokudb/mysql-test/rpl/t/suite.opt b/storage/tokudb/mysql-test/rpl/t/suite.opt index 23511b05020..15acdf7397f 100644 --- a/storage/tokudb/mysql-test/rpl/t/suite.opt +++ b/storage/tokudb/mysql-test/rpl/t/suite.opt @@ -1 +1 @@ -$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 +$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M diff --git a/storage/tokudb/mysql-test/tokudb/bulk-fetch-gen.py b/storage/tokudb/mysql-test/tokudb/bulk-fetch-gen.py index f125ce771da..4e343772511 100644 --- a/storage/tokudb/mysql-test/tokudb/bulk-fetch-gen.py +++ b/storage/tokudb/mysql-test/tokudb/bulk-fetch-gen.py @@ -71,6 +71,7 @@ tables = [ ] # Code generation stats here +print "source include/have_tokudb.inc;" print "# Tokutek" print "# Test that bulk fetch works with various table types" print "" diff --git a/storage/tokudb/mysql-test/tokudb/locks-blocking-row-locks-testgen.py b/storage/tokudb/mysql-test/tokudb/locks-blocking-row-locks-testgen.py index 372431ada04..28bea5dea56 100644 --- a/storage/tokudb/mysql-test/tokudb/locks-blocking-row-locks-testgen.py +++ b/storage/tokudb/mysql-test/tokudb/locks-blocking-row-locks-testgen.py @@ -56,6 +56,7 @@ write_range_queries = [ timeouts = [0, 500] # Here's where all the magic happens +print "source include/have_tokudb.inc;" print "# Tokutek" print "# Blocking row lock tests;" print "# Generated by %s on %s;" % (__file__, datetime.date.today()) diff --git a/storage/tokudb/mysql-test/tokudb/r/ext_key_1_innodb.result b/storage/tokudb/mysql-test/tokudb/r/ext_key_1_innodb.result index 45b6456ab9a..e27b44430c2 100644 --- a/storage/tokudb/mysql-test/tokudb/r/ext_key_1_innodb.result +++ b/storage/tokudb/mysql-test/tokudb/r/ext_key_1_innodb.result @@ -18,6 +18,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -35,6 +36,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -51,6 +53,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -67,6 +70,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -84,6 +88,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -100,6 +105,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/storage/tokudb/mysql-test/tokudb/r/ext_key_1_tokudb.result b/storage/tokudb/mysql-test/tokudb/r/ext_key_1_tokudb.result index 73b5d8c5d92..11ee06a1b9e 100644 --- a/storage/tokudb/mysql-test/tokudb/r/ext_key_1_tokudb.result +++ b/storage/tokudb/mysql-test/tokudb/r/ext_key_1_tokudb.result @@ -18,6 +18,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -35,6 +36,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -51,6 +53,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -67,6 +70,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -84,6 +88,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -100,6 +105,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/storage/tokudb/mysql-test/tokudb/r/ext_key_2_innodb.result b/storage/tokudb/mysql-test/tokudb/r/ext_key_2_innodb.result index 5e947bac5ea..cc1b3545654 100644 --- a/storage/tokudb/mysql-test/tokudb/r/ext_key_2_innodb.result +++ b/storage/tokudb/mysql-test/tokudb/r/ext_key_2_innodb.result @@ -18,6 +18,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -35,6 +36,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/storage/tokudb/mysql-test/tokudb/r/ext_key_2_tokudb.result b/storage/tokudb/mysql-test/tokudb/r/ext_key_2_tokudb.result index d7ddfd56d26..757ebcb54ac 100644 --- a/storage/tokudb/mysql-test/tokudb/r/ext_key_2_tokudb.result +++ b/storage/tokudb/mysql-test/tokudb/r/ext_key_2_tokudb.result @@ -18,6 +18,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 @@ -35,6 +36,7 @@ Handler_read_key 1 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 +Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 diff --git a/storage/tokudb/mysql-test/tokudb/replace-ignore-gen.py b/storage/tokudb/mysql-test/tokudb/replace-ignore-gen.py index d8227da96a5..65c0f317abe 100644 --- a/storage/tokudb/mysql-test/tokudb/replace-ignore-gen.py +++ b/storage/tokudb/mysql-test/tokudb/replace-ignore-gen.py @@ -23,6 +23,7 @@ def sqlgen_explain_and_do(query): def sqlgen_drop_table(): print "drop table t;" +print "source include/have_tokudb.inc;" print "# Tokutek" print "# Test that replace into and insert ignore insertions " print "# work under various index schemas. " diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py b/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py index b94a80ec7be..2c7d8dd9a54 100644..100755 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py @@ -22,6 +22,7 @@ def gen_test(n): print "DROP TABLE t;" def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_bin.py" print "# test binary expansion is hot" print "--source include/big_test.inc" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py index b574f15735a..6bd5de38fe8 100644..100755 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py @@ -26,6 +26,7 @@ def gen_test(n): print "DROP TABLE t;" def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_char_rename.py" print "# test char expansion + rename is hot" print "--disable_warnings" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_blob.py b/storage/tokudb/mysql-test/tokudb/t/change_column_blob.py index d884932307f..e25fce54d0e 100644 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_blob.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_blob.py @@ -1,5 +1,6 @@ import sys def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_blob.py" print "# generate hot blob expansion test cases" print "--disable_warnings" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char.py index 7481d9092f2..c53442ade50 100644..100755 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_char.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char.py @@ -22,6 +22,7 @@ def gen_test(n): print "DROP TABLE t;" def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_char.py" print "# test char expansion" print "--source include/big_test.inc" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py index 4b94d2fc98b..e92797918d5 100644..100755 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py @@ -23,6 +23,7 @@ def gen_test(n): print "DROP TABLE t;" def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_char_binary.py" print "# test that char(X) <-> binary(X) is not hot" print "--disable_warnings" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py index 81cf2058a3e..065e37b186d 100644..100755 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py @@ -23,6 +23,7 @@ def gen_test(n): print "DROP TABLE t;" def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_char_charbinary.py" print "# test that char(X) <-> char(X) binary is not hot" print "--disable_warnings" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py index 6bc8ae80c7d..fe73fce0d53 100644..100755 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py @@ -26,6 +26,7 @@ def gen_test(n): print "DROP TABLE t;" def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_char_rename.py" print "# test char expansion + rename is hot" print "--disable_warnings" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int.py index f93b9d7bb69..6f69156e260 100644..100755 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_int.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int.py @@ -25,6 +25,7 @@ def gen_test(types, values): print "DROP TABLE ti;" print "DROP TABLE t;" def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_int.py" print "# test int expansion is hot" print "--disable_warnings" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py index 8b217b59ab1..fd7e5868c40 100644..100755 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py @@ -25,6 +25,7 @@ def gen_test(types): print "DROP TABLE t;" def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_int_key.py" print "# ensure that changing an int column that is part of a key is not hot" print "--disable_warnings" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py index 6fbb2343fea..1708c65efde 100644..100755 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py @@ -21,6 +21,7 @@ def gen_tests(int_types, modifiers): for from_modifier in range(len(modifiers)): gen_tests_for_int(from_int, from_modifier, int_types, modifiers) def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_int_not_supported.py" print "# ensure that int types are only expanded and are not cnverted to some other type" print "--disable_warnings" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py index a1cd155f3de..5222564a9a2 100644..100755 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py @@ -27,6 +27,7 @@ def gen_test(types, values): print "DROP TABLE ti;" print "DROP TABLE t;" def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_int_rename.py" print "--disable_warnings" print "DROP TABLE IF EXISTS t, ti;" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_multiple_columns.py b/storage/tokudb/mysql-test/tokudb/t/change_column_multiple_columns.py index 7e562f38a0f..05f3683a14f 100644 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_multiple_columns.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_multiple_columns.py @@ -6,6 +6,7 @@ old_types = [ 'VARCHAR(1)', 'VARBINARY(1)', 'INT', 'CHAR(1)', 'BINARY(1)' ] new_types = [ 'VARCHAR(2)', 'VARBINARY(2)', 'BIGINT', 'CHAR(2)', 'BINARY(2)' ] def main(): + print "source include/have_tokudb.inc;" print "# this test generated by change_multiple_columns.py" print "# this test generated multiple column changes which should all fail since we support only one at a time" print "--disable_warnings" diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_text.py b/storage/tokudb/mysql-test/tokudb/t/change_column_text.py index 13de13dc222..fada9b0852e 100644 --- a/storage/tokudb/mysql-test/tokudb/t/change_column_text.py +++ b/storage/tokudb/mysql-test/tokudb/t/change_column_text.py @@ -1,5 +1,6 @@ import sys def main(): + print "source include/have_tokudb.inc;" print "# this test is generated by change_text.py" print "# generate hot text expansion test cases" print "--disable_warnings" diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test index 012c0af63b5..d8ce18b3aa7 100644 --- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test +++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_lock_waits_released.test @@ -53,6 +53,9 @@ select trx_id,trx_mysql_thread_id from information_schema.tokudb_trx; connection conn_a; commit; # verify that the lock on the 1st transaction is released and replaced by the lock for the 2nd transaction +let $wait_condition= select count(*)=1 from information_schema.tokudb_locks where locks_dname='./test/t-main'; +source include/wait_condition.inc; + replace_column 1 TRX_ID 2 MYSQL_ID; select * from information_schema.tokudb_locks; select * from information_schema.tokudb_lock_waits; diff --git a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_locks_released.test b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_locks_released.test index bbb0533e784..93ae4767ecd 100644 --- a/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_locks_released.test +++ b/storage/tokudb/mysql-test/tokudb/t/i_s_tokudb_locks_released.test @@ -44,6 +44,9 @@ eval select * from information_schema.tokudb_locks; connection conn_a; commit; # verify that the lock on the 1st transaction is released and replaced by the lock for the 2nd transaction +let $wait_condition= select count(*)=1 from information_schema.tokudb_locks where locks_dname='./test/t-main'; +source include/wait_condition.inc; + replace_column 1 TRX_ID 2 MYSQL_ID; select * from information_schema.tokudb_locks; diff --git a/storage/tokudb/mysql-test/tokudb/t/suite.opt b/storage/tokudb/mysql-test/tokudb/t/suite.opt index 23511b05020..15acdf7397f 100644 --- a/storage/tokudb/mysql-test/tokudb/t/suite.opt +++ b/storage/tokudb/mysql-test/tokudb/t/suite.opt @@ -1 +1 @@ -$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 +$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M diff --git a/storage/tokudb/mysql-test/tokudb_add_index/t/suite.opt b/storage/tokudb/mysql-test/tokudb_add_index/t/suite.opt index 23511b05020..15acdf7397f 100644 --- a/storage/tokudb/mysql-test/tokudb_add_index/t/suite.opt +++ b/storage/tokudb/mysql-test/tokudb_add_index/t/suite.opt @@ -1 +1 @@ -$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 +$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M diff --git a/storage/tokudb/mysql-test/tokudb_alter_table/t/suite.opt b/storage/tokudb/mysql-test/tokudb_alter_table/t/suite.opt index 23511b05020..15acdf7397f 100644 --- a/storage/tokudb/mysql-test/tokudb_alter_table/t/suite.opt +++ b/storage/tokudb/mysql-test/tokudb_alter_table/t/suite.opt @@ -1 +1 @@ -$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 +$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M diff --git a/storage/tokudb/mysql-test/tokudb_backup/t/suite.opt b/storage/tokudb/mysql-test/tokudb_backup/t/suite.opt index e52bd6327e0..0d80cf85a91 100644 --- a/storage/tokudb/mysql-test/tokudb_backup/t/suite.opt +++ b/storage/tokudb/mysql-test/tokudb_backup/t/suite.opt @@ -1 +1 @@ -$TOKUDB_OPT $TOKUDB_LOAD_ADD $TOKUDB_BACKUP_OPT $TOKUDB_BACKUP_LOAD_ADD --loose-tokudb-check-jemalloc=0 +$TOKUDB_OPT $TOKUDB_LOAD_ADD $TOKUDB_BACKUP_OPT $TOKUDB_BACKUP_LOAD_ADD --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/suite.opt b/storage/tokudb/mysql-test/tokudb_bugs/t/suite.opt index 23511b05020..15acdf7397f 100644 --- a/storage/tokudb/mysql-test/tokudb_bugs/t/suite.opt +++ b/storage/tokudb/mysql-test/tokudb_bugs/t/suite.opt @@ -1 +1 @@ -$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 +$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M diff --git a/storage/tokudb/mysql-test/tokudb_parts/t/suite.opt b/storage/tokudb/mysql-test/tokudb_parts/t/suite.opt index 23511b05020..15acdf7397f 100644 --- a/storage/tokudb/mysql-test/tokudb_parts/t/suite.opt +++ b/storage/tokudb/mysql-test/tokudb_parts/t/suite.opt @@ -1 +1 @@ -$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 +$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M diff --git a/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_rfr_disable_on_expl_pk_absence-slave.opt b/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_rfr_disable_on_expl_pk_absence-slave.opt index fb12af6c5bd..c87bbb62418 100644 --- a/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_rfr_disable_on_expl_pk_absence-slave.opt +++ b/storage/tokudb/mysql-test/tokudb_rpl/t/rpl_rfr_disable_on_expl_pk_absence-slave.opt @@ -1 +1 @@ ---read-only=true --tokudb-rpl-unique-checks=false --tokudb-rpl-lookup-rows=false +--read-only=true --loose-tokudb-rpl-unique-checks=false --loose-tokudb-rpl-lookup-rows=false diff --git a/storage/tokudb/mysql-test/tokudb_sys_vars/t/suite.opt b/storage/tokudb/mysql-test/tokudb_sys_vars/t/suite.opt index 23511b05020..15acdf7397f 100644 --- a/storage/tokudb/mysql-test/tokudb_sys_vars/t/suite.opt +++ b/storage/tokudb/mysql-test/tokudb_sys_vars/t/suite.opt @@ -1 +1 @@ -$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 +$TOKUDB_OPT $TOKUDB_LOAD_ADD --loose-tokudb-check-jemalloc=0 --loose-tokudb-cache-size=512M --loose-tokudb-block-size=1M diff --git a/storage/tokudb/tokudb_sysvars.cc b/storage/tokudb/tokudb_sysvars.cc index 3ec7a0e1f05..7cea749b4fb 100644 --- a/storage/tokudb/tokudb_sysvars.cc +++ b/storage/tokudb/tokudb_sysvars.cc @@ -74,9 +74,7 @@ char* gdb_path = NULL; my_bool gdb_on_fatal = FALSE; #endif -#if TOKUDB_CHECK_JEMALLOC -uint check_jemalloc = 0; -#endif +my_bool check_jemalloc = TRUE; static MYSQL_SYSVAR_ULONGLONG( cache_size, @@ -416,19 +414,14 @@ static MYSQL_SYSVAR_BOOL( true); #endif -#if TOKUDB_CHECK_JEMALLOC -static MYSQL_SYSVAR_UINT( +static MYSQL_SYSVAR_BOOL( check_jemalloc, check_jemalloc, - 0, - "check if jemalloc is linked", + PLUGIN_VAR_READONLY|PLUGIN_VAR_RQCMDARG, + "check if jemalloc is linked and transparent huge pages are disabled", NULL, NULL, - 1, - 0, - 1, - 0); -#endif + TRUE); //****************************************************************************** @@ -948,9 +941,7 @@ st_mysql_sys_var* system_variables[] = { MYSQL_SYSVAR(gdb_on_fatal), #endif -#if TOKUDB_CHECK_JEMALLOC MYSQL_SYSVAR(check_jemalloc), -#endif // session vars MYSQL_SYSVAR(alter_print_error), diff --git a/storage/tokudb/tokudb_sysvars.h b/storage/tokudb/tokudb_sysvars.h index b67cf8aa0e2..3bd96f7c68d 100644 --- a/storage/tokudb/tokudb_sysvars.h +++ b/storage/tokudb/tokudb_sysvars.h @@ -108,9 +108,7 @@ extern char* gdb_path; extern my_bool gdb_on_fatal; #endif -#if TOKUDB_CHECK_JEMALLOC -extern uint check_jemalloc; -#endif +extern my_bool check_jemalloc; #if TOKUDB_DEBUG // used to control background job manager diff --git a/storage/xtradb/btr/btr0btr.cc b/storage/xtradb/btr/btr0btr.cc index caa35d31109..00a04e75c49 100644 --- a/storage/xtradb/btr/btr0btr.cc +++ b/storage/xtradb/btr/btr0btr.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. Copyright (c) 2014, 2015, MariaDB Corporation @@ -1146,7 +1146,7 @@ that the caller has made the reservation for free extents! @retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded (init_mtr == mtr, or the page was not previously freed in mtr) @retval block (not allocated or initialized) otherwise */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) buf_block_t* btr_page_alloc_low( /*===============*/ @@ -2217,7 +2217,8 @@ btr_parse_page_reorganize( { ulint level; - ut_ad(ptr && end_ptr); + ut_ad(ptr != NULL); + ut_ad(end_ptr != NULL); /* If dealing with a compressed page the record has the compression level used during original compression written in @@ -2689,7 +2690,7 @@ func_exit: Returns TRUE if the insert fits on the appropriate half-page with the chosen split_rec. @return true if fits */ -static __attribute__((nonnull(1,3,4,6), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(1,3,4,6), warn_unused_result)) bool btr_page_insert_fits( /*=================*/ @@ -2832,7 +2833,7 @@ btr_insert_on_non_leaf_level_func( /**************************************************************//** Attaches the halves of an index page on the appropriate level in an index tree. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void btr_attach_half_pages( /*==================*/ @@ -2968,7 +2969,7 @@ btr_attach_half_pages( /*************************************************************//** Determine if a tuple is smaller than any record on the page. @return TRUE if smaller */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool btr_page_tuple_smaller( /*===================*/ @@ -3560,7 +3561,8 @@ btr_level_list_remove_func( ulint prev_page_no; ulint next_page_no; - ut_ad(page && mtr); + ut_ad(page != NULL); + ut_ad(mtr != NULL); ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX)); ut_ad(space == page_get_space_id(page)); /* Get the previous and next page numbers of page */ diff --git a/storage/xtradb/btr/btr0cur.cc b/storage/xtradb/btr/btr0cur.cc index 7ee37836bfb..b52a068863f 100644 --- a/storage/xtradb/btr/btr0cur.cc +++ b/storage/xtradb/btr/btr0cur.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2012, Facebook Inc. Copyright (c) 2015, MariaDB Corporation. @@ -1237,7 +1237,7 @@ This has to be done either within the same mini-transaction, or by invoking ibuf_reset_free_bits() before mtr_commit(). @return pointer to inserted record if succeed, else NULL */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) rec_t* btr_cur_insert_if_possible( /*=======================*/ @@ -1280,7 +1280,7 @@ btr_cur_insert_if_possible( /*************************************************************//** For an insert, checks the locks and does the undo logging if desired. @return DB_SUCCESS, DB_WAIT_LOCK, DB_FAIL, or error number */ -UNIV_INLINE __attribute__((warn_unused_result, nonnull(2,3,5,6))) +UNIV_INLINE MY_ATTRIBUTE((warn_unused_result, nonnull(2,3,5,6))) dberr_t btr_cur_ins_lock_and_undo( /*======================*/ @@ -1843,7 +1843,7 @@ btr_cur_pessimistic_insert( /*************************************************************//** For an update, checks the locks and does the undo logging. @return DB_SUCCESS, DB_WAIT_LOCK, or error number */ -UNIV_INLINE __attribute__((warn_unused_result, nonnull(2,3,6,7))) +UNIV_INLINE MY_ATTRIBUTE((warn_unused_result, nonnull(2,3,6,7))) dberr_t btr_cur_upd_lock_and_undo( /*======================*/ @@ -1862,7 +1862,7 @@ btr_cur_upd_lock_and_undo( const rec_t* rec; dberr_t err; - ut_ad(thr || (flags & BTR_NO_LOCKING_FLAG)); + ut_ad((thr != NULL) || (flags & BTR_NO_LOCKING_FLAG)); if (UNIV_UNLIKELY(thr && thr_get_trx(thr)->fake_changes)) { /* skip LOCK, UNDO */ @@ -3208,7 +3208,7 @@ btr_cur_del_mark_set_clust_rec( ut_ad(page_is_leaf(page_align(rec))); #ifdef UNIV_DEBUG - if (btr_cur_print_record_ops && thr) { + if (btr_cur_print_record_ops && (thr != NULL)) { btr_cur_trx_report(thr_get_trx(thr)->id, index, "del mark "); rec_print_new(stderr, rec, offsets); } @@ -3366,7 +3366,7 @@ btr_cur_del_mark_set_sec_rec( rec = btr_cur_get_rec(cursor); #ifdef UNIV_DEBUG - if (btr_cur_print_record_ops && thr) { + if (btr_cur_print_record_ops && (thr != NULL)) { btr_cur_trx_report(thr_get_trx(thr)->id, cursor->index, "del mark "); rec_print(stderr, rec, cursor->index); @@ -5340,7 +5340,7 @@ btr_free_externally_stored_field( ulint i, /*!< in: field number of field_ref; ignored if rec == NULL */ enum trx_rb_ctx rb_ctx, /*!< in: rollback context */ - mtr_t* local_mtr __attribute__((unused))) /*!< in: mtr + mtr_t* local_mtr MY_ATTRIBUTE((unused))) /*!< in: mtr containing the latch to data an an X-latch to the index tree */ { diff --git a/storage/xtradb/btr/btr0sea.cc b/storage/xtradb/btr/btr0sea.cc index 683bf7cd1c7..68dbcdf1fa7 100644 --- a/storage/xtradb/btr/btr0sea.cc +++ b/storage/xtradb/btr/btr0sea.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -505,7 +505,7 @@ btr_search_update_block_hash_info( /*==============================*/ btr_search_t* info, /*!< in: search info */ buf_block_t* block, /*!< in: buffer block */ - btr_cur_t* cursor __attribute__((unused))) + btr_cur_t* cursor MY_ATTRIBUTE((unused))) /*!< in: cursor */ { #ifdef UNIV_SYNC_DEBUG diff --git a/storage/xtradb/buf/buf0buddy.cc b/storage/xtradb/buf/buf0buddy.cc index 8f6be0cf2af..8cb880c1169 100644 --- a/storage/xtradb/buf/buf0buddy.cc +++ b/storage/xtradb/buf/buf0buddy.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 2016, 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 @@ -112,7 +112,7 @@ buf_buddy_mem_invalid( /**********************************************************************//** Check if a buddy is stamped free. @return whether the buddy is free */ -UNIV_INLINE __attribute__((warn_unused_result)) +UNIV_INLINE MY_ATTRIBUTE((warn_unused_result)) bool buf_buddy_stamp_is_free( /*====================*/ @@ -225,7 +225,7 @@ Checks if a buf is free i.e.: in the zip_free[]. @retval BUF_BUDDY_STATE_FREE if fully free @retval BUF_BUDDY_STATE_USED if currently in use @retval BUF_BUDDY_STATE_PARTIALLY_USED if partially in use. */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) buf_buddy_state_t buf_buddy_is_free( /*==============*/ diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index 19dd375f6e6..a81d21a04b5 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved. @@ -706,7 +706,7 @@ buf_page_is_corrupted( "InnoDB: " REFMAN "forcing-innodb-recovery.html\n" "InnoDB: for more information.\n", - (ulong) mach_read_from_4( + (ulint) mach_read_from_4( read_buf + FIL_PAGE_OFFSET), (lsn_t) mach_read_from_8( read_buf + FIL_PAGE_LSN), @@ -904,7 +904,7 @@ buf_page_print( ut_print_timestamp(stderr); fprintf(stderr, " InnoDB: Page dump in ascii and hex (%lu bytes):\n", - (ulong) size); + size); ut_print_buf(stderr, read_buf, size); fputs("\nInnoDB: End of page dump\n", stderr); } @@ -2500,9 +2500,9 @@ buf_zip_decompress( } fprintf(stderr, - "InnoDB: unable to decompress space %lu page %lu\n", - (ulong) block->page.space, - (ulong) block->page.offset); + "InnoDB: unable to decompress space %u page %u\n", + block->page.space, + block->page.offset); return(FALSE); case FIL_PAGE_TYPE_ALLOCATED: @@ -3838,7 +3838,7 @@ buf_page_init_low( /********************************************************************//** Inits a page to the buffer buf_pool. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void buf_page_init( /*==========*/ @@ -3909,8 +3909,8 @@ buf_page_init( fprintf(stderr, "InnoDB: Error: page %lu %lu already found" " in the hash table: %p, %p\n", - (ulong) space, - (ulong) offset, + space, + offset, (const void*) hash_page, (const void*) block); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG mutex_exit(&block->mutex); @@ -4278,7 +4278,7 @@ buf_page_create( #ifdef UNIV_DEBUG if (buf_debug_prints) { fprintf(stderr, "Creating space %lu page %lu to buffer\n", - (ulong) space, (ulong) offset); + space, offset); } #endif /* UNIV_DEBUG */ @@ -4686,10 +4686,10 @@ buf_page_io_complete( ut_print_timestamp(stderr); fprintf(stderr, - " InnoDB: Error: reading page %lu\n" + " InnoDB: Error: reading page %u\n" "InnoDB: which is in the" " doublewrite buffer!\n", - (ulong) bpage->offset); + bpage->offset); } else if (!read_space_id && !read_page_no) { /* This is likely an uninitialized page. */ } else if ((bpage->space @@ -4705,10 +4705,11 @@ buf_page_io_complete( " InnoDB: Error: space id and page n:o" " stored in the page\n" "InnoDB: read in are %lu:%lu," - " should be %lu:%lu!\n", - (ulong) read_space_id, (ulong) read_page_no, - (ulong) bpage->space, - (ulong) bpage->offset); + " should be %u:%u!\n", + read_space_id, + read_page_no, + bpage->space, + bpage->offset); } if (UNIV_LIKELY(!bpage->is_corrupt || @@ -4742,10 +4743,10 @@ corrupt: "Database page corruption on disk" " or a failed"); ib_logf(IB_LOG_LEVEL_ERROR, - "Space %lu file %s read of page %lu.", - (ulint)bpage->space, + "Space %u file %s read of page %u.", + bpage->space, space ? space->name : "NULL", - (ulong) bpage->offset); + bpage->offset); ib_logf(IB_LOG_LEVEL_ERROR, "You may have to recover" " from a backup."); @@ -4973,8 +4974,8 @@ retry_mutex: if (buf_debug_prints) { fprintf(stderr, "Has %s page space %lu page no %lu\n", io_type == BUF_IO_READ ? "read" : "written", - (ulong) buf_page_get_space(bpage), - (ulong) buf_page_get_page_no(bpage)); + buf_page_get_space(bpage), + buf_page_get_page_no(bpage)); } #endif /* UNIV_DEBUG */ @@ -5009,11 +5010,21 @@ buf_all_freed_instance( mutex_exit(&buf_pool->LRU_list_mutex); if (UNIV_LIKELY_NULL(block)) { - if (block->page.key_version == 0) { - fprintf(stderr, - "Page %lu %lu still fixed or dirty\n", - (ulong) block->page.space, - (ulong) block->page.offset); + if (block->page.key_version == 0) { + fil_space_t* space = fil_space_get(block->page.space); + ib_logf(IB_LOG_LEVEL_ERROR, + "Page %u %u still fixed or dirty.", + block->page.space, + block->page.offset); + ib_logf(IB_LOG_LEVEL_ERROR, + "Page oldest_modification %lu fix_count %d io_fix %d.", + block->page.oldest_modification, + block->page.buf_fix_count, + buf_page_get_io_fix(&block->page)); + ib_logf(IB_LOG_LEVEL_ERROR, + "Page space_id %u name %s.", + block->page.space, + (space && space->name) ? space->name : "NULL"); ut_error; } } @@ -5306,8 +5317,8 @@ buf_pool_validate_instance( if (n_lru + n_free > buf_pool->curr_size + n_zip) { fprintf(stderr, "n LRU %lu, n free %lu, pool %lu zip %lu\n", - (ulong) n_lru, (ulong) n_free, - (ulong) buf_pool->curr_size, (ulong) n_zip); + n_lru, n_free, + buf_pool->curr_size, n_zip); ut_error; } @@ -5317,8 +5328,8 @@ buf_pool_validate_instance( if (UT_LIST_GET_LEN(buf_pool->free) != n_free) { fprintf(stderr, "Free list len %lu, free blocks %lu\n", - (ulong) UT_LIST_GET_LEN(buf_pool->free), - (ulong) n_free); + UT_LIST_GET_LEN(buf_pool->free), + n_free); ut_error; } @@ -5399,20 +5410,20 @@ buf_print_instance( "n pending flush LRU %lu list %lu single page %lu\n" "pages made young %lu, not young %lu\n" "pages read %lu, created %lu, written %lu\n", - (ulong) size, - (ulong) UT_LIST_GET_LEN(buf_pool->LRU), - (ulong) UT_LIST_GET_LEN(buf_pool->free), - (ulong) UT_LIST_GET_LEN(buf_pool->flush_list), - (ulong) buf_pool->n_pend_unzip, - (ulong) buf_pool->n_pend_reads, - (ulong) buf_pool->n_flush[BUF_FLUSH_LRU], - (ulong) buf_pool->n_flush[BUF_FLUSH_LIST], - (ulong) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE], - (ulong) buf_pool->stat.n_pages_made_young, - (ulong) buf_pool->stat.n_pages_not_made_young, - (ulong) buf_pool->stat.n_pages_read, - (ulong) buf_pool->stat.n_pages_created, - (ulong) buf_pool->stat.n_pages_written); + (ulint) size, + (ulint) UT_LIST_GET_LEN(buf_pool->LRU), + (ulint) UT_LIST_GET_LEN(buf_pool->free), + (ulint) UT_LIST_GET_LEN(buf_pool->flush_list), + (ulint) buf_pool->n_pend_unzip, + (ulint) buf_pool->n_pend_reads, + (ulint) buf_pool->n_flush[BUF_FLUSH_LRU], + (ulint) buf_pool->n_flush[BUF_FLUSH_LIST], + (ulint) buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE], + (ulint) buf_pool->stat.n_pages_made_young, + (ulint) buf_pool->stat.n_pages_not_made_young, + (ulint) buf_pool->stat.n_pages_read, + (ulint) buf_pool->stat.n_pages_created, + (ulint) buf_pool->stat.n_pages_written); /* Count the number of blocks belonging to each index in the buffer */ @@ -5463,7 +5474,7 @@ buf_print_instance( fprintf(stderr, "Block count for index %llu in buffer is about %lu", (ullint) index_ids[i], - (ulong) counts[i]); + (ulint) counts[i]); if (index) { putc(' ', stderr); @@ -5917,10 +5928,10 @@ buf_print_io_instance( fprintf(file, "Buffer pool hit rate %lu / 1000," " young-making rate %lu / 1000 not %lu / 1000\n", - (ulong) hit_rate, - (ulong) (1000 * pool_info->young_making_delta + (ulint) hit_rate, + (ulint) (1000 * pool_info->young_making_delta / pool_info->n_page_get_delta), - (ulong) (1000 * pool_info->not_young_making_delta + (ulint) (1000 * pool_info->not_young_making_delta / pool_info->n_page_get_delta)); } else { fputs("No buffer pool page gets since the last printout\n", diff --git a/storage/xtradb/buf/buf0dump.cc b/storage/xtradb/buf/buf0dump.cc index a68bb8a1344..114c96cec98 100644 --- a/storage/xtradb/buf/buf0dump.cc +++ b/storage/xtradb/buf/buf0dump.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2011, 2016, 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 @@ -105,7 +105,7 @@ SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS'; or by: SHOW STATUS LIKE 'innodb_buffer_pool_dump_status'; */ -static __attribute__((nonnull, format(printf, 2, 3))) +static MY_ATTRIBUTE((nonnull, format(printf, 2, 3))) void buf_dump_status( /*============*/ @@ -137,7 +137,7 @@ SELECT variable_value FROM information_schema.global_status WHERE variable_name = 'INNODB_BUFFER_POOL_LOAD_STATUS'; or by: SHOW STATUS LIKE 'innodb_buffer_pool_load_status'; */ -static __attribute__((nonnull, format(printf, 2, 3))) +static MY_ATTRIBUTE((nonnull, format(printf, 2, 3))) void buf_load_status( /*============*/ @@ -684,7 +684,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(buf_dump_thread)( /*============================*/ - void* arg __attribute__((unused))) /*!< in: a dummy parameter + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { ut_ad(!srv_read_only_mode); diff --git a/storage/xtradb/buf/buf0flu.cc b/storage/xtradb/buf/buf0flu.cc index 1dfd92e4fba..168f0a438a6 100644 --- a/storage/xtradb/buf/buf0flu.cc +++ b/storage/xtradb/buf/buf0flu.cc @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates -Copyright (c) 2013, 2015, MariaDB +Copyright (c) 1995, 2016, Oracle and/or its affiliates +Copyright (c) 2013, 2016, MariaDB Copyright (c) 2013, 2014, Fusion-io This program is free software; you can redistribute it and/or modify it under @@ -1506,7 +1506,7 @@ It attempts to make 'max' blocks available in the free list. Note that it is a best effort attempt and it is not guaranteed that after a call to this function there will be 'max' blocks in the free list. @return number of blocks for which the write request was queued. */ -__attribute__((nonnull)) +MY_ATTRIBUTE((nonnull)) static void buf_flush_LRU_list_batch( @@ -1652,7 +1652,7 @@ Whether LRU or unzip_LRU is used depends on the state of the system. @return number of blocks for which either the write request was queued or in case of unzip_LRU the number of blocks actually moved to the free list */ -__attribute__((nonnull)) +MY_ATTRIBUTE((nonnull)) static void buf_do_LRU_batch( @@ -1772,7 +1772,7 @@ pages: to avoid deadlocks, this function must be written so that it cannot end up waiting for these latches! NOTE 2: in the case of a flush list flush, the calling thread is not allowed to own any latches on pages! @return number of blocks for which the write request was queued */ -__attribute__((nonnull)) +MY_ATTRIBUTE((nonnull)) void buf_flush_batch( /*============*/ @@ -1969,7 +1969,7 @@ list. NOTE: The calling thread is not allowed to own any latches on pages! @return true if a batch was queued successfully. false if another batch of same type was already running. */ -__attribute__((nonnull)) +MY_ATTRIBUTE((nonnull)) static bool buf_flush_LRU( @@ -2642,7 +2642,7 @@ page_cleaner_sleep_if_needed( /*********************************************************************//** Returns the aggregate free list length over all buffer pool instances. @return total free list length. */ -__attribute__((warn_unused_result)) +MY_ATTRIBUTE((warn_unused_result)) static ulint buf_get_total_free_list_length(void) @@ -2660,7 +2660,7 @@ buf_get_total_free_list_length(void) /*********************************************************************//** Adjust the desired page cleaner thread sleep time for LRU flushes. */ -__attribute__((nonnull)) +MY_ATTRIBUTE((nonnull)) static void page_cleaner_adapt_lru_sleep_time( @@ -2699,7 +2699,7 @@ page_cleaner_adapt_lru_sleep_time( /*********************************************************************//** Get the desired page cleaner thread sleep time for flush list flushes. @return desired sleep time */ -__attribute__((warn_unused_result)) +MY_ATTRIBUTE((warn_unused_result)) static ulint page_cleaner_adapt_flush_sleep_time(void) @@ -2726,7 +2726,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(buf_flush_page_cleaner_thread)( /*==========================================*/ - void* arg __attribute__((unused))) + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { @@ -2878,7 +2878,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(buf_flush_lru_manager_thread)( /*==========================================*/ - void* arg __attribute__((unused))) + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { diff --git a/storage/xtradb/buf/buf0lru.cc b/storage/xtradb/buf/buf0lru.cc index fdec0e48198..579166753c4 100644 --- a/storage/xtradb/buf/buf0lru.cc +++ b/storage/xtradb/buf/buf0lru.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, 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 @@ -143,7 +143,7 @@ If a compressed page is freed other compressed pages may be relocated. caller needs to free the page to the free list @retval false if BUF_BLOCK_ZIP_PAGE was removed from page_hash. In this case the block is already returned to the buddy allocator. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool buf_LRU_block_remove_hashed( /*========================*/ @@ -368,7 +368,7 @@ want to hog the CPU and resources. Release the buffer pool and block mutex and try to force a context switch. Then reacquire the same mutexes. The current page is "fixed" before the release of the mutexes and then "unfixed" again once we have reacquired the mutexes. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void buf_flush_yield( /*============*/ @@ -407,7 +407,7 @@ If we have hogged the resources for too long then release the buffer pool and flush list mutex and do a thread yield. Set the current page to "sticky" so that it is not relocated during the yield. @return true if yielded */ -static __attribute__((nonnull(1), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(1), warn_unused_result)) bool buf_flush_try_yield( /*================*/ @@ -476,7 +476,7 @@ buf_flush_try_yield( Removes a single page from a given tablespace inside a specific buffer pool instance. @return true if page was removed. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool buf_flush_or_remove_page( /*=====================*/ @@ -578,7 +578,7 @@ the list as they age towards the tail of the LRU. @retval DB_SUCCESS if all freed @retval DB_FAIL if not all freed @retval DB_INTERRUPTED if the transaction was interrupted */ -static __attribute__((nonnull(1), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(1), warn_unused_result)) dberr_t buf_flush_or_remove_pages( /*======================*/ @@ -699,7 +699,7 @@ Remove or flush all the dirty pages that belong to a given tablespace inside a specific buffer pool instance. The pages will remain in the LRU list and will be evicted from the LRU list as they age and move towards the tail of the LRU list. */ -static __attribute__((nonnull(1))) +static MY_ATTRIBUTE((nonnull(1))) void buf_flush_dirty_pages( /*==================*/ @@ -739,7 +739,7 @@ buf_flush_dirty_pages( /******************************************************************//** Remove all pages that belong to a given tablespace inside a specific buffer pool instance when we are DISCARDing the tablespace. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void buf_LRU_remove_all_pages( /*=====================*/ @@ -895,7 +895,7 @@ buffer pool instance when we are deleting the data file(s) of that tablespace. The pages still remain a part of LRU and are evicted from the list as they age towards the tail of the LRU only if buf_remove is BUF_REMOVE_FLUSH_NO_WRITE. */ -static __attribute__((nonnull(1))) +static MY_ATTRIBUTE((nonnull(1))) void buf_LRU_remove_pages( /*=================*/ diff --git a/storage/xtradb/data/data0data.cc b/storage/xtradb/data/data0data.cc index 179de79b69f..593af089b00 100644 --- a/storage/xtradb/data/data0data.cc +++ b/storage/xtradb/data/data0data.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -67,7 +67,8 @@ dtuple_coll_cmp( ulint n_fields; ulint i; - ut_ad(tuple1 && tuple2); + ut_ad(tuple1 != NULL); + ut_ad(tuple2 != NULL); ut_ad(tuple1->magic_n == DATA_TUPLE_MAGIC_N); ut_ad(tuple2->magic_n == DATA_TUPLE_MAGIC_N); ut_ad(dtuple_check_typed(tuple1)); @@ -715,7 +716,7 @@ UNIV_INTERN void dtuple_convert_back_big_rec( /*========================*/ - dict_index_t* index __attribute__((unused)), /*!< in: index */ + dict_index_t* index MY_ATTRIBUTE((unused)), /*!< in: index */ dtuple_t* entry, /*!< in: entry whose data was put to vector */ big_rec_t* vector) /*!< in, own: big rec vector; it is freed in this function */ diff --git a/storage/xtradb/dict/dict0crea.cc b/storage/xtradb/dict/dict0crea.cc index e2c7355b2e4..870e452e5f2 100644 --- a/storage/xtradb/dict/dict0crea.cc +++ b/storage/xtradb/dict/dict0crea.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -246,7 +246,7 @@ dict_create_sys_columns_tuple( /***************************************************************//** Builds a table definition to insert. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t dict_build_table_def_step( /*======================*/ @@ -574,7 +574,7 @@ dict_create_search_tuple( /***************************************************************//** Builds an index definition row to insert. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t dict_build_index_def_step( /*======================*/ @@ -649,7 +649,7 @@ dict_build_field_def_step( /***************************************************************//** Creates an index tree for the index if it is not a member of a cluster. @return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t dict_create_index_tree_step( /*========================*/ @@ -1468,7 +1468,7 @@ dict_create_or_check_foreign_constraint_tables(void) /****************************************************************//** Evaluate the given foreign key SQL statement. @return error code or DB_SUCCESS */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t dict_foreign_eval_sql( /*==================*/ @@ -1534,7 +1534,7 @@ dict_foreign_eval_sql( Add a single foreign key field definition to the data dictionary tables in the database. @return error code or DB_SUCCESS */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t dict_create_add_foreign_field_to_dictionary( /*========================================*/ diff --git a/storage/xtradb/dict/dict0dict.cc b/storage/xtradb/dict/dict0dict.cc index a147fbbc671..86ec720d24e 100644 --- a/storage/xtradb/dict/dict0dict.cc +++ b/storage/xtradb/dict/dict0dict.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. Copyright (c) 2013, 2015, MariaDB Corporation. @@ -6309,7 +6309,7 @@ dict_set_corrupted_index_cache_only( dict_index_t* index, /*!< in/out: index */ dict_table_t* table) /*!< in/out: table */ { - ut_ad(index); + ut_ad(index != NULL); ut_ad(mutex_own(&dict_sys->mutex)); ut_ad(!dict_table_is_comp(dict_sys->sys_tables)); ut_ad(!dict_table_is_comp(dict_sys->sys_indexes)); @@ -6319,8 +6319,9 @@ dict_set_corrupted_index_cache_only( if (dict_index_is_clust(index)) { dict_table_t* corrupt_table; - corrupt_table = table ? table : index->table; - ut_ad(!index->table || !table || index->table == table); + corrupt_table = (table != NULL) ? table : index->table; + ut_ad((index->table != NULL) || (table != NULL) + || index->table == table); if (corrupt_table) { corrupt_table->corrupted = TRUE; @@ -6438,11 +6439,6 @@ dict_table_get_index_on_name( { dict_index_t* index; - /* If name is NULL, just return */ - if (!name) { - return(NULL); - } - index = dict_table_get_first_index(table); while (index != NULL) { diff --git a/storage/xtradb/dict/dict0load.cc b/storage/xtradb/dict/dict0load.cc index cf2a5b69509..a1cf462b11c 100644 --- a/storage/xtradb/dict/dict0load.cc +++ b/storage/xtradb/dict/dict0load.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -1751,7 +1751,7 @@ err_len: goto err_len; } type = mach_read_from_4(field); - if (type & (~0 << DICT_IT_BITS)) { + if (type & (~0U << DICT_IT_BITS)) { return("unknown SYS_INDEXES.TYPE bits"); } @@ -1791,7 +1791,7 @@ Loads definitions for table indexes. Adds them to the data dictionary cache. @return DB_SUCCESS if ok, DB_CORRUPTION if corruption of dictionary table or DB_UNSUPPORTED if table has unknown index type */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) dberr_t dict_load_indexes( /*==============*/ @@ -2539,6 +2539,7 @@ func_exit: /* the table->fts could be created in dict_load_column when a user defined FTS_DOC_ID is present, but no FTS */ + fts_optimize_remove_table(table); fts_free(table); } else { fts_optimize_add_table(table); @@ -2604,14 +2605,13 @@ dict_load_table_on_id( btr_pcur_open_on_user_rec(sys_table_ids, tuple, PAGE_CUR_GE, BTR_SEARCH_LEAF, &pcur, &mtr); -check_rec: rec = btr_pcur_get_rec(&pcur); if (page_rec_is_user_rec(rec)) { /*---------------------------------------------------*/ /* Now we have the record in the secondary index containing the table ID and NAME */ - +check_rec: field = rec_get_nth_field_old( rec, DICT_FLD__SYS_TABLE_IDS__ID, &len); ut_ad(len == 8); @@ -2621,12 +2621,14 @@ check_rec: if (rec_get_deleted_flag(rec, 0)) { /* Until purge has completed, there may be delete-marked duplicate records - for the same SYS_TABLES.ID. - Due to Bug #60049, some delete-marked - records may survive the purge forever. */ - if (btr_pcur_move_to_next(&pcur, &mtr)) { - - goto check_rec; + for the same SYS_TABLES.ID, but different + SYS_TABLES.NAME. */ + while (btr_pcur_move_to_next(&pcur, &mtr)) { + rec = btr_pcur_get_rec(&pcur); + + if (page_rec_is_user_rec(rec)) { + goto check_rec; + } } } else { /* Now we get the table name from the record */ @@ -2888,7 +2890,7 @@ dict_load_foreign_cols( /***********************************************************************//** Loads a foreign key constraint to the dictionary cache. @return DB_SUCCESS or error code */ -static __attribute__((nonnull(1), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(1), warn_unused_result)) dberr_t dict_load_foreign( /*==============*/ diff --git a/storage/xtradb/dict/dict0mem.cc b/storage/xtradb/dict/dict0mem.cc index a4f6cd6c91f..bde72b83c54 100644 --- a/storage/xtradb/dict/dict0mem.cc +++ b/storage/xtradb/dict/dict0mem.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. This program is free software; you can redistribute it and/or modify it under @@ -306,7 +306,7 @@ dict_mem_table_add_col( /**********************************************************************//** Renames a column of a table in the data dictionary cache. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void dict_mem_table_col_rename_low( /*==========================*/ diff --git a/storage/xtradb/dict/dict0stats_bg.cc b/storage/xtradb/dict/dict0stats_bg.cc index e7842d3da9a..5f24bb2b742 100644 --- a/storage/xtradb/dict/dict0stats_bg.cc +++ b/storage/xtradb/dict/dict0stats_bg.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2012, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2012, 2016, 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 @@ -528,7 +528,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(dict_stats_thread)( /*==============================*/ - void* arg __attribute__((unused))) /*!< in: a dummy parameter + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { ut_a(!srv_read_only_mode); @@ -549,14 +549,6 @@ DECLARE_THREAD(dict_stats_thread)( break; } -#if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG - if (srv_ibuf_disable_background_merge) { - usleep(100000); - os_event_reset(dict_stats_event); - continue; - } -#endif - dict_stats_process_entry_from_recalc_pool(); while (defrag_pool.size()) diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index b0695e2f260..58e08f11778 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -1434,6 +1434,28 @@ fil_space_free( /*******************************************************************//** Returns a pointer to the file_space_t that is in the memory cache +associated with a space id. +@return file_space_t pointer, NULL if space not found */ +fil_space_t* +fil_space_get( +/*==========*/ + ulint id) /*!< in: space id */ +{ + fil_space_t* space; + + ut_ad(fil_system); + + mutex_enter(&fil_system->mutex); + + space = fil_space_get_by_id(id); + + mutex_exit(&fil_system->mutex); + + return (space); +} + +/*******************************************************************//** +Returns a pointer to the file_space_t that is in the memory cache associated with a space id. The caller must lock fil_system->mutex. @return file_space_t pointer, NULL if space not found */ UNIV_INLINE @@ -1852,7 +1874,7 @@ fil_set_max_space_id_if_bigger( Writes the flushed lsn and the latest archived log number to the page header of the first page of a data file of the system tablespace (space 0), which is uncompressed. */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) dberr_t fil_write_lsn_and_arch_no_to_file( /*==============================*/ @@ -1860,7 +1882,7 @@ fil_write_lsn_and_arch_no_to_file( ulint sum_of_sizes, /*!< in: combined size of previous files in space, in database pages */ lsn_t lsn, /*!< in: lsn to write */ - ulint arch_log_no __attribute__((unused))) + ulint arch_log_no MY_ATTRIBUTE((unused))) /*!< in: archived log number to write */ { byte* buf1; @@ -1948,7 +1970,7 @@ Checks the consistency of the first data page of a tablespace at database startup. @retval NULL on success, or if innodb_force_recovery is set @return pointer to an error message string */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) const char* fil_check_first_page( /*=================*/ diff --git a/storage/xtradb/fsp/fsp0fsp.cc b/storage/xtradb/fsp/fsp0fsp.cc index 790232edb66..4acfd134c1f 100644 --- a/storage/xtradb/fsp/fsp0fsp.cc +++ b/storage/xtradb/fsp/fsp0fsp.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, 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 @@ -94,7 +94,7 @@ fseg_n_reserved_pages_low( /********************************************************************//** Marks a page used. The page must reside within the extents of the given segment. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void fseg_mark_page_used( /*================*/ @@ -133,7 +133,7 @@ fsp_fill_free_list( ulint space, /*!< in: space */ fsp_header_t* header, /*!< in/out: space header */ mtr_t* mtr) /*!< in/out: mini-transaction */ - UNIV_COLD __attribute__((nonnull)); + UNIV_COLD MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Allocates a single free page from a segment. This function implements the intelligent allocation strategy which tries to minimize file space @@ -162,7 +162,7 @@ fseg_alloc_free_page_low( in which the page should be initialized. If init_mtr!=mtr, but the page is already latched in mtr, do not initialize the page. */ - __attribute__((warn_unused_result, nonnull)); + MY_ATTRIBUTE((warn_unused_result, nonnull)); #endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** @@ -429,7 +429,7 @@ descriptor resides is x-locked. This function no longer extends the data file. @return pointer to the extent descriptor, NULL if the page does not exist in the space or if the offset is >= the free limit */ -UNIV_INLINE __attribute__((nonnull, warn_unused_result)) +UNIV_INLINE MY_ATTRIBUTE((nonnull, warn_unused_result)) xdes_t* xdes_get_descriptor_with_space_hdr( /*===============================*/ @@ -488,7 +488,7 @@ descriptor resides is x-locked. This function no longer extends the data file. @return pointer to the extent descriptor, NULL if the page does not exist in the space or if the offset exceeds the free limit */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) xdes_t* xdes_get_descriptor( /*================*/ @@ -618,7 +618,7 @@ byte* fsp_parse_init_file_page( /*=====================*/ byte* ptr, /*!< in: buffer */ - byte* end_ptr __attribute__((unused)), /*!< in: buffer end */ + byte* end_ptr MY_ATTRIBUTE((unused)), /*!< in: buffer end */ buf_block_t* block) /*!< in: block or NULL */ { ut_ad(ptr && end_ptr); @@ -859,7 +859,7 @@ fsp_header_get_tablespace_size(void) Tries to extend a single-table tablespace so that a page would fit in the data file. @return TRUE if success */ -static UNIV_COLD __attribute__((nonnull, warn_unused_result)) +static UNIV_COLD MY_ATTRIBUTE((nonnull, warn_unused_result)) ibool fsp_try_extend_data_file_with_pages( /*================================*/ @@ -891,7 +891,7 @@ fsp_try_extend_data_file_with_pages( /***********************************************************************//** Tries to extend the last data file of a tablespace if it is auto-extending. @return FALSE if not auto-extending */ -static UNIV_COLD __attribute__((nonnull)) +static UNIV_COLD MY_ATTRIBUTE((nonnull)) ibool fsp_try_extend_data_file( /*=====================*/ @@ -1073,7 +1073,8 @@ fsp_fill_free_list( ulint i; mtr_t ibuf_mtr; - ut_ad(header && mtr); + ut_ad(header != NULL); + ut_ad(mtr != NULL); ut_ad(page_offset(header) == FSP_HEADER_OFFSET); /* Check if we can fill free list from above the free list limit */ @@ -1245,7 +1246,7 @@ fsp_alloc_free_extent( /**********************************************************************//** Allocates a single free page from a space. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void fsp_alloc_from_free_frag( /*=====================*/ @@ -1336,7 +1337,7 @@ Allocates a single free page from a space. The page is marked as used. @retval block, rw_lock_x_lock_count(&block->lock) == 1 if allocation succeeded (init_mtr == mtr, or the page was not previously freed in mtr) @retval block (not allocated or initialized) otherwise */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) buf_block_t* fsp_alloc_free_page( /*================*/ @@ -1585,9 +1586,9 @@ fsp_seg_inode_page_get_nth_inode( /*=============================*/ page_t* page, /*!< in: segment inode page */ ulint i, /*!< in: inode index on page */ - ulint zip_size __attribute__((unused)), + ulint zip_size MY_ATTRIBUTE((unused)), /*!< in: compressed page size, or 0 */ - mtr_t* mtr __attribute__((unused))) + mtr_t* mtr MY_ATTRIBUTE((unused))) /*!< in/out: mini-transaction */ { ut_ad(i < FSP_SEG_INODES_PER_PAGE(zip_size)); @@ -1892,7 +1893,7 @@ fseg_get_nth_frag_page_no( /*======================*/ fseg_inode_t* inode, /*!< in: segment inode */ ulint n, /*!< in: slot index */ - mtr_t* mtr __attribute__((unused))) + mtr_t* mtr MY_ATTRIBUTE((unused))) /*!< in/out: mini-transaction */ { ut_ad(inode && mtr); @@ -2986,7 +2987,7 @@ fsp_get_available_space_in_free_extents( /********************************************************************//** Marks a page used. The page must reside within the extents of the given segment. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void fseg_mark_page_used( /*================*/ @@ -3058,7 +3059,8 @@ fseg_free_page_low( ib_id_t seg_id; ulint i; - ut_ad(seg_inode && mtr); + ut_ad(seg_inode != NULL); + ut_ad(mtr != NULL); ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE)); @@ -3273,7 +3275,8 @@ fseg_free_extent( ulint descr_n_used; ulint i; - ut_ad(seg_inode && mtr); + ut_ad(seg_inode != NULL); + ut_ad(mtr != NULL); descr = xdes_get_descriptor(space, zip_size, page, mtr); diff --git a/storage/xtradb/fts/fts0blex.cc b/storage/xtradb/fts/fts0blex.cc index 7d0acb00a3b..2d71934fa0e 100644 --- a/storage/xtradb/fts/fts0blex.cc +++ b/storage/xtradb/fts/fts0blex.cc @@ -305,9 +305,9 @@ YY_BUFFER_STATE fts0b_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner YY_BUFFER_STATE fts0b_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); YY_BUFFER_STATE fts0b_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); -void *fts0balloc (yy_size_t , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) ); -void *fts0brealloc (void *,yy_size_t , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) ); -void fts0bfree (void * , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) ); +void *fts0balloc (yy_size_t , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) ); +void *fts0brealloc (void *,yy_size_t , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) ); +void fts0bfree (void * , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) ); #define yy_new_buffer fts0b_create_buffer @@ -347,7 +347,7 @@ typedef int yy_state_type; static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); static int yy_get_next_buffer (yyscan_t yyscanner ); -static void yy_fatal_error (yyconst char msg[] , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) ); +static void yy_fatal_error (yyconst char msg[] , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. @@ -451,7 +451,7 @@ static yyconst flex_int16_t yy_chk[32] = #line 1 "fts0blex.l" /***************************************************************************** -Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2007, 2016, 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 @@ -579,11 +579,11 @@ extern int fts0bwrap (yyscan_t yyscanner ); #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))); +static void yy_flex_strncpy (char *,yyconst char *,int , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))); +static int yy_flex_strlen (yyconst char * , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))); #endif #ifndef YY_NO_INPUT @@ -1609,7 +1609,7 @@ YY_BUFFER_STATE fts0b_scan_bytes (yyconst char * yybytes, int _yybytes_len , y #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); @@ -1910,7 +1910,7 @@ int fts0blex_destroy (yyscan_t yyscanner) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { register int i; for ( i = 0; i < n; ++i ) @@ -1919,7 +1919,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yys #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { register int n; for ( n = 0; s[n]; ++n ) @@ -1929,12 +1929,12 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner __at } #endif -void *fts0balloc (yy_size_t size , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +void *fts0balloc (yy_size_t size , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { return (void *) malloc( size ); } -void *fts0brealloc (void * ptr, yy_size_t size , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +void *fts0brealloc (void * ptr, yy_size_t size , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those @@ -1946,7 +1946,7 @@ void *fts0brealloc (void * ptr, yy_size_t size , yyscan_t yyscanner return (void *) realloc( (char *) ptr, size ); } -void fts0bfree (void * ptr , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +void fts0bfree (void * ptr , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { free( (char *) ptr ); /* see fts0brealloc() for (char *) cast */ } diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc index a2e8a3d90ac..5e008b37b8d 100644 --- a/storage/xtradb/fts/fts0fts.cc +++ b/storage/xtradb/fts/fts0fts.cc @@ -280,7 +280,7 @@ void fts_words_free( /*===========*/ ib_rbt_t* words) /*!< in: rb tree of words */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifdef FTS_CACHE_SIZE_DEBUG /****************************************************************//** Read the max cache size parameter from the config table. */ @@ -302,7 +302,7 @@ fts_add_doc_by_id( /*==============*/ fts_trx_table_t*ftt, /*!< in: FTS trx table */ doc_id_t doc_id, /*!< in: doc id */ - ib_vector_t* fts_indexes __attribute__((unused))); + ib_vector_t* fts_indexes MY_ATTRIBUTE((unused))); /*!< in: affected fts indexes */ #ifdef FTS_DOC_STATS_DEBUG /****************************************************************//** @@ -317,7 +317,7 @@ fts_is_word_in_index( fts_table_t* fts_table, /*!< in: table instance */ const fts_string_t* word, /*!< in: the word to check */ ibool* found) /*!< out: TRUE if exists */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* FTS_DOC_STATS_DEBUG */ /******************************************************************//** @@ -332,7 +332,7 @@ fts_update_sync_doc_id( const char* table_name, /*!< in: table name, or NULL */ doc_id_t doc_id, /*!< in: last document id */ trx_t* trx) /*!< in: update trx, or NULL */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /****************************************************************//** This function loads the default InnoDB stopword list */ @@ -1075,13 +1075,12 @@ fts_words_free( } } -/*********************************************************************//** -Clear cache. */ +/** Clear cache. +@param[in,out] cache fts cache */ UNIV_INTERN void fts_cache_clear( -/*============*/ - fts_cache_t* cache) /*!< in: cache */ + fts_cache_t* cache) { ulint i; @@ -1477,7 +1476,7 @@ fts_cache_add_doc( /****************************************************************//** Drops a table. If the table can't be found we return a SUCCESS code. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_drop_table( /*===========*/ @@ -1519,7 +1518,7 @@ fts_drop_table( /****************************************************************//** Rename a single auxiliary table due to database name change. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_rename_one_aux_table( /*=====================*/ @@ -1628,7 +1627,7 @@ Drops the common ancillary tables needed for supporting an FTS index on the given table. row_mysql_lock_data_dictionary must have been called before this. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_drop_common_tables( /*===================*/ @@ -1755,7 +1754,7 @@ Drops FTS ancillary tables needed for supporting an FTS index on the given table. row_mysql_lock_data_dictionary must have been called before this. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_drop_all_index_tables( /*======================*/ @@ -2663,7 +2662,7 @@ fts_get_next_doc_id( This function fetch the Doc ID from CONFIG table, and compare with the Doc ID supplied. And store the larger one to the CONFIG table. @return DB_SUCCESS if OK */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) dberr_t fts_cmp_set_sync_doc_id( /*====================*/ @@ -2917,7 +2916,7 @@ fts_add( /*********************************************************************//** Do commit-phase steps necessary for the deletion of a row. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_delete( /*=======*/ @@ -3008,7 +3007,7 @@ fts_delete( /*********************************************************************//** Do commit-phase steps necessary for the modification of a row. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_modify( /*=======*/ @@ -3079,7 +3078,7 @@ fts_create_doc_id( The given transaction is about to be committed; do whatever is necessary from the FTS system's POV. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_commit_table( /*=============*/ @@ -3413,7 +3412,7 @@ fts_add_doc_by_id( /*==============*/ fts_trx_table_t*ftt, /*!< in: FTS trx table */ doc_id_t doc_id, /*!< in: doc id */ - ib_vector_t* fts_indexes __attribute__((unused))) + ib_vector_t* fts_indexes MY_ATTRIBUTE((unused))) /*!< in: affected fts indexes */ { mtr_t mtr; @@ -3533,7 +3532,7 @@ fts_add_doc_by_id( get_doc, clust_index, doc_pcur, offsets, &doc); if (doc.found) { - ibool success __attribute__((unused)); + ibool success MY_ATTRIBUTE((unused)); btr_pcur_store_position(doc_pcur, &mtr); mtr_commit(&mtr); @@ -3642,7 +3641,7 @@ fts_get_max_doc_id( dict_table_t* table) /*!< in: user table */ { dict_index_t* index; - dict_field_t* dfield __attribute__((unused)) = NULL; + dict_field_t* dfield MY_ATTRIBUTE((unused)) = NULL; doc_id_t doc_id = 0; mtr_t mtr; btr_pcur_t pcur; @@ -3900,7 +3899,7 @@ fts_write_node( /*********************************************************************//** Add rows to the DELETED_CACHE table. @return DB_SUCCESS if all went well else error code*/ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_sync_add_deleted_cache( /*=======================*/ @@ -3954,7 +3953,7 @@ fts_sync_add_deleted_cache( @param[in] index_cache index cache @param[in] unlock_cache whether unlock cache when write node @return DB_SUCCESS if all went well else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_sync_write_words( trx_t* trx, @@ -4090,7 +4089,7 @@ fts_sync_write_words( /*********************************************************************//** Write a single documents statistics to disk. @return DB_SUCCESS if all went well else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_sync_write_doc_stat( /*====================*/ @@ -4344,7 +4343,7 @@ fts_sync_begin( Run SYNC on the table, i.e., write out data from the index specific cache to the FTS aux INDEX table and FTS aux doc id stats table. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_sync_index( /*===========*/ @@ -4412,7 +4411,7 @@ fts_sync_index_check( /*********************************************************************//** Commit the SYNC, change state of processed doc ids etc. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_sync_commit( /*============*/ @@ -4474,13 +4473,12 @@ fts_sync_commit( return(error); } -/*********************************************************************//** -Rollback a sync operation */ +/** Rollback a sync operation +@param[in,out] sync sync state */ static void fts_sync_rollback( -/*==============*/ - fts_sync_t* sync) /*!< in: sync state */ + fts_sync_t* sync) { trx_t* trx = sync->trx; fts_cache_t* cache = sync->table->fts->cache; @@ -6170,7 +6168,7 @@ fts_update_hex_format_flag( /*********************************************************************//** Rename an aux table to HEX format. It's called when "%016llu" is used to format an object id in table name, which only happens in Windows. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_rename_one_aux_table_to_hex_format( /*===================================*/ @@ -6261,7 +6259,7 @@ Note the ids in tables are correct but the names are old ambiguous ones. This function should make sure that either all the parent table and aux tables are set DICT_TF2_FTS_AUX_HEX_NAME with flags2 or none of them are set */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_rename_aux_tables_to_hex_format_low( /*====================================*/ @@ -6415,7 +6413,7 @@ fts_fake_hex_to_dec( { ib_id_t dec_id = 0; char tmp_id[FTS_AUX_MIN_TABLE_ID_LENGTH]; - int ret __attribute__((unused)); + int ret MY_ATTRIBUTE((unused)); ret = sprintf(tmp_id, UINT64PFx, id); ut_ad(ret == 16); @@ -6737,7 +6735,7 @@ fts_drop_aux_table_from_vector( Check and drop all orphaned FTS auxiliary tables, those that don't have a parent table or FTS index defined on them. @return DB_SUCCESS or error code */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void fts_check_and_drop_orphaned_tables( /*===============================*/ diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc index ccb7090c61d..d9f2532578e 100644 --- a/storage/xtradb/fts/fts0opt.cc +++ b/storage/xtradb/fts/fts0opt.cc @@ -797,7 +797,7 @@ fts_zip_deflate_end( Read the words from the FTS INDEX. @return DB_SUCCESS if all OK, DB_TABLE_NOT_FOUND if no more indexes to search else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_index_fetch_words( /*==================*/ @@ -1131,7 +1131,7 @@ fts_optimize_lookup( /**********************************************************************//** Encode the word pos list into the node @return DB_SUCCESS or error code*/ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) dberr_t fts_optimize_encode_node( /*=====================*/ @@ -1220,7 +1220,7 @@ fts_optimize_encode_node( /**********************************************************************//** Optimize the data contained in a node. @return DB_SUCCESS or error code*/ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) dberr_t fts_optimize_node( /*==============*/ @@ -1318,7 +1318,7 @@ test_again: /**********************************************************************//** Determine the starting pos within the deleted doc id vector for a word. @return delete position */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) int fts_optimize_deleted_pos( /*=====================*/ @@ -1447,7 +1447,7 @@ fts_optimize_word( /**********************************************************************//** Update the FTS index table. This is a delete followed by an insert. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_write_word( /*====================*/ @@ -1550,7 +1550,7 @@ fts_word_free( /**********************************************************************//** Optimize the word ilist and rewrite data to the FTS index. @return status one of RESTART, EXIT, ERROR */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_compact( /*=================*/ @@ -1645,7 +1645,7 @@ fts_optimize_create( /**********************************************************************//** Get optimize start time of an FTS index. @return DB_SUCCESS if all OK else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_get_index_start_time( /*==============================*/ @@ -1661,7 +1661,7 @@ fts_optimize_get_index_start_time( /**********************************************************************//** Set the optimize start time of an FTS index. @return DB_SUCCESS if all OK else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_set_index_start_time( /*==============================*/ @@ -1677,7 +1677,7 @@ fts_optimize_set_index_start_time( /**********************************************************************//** Get optimize end time of an FTS index. @return DB_SUCCESS if all OK else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_get_index_end_time( /*============================*/ @@ -1692,7 +1692,7 @@ fts_optimize_get_index_end_time( /**********************************************************************//** Set the optimize end time of an FTS index. @return DB_SUCCESS if all OK else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_set_index_end_time( /*============================*/ @@ -1912,7 +1912,7 @@ fts_optimize_set_next_word( Optimize is complete. Set the completion time, and reset the optimize start string for this FTS index to "". @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_index_completed( /*=========================*/ @@ -1952,7 +1952,7 @@ fts_optimize_index_completed( Read the list of words from the FTS auxiliary index that will be optimized in this pass. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_index_read_words( /*==========================*/ @@ -2009,7 +2009,7 @@ fts_optimize_index_read_words( Run OPTIMIZE on the given FTS index. Note: this can take a very long time (hours). @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_index( /*===============*/ @@ -2080,7 +2080,7 @@ fts_optimize_index( /**********************************************************************//** Delete the document ids in the delete, and delete cache tables. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_purge_deleted_doc_ids( /*===============================*/ @@ -2149,7 +2149,7 @@ fts_optimize_purge_deleted_doc_ids( /**********************************************************************//** Delete the document ids in the pending delete, and delete tables. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_purge_deleted_doc_id_snapshot( /*=======================================*/ @@ -2199,7 +2199,7 @@ Copy the deleted doc ids that will be purged during this optimize run to the being deleted FTS auxiliary tables. The transaction is committed upon successfull copy and rolled back on DB_DUPLICATE_KEY error. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_create_deleted_doc_id_snapshot( /*========================================*/ @@ -2237,7 +2237,7 @@ fts_optimize_create_deleted_doc_id_snapshot( Read in the document ids that are to be purged during optimize. The transaction is committed upon successfully read. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_read_deleted_doc_id_snapshot( /*======================================*/ @@ -2274,7 +2274,7 @@ Optimze all the FTS indexes, skipping those that have already been optimized, since the FTS auxiliary indexes are not guaranteed to be of the same cardinality. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_indexes( /*=================*/ @@ -2344,7 +2344,7 @@ fts_optimize_indexes( /*********************************************************************//** Cleanup the snapshot tables and the master deleted table. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_purge_snapshot( /*========================*/ @@ -2373,7 +2373,7 @@ fts_optimize_purge_snapshot( /*********************************************************************//** Reset the start time to 0 so that a new optimize can be started. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_optimize_reset_start_time( /*==========================*/ @@ -2412,7 +2412,7 @@ fts_optimize_reset_start_time( /*********************************************************************//** Run OPTIMIZE on the given table by a background thread. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) dberr_t fts_optimize_table_bk( /*==================*/ @@ -2757,6 +2757,7 @@ fts_optimize_new_table( empty_slot = i; } else if (slot->table->id == table->id) { /* Already exists in our optimize queue. */ + ut_ad(slot->table_id = table->id); return(FALSE); } } @@ -2974,6 +2975,13 @@ fts_optimize_sync_table( { dict_table_t* table = NULL; + /* Prevent DROP INDEX etc. from running when we are syncing + cache in background. */ + if (!rw_lock_s_lock_nowait(&dict_operation_lock, __FILE__, __LINE__)) { + /* Exit when fail to get dict operation lock. */ + return; + } + table = dict_table_open_on_id(table_id, FALSE, DICT_TABLE_OP_NORMAL); if (table) { @@ -2983,6 +2991,8 @@ fts_optimize_sync_table( dict_table_close(table, FALSE, FALSE); } + + rw_lock_s_unlock(&dict_operation_lock); } /**********************************************************************//** diff --git a/storage/xtradb/fts/fts0que.cc b/storage/xtradb/fts/fts0que.cc index 66060439215..2e335c1c255 100644 --- a/storage/xtradb/fts/fts0que.cc +++ b/storage/xtradb/fts/fts0que.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2007, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2007, 2016, 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 @@ -287,7 +287,7 @@ fts_expand_query( dict_index_t* index, /*!< in: FTS index to search */ fts_query_t* query) /*!< in: query result, to be freed by the client */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** This function finds documents that contain all words in a phrase or proximity search. And if proximity search, verify @@ -1128,7 +1128,7 @@ cont_search: /*****************************************************************//** Set difference. @return DB_SUCCESS if all go well */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_query_difference( /*=================*/ @@ -1220,7 +1220,7 @@ fts_query_difference( /*****************************************************************//** Intersect the token doc ids with the current set. @return DB_SUCCESS if all go well */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_query_intersect( /*================*/ @@ -1398,7 +1398,7 @@ fts_query_cache( /*****************************************************************//** Set union. @return DB_SUCCESS if all go well */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_query_union( /*============*/ @@ -2015,7 +2015,7 @@ fts_query_select( Read the rows from the FTS index, that match word and where the doc id is between first and last doc id. @return DB_SUCCESS if all go well else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_query_find_term( /*================*/ @@ -2155,7 +2155,7 @@ fts_query_sum( /******************************************************************** Calculate the total documents that contain a particular word (term). @return DB_SUCCESS if all go well else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_query_total_docs_containing_term( /*=================================*/ @@ -2234,7 +2234,7 @@ fts_query_total_docs_containing_term( /******************************************************************** Get the total number of words in a documents. @return DB_SUCCESS if all go well else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_query_terms_in_document( /*========================*/ @@ -2315,7 +2315,7 @@ fts_query_terms_in_document( /*****************************************************************//** Retrieve the document and match the phrase tokens. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_query_match_document( /*=====================*/ @@ -2361,7 +2361,7 @@ fts_query_match_document( This function fetches the original documents and count the words in between matching words to see that is in specified distance @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool fts_query_is_in_proximity_range( /*============================*/ @@ -2416,7 +2416,7 @@ fts_query_is_in_proximity_range( Iterate over the matched document ids and search the for the actual phrase in the text. @return DB_SUCCESS if all OK */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_query_search_phrase( /*====================*/ @@ -2504,7 +2504,7 @@ func_exit: /*****************************************************************//** Text/Phrase search. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_query_phrase_search( /*====================*/ @@ -2755,7 +2755,7 @@ func_exit: /*****************************************************************//** Find the word and evaluate. @return DB_SUCCESS if all go well */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_query_execute( /*==============*/ @@ -4124,7 +4124,7 @@ words in documents found in the first search pass will be used as search arguments to search the document again, thus "expand" the search result set. @return DB_SUCCESS if success, otherwise the error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t fts_expand_query( /*=============*/ diff --git a/storage/xtradb/fts/fts0tlex.cc b/storage/xtradb/fts/fts0tlex.cc index b744fbf0763..d4d9b4c48d1 100644 --- a/storage/xtradb/fts/fts0tlex.cc +++ b/storage/xtradb/fts/fts0tlex.cc @@ -305,9 +305,9 @@ YY_BUFFER_STATE fts0t_scan_buffer (char *base,yy_size_t size ,yyscan_t yyscanner YY_BUFFER_STATE fts0t_scan_string (yyconst char *yy_str ,yyscan_t yyscanner ); YY_BUFFER_STATE fts0t_scan_bytes (yyconst char *bytes,int len ,yyscan_t yyscanner ); -void *fts0talloc (yy_size_t , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) ); -void *fts0trealloc (void *,yy_size_t , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) ); -void fts0tfree (void * , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) ); +void *fts0talloc (yy_size_t , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) ); +void *fts0trealloc (void *,yy_size_t , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) ); +void fts0tfree (void * , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) ); #define yy_new_buffer fts0t_create_buffer @@ -347,7 +347,7 @@ typedef int yy_state_type; static yy_state_type yy_get_previous_state (yyscan_t yyscanner ); static yy_state_type yy_try_NUL_trans (yy_state_type current_state ,yyscan_t yyscanner); static int yy_get_next_buffer (yyscan_t yyscanner ); -static void yy_fatal_error (yyconst char msg[] , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) ); +static void yy_fatal_error (yyconst char msg[] , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) ); /* Done after the current pattern has been matched and before the * corresponding action - sets up yytext. @@ -447,7 +447,7 @@ static yyconst flex_int16_t yy_chk[29] = #line 1 "fts0tlex.l" /***************************************************************************** -Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2007, 2016, 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 @@ -575,11 +575,11 @@ extern int fts0twrap (yyscan_t yyscanner ); #endif #ifndef yytext_ptr -static void yy_flex_strncpy (char *,yyconst char *,int , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))); +static void yy_flex_strncpy (char *,yyconst char *,int , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))); #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))); +static int yy_flex_strlen (yyconst char * , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))); #endif #ifndef YY_NO_INPUT @@ -1602,7 +1602,7 @@ YY_BUFFER_STATE fts0t_scan_bytes (yyconst char * yybytes, int _yybytes_len , y #define YY_EXIT_FAILURE 2 #endif -static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +static void yy_fatal_error (yyconst char* msg , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { (void) fprintf( stderr, "%s\n", msg ); exit( YY_EXIT_FAILURE ); @@ -1903,7 +1903,7 @@ int fts0tlex_destroy (yyscan_t yyscanner) */ #ifndef yytext_ptr -static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { register int i; for ( i = 0; i < n; ++i ) @@ -1912,7 +1912,7 @@ static void yy_flex_strncpy (char* s1, yyconst char * s2, int n , yys #endif #ifdef YY_NEED_STRLEN -static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { register int n; for ( n = 0; s[n]; ++n ) @@ -1922,12 +1922,12 @@ static int yy_flex_strlen (yyconst char * s , yyscan_t yyscanner __at } #endif -void *fts0talloc (yy_size_t size , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +void *fts0talloc (yy_size_t size , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { return (void *) malloc( size ); } -void *fts0trealloc (void * ptr, yy_size_t size , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +void *fts0trealloc (void * ptr, yy_size_t size , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { /* The cast to (char *) in the following accommodates both * implementations that use char* generic pointers, and those @@ -1939,7 +1939,7 @@ void *fts0trealloc (void * ptr, yy_size_t size , yyscan_t yyscanner return (void *) realloc( (char *) ptr, size ); } -void fts0tfree (void * ptr , yyscan_t yyscanner __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused)) __attribute__((unused))) +void fts0tfree (void * ptr , yyscan_t yyscanner MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused)) MY_ATTRIBUTE((unused))) { free( (char *) ptr ); /* see fts0trealloc() for (char *) cast */ } diff --git a/storage/xtradb/fts/make_parser.sh b/storage/xtradb/fts/make_parser.sh index 2c072914c8b..52b63eff674 100755 --- a/storage/xtradb/fts/make_parser.sh +++ b/storage/xtradb/fts/make_parser.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) 2007, 2011, Oracle and/or its affiliates. All Rights Reserved. +# Copyright (c) 2007, 2016, 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 @@ -22,15 +22,15 @@ make -f Makefile.query echo '#include "univ.i"' > $TMPF # This is to avoid compiler warning about unused parameters. -# FIXME: gcc extension "__attribute__" causing compilation errors on windows +# FIXME: gcc extension "MY_ATTRIBUTE" causing compilation errors on windows # platform. Quote them out for now. sed -e ' -s/^\(static.*void.*yy_fatal_error.*msg.*,\)\(.*yyscanner\)/\1 \2 __attribute__((unused))/; -s/^\(static.*void.*yy_flex_strncpy.*n.*,\)\(.*yyscanner\)/\1 \2 __attribute__((unused))/; -s/^\(static.*int.*yy_flex_strlen.*s.*,\)\(.*yyscanner\)/\1 \2 __attribute__((unused))/; -s/^\(\(static\|void\).*fts0[bt]alloc.*,\)\(.*yyscanner\)/\1 \3 __attribute__((unused))/; -s/^\(\(static\|void\).*fts0[bt]realloc.*,\)\(.*yyscanner\)/\1 \3 __attribute__((unused))/; -s/^\(\(static\|void\).*fts0[bt]free.*,\)\(.*yyscanner\)/\1 \3 __attribute__((unused))/; +s/^\(static.*void.*yy_fatal_error.*msg.*,\)\(.*yyscanner\)/\1 \2 MY_ATTRIBUTE((unused))/; +s/^\(static.*void.*yy_flex_strncpy.*n.*,\)\(.*yyscanner\)/\1 \2 MY_ATTRIBUTE((unused))/; +s/^\(static.*int.*yy_flex_strlen.*s.*,\)\(.*yyscanner\)/\1 \2 MY_ATTRIBUTE((unused))/; +s/^\(\(static\|void\).*fts0[bt]alloc.*,\)\(.*yyscanner\)/\1 \3 MY_ATTRIBUTE((unused))/; +s/^\(\(static\|void\).*fts0[bt]realloc.*,\)\(.*yyscanner\)/\1 \3 MY_ATTRIBUTE((unused))/; +s/^\(\(static\|void\).*fts0[bt]free.*,\)\(.*yyscanner\)/\1 \3 MY_ATTRIBUTE((unused))/; ' < fts0blex.cc >> $TMPF mv $TMPF fts0blex.cc @@ -38,12 +38,12 @@ mv $TMPF fts0blex.cc echo '#include "univ.i"' > $TMPF sed -e ' -s/^\(static.*void.*yy_fatal_error.*msg.*,\)\(.*yyscanner\)/\1 \2 __attribute__((unused))/; -s/^\(static.*void.*yy_flex_strncpy.*n.*,\)\(.*yyscanner\)/\1 \2 __attribute__((unused))/; -s/^\(static.*int.*yy_flex_strlen.*s.*,\)\(.*yyscanner\)/\1 \2 __attribute__((unused))/; -s/^\(\(static\|void\).*fts0[bt]alloc.*,\)\(.*yyscanner\)/\1 \3 __attribute__((unused))/; -s/^\(\(static\|void\).*fts0[bt]realloc.*,\)\(.*yyscanner\)/\1 \3 __attribute__((unused))/; -s/^\(\(static\|void\).*fts0[bt]free.*,\)\(.*yyscanner\)/\1 \3 __attribute__((unused))/; +s/^\(static.*void.*yy_fatal_error.*msg.*,\)\(.*yyscanner\)/\1 \2 MY_ATTRIBUTE((unused))/; +s/^\(static.*void.*yy_flex_strncpy.*n.*,\)\(.*yyscanner\)/\1 \2 MY_ATTRIBUTE((unused))/; +s/^\(static.*int.*yy_flex_strlen.*s.*,\)\(.*yyscanner\)/\1 \2 MY_ATTRIBUTE((unused))/; +s/^\(\(static\|void\).*fts0[bt]alloc.*,\)\(.*yyscanner\)/\1 \3 MY_ATTRIBUTE((unused))/; +s/^\(\(static\|void\).*fts0[bt]realloc.*,\)\(.*yyscanner\)/\1 \3 MY_ATTRIBUTE((unused))/; +s/^\(\(static\|void\).*fts0[bt]free.*,\)\(.*yyscanner\)/\1 \3 MY_ATTRIBUTE((unused))/; ' < fts0tlex.cc >> $TMPF mv $TMPF fts0tlex.cc diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 292d498ebfb..1f7c4948916 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -2045,7 +2045,7 @@ thd_flush_log_at_trx_commit( /********************************************************************//** Obtain the InnoDB transaction of a MySQL thread. @return reference to transaction pointer */ -__attribute__((warn_unused_result, nonnull)) +MY_ATTRIBUTE((warn_unused_result, nonnull)) static inline trx_t*& thd_to_trx( @@ -2081,8 +2081,8 @@ static int innobase_release_temporary_latches( /*===============================*/ - handlerton* hton __attribute__((unused)), /*!< in: handlerton */ - THD* thd __attribute__((unused))) /*!< in: MySQL thread */ + handlerton* hton MY_ATTRIBUTE((unused)), /*!< in: handlerton */ + THD* thd MY_ATTRIBUTE((unused))) /*!< in: MySQL thread */ { #ifdef UNIV_DEBUG DBUG_ASSERT(hton == innodb_hton_ptr); @@ -4455,7 +4455,7 @@ int innobase_end( /*=========*/ handlerton* hton, /*!< in/out: InnoDB handlerton */ - ha_panic_function type __attribute__((unused))) + ha_panic_function type MY_ATTRIBUTE((unused))) /*!< in: ha_panic() parameter */ { int err= 0; @@ -4550,7 +4550,7 @@ static my_bool innobase_is_fake_change( /*====================*/ - handlerton *hton __attribute__((unused)), + handlerton *hton MY_ATTRIBUTE((unused)), /*!< in: InnoDB handlerton */ THD* thd) /*!< in: MySQL thread handle of the user for whom the transaction is being committed */ @@ -11255,7 +11255,7 @@ create_table_check_doc_id_col( /*****************************************************************//** Creates a table definition to an InnoDB database. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) int create_table_def( /*=============*/ @@ -12939,6 +12939,25 @@ ha_innobase::discard_or_import_tablespace( /* Commit the transaction in order to release the table lock. */ trx_commit_for_mysql(prebuilt->trx); + if (err == DB_SUCCESS && !discard + && dict_stats_is_persistent_enabled(dict_table)) { + dberr_t ret; + + /* Adjust the persistent statistics. */ + ret = dict_stats_update(dict_table, + DICT_STATS_RECALC_PERSISTENT); + + if (ret != DB_SUCCESS) { + push_warning_printf( + ha_thd(), + Sql_condition::WARN_LEVEL_WARN, + ER_ALTER_INFO, + "Error updating stats for table '%s'" + " after table rebuild: %s", + dict_table->name, ut_strerr(ret)); + } + } + DBUG_RETURN(convert_error_code_to_mysql(err, dict_table->flags, NULL)); } @@ -13323,7 +13342,7 @@ innobase_drop_database( /*********************************************************************//** Renames an InnoDB table. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t innobase_rename_table( /*==================*/ @@ -18455,7 +18474,7 @@ static char* srv_buffer_pool_evict; Evict all uncompressed pages of compressed tables from the buffer pool. Keep the compressed pages in the buffer pool. @return whether all uncompressed pages were evicted */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) bool innodb_buffer_pool_evict_uncompressed(void) /*=======================================*/ @@ -19078,13 +19097,13 @@ void purge_run_now_set( /*==============*/ THD* thd /*!< in: thread handle */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), struct st_mysql_sys_var* var /*!< in: pointer to system variable */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), void* var_ptr /*!< out: where the formal string goes */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), const void* save) /*!< in: immediate result from check function */ { @@ -19101,13 +19120,13 @@ void purge_stop_now_set( /*===============*/ THD* thd /*!< in: thread handle */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), struct st_mysql_sys_var* var /*!< in: pointer to system variable */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), void* var_ptr /*!< out: where the formal string goes */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), const void* save) /*!< in: immediate result from check function */ { @@ -19123,13 +19142,13 @@ void checkpoint_now_set( /*===============*/ THD* thd /*!< in: thread handle */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), struct st_mysql_sys_var* var /*!< in: pointer to system variable */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), void* var_ptr /*!< out: where the formal string goes */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), const void* save) /*!< in: immediate result from check function */ { @@ -19150,13 +19169,13 @@ void buf_flush_list_now_set( /*===================*/ THD* thd /*!< in: thread handle */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), struct st_mysql_sys_var* var /*!< in: pointer to system - variable */ - __attribute__((unused)), + variable */ + MY_ATTRIBUTE((unused)), void* var_ptr /*!< out: where the formal - string goes */ - __attribute__((unused)), + string goes */ + MY_ATTRIBUTE((unused)), const void* save) /*!< in: immediate result from check function */ { @@ -19173,13 +19192,13 @@ void track_redo_log_now_set( /*===================*/ THD* thd /*!< in: thread handle */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), struct st_mysql_sys_var* var /*!< in: pointer to system variable */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), void* var_ptr /*!< out: where the formal string goes */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), const void* save) /*!< in: immediate result from check function */ { @@ -19288,13 +19307,13 @@ void buffer_pool_dump_now( /*=================*/ THD* thd /*!< in: thread handle */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), struct st_mysql_sys_var* var /*!< in: pointer to system variable */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), void* var_ptr /*!< out: where the formal string goes */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), const void* save) /*!< in: immediate result from check function */ { @@ -21464,7 +21483,7 @@ maria_declare_plugin(xtradb) innodb_status_variables_export,/* status variables */ innobase_system_variables, /* system variables */ INNODB_VERSION_STR, /* string version */ - MariaDB_PLUGIN_MATURITY_GAMMA /* maturity */ + MariaDB_PLUGIN_MATURITY_STABLE /* maturity */ }, i_s_xtradb_read_view, i_s_xtradb_internal_hash_tables, diff --git a/storage/xtradb/handler/ha_innodb.h b/storage/xtradb/handler/ha_innodb.h index ea4be1fb2e0..7b0d20aec72 100644 --- a/storage/xtradb/handler/ha_innodb.h +++ b/storage/xtradb/handler/ha_innodb.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2000, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2013, 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -466,7 +466,7 @@ enum durability_properties thd_get_durability_property(const MYSQL_THD thd); @return True if sql_mode has strict mode (all or trans), false otherwise. */ bool thd_is_strict_mode(const MYSQL_THD thd) -__attribute__((nonnull)); +MY_ATTRIBUTE((nonnull)); } /* extern "C" */ /** Get the file name and position of the MySQL binlog corresponding to the @@ -528,7 +528,7 @@ innobase_index_name_is_reserved( const KEY* key_info, /*!< in: Indexes to be created */ ulint num_of_keys) /*!< in: Number of indexes to be created. */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*****************************************************************//** #ifdef WITH_WSREP @@ -548,7 +548,7 @@ innobase_table_flags( outside system tablespace */ ulint* flags, /*!< out: DICT_TF flags */ ulint* flags2) /*!< out: DICT_TF2 flags */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*****************************************************************//** Validates the create options. We may build on this function @@ -565,7 +565,7 @@ create_options_are_invalid( columns and indexes */ HA_CREATE_INFO* create_info, /*!< in: create info. */ bool use_tablespace) /*!< in: srv_file_per_table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Retrieve the FTS Relevance Ranking result for doc with doc_id @@ -595,7 +595,7 @@ void innobase_fts_close_ranking( /*=======================*/ FT_INFO* fts_hdl) /*!< in: FTS handler */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*****************************************************************//** Initialize the table FTS stopword list @return TRUE if success */ @@ -606,7 +606,7 @@ innobase_fts_load_stopword( dict_table_t* table, /*!< in: Table has the FTS */ trx_t* trx, /*!< in: transaction */ THD* thd) /*!< in: current thread */ - __attribute__((nonnull(1,3), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,3), warn_unused_result)); /** Some defines for innobase_fts_check_doc_id_index() return value */ enum fts_doc_id_index_enum { @@ -628,7 +628,7 @@ innobase_fts_check_doc_id_index( that is being altered */ ulint* fts_doc_col_no) /*!< out: The column number for Doc ID */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /*******************************************************************//** Check whether the table has a unique index with FTS_DOC_ID_INDEX_NAME @@ -641,7 +641,7 @@ innobase_fts_check_doc_id_index_in_def( /*===================================*/ ulint n_key, /*!< in: Number of keys */ const KEY* key_info) /*!< in: Key definitions */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************** @return version of the extended FTS API */ diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc index 7459c4c4199..1ce5595865a 100644 --- a/storage/xtradb/handler/handler0alter.cc +++ b/storage/xtradb/handler/handler0alter.cc @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 2005, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2013, 2016, MariaDB Corporation. 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 @@ -105,7 +105,7 @@ static const Alter_inplace_info::HA_ALTER_FLAGS INNOBASE_ALTER_NOREBUILD | Alter_inplace_info::ALTER_COLUMN_NAME; /* Report an InnoDB error to the client by invoking my_error(). */ -static UNIV_COLD __attribute__((nonnull)) +static UNIV_COLD MY_ATTRIBUTE((nonnull)) void my_error_innodb( /*============*/ @@ -207,7 +207,7 @@ Determine if ALTER TABLE needs to rebuild the table. @param ha_alter_info the DDL operation @param altered_table MySQL original table @return whether it is necessary to rebuild the table */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool innobase_need_rebuild( /*==================*/ @@ -234,7 +234,7 @@ innobase_need_rebuild( & Alter_inplace_info::ADD_INDEX) || (ha_alter_info->handler_flags & Alter_inplace_info::ADD_FOREIGN_KEY))) { - for (ulint i = 0; i < ha_alter_info->key_count; i++) { + for (ulint i = 0; i < ha_alter_info->index_add_count; i++) { const KEY* key = &ha_alter_info->key_info_buffer[ ha_alter_info->index_add_buffer[i]]; @@ -245,13 +245,13 @@ innobase_need_rebuild( /* Field used on added index is renamed on this same alter table. We need table rebuild. */ - if (field->flags & FIELD_IS_RENAMED) { + if (field && field->flags & FIELD_IS_RENAMED) { return (true); } } } } - + return(!!(ha_alter_info->handler_flags & INNOBASE_ALTER_REBUILD)); } @@ -651,7 +651,7 @@ ha_innobase::check_if_supported_inplace_alter( /*************************************************************//** Initialize the dict_foreign_t structure with supplied info @return true if added, false if duplicate foreign->id */ -static __attribute__((nonnull(1,3,5,7))) +static MY_ATTRIBUTE((nonnull(1,3,5,7))) bool innobase_init_foreign( /*==================*/ @@ -740,7 +740,7 @@ innobase_init_foreign( /*************************************************************//** Check whether the foreign key options is legit @return true if it is */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool innobase_check_fk_option( /*=====================*/ @@ -772,7 +772,7 @@ innobase_check_fk_option( /*************************************************************//** Set foreign key options @return true if successfully set */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool innobase_set_foreign_key_option( /*============================*/ @@ -817,7 +817,7 @@ innobase_set_foreign_key_option( Check if a foreign key constraint can make use of an index that is being created. @return useable index, or NULL if none found */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) const KEY* innobase_find_equiv_index( /*======================*/ @@ -873,7 +873,7 @@ no_match: Find an index whose first fields are the columns in the array in the same order and is not marked for deletion @return matching index, NULL if not found */ -static __attribute__((nonnull(1,2,6), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(1,2,6), warn_unused_result)) dict_index_t* innobase_find_fk_index( /*===================*/ @@ -920,7 +920,7 @@ next_rec: Create InnoDB foreign key structure from MySQL alter_info @retval true if successful @retval false on error (will call my_error()) */ -static __attribute__((nonnull(1,2,3,7,8), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(1,2,3,7,8), warn_unused_result)) bool innobase_get_foreign_key_info( /*==========================*/ @@ -1419,7 +1419,7 @@ innobase_rec_reset( /*******************************************************************//** This function checks that index keys are sensible. @return 0 or error number */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) int innobase_check_index_keys( /*======================*/ @@ -1540,7 +1540,7 @@ name_ok: /*******************************************************************//** Create index field definition for key part */ -static __attribute__((nonnull(2,3))) +static MY_ATTRIBUTE((nonnull(2,3))) void innobase_create_index_field_def( /*============================*/ @@ -1589,7 +1589,7 @@ innobase_create_index_field_def( /*******************************************************************//** Create index definition for key */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void innobase_create_index_def( /*======================*/ @@ -1880,7 +1880,7 @@ ELSE ENDIF @return key definitions */ -static __attribute__((nonnull, warn_unused_result, malloc)) +static MY_ATTRIBUTE((nonnull, warn_unused_result, malloc)) index_def_t* innobase_create_key_defs( /*=====================*/ @@ -2104,7 +2104,7 @@ created_clustered: /*******************************************************************//** Check each index column size, make sure they do not exceed the max limit @return true if index column size exceeds limit */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool innobase_check_column_length( /*=========================*/ @@ -2254,7 +2254,7 @@ online_retry_drop_indexes_low( /********************************************************************//** Drop any indexes that we were not able to free previously due to open table handles. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void online_retry_drop_indexes( /*======================*/ @@ -2284,7 +2284,7 @@ online_retry_drop_indexes( /********************************************************************//** Commit a dictionary transaction and drop any indexes that we were not able to free previously due to open table handles. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void online_retry_drop_indexes_with_trx( /*===============================*/ @@ -2313,7 +2313,7 @@ online_retry_drop_indexes_with_trx( @param drop_fk constraints being dropped @param n_drop_fk number of constraints that are being dropped @return whether the constraint is being dropped */ -inline __attribute__((pure, nonnull, warn_unused_result)) +inline MY_ATTRIBUTE((pure, nonnull, warn_unused_result)) bool innobase_dropping_foreign( /*======================*/ @@ -2340,7 +2340,7 @@ column that is being dropped or modified to NOT NULL. @retval true Not allowed (will call my_error()) @retval false Allowed */ -static __attribute__((pure, nonnull, warn_unused_result)) +static MY_ATTRIBUTE((pure, nonnull, warn_unused_result)) bool innobase_check_foreigns_low( /*========================*/ @@ -2440,7 +2440,7 @@ column that is being dropped or modified to NOT NULL. @retval true Not allowed (will call my_error()) @retval false Allowed */ -static __attribute__((pure, nonnull, warn_unused_result)) +static MY_ATTRIBUTE((pure, nonnull, warn_unused_result)) bool innobase_check_foreigns( /*====================*/ @@ -2485,7 +2485,7 @@ innobase_check_foreigns( @param dfield InnoDB data field to copy to @param field MySQL value for the column @param comp nonzero if in compact format */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void innobase_build_col_map_add( /*=======================*/ @@ -2519,7 +2519,7 @@ adding columns. @param heap Memory heap where allocated @return array of integers, mapping column numbers in the table to column numbers in altered_table */ -static __attribute__((nonnull(1,2,3,4,5,7), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(1,2,3,4,5,7), warn_unused_result)) const ulint* innobase_build_col_map( /*===================*/ @@ -2669,7 +2669,7 @@ innobase_drop_fts_index_table( @param user_table InnoDB table as it is before the ALTER operation @param heap Memory heap for the allocation @return array of new column names in rebuilt_table, or NULL if not renamed */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) const char** innobase_get_col_names( Alter_inplace_info* ha_alter_info, @@ -2732,7 +2732,7 @@ while preparing ALTER TABLE. @retval true Failure @retval false Success */ -static __attribute__((warn_unused_result, nonnull(1,2,3,4))) +static MY_ATTRIBUTE((warn_unused_result, nonnull(1,2,3,4))) bool prepare_inplace_alter_table_dict( /*=============================*/ @@ -3392,7 +3392,7 @@ err_exit: /* Check whether an index is needed for the foreign key constraint. If so, if it is dropped, is there an equivalent index can play its role. @return true if the index is needed and can't be dropped */ -static __attribute__((nonnull(1,2,3,5), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(1,2,3,5), warn_unused_result)) bool innobase_check_foreign_key_index( /*=============================*/ @@ -4328,7 +4328,7 @@ temparary index prefix @param locked TRUE=table locked, FALSE=may need to do a lazy drop @param trx the transaction */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void innobase_rollback_sec_index( /*========================*/ @@ -4362,7 +4362,7 @@ during prepare, but might not be during commit). @retval true Failure @retval false Success */ -inline __attribute__((nonnull, warn_unused_result)) +inline MY_ATTRIBUTE((nonnull, warn_unused_result)) bool rollback_inplace_alter_table( /*=========================*/ @@ -4494,7 +4494,7 @@ func_exit: @param foreign_id Foreign key constraint identifier @retval true Failure @retval false Success */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool innobase_drop_foreign_try( /*======================*/ @@ -4551,7 +4551,7 @@ innobase_drop_foreign_try( @param new_clustered whether the table has been rebuilt @retval true Failure @retval false Success */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool innobase_rename_column_try( /*=======================*/ @@ -4760,7 +4760,7 @@ rename_foreign: @param table_name Table name in MySQL @retval true Failure @retval false Success */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool innobase_rename_columns_try( /*========================*/ @@ -4810,7 +4810,7 @@ as part of commit_cache_norebuild(). @param ha_alter_info Data used during in-place alter. @param table the TABLE @param user_table InnoDB table that was being altered */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void innobase_rename_columns_cache( /*==========================*/ @@ -4854,7 +4854,7 @@ processed_field: @param altered_table MySQL table that is being altered @param old_table MySQL table as it is before the ALTER operation @return the next auto-increment value (0 if not present) */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) ulonglong commit_get_autoinc( /*===============*/ @@ -4938,7 +4938,7 @@ but do not touch the data dictionary cache. @retval true Failure @retval false Success */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool innobase_update_foreign_try( /*========================*/ @@ -5022,7 +5022,7 @@ after the changes to data dictionary tables were committed. @param ctx In-place ALTER TABLE context @param user_thd MySQL connection @return InnoDB error code (should always be DB_SUCCESS) */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t innobase_update_foreign_cache( /*==========================*/ @@ -5107,7 +5107,7 @@ when rebuilding the table. @retval true Failure @retval false Success */ -inline __attribute__((nonnull, warn_unused_result)) +inline MY_ATTRIBUTE((nonnull, warn_unused_result)) bool commit_try_rebuild( /*===============*/ @@ -5269,7 +5269,7 @@ commit_try_rebuild( /** Apply the changes made during commit_try_rebuild(), to the data dictionary cache and the file system. @param ctx In-place ALTER TABLE context */ -inline __attribute__((nonnull)) +inline MY_ATTRIBUTE((nonnull)) void commit_cache_rebuild( /*=================*/ @@ -5366,7 +5366,7 @@ when not rebuilding the table. @retval true Failure @retval false Success */ -inline __attribute__((nonnull, warn_unused_result)) +inline MY_ATTRIBUTE((nonnull, warn_unused_result)) bool commit_try_norebuild( /*=================*/ @@ -5476,7 +5476,7 @@ after a successful commit_try_norebuild() call. @param trx Data dictionary transaction object (will be started and committed) @return whether all replacements were found for dropped indexes */ -inline __attribute__((nonnull, warn_unused_result)) +inline MY_ATTRIBUTE((nonnull, warn_unused_result)) bool commit_cache_norebuild( /*===================*/ diff --git a/storage/xtradb/handler/i_s.cc b/storage/xtradb/handler/i_s.cc index a131a50458a..d0e26f1352c 100644 --- a/storage/xtradb/handler/i_s.cc +++ b/storage/xtradb/handler/i_s.cc @@ -792,7 +792,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_trx = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */ @@ -1050,7 +1050,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_locks = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */ @@ -1231,7 +1231,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_lock_waits = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /*******************************************************************//** @@ -1565,7 +1565,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset = @@ -1613,7 +1613,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmp_reset = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /* Fields of the dynamic tables @@ -1912,7 +1912,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index_reset = @@ -1961,7 +1961,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_per_index_reset = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table information_schema.innodb_cmpmem. */ @@ -2203,7 +2203,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset = @@ -2251,7 +2251,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_cmpmem_reset = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_metrics */ @@ -2774,7 +2774,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_metrics = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.innodb_ft_default_stopword */ static ST_FIELD_INFO i_s_stopword_fields_info[] = @@ -2886,7 +2886,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_default_stopword = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_DELETED @@ -3053,7 +3053,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_deleted = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /*******************************************************************//** @@ -3135,7 +3135,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_being_deleted = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_INDEX_CACHED and @@ -3423,7 +3423,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_index_cache = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /*******************************************************************//** @@ -3857,7 +3857,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_index_table = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_FT_CONFIG */ @@ -4054,7 +4054,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_ft_config = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /* Fields of the dynamic table INNODB_BUFFER_POOL_STATS. */ @@ -4601,7 +4601,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_stats = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /* Fields of the dynamic table INNODB_BUFFER_POOL_PAGE. */ @@ -5310,7 +5310,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] = @@ -5855,7 +5855,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_buffer_page_lru = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /*******************************************************************//** @@ -6147,7 +6147,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tables = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /** SYS_TABLESTATS ***********************************************/ @@ -6435,7 +6435,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_tablestats = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /** SYS_INDEXES **************************************************/ @@ -6685,7 +6685,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_indexes = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /** SYS_COLUMNS **************************************************/ @@ -6920,7 +6920,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_columns = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /** SYS_FIELDS ***************************************************/ @@ -7128,7 +7128,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_fields = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /** SYS_FOREIGN ********************************************/ @@ -7351,7 +7351,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /** SYS_FOREIGN_COLS ********************************************/ @@ -7566,7 +7566,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_sys_foreign_cols = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /** SYS_TABLESPACES ********************************************/ @@ -7833,7 +7833,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_tablespaces = STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_DATAFILES ************************************************/ @@ -8020,7 +8020,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_datafiles = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; static ST_FIELD_INFO i_s_innodb_changed_pages_info[] = @@ -8389,7 +8389,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_changed_pages = STRUCT_FLD(version, 0x0100 /* 1.0 */), STRUCT_FLD(status_vars, NULL), STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /** TABLESPACES_ENCRYPTION ********************************************/ @@ -8681,7 +8681,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_encryption = /* struct st_mysql_sys_var** */ STRUCT_FLD(system_vars, NULL), - INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_GAMMA + INNODB_VERSION_STR, MariaDB_PLUGIN_MATURITY_STABLE }; /** TABLESPACES_SCRUBBING ********************************************/ @@ -8980,7 +8980,7 @@ UNIV_INTERN struct st_maria_plugin i_s_innodb_tablespaces_scrubbing = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA) + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE) }; /** INNODB_MUTEXES *********************************************/ @@ -9194,7 +9194,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_mutexes = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; /** SYS_SEMAPHORE_WAITS ************************************************/ @@ -9471,7 +9471,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_sys_semaphore_waits = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; static ST_FIELD_INFO innodb_changed_page_bitmaps_fields_info[] = @@ -9595,6 +9595,6 @@ UNIV_INTERN struct st_mysql_plugin i_s_innodb_changed_page_bitmaps = /* Maria extension */ STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; diff --git a/storage/xtradb/handler/xtradb_i_s.cc b/storage/xtradb/handler/xtradb_i_s.cc index a0ff959013a..96e31b94470 100644 --- a/storage/xtradb/handler/xtradb_i_s.cc +++ b/storage/xtradb/handler/xtradb_i_s.cc @@ -176,7 +176,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_xtradb_read_view = STRUCT_FLD(status_vars, NULL), STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; static ST_FIELD_INFO xtradb_internal_hash_tables_fields_info[] = @@ -381,7 +381,7 @@ UNIV_INTERN struct st_mysql_plugin i_s_xtradb_internal_hash_tables = STRUCT_FLD(status_vars, NULL), STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; @@ -514,5 +514,5 @@ UNIV_INTERN struct st_mysql_plugin i_s_xtradb_rseg = STRUCT_FLD(status_vars, NULL), STRUCT_FLD(system_vars, NULL), STRUCT_FLD(version_info, INNODB_VERSION_STR), - STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_GAMMA), + STRUCT_FLD(maturity, MariaDB_PLUGIN_MATURITY_STABLE), }; diff --git a/storage/xtradb/ibuf/ibuf0ibuf.cc b/storage/xtradb/ibuf/ibuf0ibuf.cc index 4467b713c88..dc6ad49838e 100644 --- a/storage/xtradb/ibuf/ibuf0ibuf.cc +++ b/storage/xtradb/ibuf/ibuf0ibuf.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -711,7 +711,7 @@ byte* ibuf_parse_bitmap_init( /*===================*/ byte* ptr, /*!< in: buffer */ - byte* end_ptr __attribute__((unused)), /*!< in: buffer end */ + byte* end_ptr MY_ATTRIBUTE((unused)), /*!< in: buffer end */ buf_block_t* block, /*!< in: block or NULL */ mtr_t* mtr) /*!< in: mtr or NULL */ { @@ -2554,7 +2554,7 @@ ibuf_get_merge_page_nos_func( /*******************************************************************//** Get the matching records for space id. @return current rec or NULL */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) const rec_t* ibuf_get_user_rec( /*===============*/ @@ -2576,7 +2576,7 @@ ibuf_get_user_rec( Reads page numbers for a space id from an ibuf tree. @return a lower limit for the combined volume of records which will be merged */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) ulint ibuf_get_merge_pages( /*=================*/ @@ -2684,40 +2684,22 @@ ibuf_merge_pages( } /*********************************************************************//** -Get the table instance from the table id. -@return table instance */ -static __attribute__((warn_unused_result)) -dict_table_t* -ibuf_get_table( -/*===========*/ - table_id_t table_id) /*!< in: valid table id */ -{ - rw_lock_s_lock_func(&dict_operation_lock, 0, __FILE__, __LINE__); - - dict_table_t* table = dict_table_open_on_id( - table_id, FALSE, DICT_TABLE_OP_NORMAL); - - rw_lock_s_unlock_gen(&dict_operation_lock, 0); - - return(table); -} - -/*********************************************************************//** -Contracts insert buffer trees by reading pages to the buffer pool. -@return a lower limit for the combined size in bytes of entries which -will be merged from ibuf trees to the pages read, 0 if ibuf is -empty */ -static +Contracts insert buffer trees by reading pages referring to space_id +to the buffer pool. +@returns number of pages merged.*/ +UNIV_INTERN ulint ibuf_merge_space( /*=============*/ - ulint space, /*!< in: tablespace id to merge */ - ulint* n_pages)/*!< out: number of pages to which merged */ + ulint space) /*!< in: tablespace id to merge */ { mtr_t mtr; btr_pcur_t pcur; mem_heap_t* heap = mem_heap_create(512); dtuple_t* tuple = ibuf_search_tuple_build(space, 0, heap); + ulint n_pages = 0; + + ut_ad(space < SRV_LOG_SPACE_FIRST_ID); ibuf_mtr_start(&mtr); @@ -2749,52 +2731,46 @@ ibuf_merge_space( } else { sum_sizes = ibuf_get_merge_pages( - &pcur, space, IBUF_MAX_N_PAGES_MERGED, - &pages[0], &spaces[0], &versions[0], n_pages, - &mtr); - - if (*n_pages > 0) { - ++sum_sizes; - } + &pcur, space, IBUF_MAX_N_PAGES_MERGED, + &pages[0], &spaces[0], &versions[0], &n_pages, + &mtr); + ib_logf(IB_LOG_LEVEL_INFO,"\n Size of pages merged %lu" + ,sum_sizes); } ibuf_mtr_commit(&mtr); btr_pcur_close(&pcur); - if (sum_sizes > 0) { - - ut_a(*n_pages > 0 || sum_sizes == 1); + if (n_pages > 0) { #ifdef UNIV_DEBUG - ut_ad(*n_pages <= UT_ARR_SIZE(pages)); + ut_ad(n_pages <= UT_ARR_SIZE(pages)); - for (ulint i = 0; i < *n_pages; ++i) { + for (ulint i = 0; i < n_pages; ++i) { ut_ad(spaces[i] == space); ut_ad(i == 0 || versions[i] == versions[i - 1]); } #endif /* UNIV_DEBUG */ buf_read_ibuf_merge_pages( - true, spaces, versions, pages, *n_pages); + true, spaces, versions, pages, n_pages); } - return(sum_sizes); + return(n_pages); } -/*********************************************************************//** -Contracts insert buffer trees by reading pages to the buffer pool. +/** Contract the change buffer by reading pages to the buffer pool. +@param[out] n_pages number of pages merged +@param[in] sync whether the caller waits for +the issued reads to complete @return a lower limit for the combined size in bytes of entries which will be merged from ibuf trees to the pages read, 0 if ibuf is empty */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) ulint ibuf_merge( /*=======*/ - table_id_t table_id, /*!< in: if merge should be - done only for a specific - table, for all tables this - should be 0 */ ulint* n_pages, /*!< out: number of pages to which merged */ bool sync) /*!< in: TRUE if the caller @@ -2802,8 +2778,6 @@ ibuf_merge( read with the highest tablespace address to complete */ { - dict_table_t* table; - *n_pages = 0; /* We perform a dirty read of ibuf->empty, without latching @@ -2817,55 +2791,45 @@ ibuf_merge( } else if (ibuf_debug) { return(0); #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ - } else if (table_id == 0) { + } else { return(ibuf_merge_pages(n_pages, sync)); - } else if ((table = ibuf_get_table(table_id)) == 0) { - /* Table has been dropped. */ - return(0); } - - ulint volume = ibuf_merge_space(table->space, n_pages); - - dict_table_close(table, FALSE, FALSE); - - return(volume); } -/*********************************************************************//** -Contracts insert buffer trees by reading pages to the buffer pool. +/** Contract the change buffer by reading pages to the buffer pool. +@param[in] sync whether the caller waits for +the issued reads to complete @return a lower limit for the combined size in bytes of entries which -will be merged from ibuf trees to the pages read, 0 if ibuf is -empty */ +will be merged from ibuf trees to the pages read, 0 if ibuf is empty */ static ulint ibuf_contract( /*==========*/ - ibool sync) /*!< in: TRUE if the caller wants to wait for the + bool sync) /*!< in: TRUE if the caller wants to wait for the issued read with the highest tablespace address to complete */ { ulint n_pages; - return(ibuf_merge(0, &n_pages, sync)); + return(ibuf_merge_pages(&n_pages, sync)); } -/*********************************************************************//** -Contracts insert buffer trees by reading pages to the buffer pool. +/** Contract the change buffer by reading pages to the buffer pool. +@param[in] full If true, do a full contraction based +on PCT_IO(100). If false, the size of contract batch is determined +based on the current size of the change buffer. @return a lower limit for the combined size in bytes of entries which will be merged from ibuf trees to the pages read, 0 if ibuf is empty */ UNIV_INTERN ulint -ibuf_contract_in_background( -/*========================*/ - table_id_t table_id, /*!< in: if merge should be done only - for a specific table, for all tables - this should be 0 */ - ibool full) /*!< in: TRUE if the caller wants to - do a full contract based on PCT_IO(100). - If FALSE then the size of contract - batch is determined based on the - current size of the ibuf tree. */ +ibuf_merge_in_background( +/*=====================*/ + bool full) /*!< in: TRUE if the caller wants to + do a full contract based on PCT_IO(100). + If FALSE then the size of contract + batch is determined based on the + current size of the ibuf tree. */ { ulint sum_bytes = 0; ulint sum_pages = 0; @@ -2873,7 +2837,7 @@ ibuf_contract_in_background( ulint n_pages; #if defined UNIV_DEBUG || defined UNIV_IBUF_DEBUG - if (srv_ibuf_disable_background_merge && table_id == 0) { + if (srv_ibuf_disable_background_merge) { return(0); } #endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ @@ -2908,7 +2872,7 @@ ibuf_contract_in_background( while (sum_pages < n_pages) { ulint n_bytes; - n_bytes = ibuf_merge(table_id, &n_pag2, FALSE); + n_bytes = ibuf_merge(&n_pag2, false); if (n_bytes == 0) { return(sum_bytes); @@ -3514,7 +3478,7 @@ ibuf_get_entry_counter_func( Buffer an operation in the insert/delete buffer, instead of doing it directly to the disk page, if this is possible. @return DB_SUCCESS, DB_STRONG_FAIL or other error */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t ibuf_insert_low( /*============*/ @@ -3583,8 +3547,7 @@ ibuf_insert_low( #ifdef UNIV_IBUF_DEBUG fputs("Ibuf too big\n", stderr); #endif - /* Use synchronous contract (== TRUE) */ - ibuf_contract(TRUE); + ibuf_contract(true); return(DB_STRONG_FAIL); } @@ -4007,7 +3970,7 @@ skip_watch: During merge, inserts to an index page a secondary index entry extracted from the insert buffer. @return newly inserted record */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) rec_t* ibuf_insert_to_index_page_low( /*==========================*/ @@ -4438,7 +4401,7 @@ ibuf_delete( /*********************************************************************//** Restores insert buffer tree cursor position @return TRUE if the position was restored; FALSE if not */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) ibool ibuf_restore_pos( /*=============*/ @@ -4493,7 +4456,7 @@ Deletes from ibuf the record on which pcur is positioned. If we have to resort to a pessimistic delete, this function commits mtr and closes the cursor. @return TRUE if mtr was committed and pcur closed in this operation */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) ibool ibuf_delete_rec( /*============*/ diff --git a/storage/xtradb/include/api0api.h b/storage/xtradb/include/api0api.h index e4c9c941de5..500bf4fe3b2 100644 --- a/storage/xtradb/include/api0api.h +++ b/storage/xtradb/include/api0api.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2011, 2016, 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 @@ -36,7 +36,7 @@ InnoDB Native API #endif #if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER) -#define UNIV_NO_IGNORE __attribute__ ((warn_unused_result)) +#define UNIV_NO_IGNORE MY_ATTRIBUTE ((warn_unused_result)) #else #define UNIV_NO_IGNORE #endif /* __GNUC__ && __GNUC__ > 2 && !__INTEL_COMPILER */ diff --git a/storage/xtradb/include/btr0btr.h b/storage/xtradb/include/btr0btr.h index 36aaf676ccf..5047d1b2d4e 100644 --- a/storage/xtradb/include/btr0btr.h +++ b/storage/xtradb/include/btr0btr.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. Copyright (c) 2014, 2015, MariaDB Corporation. All Rights Reserved. @@ -118,7 +118,7 @@ btr_corruption_report( /*==================*/ const buf_block_t* block, /*!< in: corrupted block */ const dict_index_t* index) /*!< in: index tree */ - UNIV_COLD __attribute__((nonnull)); + UNIV_COLD MY_ATTRIBUTE((nonnull)); /** Assert that a B-tree page is not corrupted. @param block buffer block containing a B-tree page @@ -160,7 +160,7 @@ btr_blob_dbg_add_blob( ulint page_no, /*!< in: start page of the column */ dict_index_t* index, /*!< in/out: index tree */ const char* ctx) /*!< in: context (for logging) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Display the references to off-page columns. This function is to be called from a debugger, @@ -170,7 +170,7 @@ void btr_blob_dbg_print( /*===============*/ const dict_index_t* index) /*!< in: index tree */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Check that there are no references to off-page columns from or to the given page. Invoked when freeing or clearing a page. @@ -181,7 +181,7 @@ btr_blob_dbg_is_empty( /*==================*/ dict_index_t* index, /*!< in: index */ ulint page_no) /*!< in: page number */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**************************************************************//** Modify the 'deleted' flag of a record. */ @@ -193,7 +193,7 @@ btr_blob_dbg_set_deleted_flag( dict_index_t* index, /*!< in/out: index */ const ulint* offsets,/*!< in: rec_get_offs(rec, index) */ ibool del) /*!< in: TRUE=deleted, FALSE=exists */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Change the ownership of an off-page column. */ UNIV_INTERN @@ -205,7 +205,7 @@ btr_blob_dbg_owner( const ulint* offsets,/*!< in: rec_get_offs(rec, index) */ ulint i, /*!< in: ith field in rec */ ibool own) /*!< in: TRUE=owned, FALSE=disowned */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /** Assert that there are no BLOB references to or from the given page. */ # define btr_blob_dbg_assert_empty(index, page_no) \ ut_a(btr_blob_dbg_is_empty(index, page_no)) @@ -225,7 +225,7 @@ btr_root_get( /*=========*/ const dict_index_t* index, /*!< in: index tree */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Checks and adjusts the root node of a tree during IMPORT TABLESPACE. @@ -235,7 +235,7 @@ dberr_t btr_root_adjust_on_import( /*======================*/ const dict_index_t* index) /*!< in: index tree */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**************************************************************//** Gets the height of the B-tree (the level of the root, when the leaf @@ -248,7 +248,7 @@ btr_height_get( /*===========*/ dict_index_t* index, /*!< in: index tree */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**************************************************************//** Gets a buffer page and declares its latching order level. */ UNIV_INLINE @@ -310,7 +310,7 @@ index_id_t btr_page_get_index_id( /*==================*/ const page_t* page) /*!< in: index page */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); #ifndef UNIV_HOTBACKUP /********************************************************//** Gets the node level field in an index page. @@ -320,7 +320,7 @@ ulint btr_page_get_level_low( /*===================*/ const page_t* page) /*!< in: index page */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); #define btr_page_get_level(page, mtr) btr_page_get_level_low(page) /********************************************************//** Gets the next index page number. @@ -331,7 +331,7 @@ btr_page_get_next( /*==============*/ const page_t* page, /*!< in: index page */ mtr_t* mtr) /*!< in: mini-transaction handle */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************//** Gets the previous index page number. @return prev page number */ @@ -341,7 +341,7 @@ btr_page_get_prev( /*==============*/ const page_t* page, /*!< in: index page */ mtr_t* mtr) /*!< in: mini-transaction handle */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Gets pointer to the previous user record in the tree. It is assumed that the caller has appropriate latches on the page and its neighbor. @@ -353,7 +353,7 @@ btr_get_prev_user_rec( rec_t* rec, /*!< in: record on leaf level */ mtr_t* mtr) /*!< in: mtr holding a latch on the page, and if needed, also to the previous page */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Gets pointer to the next user record in the tree. It is assumed that the caller has appropriate latches on the page and its neighbor. @@ -365,7 +365,7 @@ btr_get_next_user_rec( rec_t* rec, /*!< in: record on leaf level */ mtr_t* mtr) /*!< in: mtr holding a latch on the page, and if needed, also to the next page */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**************************************************************//** Releases the latch on a leaf page and bufferunfixes it. */ UNIV_INLINE @@ -376,7 +376,7 @@ btr_leaf_page_release( ulint latch_mode, /*!< in: BTR_SEARCH_LEAF or BTR_MODIFY_LEAF */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Gets the child node file address in a node pointer. NOTE: the offsets array must contain all offsets for the record since @@ -390,7 +390,7 @@ btr_node_ptr_get_child_page_no( /*===========================*/ const rec_t* rec, /*!< in: node pointer record */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /************************************************************//** Creates the root node for a new index tree. @return page number of the created root, FIL_NULL if did not succeed */ @@ -405,7 +405,7 @@ btr_create( index_id_t index_id,/*!< in: index id */ dict_index_t* index, /*!< in: index */ mtr_t* mtr) /*!< in: mini-transaction handle */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /************************************************************//** Frees a B-tree except the root page, which MUST be freed after this by calling btr_free_root. */ @@ -428,7 +428,7 @@ btr_free_root( or 0 for uncompressed pages */ ulint root_page_no, /*!< in: root page number */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Makes tree one level higher by splitting the root, and inserts the tuple. It is assumed that mtr contains an x-latch on the tree. @@ -477,7 +477,7 @@ btr_page_reorganize_low( page_cur_t* cursor, /*!< in/out: page cursor */ dict_index_t* index, /*!< in: the index tree of the page */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Reorganizes an index page. @@ -496,7 +496,7 @@ btr_page_reorganize( page_cur_t* cursor, /*!< in/out: page cursor */ dict_index_t* index, /*!< in: the index tree of the page */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Decides if the page should be split at the convergence point of inserts converging to left. @@ -509,7 +509,7 @@ btr_page_get_split_rec_to_left( rec_t** split_rec)/*!< out: if split recommended, the first record on upper half page, or NULL if tuple should be first */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Decides if the page should be split at the convergence point of inserts converging to right. @@ -522,7 +522,7 @@ btr_page_get_split_rec_to_right( rec_t** split_rec)/*!< out: if split recommended, the first record on upper half page, or NULL if tuple should be first */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Splits an index page to halves and inserts the tuple. It is assumed that mtr holds an x-latch to the index tree. NOTE: the tree x-latch is @@ -561,7 +561,7 @@ btr_insert_on_non_leaf_level_func( const char* file, /*!< in: file name */ ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); # define btr_insert_on_non_leaf_level(f,i,l,t,m) \ btr_insert_on_non_leaf_level_func(f,i,l,t,__FILE__,__LINE__,m) #endif /* !UNIV_HOTBACKUP */ @@ -573,7 +573,7 @@ btr_set_min_rec_mark( /*=================*/ rec_t* rec, /*!< in/out: record */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifndef UNIV_HOTBACKUP /*************************************************************//** Deletes on the upper level the node pointer to a page. */ @@ -584,7 +584,7 @@ btr_node_ptr_delete( dict_index_t* index, /*!< in: index tree */ buf_block_t* block, /*!< in: page whose node pointer is deleted */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifdef UNIV_DEBUG /************************************************************//** Checks that the node pointer to a page is appropriate. @@ -596,7 +596,7 @@ btr_check_node_ptr( dict_index_t* index, /*!< in: index tree */ buf_block_t* block, /*!< in: index page */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* UNIV_DEBUG */ /*************************************************************//** Tries to merge the page first to the left immediate brother if such a @@ -619,7 +619,7 @@ btr_compress( ibool adjust, /*!< in: TRUE if should adjust the cursor position even if compression occurs */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Discards a page from a B-tree. This is used to remove the last record from a B-tree page: the whole page must be removed at the same time. This cannot @@ -631,7 +631,7 @@ btr_discard_page( btr_cur_t* cursor, /*!< in: cursor on the page to discard: not on the root page */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* !UNIV_HOTBACKUP */ /****************************************************************//** Parses the redo log record for setting an index record as the predefined @@ -646,7 +646,7 @@ btr_parse_set_min_rec_mark( ulint comp, /*!< in: nonzero=compact page format */ page_t* page, /*!< in: page or NULL */ mtr_t* mtr) /*!< in: mtr or NULL */ - __attribute__((nonnull(1,2), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2), warn_unused_result)); /***********************************************************//** Parses a redo log record of reorganizing a page. @return end of log record or NULL */ @@ -660,7 +660,7 @@ btr_parse_page_reorganize( bool compressed,/*!< in: true if compressed page */ buf_block_t* block, /*!< in: page to be reorganized, or NULL */ mtr_t* mtr) /*!< in: mtr or NULL */ - __attribute__((nonnull(1,2,3), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2,3), warn_unused_result)); #ifndef UNIV_HOTBACKUP /**************************************************************//** Gets the number of pages in a B-tree. @@ -673,7 +673,7 @@ btr_get_size( ulint flag, /*!< in: BTR_N_LEAF_PAGES or BTR_TOTAL_SIZE */ mtr_t* mtr) /*!< in/out: mini-transaction where index is s-latched */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**************************************************************//** Gets the number of reserved and used pages in a B-tree. @return number of pages reserved, or ULINT_UNDEFINED if the index @@ -711,7 +711,7 @@ btr_page_alloc( mtr_t* init_mtr) /*!< in/out: mini-transaction for x-latching and initializing the page */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**************************************************************//** Frees a file page used in an index tree. NOTE: cannot free field external storage pages because the page must contain info on its level. */ @@ -722,7 +722,7 @@ btr_page_free( dict_index_t* index, /*!< in: index tree */ buf_block_t* block, /*!< in: block to be freed, x-latched */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Frees a file page used in an index tree. Can be used also to BLOB external storage pages, because the page level 0 can be given as an @@ -772,7 +772,7 @@ void btr_print_size( /*===========*/ dict_index_t* index) /*!< in: index tree */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Prints directories and other info of all nodes in the index. */ UNIV_INTERN @@ -782,7 +782,7 @@ btr_print_index( dict_index_t* index, /*!< in: index */ ulint width) /*!< in: print this many entries from start and end */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* UNIV_BTR_PRINT */ /************************************************************//** Checks the size and number of fields in a record based on the definition of @@ -797,7 +797,7 @@ btr_index_rec_validate( ibool dump_on_error) /*!< in: TRUE if the function should print hex dump of record and page on error */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**************************************************************//** Checks the consistency of an index tree. @return DB_SUCCESS if ok, error code if not */ @@ -807,7 +807,7 @@ btr_validate_index( /*===============*/ dict_index_t* index, /*!< in: index */ const trx_t* trx) /*!< in: transaction or 0 */ - __attribute__((nonnull(1), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1), warn_unused_result)); #ifdef UNIV_SYNC_DEBUG /*************************************************************//** diff --git a/storage/xtradb/include/btr0btr.ic b/storage/xtradb/include/btr0btr.ic index 5fc621f469d..8c9c3bead09 100644 --- a/storage/xtradb/include/btr0btr.ic +++ b/storage/xtradb/include/btr0btr.ic @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, MariaDB Corporation. +Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -165,10 +165,11 @@ ulint btr_page_get_next( /*==============*/ const page_t* page, /*!< in: index page */ - mtr_t* mtr __attribute__((unused))) + mtr_t* mtr MY_ATTRIBUTE((unused))) /*!< in: mini-transaction handle */ { - ut_ad(page && mtr); + ut_ad(page != NULL); + ut_ad(mtr != NULL); #ifndef UNIV_INNOCHECKSUM ut_ad(mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_X_FIX) || mtr_memo_contains_page(mtr, page, MTR_MEMO_PAGE_S_FIX)); @@ -188,7 +189,8 @@ btr_page_set_next( ulint next, /*!< in: next page number */ mtr_t* mtr) /*!< in: mini-transaction handle */ { - ut_ad(page && mtr); + ut_ad(page != NULL); + ut_ad(mtr != NULL); if (page_zip) { mach_write_to_4(page + FIL_PAGE_NEXT, next); @@ -206,9 +208,10 @@ ulint btr_page_get_prev( /*==============*/ const page_t* page, /*!< in: index page */ - mtr_t* mtr __attribute__((unused))) /*!< in: mini-transaction handle */ + mtr_t* mtr MY_ATTRIBUTE((unused))) /*!< in: mini-transaction handle */ { - ut_ad(page && mtr); + ut_ad(page != NULL); + ut_ad(mtr != NULL); return(mach_read_from_4(page + FIL_PAGE_PREV)); } @@ -225,7 +228,8 @@ btr_page_set_prev( ulint prev, /*!< in: previous page number */ mtr_t* mtr) /*!< in: mini-transaction handle */ { - ut_ad(page && mtr); + ut_ad(page != NULL); + ut_ad(mtr != NULL); if (page_zip) { mach_write_to_4(page + FIL_PAGE_PREV, prev); diff --git a/storage/xtradb/include/btr0cur.h b/storage/xtradb/include/btr0cur.h index 2c60f3ad64c..f485d072c4c 100644 --- a/storage/xtradb/include/btr0cur.h +++ b/storage/xtradb/include/btr0cur.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -186,7 +186,7 @@ btr_cur_open_at_index_side_func( const char* file, /*!< in: file name */ ulint line, /*!< in: line where called */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #define btr_cur_open_at_index_side(f,i,l,c,lv,m) \ btr_cur_open_at_index_side_func(f,i,l,c,lv,__FILE__,__LINE__,m) /**********************************************************************//** @@ -235,7 +235,7 @@ btr_cur_optimistic_insert( compressed tablespace, the caller must mtr_commit(mtr) before latching any further pages */ - __attribute__((nonnull(2,3,4,5,6,7,10), warn_unused_result)); + MY_ATTRIBUTE((nonnull(2,3,4,5,6,7,10), warn_unused_result)); /*************************************************************//** Performs an insert on a page of an index tree. It is assumed that mtr holds an x-latch on the tree and on the cursor page. If the insert is @@ -266,7 +266,7 @@ btr_cur_pessimistic_insert( ulint n_ext, /*!< in: number of externally stored columns */ que_thr_t* thr, /*!< in: query thread or NULL */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull(2,3,4,5,6,7,10), warn_unused_result)); + MY_ATTRIBUTE((nonnull(2,3,4,5,6,7,10), warn_unused_result)); /*************************************************************//** See if there is enough place in the page modification log to log an update-in-place. @@ -295,9 +295,9 @@ btr_cur_update_alloc_zip_func( mtr_t* mtr, /*!< in/out: mini-transaction */ trx_t* trx) /*!< in: NULL or transaction */ #ifdef UNIV_DEBUG - __attribute__((nonnull (1, 2, 3, 4, 7), warn_unused_result)); + MY_ATTRIBUTE((nonnull (1, 2, 3, 4, 7), warn_unused_result)); #else - __attribute__((nonnull (1, 2, 3, 6), warn_unused_result)); + MY_ATTRIBUTE((nonnull (1, 2, 3, 6), warn_unused_result)); #endif #ifdef UNIV_DEBUG @@ -331,7 +331,7 @@ btr_cur_update_in_place( is a secondary index, the caller must mtr_commit(mtr) before latching any further pages */ - __attribute__((warn_unused_result, nonnull)); + MY_ATTRIBUTE((warn_unused_result, nonnull)); /***********************************************************//** Writes a redo log record of updating a record in-place. */ UNIV_INTERN @@ -345,7 +345,7 @@ btr_cur_update_in_place_log( trx_id_t trx_id, /*!< in: transaction id */ roll_ptr_t roll_ptr, /*!< in: roll ptr */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Tries to update a record on a page in an index tree. It is assumed that mtr holds an x-latch on the page. The operation does not succeed if there is too @@ -377,7 +377,7 @@ btr_cur_optimistic_update( is a secondary index, the caller must mtr_commit(mtr) before latching any further pages */ - __attribute__((warn_unused_result, nonnull)); + MY_ATTRIBUTE((warn_unused_result, nonnull)); /*************************************************************//** Performs an update of a record on a page of a tree. It is assumed that mtr holds an x-latch on the tree and on the cursor page. If the @@ -411,7 +411,7 @@ btr_cur_pessimistic_update( trx_id_t trx_id, /*!< in: transaction id */ mtr_t* mtr) /*!< in/out: mini-transaction; must be committed before latching any further pages */ - __attribute__((warn_unused_result, nonnull)); + MY_ATTRIBUTE((warn_unused_result, nonnull)); /***********************************************************//** Marks a clustered index record deleted. Writes an undo log record to undo log on this delete marking. Writes in the trx id field the id @@ -428,7 +428,7 @@ btr_cur_del_mark_set_clust_rec( const ulint* offsets,/*!< in: rec_get_offsets(rec) */ que_thr_t* thr, /*!< in: query thread */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************//** Sets a secondary index record delete mark to TRUE or FALSE. @return DB_SUCCESS, DB_LOCK_WAIT, or error number */ @@ -441,7 +441,7 @@ btr_cur_del_mark_set_sec_rec( ibool val, /*!< in: value to set */ que_thr_t* thr, /*!< in: query thread */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Tries to compress a page of the tree if it seems useful. It is assumed that mtr holds an x-latch on the tree and on the cursor page. To avoid @@ -459,7 +459,7 @@ btr_cur_compress_if_useful( ibool adjust, /*!< in: TRUE if should adjust the cursor position even if compression occurs */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*******************************************************//** Removes the record on which the tree cursor is positioned. It is assumed that the mtr has an x-latch on the page where the cursor is positioned, @@ -480,7 +480,7 @@ btr_cur_optimistic_delete_func( TRUE on a leaf page of a secondary index, the mtr must be committed before latching any further pages */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); # ifdef UNIV_DEBUG # define btr_cur_optimistic_delete(cursor, flags, mtr) \ btr_cur_optimistic_delete_func(cursor, flags, mtr) @@ -516,7 +516,7 @@ btr_cur_pessimistic_delete( ulint flags, /*!< in: BTR_CREATE_FLAG or 0 */ enum trx_rb_ctx rb_ctx, /*!< in: rollback context */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* !UNIV_HOTBACKUP */ /***********************************************************//** Parses a redo log record of updating a record in-place. @@ -610,7 +610,7 @@ btr_cur_disown_inherited_fields( const ulint* offsets,/*!< in: array returned by rec_get_offsets() */ const upd_t* update, /*!< in: update vector */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull(2,3,4,5,6))); + MY_ATTRIBUTE((nonnull(2,3,4,5,6))); /** Operation code for btr_store_big_rec_extern_fields(). */ enum blob_op { @@ -630,7 +630,7 @@ ibool btr_blob_op_is_update( /*==================*/ enum blob_op op) /*!< in: operation */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /*******************************************************************//** Stores the fields in big_rec_vec to the tablespace and puts pointers to @@ -655,7 +655,7 @@ btr_store_big_rec_extern_fields( mtr_t* btr_mtr, /*!< in: mtr containing the latches to the clustered index */ enum blob_op op) /*! in: operation code */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Frees the space in an externally stored field to the file space @@ -752,7 +752,7 @@ btr_push_update_extern_fields( dtuple_t* tuple, /*!< in/out: data tuple */ const upd_t* update, /*!< in: update vector */ mem_heap_t* heap) /*!< in: memory heap */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /***********************************************************//** Sets a secondary index record's delete mark to the given value. This function is only used by the insert buffer merge mechanism. */ diff --git a/storage/xtradb/include/btr0pcur.h b/storage/xtradb/include/btr0pcur.h index d8e7cf6b283..dafe14ce556 100644 --- a/storage/xtradb/include/btr0pcur.h +++ b/storage/xtradb/include/btr0pcur.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -155,7 +155,7 @@ btr_pcur_open_at_index_side( ulint level, /*!< in: level to search for (0=leaf) */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Gets the up_match value for a pcur after a search. @return number of matched fields at the cursor or to the right if diff --git a/storage/xtradb/include/btr0sea.h b/storage/xtradb/include/btr0sea.h index 6e4ef16cf79..db7b477fae1 100644 --- a/storage/xtradb/include/btr0sea.h +++ b/storage/xtradb/include/btr0sea.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -69,7 +69,7 @@ btr_search_t* btr_search_get_info( /*================*/ dict_index_t* index) /*!< in: index */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*****************************************************************//** Creates and initializes a search info struct. @return own: search info struct */ @@ -200,7 +200,7 @@ hash_table_t* btr_search_get_hash_table( /*======================*/ const dict_index_t* index) /*!< in: index */ - __attribute__((pure,warn_unused_result)); + MY_ATTRIBUTE((pure,warn_unused_result)); /********************************************************************//** Returns the adaptive hash index latch for a given index key. @@ -210,7 +210,7 @@ prio_rw_lock_t* btr_search_get_latch( /*=================*/ const dict_index_t* index) /*!< in: index */ - __attribute__((pure,warn_unused_result)); + MY_ATTRIBUTE((pure,warn_unused_result)); /*********************************************************************//** Returns the AHI partition number corresponding to a given index ID. */ @@ -219,7 +219,7 @@ ulint btr_search_get_key( /*===============*/ index_id_t index_id) /*!< in: index ID */ - __attribute__((pure,warn_unused_result)); + MY_ATTRIBUTE((pure,warn_unused_result)); /*********************************************************************//** Initializes AHI-related fields in a newly created index. */ @@ -228,7 +228,7 @@ void btr_search_index_init( /*===============*/ dict_index_t* index) /*!< in: index */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Latches all adaptive hash index latches in exclusive mode. */ @@ -256,7 +256,7 @@ bool btr_search_own_all( /*===============*/ ulint lock_type) - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /********************************************************************//** Checks if the thread owns any adaptive hash latches in either S or X mode. @return true if the thread owns at least one latch in any mode. */ @@ -264,7 +264,7 @@ UNIV_INLINE bool btr_search_own_any(void) /*=====================*/ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); #endif /** The search info struct in an index */ diff --git a/storage/xtradb/include/btr0types.h b/storage/xtradb/include/btr0types.h index cd0392e7951..4bc9c72eccc 100644 --- a/storage/xtradb/include/btr0types.h +++ b/storage/xtradb/include/btr0types.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -82,7 +82,7 @@ btr_blob_dbg_rbt_insert( dict_index_t* index, /*!< in/out: index tree */ const btr_blob_dbg_t* b, /*!< in: the reference */ const char* ctx) /*!< in: context (for logging) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /** Remove from index->blobs a reference to an off-page column. @param index the index tree @@ -95,7 +95,7 @@ btr_blob_dbg_rbt_delete( dict_index_t* index, /*!< in/out: index tree */ const btr_blob_dbg_t* b, /*!< in: the reference */ const char* ctx) /*!< in: context (for logging) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Add to index->blobs any references to off-page columns from a record. @@ -108,7 +108,7 @@ btr_blob_dbg_add_rec( dict_index_t* index, /*!< in/out: index */ const ulint* offsets,/*!< in: offsets */ const char* ctx) /*!< in: context (for logging) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Remove from index->blobs any references to off-page columns from a record. @return number of references removed */ @@ -120,7 +120,7 @@ btr_blob_dbg_remove_rec( dict_index_t* index, /*!< in/out: index */ const ulint* offsets,/*!< in: offsets */ const char* ctx) /*!< in: context (for logging) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Count and add to index->blobs any references to off-page columns from records on a page. @@ -132,7 +132,7 @@ btr_blob_dbg_add( const page_t* page, /*!< in: rewritten page */ dict_index_t* index, /*!< in/out: index */ const char* ctx) /*!< in: context (for logging) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Count and remove from index->blobs any references to off-page columns from records on a page. @@ -145,7 +145,7 @@ btr_blob_dbg_remove( const page_t* page, /*!< in: b-tree page */ dict_index_t* index, /*!< in/out: index */ const char* ctx) /*!< in: context (for logging) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Restore in index->blobs any references to off-page columns Used when page reorganize fails due to compressed page overflow. */ @@ -157,7 +157,7 @@ btr_blob_dbg_restore( const page_t* page, /*!< in: copy of original page */ dict_index_t* index, /*!< in/out: index */ const char* ctx) /*!< in: context (for logging) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /** Operation that processes the BLOB references of an index record @param[in] rec record on index page @@ -181,7 +181,7 @@ btr_blob_dbg_op( dict_index_t* index, /*!< in/out: index */ const char* ctx, /*!< in: context (for logging) */ const btr_blob_dbg_op_f op) /*!< in: operation on records */ - __attribute__((nonnull(1,3,4,5))); + MY_ATTRIBUTE((nonnull(1,3,4,5))); #else /* UNIV_BLOB_DEBUG */ # define btr_blob_dbg_add_rec(rec, index, offsets, ctx) ((void) 0) # define btr_blob_dbg_add(page, index, ctx) ((void) 0) diff --git a/storage/xtradb/include/buf0buddy.h b/storage/xtradb/include/buf0buddy.h index a86fc87e3d3..09768dda92f 100644 --- a/storage/xtradb/include/buf0buddy.h +++ b/storage/xtradb/include/buf0buddy.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 2016, 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 @@ -54,7 +54,7 @@ buf_buddy_alloc( storage was allocated from the LRU list and buf_pool->LRU_list_mutex was temporarily released */ - __attribute__((malloc, nonnull)); + MY_ATTRIBUTE((malloc, nonnull)); /**********************************************************************//** Deallocate a block. */ @@ -68,7 +68,7 @@ buf_buddy_free( be pointed to by the buffer pool */ ulint size) /*!< in: block size, up to UNIV_PAGE_SIZE */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifndef UNIV_NONINL # include "buf0buddy.ic" diff --git a/storage/xtradb/include/buf0buddy.ic b/storage/xtradb/include/buf0buddy.ic index 020442016d0..9bc8e9e8762 100644 --- a/storage/xtradb/include/buf0buddy.ic +++ b/storage/xtradb/include/buf0buddy.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 2016, 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 @@ -50,7 +50,7 @@ buf_buddy_alloc_low( allocated from the LRU list and buf_pool->LRU_list_mutex was temporarily released */ - __attribute__((malloc, nonnull)); + MY_ATTRIBUTE((malloc, nonnull)); /**********************************************************************//** Deallocate a block. */ @@ -63,7 +63,7 @@ buf_buddy_free_low( pointed to by the buffer pool */ ulint i) /*!< in: index of buf_pool->zip_free[], or BUF_BUDDY_SIZES */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Get the index of buf_pool->zip_free[] for a given block size. diff --git a/storage/xtradb/include/buf0buf.h b/storage/xtradb/include/buf0buf.h index c25cd406498..f599997be02 100644 --- a/storage/xtradb/include/buf0buf.h +++ b/storage/xtradb/include/buf0buf.h @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2015, MariaDB Corporation. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2013, 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -244,7 +244,7 @@ buf_relocate( buf_page_get_state(bpage) must be BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_ZIP_PAGE */ buf_page_t* dpage) /*!< in/out: destination control block */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Gets the current size of buffer buf_pool in bytes. @return size in bytes */ @@ -284,7 +284,7 @@ UNIV_INLINE buf_page_t* buf_page_alloc_descriptor(void) /*===========================*/ - __attribute__((malloc)); + MY_ATTRIBUTE((malloc)); /********************************************************************//** Free a buf_page_t descriptor. */ UNIV_INLINE @@ -292,7 +292,7 @@ void buf_page_free_descriptor( /*=====================*/ buf_page_t* bpage) /*!< in: bpage descriptor to free. */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Allocates a buffer block. @@ -533,7 +533,7 @@ ulint buf_page_get_freed_page_clock( /*==========================*/ const buf_page_t* bpage) /*!< in: block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /********************************************************************//** Reads the freed_page_clock of a buffer block. @return freed_page_clock */ @@ -542,7 +542,7 @@ ulint buf_block_get_freed_page_clock( /*===========================*/ const buf_block_t* block) /*!< in: block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /********************************************************************//** Tells if a block is still close enough to the MRU end of the LRU list @@ -605,7 +605,7 @@ buf_block_buf_fix_inc_func( ulint line, /*!< in: line */ # endif /* UNIV_SYNC_DEBUG */ buf_block_t* block) /*!< in/out: block to bufferfix */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*******************************************************************//** Increments the bufferfix count. */ @@ -651,7 +651,7 @@ buf_page_is_corrupted( const byte* read_buf, /*!< in: a database page */ ulint zip_size) /*!< in: size of compressed page; 0 for uncompressed pages */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Checks if a page is all zeroes. @return TRUE if the page is all zeroes */ @@ -681,7 +681,7 @@ ulint buf_block_get_lock_hash_val( /*========================*/ const buf_block_t* block) /*!< in: block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); #ifdef UNIV_DEBUG /*********************************************************************//** Finds a block in the buffer pool that points to a @@ -739,10 +739,10 @@ buf_page_print( const byte* read_buf, /*!< in: a database page */ ulint zip_size, /*!< in: compressed page size, or 0 for uncompressed pages */ - ulint flags); /*!< in: 0 or + ulint flags) /*!< in: 0 or BUF_PAGE_PRINT_NO_CRASH or BUF_PAGE_PRINT_NO_FULL */ - + UNIV_COLD MY_ATTRIBUTE((nonnull)); /********************************************************************//** Decompress a block. @return TRUE if successful */ @@ -879,7 +879,7 @@ enum buf_page_state buf_block_get_state( /*================*/ const buf_block_t* block) /*!< in: pointer to the control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Sets the state of a block. */ UNIV_INLINE @@ -904,7 +904,7 @@ ibool buf_page_in_file( /*=============*/ const buf_page_t* bpage) /*!< in: pointer to control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); #ifndef UNIV_HOTBACKUP /*********************************************************************//** Determines if a block should be on unzip_LRU list. @@ -914,7 +914,7 @@ ibool buf_page_belongs_to_unzip_LRU( /*==========================*/ const buf_page_t* bpage) /*!< in: pointer to control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Gets the mutex of a block. @@ -924,7 +924,7 @@ ib_mutex_t* buf_page_get_mutex( /*===============*/ const buf_page_t* bpage) /*!< in: pointer to control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Get the flush type of a page. @@ -934,7 +934,7 @@ buf_flush_t buf_page_get_flush_type( /*====================*/ const buf_page_t* bpage) /*!< in: buffer page */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Set the flush type of a page. */ UNIV_INLINE @@ -960,7 +960,7 @@ enum buf_io_fix buf_page_get_io_fix( /*================*/ const buf_page_t* bpage) /*!< in: pointer to the control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Gets the io_fix state of a block. @return io_fix state */ @@ -969,7 +969,7 @@ enum buf_io_fix buf_block_get_io_fix( /*================*/ const buf_block_t* block) /*!< in: pointer to the control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Gets the io_fix state of a block. Does not assert that the buf_page_get_mutex() mutex is held, to be used in the cases where it is safe @@ -980,7 +980,7 @@ enum buf_io_fix buf_page_get_io_fix_unlocked( /*=========================*/ const buf_page_t* bpage) /*!< in: pointer to the control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Sets the io_fix state of a block. */ UNIV_INLINE @@ -1026,7 +1026,7 @@ ibool buf_page_can_relocate( /*==================*/ const buf_page_t* bpage) /*!< control block being relocated */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Determine if a block has been flagged old. @@ -1036,7 +1036,7 @@ ibool buf_page_is_old( /*============*/ const buf_page_t* bpage) /*!< in: control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Flag a block old. */ UNIV_INLINE @@ -1053,7 +1053,7 @@ unsigned buf_page_is_accessed( /*=================*/ const buf_page_t* bpage) /*!< in: control block */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*********************************************************************//** Flag a block accessed. */ UNIV_INLINE @@ -1061,7 +1061,7 @@ void buf_page_set_accessed( /*==================*/ buf_page_t* bpage) /*!< in/out: control block */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Gets the buf_block_t handle of a buffered file block if an uncompressed page frame exists, or NULL. Note: even though bpage is not declared a @@ -1072,7 +1072,7 @@ buf_block_t* buf_page_get_block( /*===============*/ buf_page_t* bpage) /*!< in: control block, or NULL */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); #endif /* !UNIV_HOTBACKUP */ #ifdef UNIV_DEBUG /*********************************************************************//** @@ -1083,7 +1083,7 @@ buf_frame_t* buf_block_get_frame( /*================*/ const buf_block_t* block) /*!< in: pointer to the control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); # define buf_block_get_frame_fast(block) buf_block_get_frame(block) #else /* UNIV_DEBUG */ # define buf_block_get_frame(block) (block ? (block)->frame : 0) @@ -1097,7 +1097,7 @@ ulint buf_page_get_space( /*===============*/ const buf_page_t* bpage) /*!< in: pointer to the control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Gets the space id of a block. @return space id */ @@ -1106,7 +1106,7 @@ ulint buf_block_get_space( /*================*/ const buf_block_t* block) /*!< in: pointer to the control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Gets the page number of a block. @return page number */ @@ -1115,7 +1115,7 @@ ulint buf_page_get_page_no( /*=================*/ const buf_page_t* bpage) /*!< in: pointer to the control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Gets the page number of a block. @return page number */ @@ -1124,7 +1124,7 @@ ulint buf_block_get_page_no( /*==================*/ const buf_block_t* block) /*!< in: pointer to the control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Gets the compressed page size of a block. @return compressed page size, or 0 */ @@ -1133,7 +1133,7 @@ ulint buf_page_get_zip_size( /*==================*/ const buf_page_t* bpage) /*!< in: pointer to the control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Gets the compressed page size of a block. @return compressed page size, or 0 */ @@ -1142,7 +1142,7 @@ ulint buf_block_get_zip_size( /*===================*/ const buf_block_t* block) /*!< in: pointer to the control block */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /*********************************************************************//** Gets the compressed page descriptor corresponding to an uncompressed page if applicable. */ @@ -1231,7 +1231,7 @@ buf_page_address_fold( /*==================*/ ulint space, /*!< in: space id */ ulint offset) /*!< in: offset of the page within space */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /********************************************************************//** Calculates the index of a buffer pool to the buf_pool[] array. @return the position of the buffer pool in buf_pool[] */ @@ -1240,7 +1240,7 @@ ulint buf_pool_index( /*===========*/ const buf_pool_t* buf_pool) /*!< in: buffer pool */ - __attribute__((nonnull, const)); + MY_ATTRIBUTE((nonnull, const)); /******************************************************************//** Returns the buffer pool instance given a page instance @return buf_pool */ @@ -1380,7 +1380,7 @@ buf_pool_watch_is_sentinel( /*=======================*/ buf_pool_t* buf_pool, /*!< buffer pool instance */ const buf_page_t* bpage) /*!< in: block */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /****************************************************************//** Add watch for the given page to be read in. Caller must have appropriate hash_lock for the bpage and hold the LRU list mutex to avoid a race @@ -1394,7 +1394,7 @@ buf_pool_watch_set( ulint space, /*!< in: space id */ ulint offset, /*!< in: page number */ ulint fold) /*!< in: buf_page_address_fold(space, offset) */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /****************************************************************//** Stop watching if the page has been read in. buf_pool_watch_set(space,offset) must have returned NULL before. */ @@ -1415,7 +1415,7 @@ buf_pool_watch_occurred( /*====================*/ ulint space, /*!< in: space id */ ulint offset) /*!< in: page number */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /********************************************************************//** Get total buffer pool statistics. */ UNIV_INTERN @@ -1473,7 +1473,7 @@ bool buf_own_zip_mutex_for_page( /*=======================*/ const buf_page_t* bpage) - __attribute__((nonnull,warn_unused_result)); + MY_ATTRIBUTE((nonnull,warn_unused_result)); #endif /* UNIV_DEBUG */ /********************************************************************//** diff --git a/storage/xtradb/include/buf0flu.h b/storage/xtradb/include/buf0flu.h index c8a329251fa..af50a5498ef 100644 --- a/storage/xtradb/include/buf0flu.h +++ b/storage/xtradb/include/buf0flu.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, 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 @@ -96,7 +96,7 @@ buf_flush_page_try( /*===============*/ buf_pool_t* buf_pool, /*!< in/out: buffer pool instance */ buf_block_t* block) /*!< in/out: buffer control block */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); # endif /* UNIV_DEBUG || UNIV_IBUF_DEBUG */ /*******************************************************************//** This utility flushes dirty blocks from the end of the flush list of @@ -277,7 +277,7 @@ buf_flush_ready_for_flush( buf_page_t* bpage, /*!< in: buffer control block, must be buf_page_in_file(bpage) */ buf_flush_t flush_type)/*!< in: type of flush */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); #ifdef UNIV_DEBUG /******************************************************************//** @@ -310,7 +310,7 @@ UNIV_INLINE bool buf_flush_flush_list_in_progress(void) /*==================================*/ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /** If LRU list of a buf_pool is less than this size then LRU eviction should not happen. This is because when we do LRU flushing we also put diff --git a/storage/xtradb/include/buf0lru.h b/storage/xtradb/include/buf0lru.h index f421e329bf0..f056c6c4116 100644 --- a/storage/xtradb/include/buf0lru.h +++ b/storage/xtradb/include/buf0lru.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, 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 @@ -97,7 +97,7 @@ buf_LRU_free_page( buf_page_t* bpage, /*!< in: block to be freed */ bool zip) /*!< in: true if should remove also the compressed page of an uncompressed page */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Try to free a replaceable block. @return TRUE if found and freed */ @@ -109,7 +109,7 @@ buf_LRU_scan_and_free_block( ibool scan_all) /*!< in: scan whole LRU list if TRUE, otherwise scan only 'old' blocks. */ - __attribute__((nonnull,warn_unused_result)); + MY_ATTRIBUTE((nonnull,warn_unused_result)); /******************************************************************//** Returns a free block from the buf_pool. The block is taken off the free list. If it is empty, returns NULL. @@ -150,7 +150,7 @@ buf_block_t* buf_LRU_get_free_block( /*===================*/ buf_pool_t* buf_pool) /*!< in/out: buffer pool instance */ - __attribute__((nonnull,warn_unused_result)); + MY_ATTRIBUTE((nonnull,warn_unused_result)); /******************************************************************//** Determines if the unzip_LRU list should be used for evicting a victim instead of the general LRU list. @@ -233,7 +233,7 @@ buf_LRU_free_one_page( buf_page_t* bpage) /*!< in/out: block, must contain a file page and be in a state where it can be freed; there may or may not be a hash index to the page */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG /**********************************************************************//** diff --git a/storage/xtradb/include/data0data.h b/storage/xtradb/include/data0data.h index a548c7b89b3..1d954bfc07c 100644 --- a/storage/xtradb/include/data0data.h +++ b/storage/xtradb/include/data0data.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -46,7 +46,7 @@ dtype_t* dfield_get_type( /*============*/ const dfield_t* field) /*!< in: SQL data field */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Gets pointer to the data in a field. @return pointer to data */ @@ -55,7 +55,7 @@ void* dfield_get_data( /*============*/ const dfield_t* field) /*!< in: field */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #else /* UNIV_DEBUG */ # define dfield_get_type(field) (&(field)->type) # define dfield_get_data(field) ((field)->data) @@ -68,7 +68,7 @@ dfield_set_type( /*============*/ dfield_t* field, /*!< in: SQL data field */ const dtype_t* type) /*!< in: pointer to data type struct */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Gets length of field data. @return length of data; UNIV_SQL_NULL if SQL null data */ @@ -77,7 +77,7 @@ ulint dfield_get_len( /*===========*/ const dfield_t* field) /*!< in: field */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Sets length in a field. */ UNIV_INLINE @@ -86,7 +86,7 @@ dfield_set_len( /*===========*/ dfield_t* field, /*!< in: field */ ulint len) /*!< in: length or UNIV_SQL_NULL */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Determines if a field is SQL NULL @return nonzero if SQL null data */ @@ -95,7 +95,7 @@ ulint dfield_is_null( /*===========*/ const dfield_t* field) /*!< in: field */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Determines if a field is externally stored @return nonzero if externally stored */ @@ -104,7 +104,7 @@ ulint dfield_is_ext( /*==========*/ const dfield_t* field) /*!< in: field */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Sets the "external storage" flag */ UNIV_INLINE @@ -112,7 +112,7 @@ void dfield_set_ext( /*===========*/ dfield_t* field) /*!< in/out: field */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Sets pointer to the data and length in a field. */ UNIV_INLINE @@ -122,7 +122,7 @@ dfield_set_data( dfield_t* field, /*!< in: field */ const void* data, /*!< in: data */ ulint len) /*!< in: length or UNIV_SQL_NULL */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /*********************************************************************//** Sets a data field to SQL NULL. */ UNIV_INLINE @@ -130,7 +130,7 @@ void dfield_set_null( /*============*/ dfield_t* field) /*!< in/out: field */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Writes an SQL null field full of zeros. */ UNIV_INLINE @@ -139,7 +139,7 @@ data_write_sql_null( /*================*/ byte* data, /*!< in: pointer to a buffer of size len */ ulint len) /*!< in: SQL null size in bytes */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Copies the data and len fields. */ UNIV_INLINE @@ -148,7 +148,7 @@ dfield_copy_data( /*=============*/ dfield_t* field1, /*!< out: field to copy to */ const dfield_t* field2) /*!< in: field to copy from */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Copies a data field to another. */ UNIV_INLINE @@ -157,7 +157,7 @@ dfield_copy( /*========*/ dfield_t* field1, /*!< out: field to copy to */ const dfield_t* field2) /*!< in: field to copy from */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Copies the data pointed to by a data field. */ UNIV_INLINE @@ -166,7 +166,7 @@ dfield_dup( /*=======*/ dfield_t* field, /*!< in/out: data field */ mem_heap_t* heap) /*!< in: memory heap where allocated */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifndef UNIV_HOTBACKUP /*********************************************************************//** Tests if two data fields are equal. @@ -181,7 +181,7 @@ dfield_datas_are_binary_equal( const dfield_t* field2, /*!< in: field */ ulint len) /*!< in: maximum prefix to compare, or 0 to compare the whole field length */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Tests if dfield data length and content is equal to the given. @return TRUE if equal */ @@ -192,7 +192,7 @@ dfield_data_is_binary_equal( const dfield_t* field, /*!< in: field */ ulint len, /*!< in: data length or UNIV_SQL_NULL */ const byte* data) /*!< in: data */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Gets number of fields in a data tuple. @@ -202,7 +202,7 @@ ulint dtuple_get_n_fields( /*================*/ const dtuple_t* tuple) /*!< in: tuple */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifdef UNIV_DEBUG /*********************************************************************//** Gets nth field of a tuple. @@ -224,7 +224,7 @@ ulint dtuple_get_info_bits( /*=================*/ const dtuple_t* tuple) /*!< in: tuple */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Sets info bits in a data tuple. */ UNIV_INLINE @@ -233,7 +233,7 @@ dtuple_set_info_bits( /*=================*/ dtuple_t* tuple, /*!< in: tuple */ ulint info_bits) /*!< in: info bits */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Gets number of fields used in record comparisons. @return number of fields used in comparisons in rem0cmp.* */ @@ -242,7 +242,7 @@ ulint dtuple_get_n_fields_cmp( /*====================*/ const dtuple_t* tuple) /*!< in: tuple */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Gets number of fields used in record comparisons. */ UNIV_INLINE @@ -252,7 +252,7 @@ dtuple_set_n_fields_cmp( dtuple_t* tuple, /*!< in: tuple */ ulint n_fields_cmp) /*!< in: number of fields used in comparisons in rem0cmp.* */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /* Estimate the number of bytes that are going to be allocated when creating a new dtuple_t object */ @@ -272,7 +272,7 @@ dtuple_create_from_mem( void* buf, /*!< in, out: buffer to use */ ulint buf_size, /*!< in: buffer size */ ulint n_fields) /*!< in: number of fields */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************//** Creates a data tuple to a memory heap. The default value for number @@ -286,7 +286,7 @@ dtuple_create( is created, DTUPLE_EST_ALLOC(n_fields) bytes will be allocated from this heap */ ulint n_fields)/*!< in: number of fields */ - __attribute__((nonnull, malloc)); + MY_ATTRIBUTE((nonnull, malloc)); /*********************************************************************//** Sets number of fields used in a tuple. Normally this is set in @@ -297,7 +297,7 @@ dtuple_set_n_fields( /*================*/ dtuple_t* tuple, /*!< in: tuple */ ulint n_fields) /*!< in: number of fields */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Copies a data tuple to another. This is a shallow copy; if a deep copy is desired, dfield_dup() will have to be invoked on each field. @@ -309,7 +309,7 @@ dtuple_copy( const dtuple_t* tuple, /*!< in: tuple to copy from */ mem_heap_t* heap) /*!< in: memory heap where the tuple is created */ - __attribute__((nonnull, malloc)); + MY_ATTRIBUTE((nonnull, malloc)); /**********************************************************//** The following function returns the sum of data lengths of a tuple. The space occupied by the field structs or the tuple struct is not counted. @@ -320,7 +320,7 @@ dtuple_get_data_size( /*=================*/ const dtuple_t* tuple, /*!< in: typed data tuple */ ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Computes the number of externally stored fields in a data tuple. @return number of fields */ @@ -329,7 +329,7 @@ ulint dtuple_get_n_ext( /*=============*/ const dtuple_t* tuple) /*!< in: tuple */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /************************************************************//** Compare two data tuples, respecting the collation of character fields. @return 1, 0 , -1 if tuple1 is greater, equal, less, respectively, @@ -340,7 +340,7 @@ dtuple_coll_cmp( /*============*/ const dtuple_t* tuple1, /*!< in: tuple 1 */ const dtuple_t* tuple2) /*!< in: tuple 2 */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /************************************************************//** Folds a prefix given as the number of fields of a tuple. @return the folded value */ @@ -353,7 +353,7 @@ dtuple_fold( ulint n_bytes,/*!< in: number of bytes to fold in an incomplete last field */ index_id_t tree_id)/*!< in: index tree id */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /*******************************************************************//** Sets types of fields binary in a tuple. */ UNIV_INLINE @@ -362,7 +362,7 @@ dtuple_set_types_binary( /*====================*/ dtuple_t* tuple, /*!< in: data tuple */ ulint n) /*!< in: number of fields to set */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Checks if a dtuple contains an SQL null value. @return TRUE if some field is SQL null */ @@ -371,7 +371,7 @@ ibool dtuple_contains_null( /*=================*/ const dtuple_t* tuple) /*!< in: dtuple */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************//** Checks that a data field is typed. Asserts an error if not. @return TRUE if ok */ @@ -380,7 +380,7 @@ ibool dfield_check_typed( /*===============*/ const dfield_t* field) /*!< in: data field */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************//** Checks that a data tuple is typed. Asserts an error if not. @return TRUE if ok */ @@ -389,7 +389,7 @@ ibool dtuple_check_typed( /*===============*/ const dtuple_t* tuple) /*!< in: tuple */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************//** Checks that a data tuple is typed. @return TRUE if ok */ @@ -398,7 +398,7 @@ ibool dtuple_check_typed_no_assert( /*=========================*/ const dtuple_t* tuple) /*!< in: tuple */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifdef UNIV_DEBUG /**********************************************************//** Validates the consistency of a tuple which must be complete, i.e, @@ -409,7 +409,7 @@ ibool dtuple_validate( /*============*/ const dtuple_t* tuple) /*!< in: tuple */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* UNIV_DEBUG */ /*************************************************************//** Pretty prints a dfield value according to its data type. */ @@ -418,7 +418,7 @@ void dfield_print( /*=========*/ const dfield_t* dfield) /*!< in: dfield */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Pretty prints a dfield value according to its data type. Also the hex string is printed if a string contains non-printable characters. */ @@ -427,7 +427,7 @@ void dfield_print_also_hex( /*==================*/ const dfield_t* dfield) /*!< in: dfield */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************//** The following function prints the contents of a tuple. */ UNIV_INTERN @@ -436,7 +436,7 @@ dtuple_print( /*=========*/ FILE* f, /*!< in: output stream */ const dtuple_t* tuple) /*!< in: tuple */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Moves parts of long fields in entry to the big record vector so that the size of tuple drops below the maximum record size allowed in the @@ -453,7 +453,7 @@ dtuple_convert_big_rec( dtuple_t* entry, /*!< in/out: index entry */ ulint* n_ext) /*!< in/out: number of externally stored columns */ - __attribute__((nonnull, malloc, warn_unused_result)); + MY_ATTRIBUTE((nonnull, malloc, warn_unused_result)); /**************************************************************//** Puts back to entry the data stored in vector. Note that to ensure the fields in entry can accommodate the data, vector must have been created @@ -466,7 +466,7 @@ dtuple_convert_back_big_rec( dtuple_t* entry, /*!< in: entry whose data was put to vector */ big_rec_t* vector) /*!< in, own: big rec vector; it is freed in this function */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Frees the memory in a big rec vector. */ UNIV_INLINE @@ -475,7 +475,7 @@ dtuple_big_rec_free( /*================*/ big_rec_t* vector) /*!< in, own: big rec vector; it is freed in this function */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*######################################################################*/ diff --git a/storage/xtradb/include/data0data.ic b/storage/xtradb/include/data0data.ic index 6937d55d211..11499ab928c 100644 --- a/storage/xtradb/include/data0data.ic +++ b/storage/xtradb/include/data0data.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -56,7 +56,8 @@ dfield_set_type( dfield_t* field, /*!< in: SQL data field */ const dtype_t* type) /*!< in: pointer to data type struct */ { - ut_ad(field && type); + ut_ad(field != NULL); + ut_ad(type != NULL); field->type = *type; } @@ -194,7 +195,8 @@ dfield_copy_data( dfield_t* field1, /*!< out: field to copy to */ const dfield_t* field2) /*!< in: field to copy from */ { - ut_ad(field1 && field2); + ut_ad(field1 != NULL); + ut_ad(field2 != NULL); field1->data = field2->data; field1->len = field2->len; diff --git a/storage/xtradb/include/dict0boot.h b/storage/xtradb/include/dict0boot.h index a994c9d8ff1..477e1150f43 100644 --- a/storage/xtradb/include/dict0boot.h +++ b/storage/xtradb/include/dict0boot.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -95,7 +95,7 @@ UNIV_INTERN dberr_t dict_boot(void) /*===========*/ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /*****************************************************************//** Creates and initializes the data dictionary at the server bootstrap. @@ -104,7 +104,7 @@ UNIV_INTERN dberr_t dict_create(void) /*=============*/ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /*********************************************************************//** Check if a table id belongs to system table. @@ -114,7 +114,7 @@ bool dict_is_sys_table( /*==============*/ table_id_t id) /*!< in: table id to check */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /* Space id and page no where the dictionary header resides */ #define DICT_HDR_SPACE 0 /* the SYSTEM tablespace */ diff --git a/storage/xtradb/include/dict0crea.h b/storage/xtradb/include/dict0crea.h index 3b746fcf83c..77627c9bf67 100644 --- a/storage/xtradb/include/dict0crea.h +++ b/storage/xtradb/include/dict0crea.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -137,7 +137,7 @@ dict_create_add_foreign_id( incremented if used */ const char* name, /*!< in: table name */ dict_foreign_t* foreign)/*!< in/out: foreign key */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /** Adds the given set of foreign key objects to the dictionary tables in the database. This function does not modify the dictionary cache. The @@ -156,7 +156,7 @@ dict_create_add_foreigns_to_dictionary( const dict_foreign_set& local_fk_set, const dict_table_t* table, trx_t* trx) - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /****************************************************************//** Creates the tablespaces and datafiles system tables inside InnoDB at server bootstrap or server start if they are not found or are @@ -192,7 +192,7 @@ dict_create_add_foreign_to_dictionary( const char* name, /*!< in: table name */ const dict_foreign_t* foreign,/*!< in: foreign key */ trx_t* trx) /*!< in/out: dictionary transaction */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /* Table create node structure */ struct tab_node_t{ diff --git a/storage/xtradb/include/dict0crea.ic b/storage/xtradb/include/dict0crea.ic index 2d0d9dcb858..1cbaa47032b 100644 --- a/storage/xtradb/include/dict0crea.ic +++ b/storage/xtradb/include/dict0crea.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -33,7 +33,7 @@ UNIV_INTERN bool row_is_mysql_tmp_table_name( /*========================*/ - const char* name) __attribute__((warn_unused_result)); + const char* name) MY_ATTRIBUTE((warn_unused_result)); /*!< in: table name in the form 'database/tablename' */ diff --git a/storage/xtradb/include/dict0dict.h b/storage/xtradb/include/dict0dict.h index 2b73efaabc7..e843d63e717 100644 --- a/storage/xtradb/include/dict0dict.h +++ b/storage/xtradb/include/dict0dict.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. Copyright (c) 2013, 2015, MariaDB Corporation. @@ -59,7 +59,7 @@ void dict_casedn_str( /*============*/ char* a) /*!< in/out: string to put in lower case */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Get the database name length in a table name. @return database name length */ @@ -69,7 +69,7 @@ dict_get_db_name_len( /*=================*/ const char* name) /*!< in: table name in the form dbname '/' tablename */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Open a table from its database and table name, this is currently used by foreign constraint parser to get the referenced table. @@ -113,7 +113,7 @@ dict_remove_db_name( /*================*/ const char* name) /*!< in: table name in the form dbname '/' tablename */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Operation to perform when opening a table */ enum dict_table_op_t { @@ -161,7 +161,7 @@ dict_table_close( ibool try_drop) /*!< in: TRUE=try to drop any orphan indexes after an aborted online index creation */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Inits the data dictionary module. */ UNIV_INTERN @@ -186,7 +186,7 @@ ulint dict_col_get_mbminlen( /*==================*/ const dict_col_t* col) /*!< in: column */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Gets the maximum number of bytes per character. @return maximum multi-byte char size, in bytes */ @@ -195,7 +195,7 @@ ulint dict_col_get_mbmaxlen( /*==================*/ const dict_col_t* col) /*!< in: column */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Sets the minimum and maximum number of bytes per character. */ UNIV_INLINE @@ -207,7 +207,7 @@ dict_col_set_mbminmaxlen( character size, in bytes */ ulint mbmaxlen) /*!< in: minimum multi-byte character size, in bytes */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Gets the column data type. */ UNIV_INLINE @@ -216,7 +216,7 @@ dict_col_copy_type( /*===============*/ const dict_col_t* col, /*!< in: column */ dtype_t* type) /*!< out: data type */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Determine bytes of column prefix to be stored in the undo log. Please note if the table format is UNIV_FORMAT_A (< UNIV_FORMAT_B), no prefix @@ -229,7 +229,7 @@ dict_max_field_len_store_undo( dict_table_t* table, /*!< in: table */ const dict_col_t* col) /*!< in: column which index prefix is based on */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* !UNIV_HOTBACKUP */ #ifdef UNIV_DEBUG /*********************************************************************//** @@ -241,7 +241,7 @@ dict_col_type_assert_equal( /*=======================*/ const dict_col_t* col, /*!< in: column */ const dtype_t* type) /*!< in: data type */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* UNIV_DEBUG */ #ifndef UNIV_HOTBACKUP /***********************************************************************//** @@ -252,7 +252,7 @@ ulint dict_col_get_min_size( /*==================*/ const dict_col_t* col) /*!< in: column */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************************//** Returns the maximum size of the column. @return maximum size */ @@ -261,7 +261,7 @@ ulint dict_col_get_max_size( /*==================*/ const dict_col_t* col) /*!< in: column */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************************//** Returns the size of a fixed size column, 0 if not a fixed size column. @return fixed size, or 0 */ @@ -271,7 +271,7 @@ dict_col_get_fixed_size( /*====================*/ const dict_col_t* col, /*!< in: column */ ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************************//** Returns the ROW_FORMAT=REDUNDANT stored SQL NULL size of a column. For fixed length types it is the fixed length of the type, otherwise 0. @@ -282,7 +282,7 @@ dict_col_get_sql_null_size( /*=======================*/ const dict_col_t* col, /*!< in: column */ ulint comp) /*!< in: nonzero=ROW_FORMAT=COMPACT */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Gets the column number. @return col->ind, table column position (starting from 0) */ @@ -291,7 +291,7 @@ ulint dict_col_get_no( /*============*/ const dict_col_t* col) /*!< in: column */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Gets the column position in the clustered index. */ UNIV_INLINE @@ -300,7 +300,7 @@ dict_col_get_clust_pos( /*===================*/ const dict_col_t* col, /*!< in: table column */ const dict_index_t* clust_index) /*!< in: clustered index */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /****************************************************************//** If the given column name is reserved for InnoDB system columns, return TRUE. @@ -310,7 +310,7 @@ ibool dict_col_name_is_reserved( /*======================*/ const char* name) /*!< in: column name */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Acquire the autoinc lock. */ UNIV_INTERN @@ -318,7 +318,7 @@ void dict_table_autoinc_lock( /*====================*/ dict_table_t* table) /*!< in/out: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Unconditionally set the autoinc counter. */ UNIV_INTERN @@ -327,7 +327,7 @@ dict_table_autoinc_initialize( /*==========================*/ dict_table_t* table, /*!< in/out: table */ ib_uint64_t value) /*!< in: next value to assign to a row */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /** Store autoinc value when the table is evicted. @param[in] table table evicted */ @@ -352,7 +352,7 @@ ib_uint64_t dict_table_autoinc_read( /*====================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Updates the autoinc counter if the value supplied is greater than the current value. */ @@ -363,7 +363,7 @@ dict_table_autoinc_update_if_greater( dict_table_t* table, /*!< in/out: table */ ib_uint64_t value) /*!< in: value which was assigned to a row */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Release the autoinc lock. */ UNIV_INTERN @@ -371,7 +371,7 @@ void dict_table_autoinc_unlock( /*======================*/ dict_table_t* table) /*!< in/out: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** Adds system columns to a table object. */ @@ -381,7 +381,7 @@ dict_table_add_system_columns( /*==========================*/ dict_table_t* table, /*!< in/out: table */ mem_heap_t* heap) /*!< in: temporary heap */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifndef UNIV_HOTBACKUP /**********************************************************************//** Adds a table object to the dictionary cache. */ @@ -392,7 +392,7 @@ dict_table_add_to_cache( dict_table_t* table, /*!< in: table */ ibool can_be_evicted, /*!< in: TRUE if can be evicted*/ mem_heap_t* heap) /*!< in: temporary heap */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Removes a table object from the dictionary cache. */ UNIV_INTERN @@ -400,7 +400,7 @@ void dict_table_remove_from_cache( /*=========================*/ dict_table_t* table) /*!< in, own: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Removes a table object from the dictionary cache. */ UNIV_INTERN @@ -423,7 +423,7 @@ dict_table_rename_in_cache( /*!< in: in ALTER TABLE we want to preserve the original table name in constraints which reference it */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Removes an index from the dictionary cache. */ UNIV_INTERN @@ -432,7 +432,7 @@ dict_index_remove_from_cache( /*=========================*/ dict_table_t* table, /*!< in/out: table */ dict_index_t* index) /*!< in, own: index */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Change the id of a table object in the dictionary cache. This is used in DISCARD TABLESPACE. */ @@ -442,7 +442,7 @@ dict_table_change_id_in_cache( /*==========================*/ dict_table_t* table, /*!< in/out: table object already in cache */ table_id_t new_id) /*!< in: new id to set */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Removes a foreign constraint struct from the dictionary cache. */ UNIV_INTERN @@ -450,7 +450,7 @@ void dict_foreign_remove_from_cache( /*===========================*/ dict_foreign_t* foreign) /*!< in, own: foreign constraint */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Adds a foreign key constraint object to the dictionary cache. May free the object if there already is an object with the same identifier in. @@ -471,7 +471,7 @@ dict_foreign_add_to_cache( compatibility */ dict_err_ignore_t ignore_err) /*!< in: error to be ignored */ - __attribute__((nonnull(1), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1), warn_unused_result)); /*********************************************************************//** Checks if a table is referenced by foreign keys. @return TRUE if table is referenced by a foreign key */ @@ -480,7 +480,7 @@ ibool dict_table_is_referenced_by_foreign_key( /*====================================*/ const dict_table_t* table) /*!< in: InnoDB table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Replace the index passed in with another equivalent index in the foreign key lists of the table. @@ -494,7 +494,7 @@ dict_foreign_replace_index( /*!< in: column names, or NULL to use table->col_names */ const dict_index_t* index) /*!< in: index to be replaced */ - __attribute__((nonnull(1,3), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,3), warn_unused_result)); /**********************************************************************//** Determines whether a string starts with the specified keyword. @return TRUE if str starts with keyword */ @@ -505,7 +505,7 @@ dict_str_starts_with_keyword( THD* thd, /*!< in: MySQL thread handle */ const char* str, /*!< in: string to scan for keyword */ const char* keyword) /*!< in: keyword to look for */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Scans a table create SQL string and adds to the data dictionary the foreign key constraints declared in the string. This function @@ -534,7 +534,7 @@ dict_create_foreign_constraints( ibool reject_fks) /*!< in: if TRUE, fail with error code DB_CANNOT_ADD_CONSTRAINT if any foreign keys are found. */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Parses the CONSTRAINT id's to be dropped in an ALTER TABLE statement. @return DB_SUCCESS or DB_CANNOT_DROP_CONSTRAINT if syntax error or the @@ -551,7 +551,7 @@ dict_foreign_parse_drop_constraints( to drop */ const char*** constraints_to_drop) /*!< out: id's of the constraints to drop */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Returns a table object and increments its open handle count. NOTE! This is a high-level function to be used mainly from outside the @@ -570,7 +570,7 @@ dict_table_open_on_name( dict_err_ignore_t ignore_err) /*!< in: error to be ignored when loading the table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Tries to find an index whose first fields are the columns in the array, @@ -606,7 +606,7 @@ dict_foreign_find_index( dict_index_t** err_index) /*!< out: index where error happened */ - __attribute__((nonnull(1,3), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,3), warn_unused_result)); /**********************************************************************//** Returns a column's name. @return column name. NOTE: not guaranteed to stay valid if table is @@ -617,7 +617,7 @@ dict_table_get_col_name( /*====================*/ const dict_table_t* table, /*!< in: table */ ulint col_nr) /*!< in: column number */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Returns a column's name. @return column name. NOTE: not guaranteed to stay valid if table is @@ -636,7 +636,7 @@ void dict_table_print( /*=============*/ dict_table_t* table) /*!< in: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Outputs info on foreign keys of a table. */ UNIV_INTERN @@ -668,7 +668,7 @@ dict_index_name_print( FILE* file, /*!< in: output stream */ const trx_t* trx, /*!< in: transaction */ const dict_index_t* index) /*!< in: index to print */ - __attribute__((nonnull(1,3))); + MY_ATTRIBUTE((nonnull(1,3))); /*********************************************************************//** Tries to find an index whose first fields are the columns in the array, in the same order and is not marked for deletion and is not the same @@ -705,7 +705,7 @@ dict_foreign_qualify_index( /*!< out: index where error happened */ - __attribute__((nonnull(1,3), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,3), warn_unused_result)); #ifdef UNIV_DEBUG /********************************************************************//** Gets the first index on the table (the clustered index). @@ -715,7 +715,7 @@ dict_index_t* dict_table_get_first_index( /*=======================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Gets the last index on the table. @return index, NULL if none exists */ @@ -724,7 +724,7 @@ dict_index_t* dict_table_get_last_index( /*=======================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Gets the next index on the table. @return index, NULL if none left */ @@ -733,7 +733,7 @@ dict_index_t* dict_table_get_next_index( /*======================*/ const dict_index_t* index) /*!< in: index */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #else /* UNIV_DEBUG */ # define dict_table_get_first_index(table) UT_LIST_GET_FIRST((table)->indexes) # define dict_table_get_last_index(table) UT_LIST_GET_LAST((table)->indexes) @@ -762,7 +762,7 @@ ulint dict_index_is_clust( /*================*/ const dict_index_t* index) /*!< in: index */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /********************************************************************//** Check whether the index is unique. @return nonzero for unique index, zero for other indexes */ @@ -771,7 +771,7 @@ ulint dict_index_is_unique( /*=================*/ const dict_index_t* index) /*!< in: index */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /********************************************************************//** Check whether the index is the insert buffer tree. @return nonzero for insert buffer, zero for other indexes */ @@ -780,7 +780,7 @@ ulint dict_index_is_ibuf( /*===============*/ const dict_index_t* index) /*!< in: index */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /********************************************************************//** Check whether the index is a secondary index or the insert buffer tree. @return nonzero for insert buffer, zero for other indexes */ @@ -789,7 +789,7 @@ ulint dict_index_is_sec_or_ibuf( /*======================*/ const dict_index_t* index) /*!< in: index */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /************************************************************************ Gets the all the FTS indexes for the table. NOTE: must not be called for @@ -801,7 +801,7 @@ dict_table_get_all_fts_indexes( /* out: number of indexes collected */ dict_table_t* table, /* in: table */ ib_vector_t* indexes)/* out: vector for collecting FTS indexes */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Gets the number of user-defined columns in a table in the dictionary cache. @@ -811,7 +811,7 @@ ulint dict_table_get_n_user_cols( /*=======================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /********************************************************************//** Gets the number of system columns in a table in the dictionary cache. @return number of system (e.g., ROW_ID) columns of a table */ @@ -820,7 +820,7 @@ ulint dict_table_get_n_sys_cols( /*======================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /********************************************************************//** Gets the number of all columns (also system) in a table in the dictionary cache. @@ -830,7 +830,7 @@ ulint dict_table_get_n_cols( /*==================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /********************************************************************//** Gets the approximately estimated number of rows in the table. @return estimated number of rows */ @@ -839,7 +839,7 @@ ib_uint64_t dict_table_get_n_rows( /*==================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Increment the number of rows in the table by one. Notice that this operation is not protected by any latch, the number is @@ -849,7 +849,7 @@ void dict_table_n_rows_inc( /*==================*/ dict_table_t* table) /*!< in/out: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Decrement the number of rows in the table by one. Notice that this operation is not protected by any latch, the number is @@ -859,7 +859,7 @@ void dict_table_n_rows_dec( /*==================*/ dict_table_t* table) /*!< in/out: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifdef UNIV_DEBUG /********************************************************************//** Gets the nth column of a table. @@ -870,7 +870,7 @@ dict_table_get_nth_col( /*===================*/ const dict_table_t* table, /*!< in: table */ ulint pos) /*!< in: position of column */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Gets the given system column of a table. @return pointer to column object */ @@ -880,7 +880,7 @@ dict_table_get_sys_col( /*===================*/ const dict_table_t* table, /*!< in: table */ ulint sys) /*!< in: DATA_ROW_ID, ... */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #else /* UNIV_DEBUG */ #define dict_table_get_nth_col(table, pos) \ ((table)->cols + (pos)) @@ -896,7 +896,7 @@ dict_table_get_sys_col_no( /*======================*/ const dict_table_t* table, /*!< in: table */ ulint sys) /*!< in: DATA_ROW_ID, ... */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifndef UNIV_HOTBACKUP /********************************************************************//** Returns the minimum data size of an index record. @@ -906,7 +906,7 @@ ulint dict_index_get_min_size( /*====================*/ const dict_index_t* index) /*!< in: index */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* !UNIV_HOTBACKUP */ /********************************************************************//** Check whether the table uses the compact page format. @@ -916,7 +916,7 @@ ibool dict_table_is_comp( /*===============*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Determine the file format of a table. @return file format version */ @@ -925,7 +925,7 @@ ulint dict_table_get_format( /*==================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Determine the file format from a dict_table_t::flags. @return file format version */ @@ -934,7 +934,7 @@ ulint dict_tf_get_format( /*===============*/ ulint flags) /*!< in: dict_table_t::flags */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /********************************************************************//** Set the various values in a dict_table_t::flags pointer. */ UNIV_INLINE @@ -969,7 +969,7 @@ ulint dict_tf_to_fsp_flags( /*=================*/ ulint flags) /*!< in: dict_table_t::flags */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /********************************************************************//** Extract the compressed page size from table flags. @return compressed page size, or 0 if not compressed */ @@ -978,7 +978,7 @@ ulint dict_tf_get_zip_size( /*=================*/ ulint flags) /*!< in: flags */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /********************************************************************//** Check whether the table uses the compressed compact page format. @return compressed page size, or 0 if not compressed */ @@ -987,7 +987,7 @@ ulint dict_table_zip_size( /*================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifndef UNIV_HOTBACKUP /*********************************************************************//** Obtain exclusive locks on all index trees of the table. This is to prevent @@ -998,7 +998,7 @@ void dict_table_x_lock_indexes( /*======================*/ dict_table_t* table) /*!< in: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Release the exclusive locks on all index tree. */ UNIV_INLINE @@ -1006,7 +1006,7 @@ void dict_table_x_unlock_indexes( /*========================*/ dict_table_t* table) /*!< in: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Checks if a column is in the ordering columns of the clustered index of a table. Column prefixes are treated like whole columns. @@ -1017,7 +1017,7 @@ dict_table_col_in_clustered_key( /*============================*/ const dict_table_t* table, /*!< in: table */ ulint n) /*!< in: column number */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Check if the table has an FTS index. @return TRUE if table has an FTS index */ @@ -1026,7 +1026,7 @@ ibool dict_table_has_fts_index( /*=====================*/ dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Copies types of columns contained in table to tuple and sets all fields of the tuple to the SQL NULL value. This function should @@ -1037,7 +1037,7 @@ dict_table_copy_types( /*==================*/ dtuple_t* tuple, /*!< in/out: data tuple */ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************** Wait until all the background threads of the given table have exited, i.e., bg_threads == 0. Note: bg_threads_mutex must be reserved when @@ -1049,7 +1049,7 @@ dict_table_wait_for_bg_threads_to_exit( dict_table_t* table, /* in: table */ ulint delay) /* in: time in microseconds to wait between checks of bg_threads. */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Looks for an index with the given id. NOTE that we do not reserve the dictionary mutex: this function is for emergency purposes like @@ -1060,7 +1060,7 @@ dict_index_t* dict_index_find_on_id_low( /*======================*/ index_id_t id) /*!< in: index id */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /**********************************************************************//** Make room in the table cache by evicting an unused table. The unused table should not be part of FK relationship and currently not used in any user @@ -1086,7 +1086,7 @@ dict_index_add_to_cache( ibool strict) /*!< in: TRUE=refuse to create the index if records could be too big to fit in an B-tree page */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Removes an index from the dictionary cache. */ UNIV_INTERN @@ -1095,7 +1095,7 @@ dict_index_remove_from_cache( /*=========================*/ dict_table_t* table, /*!< in/out: table */ dict_index_t* index) /*!< in, own: index */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* !UNIV_HOTBACKUP */ /********************************************************************//** Gets the number of fields in the internal representation of an index, @@ -1108,7 +1108,7 @@ dict_index_get_n_fields( const dict_index_t* index) /*!< in: an internal representation of index (in the dictionary cache) */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Gets the number of fields in the internal representation of an index that uniquely determine the position of an index entry in the index, if @@ -1121,7 +1121,7 @@ dict_index_get_n_unique( /*====================*/ const dict_index_t* index) /*!< in: an internal representation of index (in the dictionary cache) */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Gets the number of fields in the internal representation of an index which uniquely determine the position of an index entry in the index, if @@ -1133,7 +1133,7 @@ dict_index_get_n_unique_in_tree( /*============================*/ const dict_index_t* index) /*!< in: an internal representation of index (in the dictionary cache) */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Gets the number of user-defined ordering fields in the index. In the internal representation we add the row id to the ordering fields to make all indexes @@ -1146,7 +1146,7 @@ dict_index_get_n_ordering_defined_by_user( /*======================================*/ const dict_index_t* index) /*!< in: an internal representation of index (in the dictionary cache) */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifdef UNIV_DEBUG /********************************************************************//** Gets the nth field of an index. @@ -1157,7 +1157,7 @@ dict_index_get_nth_field( /*=====================*/ const dict_index_t* index, /*!< in: index */ ulint pos) /*!< in: position of field */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #else /* UNIV_DEBUG */ # define dict_index_get_nth_field(index, pos) ((index)->fields + (pos)) #endif /* UNIV_DEBUG */ @@ -1170,7 +1170,7 @@ dict_index_get_nth_col( /*===================*/ const dict_index_t* index, /*!< in: index */ ulint pos) /*!< in: position of the field */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Gets the column number of the nth field in an index. @return column number */ @@ -1180,7 +1180,7 @@ dict_index_get_nth_col_no( /*======================*/ const dict_index_t* index, /*!< in: index */ ulint pos) /*!< in: position of the field */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Looks for column n in an index. @return position in internal representation of the index; @@ -1217,7 +1217,7 @@ dict_index_contains_col_or_prefix( /*==============================*/ const dict_index_t* index, /*!< in: index */ ulint n) /*!< in: column number */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Looks for a matching field in an index. The column has to be the same. The column in index must be complete, or must contain a prefix longer than the @@ -1232,7 +1232,7 @@ dict_index_get_nth_field_pos( const dict_index_t* index, /*!< in: index from which to search */ const dict_index_t* index2, /*!< in: index */ ulint n) /*!< in: field number in index2 */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Looks for column n position in the clustered index. @return position in internal representation of the clustered index */ @@ -1242,7 +1242,7 @@ dict_table_get_nth_col_pos( /*=======================*/ const dict_table_t* table, /*!< in: table */ ulint n) /*!< in: column number */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Returns the position of a system column in an index. @return position, ULINT_UNDEFINED if not contained */ @@ -1252,7 +1252,7 @@ dict_index_get_sys_col_pos( /*=======================*/ const dict_index_t* index, /*!< in: index */ ulint type) /*!< in: DATA_ROW_ID, ... */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Adds a column to index. */ UNIV_INTERN @@ -1263,7 +1263,7 @@ dict_index_add_col( const dict_table_t* table, /*!< in: table */ dict_col_t* col, /*!< in: column */ ulint prefix_len) /*!< in: column prefix length */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifndef UNIV_HOTBACKUP /*******************************************************************//** Copies types of fields contained in index to tuple. */ @@ -1275,7 +1275,7 @@ dict_index_copy_types( const dict_index_t* index, /*!< in: index */ ulint n_fields) /*!< in: number of field types to copy */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Gets the field column. @@ -1285,7 +1285,7 @@ const dict_col_t* dict_field_get_col( /*===============*/ const dict_field_t* field) /*!< in: index field */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifndef UNIV_HOTBACKUP /**********************************************************************//** Returns an index object if it is found in the dictionary cache. @@ -1296,7 +1296,7 @@ dict_index_t* dict_index_get_if_in_cache_low( /*===========================*/ index_id_t index_id) /*!< in: index id */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG /**********************************************************************//** Returns an index object if it is found in the dictionary cache. @@ -1306,7 +1306,7 @@ dict_index_t* dict_index_get_if_in_cache( /*=======================*/ index_id_t index_id) /*!< in: index id */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ #ifdef UNIV_DEBUG /**********************************************************************//** @@ -1319,7 +1319,7 @@ dict_index_check_search_tuple( /*==========================*/ const dict_index_t* index, /*!< in: index tree */ const dtuple_t* tuple) /*!< in: tuple used in a search */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Whether and when to allow temporary index names */ enum check_name { /** Require all indexes to be complete. */ @@ -1339,7 +1339,7 @@ dict_table_check_for_dup_indexes( in this table */ enum check_name check) /*!< in: whether and when to allow temporary index names */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* UNIV_DEBUG */ /**********************************************************************//** Builds a node pointer out of a physical record and a page number. @@ -1357,7 +1357,7 @@ dict_index_build_node_ptr( created */ ulint level) /*!< in: level of rec in tree: 0 means leaf level */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Copies an initial segment of a physical record, long enough to specify an index entry uniquely. @@ -1373,7 +1373,7 @@ dict_index_copy_rec_order_prefix( byte** buf, /*!< in/out: memory buffer for the copied prefix, or NULL */ ulint* buf_size)/*!< in/out: buffer size */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Builds a typed data tuple out of a physical record. @return own: data tuple */ @@ -1385,7 +1385,7 @@ dict_index_build_data_tuple( rec_t* rec, /*!< in: record for which to build data tuple */ ulint n_fields,/*!< in: number of data fields */ mem_heap_t* heap) /*!< in: memory heap where tuple created */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Gets the space id of the root of the index tree. @return space id */ @@ -1394,7 +1394,7 @@ ulint dict_index_get_space( /*=================*/ const dict_index_t* index) /*!< in: index */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Sets the space id of the root of the index tree. */ UNIV_INLINE @@ -1403,7 +1403,7 @@ dict_index_set_space( /*=================*/ dict_index_t* index, /*!< in/out: index */ ulint space) /*!< in: space id */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Gets the page number of the root of the index tree. @return page number */ @@ -1412,7 +1412,7 @@ ulint dict_index_get_page( /*================*/ const dict_index_t* tree) /*!< in: index */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Gets the read-write lock of the index tree. @return read-write lock */ @@ -1421,7 +1421,7 @@ prio_rw_lock_t* dict_index_get_lock( /*================*/ dict_index_t* index) /*!< in: index */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Returns free space reserved for future updates of records. This is relevant only in the case of many consecutive inserts, as updates @@ -1441,7 +1441,7 @@ enum online_index_status dict_index_get_online_status( /*=========================*/ const dict_index_t* index) /*!< in: secondary index */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Sets the status of online index creation. */ UNIV_INLINE @@ -1450,7 +1450,7 @@ dict_index_set_online_status( /*=========================*/ dict_index_t* index, /*!< in/out: index */ enum online_index_status status) /*!< in: status */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Determines if a secondary index is being or has been created online, or if the table is being rebuilt online, allowing concurrent modifications @@ -1464,7 +1464,7 @@ bool dict_index_is_online_ddl( /*=====================*/ const dict_index_t* index) /*!< in: index */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Calculates the minimum record length in an index. */ UNIV_INTERN @@ -1472,7 +1472,7 @@ ulint dict_index_calc_min_rec_len( /*========================*/ const dict_index_t* index) /*!< in: index */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Reserves the dictionary system mutex for MySQL. */ UNIV_INTERN @@ -1540,7 +1540,7 @@ dict_tables_have_same_db( dbname '/' tablename */ const char* name2) /*!< in: table name in the form dbname '/' tablename */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Removes an index from the cache */ UNIV_INTERN @@ -1549,7 +1549,7 @@ dict_index_remove_from_cache( /*=========================*/ dict_table_t* table, /*!< in/out: table */ dict_index_t* index) /*!< in, own: index */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Get index by name @return index, NULL if does not exist */ @@ -1559,7 +1559,7 @@ dict_table_get_index_on_name( /*=========================*/ dict_table_t* table, /*!< in: table */ const char* name) /*!< in: name of the index to find */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Looks for an index with the given id given a table instance. @return index or NULL */ @@ -1580,7 +1580,7 @@ dict_table_get_index_on_name_and_min_id( /*====================================*/ dict_table_t* table, /*!< in: table */ const char* name) /*!< in: name of the index to find */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************** Check whether a column exists in an FTS index. */ UNIV_INLINE @@ -1591,7 +1591,7 @@ dict_table_is_fts_column( the offset within the vector */ ib_vector_t* indexes,/* in: vector containing only FTS indexes */ ulint col_no) /* in: col number to search for */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Move a table to the non LRU end of the LRU list. */ UNIV_INTERN @@ -1599,7 +1599,7 @@ void dict_table_move_from_lru_to_non_lru( /*================================*/ dict_table_t* table) /*!< in: table to move from LRU to non-LRU */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Move a table to the LRU list from the non-LRU list. */ UNIV_INTERN @@ -1607,7 +1607,7 @@ void dict_table_move_from_non_lru_to_lru( /*================================*/ dict_table_t* table) /*!< in: table to move from non-LRU to LRU */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Move to the most recently used segment of the LRU list. */ UNIV_INTERN @@ -1615,7 +1615,7 @@ void dict_move_to_mru( /*=============*/ dict_table_t* table) /*!< in: table to move to MRU */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /** Maximum number of columns in a foreign key constraint. Please Note MySQL has a much lower limit on the number of columns allowed in a foreign key @@ -1739,7 +1739,7 @@ dict_table_schema_check( != DB_TABLE_NOT_FOUND is returned */ size_t errstr_sz) /*!< in: errstr size */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /* @} */ /*********************************************************************//** @@ -1757,7 +1757,7 @@ dict_fs2utf8( size_t db_utf8_size, /*!< in: dbname_utf8 size */ char* table_utf8, /*!< out: table name, e.g. aÑŽbØc */ size_t table_utf8_size)/*!< in: table_utf8 size */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Closes the data dictionary module. */ @@ -1774,7 +1774,7 @@ ulint dict_table_is_corrupted( /*====================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Check whether the index is corrupted. @@ -1784,7 +1784,7 @@ ulint dict_index_is_corrupted( /*====================*/ const dict_index_t* index) /*!< in: index */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** @@ -1797,7 +1797,7 @@ dict_set_corrupted( dict_index_t* index, /*!< in/out: index */ trx_t* trx, /*!< in/out: transaction */ const char* ctx) /*!< in: context */ - UNIV_COLD __attribute__((nonnull)); + UNIV_COLD MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Flags an index corrupted in the data dictionary cache only. This @@ -1809,7 +1809,7 @@ dict_set_corrupted_index_cache_only( /*================================*/ dict_index_t* index, /*!< in/out: index */ dict_table_t* table) /*!< in/out: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Flags a table with specified space_id corrupted in the table dictionary @@ -1829,7 +1829,7 @@ bool dict_tf_is_valid( /*=============*/ ulint flags) /*!< in: table flags */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /********************************************************************//** Check if the tablespace for the table has been discarded. @@ -1839,7 +1839,7 @@ bool dict_table_is_discarded( /*====================*/ const dict_table_t* table) /*!< in: table to check */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /********************************************************************//** Check if it is a temporary table. @@ -1849,7 +1849,7 @@ bool dict_table_is_temporary( /*====================*/ const dict_table_t* table) /*!< in: table to check */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); #ifndef UNIV_HOTBACKUP /*********************************************************************//** @@ -1860,7 +1860,7 @@ void dict_index_zip_success( /*===================*/ dict_index_t* index) /*!< in/out: index to be updated. */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** This function should be called whenever a page compression attempt fails. Updates the compression padding information. */ @@ -1869,7 +1869,7 @@ void dict_index_zip_failure( /*===================*/ dict_index_t* index) /*!< in/out: index to be updated. */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Return the optimal page size, for which page will likely compress. @return page size beyond which page may not compress*/ @@ -1879,7 +1879,7 @@ dict_index_zip_pad_optimal_page_size( /*=================================*/ dict_index_t* index) /*!< in: index for which page size is requested */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Convert table flag to row format string. @return row format name */ diff --git a/storage/xtradb/include/dict0dict.ic b/storage/xtradb/include/dict0dict.ic index 2f9fc3bcfe6..d9d40b809d1 100644 --- a/storage/xtradb/include/dict0dict.ic +++ b/storage/xtradb/include/dict0dict.ic @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2013, 2015, MariaDB +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2013, 2016, MariaDB This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -81,7 +81,8 @@ dict_col_copy_type( const dict_col_t* col, /*!< in: column */ dtype_t* type) /*!< out: data type */ { - ut_ad(col && type); + ut_ad(col != NULL); + ut_ad(type != NULL); type->mtype = col->mtype; type->prtype = col->prtype; @@ -358,7 +359,7 @@ UNIV_INLINE ulint dict_table_get_n_sys_cols( /*======================*/ - const dict_table_t* table __attribute__((unused))) /*!< in: table */ + const dict_table_t* table MY_ATTRIBUTE((unused))) /*!< in: table */ { ut_ad(table); ut_ad(table->magic_n == DICT_TABLE_MAGIC_N); diff --git a/storage/xtradb/include/dict0load.h b/storage/xtradb/include/dict0load.h index 030190b1a8e..dcbc3de8e94 100644 --- a/storage/xtradb/include/dict0load.h +++ b/storage/xtradb/include/dict0load.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -243,7 +243,7 @@ dict_load_foreigns( bool check_charsets, /*!< in: whether to check charset compatibility */ dict_err_ignore_t ignore_err) /*!< in: error to be ignored */ - __attribute__((nonnull(1), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1), warn_unused_result)); /********************************************************************//** Prints to the standard output information on all tables found in the data dictionary system table. */ diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h index a55d5316969..24219ac8799 100644 --- a/storage/xtradb/include/dict0mem.h +++ b/storage/xtradb/include/dict0mem.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. Copyright (c) 2013, 2016, MariaDB Corporation. @@ -199,19 +199,19 @@ DEFAULT=0, ON = 1, OFF = 2 /** Bit mask of the COMPACT field */ #define DICT_TF_MASK_COMPACT \ - ((~(~0 << DICT_TF_WIDTH_COMPACT)) \ + ((~(~0U << DICT_TF_WIDTH_COMPACT)) \ << DICT_TF_POS_COMPACT) /** Bit mask of the ZIP_SSIZE field */ #define DICT_TF_MASK_ZIP_SSIZE \ - ((~(~0 << DICT_TF_WIDTH_ZIP_SSIZE)) \ + ((~(~0U << DICT_TF_WIDTH_ZIP_SSIZE)) \ << DICT_TF_POS_ZIP_SSIZE) /** Bit mask of the ATOMIC_BLOBS field */ #define DICT_TF_MASK_ATOMIC_BLOBS \ - ((~(~0 << DICT_TF_WIDTH_ATOMIC_BLOBS)) \ + ((~(~0U << DICT_TF_WIDTH_ATOMIC_BLOBS)) \ << DICT_TF_POS_ATOMIC_BLOBS) /** Bit mask of the DATA_DIR field */ #define DICT_TF_MASK_DATA_DIR \ - ((~(~0 << DICT_TF_WIDTH_DATA_DIR)) \ + ((~(~0U << DICT_TF_WIDTH_DATA_DIR)) \ << DICT_TF_POS_DATA_DIR) /** Bit mask of the PAGE_COMPRESSION field */ #define DICT_TF_MASK_PAGE_COMPRESSION \ @@ -246,7 +246,7 @@ DEFAULT=0, ON = 1, OFF = 2 #define DICT_TF_HAS_ATOMIC_BLOBS(flags) \ ((flags & DICT_TF_MASK_ATOMIC_BLOBS) \ >> DICT_TF_POS_ATOMIC_BLOBS) -/** Return the value of the ATOMIC_BLOBS field */ +/** Return the value of the DATA_DIR field */ #define DICT_TF_HAS_DATA_DIR(flags) \ ((flags & DICT_TF_MASK_DATA_DIR) \ >> DICT_TF_POS_DATA_DIR) @@ -291,7 +291,7 @@ for unknown bits in order to protect backward incompatibility. */ /* @{ */ /** Total number of bits in table->flags2. */ #define DICT_TF2_BITS 7 -#define DICT_TF2_BIT_MASK ~(~0 << DICT_TF2_BITS) +#define DICT_TF2_BIT_MASK ~(~0U << DICT_TF2_BITS) /** TEMPORARY; TRUE for tables from CREATE TEMPORARY TABLE. */ #define DICT_TF2_TEMPORARY 1 @@ -379,7 +379,7 @@ dict_mem_table_add_col( ulint mtype, /*!< in: main datatype */ ulint prtype, /*!< in: precise type */ ulint len) /*!< in: precision */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /**********************************************************************//** Renames a column of a table in the data dictionary cache. */ UNIV_INTERN @@ -390,7 +390,7 @@ dict_mem_table_col_rename( unsigned nth_col,/*!< in: column index */ const char* from, /*!< in: old column name */ const char* to) /*!< in: new column name */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** This function populates a dict_col_t memory structure with supplied information. */ diff --git a/storage/xtradb/include/dict0stats.h b/storage/xtradb/include/dict0stats.h index abf56b2f0c7..72501bf9429 100644 --- a/storage/xtradb/include/dict0stats.h +++ b/storage/xtradb/include/dict0stats.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2009, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2009, 2016, 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 @@ -77,7 +77,7 @@ dict_stats_set_persistent( dict_table_t* table, /*!< in/out: table */ ibool ps_on, /*!< in: persistent stats explicitly enabled */ ibool ps_off) /*!< in: persistent stats explicitly disabled */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Check whether persistent statistics is enabled for a given table. @@ -87,7 +87,7 @@ ibool dict_stats_is_persistent_enabled( /*=============================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Set the auto recalc flag for a given table (only honored for a persistent @@ -127,7 +127,7 @@ void dict_stats_deinit( /*==============*/ dict_table_t* table) /*!< in/out: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Calculates new estimates for table and index statistics. The statistics @@ -179,7 +179,7 @@ void dict_stats_update_for_index( /*========================*/ dict_index_t* index) /*!< in/out: index */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Renames a table in InnoDB persistent stats storage. diff --git a/storage/xtradb/include/dict0stats_bg.h b/storage/xtradb/include/dict0stats_bg.h index 32fac3015e8..34dc4657829 100644 --- a/storage/xtradb/include/dict0stats_bg.h +++ b/storage/xtradb/include/dict0stats_bg.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2012, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2012, 2016, 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 @@ -96,7 +96,7 @@ bool dict_stats_stop_bg( /*===============*/ dict_table_t* table) /*!< in/out: table */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /*****************************************************************//** Wait until background stats thread has stopped using the specified table. diff --git a/storage/xtradb/include/dyn0dyn.h b/storage/xtradb/include/dyn0dyn.h index 7f23302d1ff..1bd10b6bf58 100644 --- a/storage/xtradb/include/dyn0dyn.h +++ b/storage/xtradb/include/dyn0dyn.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -48,7 +48,7 @@ dyn_array_create( /*=============*/ dyn_array_t* arr) /*!< in/out memory buffer of size sizeof(dyn_array_t) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /************************************************************//** Frees a dynamic array. */ UNIV_INLINE @@ -56,7 +56,7 @@ void dyn_array_free( /*===========*/ dyn_array_t* arr) /*!< in,own: dyn array */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Makes room on top of a dyn array and returns a pointer to a buffer in it. After copying the elements, the caller must close the buffer using @@ -69,7 +69,7 @@ dyn_array_open( dyn_array_t* arr, /*!< in: dynamic array */ ulint size) /*!< in: size in bytes of the buffer; MUST be smaller than DYN_ARRAY_DATA_SIZE! */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Closes the buffer returned by dyn_array_open. */ UNIV_INLINE @@ -78,7 +78,7 @@ dyn_array_close( /*============*/ dyn_array_t* arr, /*!< in: dynamic array */ const byte* ptr) /*!< in: end of used space */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Makes room on top of a dyn array and returns a pointer to the added element. The caller must copy the element to @@ -90,7 +90,7 @@ dyn_array_push( /*===========*/ dyn_array_t* arr, /*!< in/out: dynamic array */ ulint size) /*!< in: size in bytes of the element */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /************************************************************//** Returns pointer to an element in dyn array. @return pointer to element */ @@ -101,7 +101,7 @@ dyn_array_get_element( const dyn_array_t* arr, /*!< in: dyn array */ ulint pos) /*!< in: position of element in bytes from array start */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /************************************************************//** Returns the size of stored data in a dyn array. @return data size in bytes */ @@ -110,7 +110,7 @@ ulint dyn_array_get_data_size( /*====================*/ const dyn_array_t* arr) /*!< in: dyn array */ - __attribute__((nonnull, warn_unused_result, pure)); + MY_ATTRIBUTE((nonnull, warn_unused_result, pure)); /************************************************************//** Gets the first block in a dyn array. @param arr dyn array @@ -144,7 +144,7 @@ ulint dyn_block_get_used( /*===============*/ const dyn_block_t* block) /*!< in: dyn array block */ - __attribute__((nonnull, warn_unused_result, pure)); + MY_ATTRIBUTE((nonnull, warn_unused_result, pure)); /********************************************************************//** Gets pointer to the start of data in a dyn array block. @return pointer to data */ @@ -153,7 +153,7 @@ byte* dyn_block_get_data( /*===============*/ const dyn_block_t* block) /*!< in: dyn array block */ - __attribute__((nonnull, warn_unused_result, pure)); + MY_ATTRIBUTE((nonnull, warn_unused_result, pure)); /********************************************************//** Pushes n bytes to a dyn array. */ UNIV_INLINE @@ -163,7 +163,7 @@ dyn_push_string( dyn_array_t* arr, /*!< in/out: dyn array */ const byte* str, /*!< in: string to write */ ulint len) /*!< in: string length */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*#################################################################*/ diff --git a/storage/xtradb/include/dyn0dyn.ic b/storage/xtradb/include/dyn0dyn.ic index 0296554e2ee..f18f2e6dff9 100644 --- a/storage/xtradb/include/dyn0dyn.ic +++ b/storage/xtradb/include/dyn0dyn.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -36,7 +36,7 @@ dyn_block_t* dyn_array_add_block( /*================*/ dyn_array_t* arr) /*!< in/out: dyn array */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Gets the number of used bytes in a dyn array block. diff --git a/storage/xtradb/include/fil0fil.h b/storage/xtradb/include/fil0fil.h index fb9c79a3e5a..20e8303f764 100644 --- a/storage/xtradb/include/fil0fil.h +++ b/storage/xtradb/include/fil0fil.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2013, 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -436,7 +436,7 @@ fil_node_create( ulint id, /*!< in: space id where to append */ ibool is_raw) /*!< in: TRUE if a raw device or a raw disk partition */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifdef UNIV_LOG_ARCHIVE /****************************************************************//** Drops files from the start of a file space, so that its size is cut by @@ -697,7 +697,7 @@ dberr_t fil_discard_tablespace( /*===================*/ ulint id) /*!< in: space id */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); #endif /* !UNIV_HOTBACKUP */ /** Test if a tablespace file can be renamed to a new filepath by checking @@ -1212,7 +1212,7 @@ fil_tablespace_iterate( dict_table_t* table, ulint n_io_buffers, PageCallback& callback) - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Checks if a single-table tablespace for a given table name exists in the @@ -1236,7 +1236,7 @@ fil_get_space_names( /*================*/ space_name_list_t& space_name_list) /*!< in/out: Vector for collecting the names. */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /** Generate redo log for swapping two .ibd files @param[in] old_table old table @@ -1251,7 +1251,7 @@ fil_mtr_rename_log( const dict_table_t* new_table, const char* tmp_name, mtr_t* mtr) - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*******************************************************************//** Finds the given page_no of the given space id from the double write buffer, @@ -1265,6 +1265,14 @@ fil_user_tablespace_restore_page( ulint page_no); /* in: page_no to obtain from double write buffer */ +/*******************************************************************//** +Returns a pointer to the file_space_t that is in the memory cache +associated with a space id. +@return file_space_t pointer, NULL if space not found */ +fil_space_t* +fil_space_get( +/*==========*/ + ulint id); /*!< in: space id */ #endif /* !UNIV_INNOCHECKSUM */ /************************************************************************* diff --git a/storage/xtradb/include/fsp0fsp.h b/storage/xtradb/include/fsp0fsp.h index 839aed80418..9212328f724 100644 --- a/storage/xtradb/include/fsp0fsp.h +++ b/storage/xtradb/include/fsp0fsp.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under @@ -108,23 +108,23 @@ dictionary */ /** Bit mask of the POST_ANTELOPE field */ #define FSP_FLAGS_MASK_POST_ANTELOPE \ - ((~(~0 << FSP_FLAGS_WIDTH_POST_ANTELOPE)) \ + ((~(~0U << FSP_FLAGS_WIDTH_POST_ANTELOPE)) \ << FSP_FLAGS_POS_POST_ANTELOPE) /** Bit mask of the ZIP_SSIZE field */ #define FSP_FLAGS_MASK_ZIP_SSIZE \ - ((~(~0 << FSP_FLAGS_WIDTH_ZIP_SSIZE)) \ + ((~(~0U << FSP_FLAGS_WIDTH_ZIP_SSIZE)) \ << FSP_FLAGS_POS_ZIP_SSIZE) /** Bit mask of the ATOMIC_BLOBS field */ #define FSP_FLAGS_MASK_ATOMIC_BLOBS \ - ((~(~0 << FSP_FLAGS_WIDTH_ATOMIC_BLOBS)) \ + ((~(~0U << FSP_FLAGS_WIDTH_ATOMIC_BLOBS)) \ << FSP_FLAGS_POS_ATOMIC_BLOBS) /** Bit mask of the PAGE_SSIZE field */ #define FSP_FLAGS_MASK_PAGE_SSIZE \ - ((~(~0 << FSP_FLAGS_WIDTH_PAGE_SSIZE)) \ + ((~(~0U << FSP_FLAGS_WIDTH_PAGE_SSIZE)) \ << FSP_FLAGS_POS_PAGE_SSIZE) /** Bit mask of the DATA_DIR field */ #define FSP_FLAGS_MASK_DATA_DIR \ - ((~(~0 << FSP_FLAGS_WIDTH_DATA_DIR)) \ + ((~(~0U << FSP_FLAGS_WIDTH_DATA_DIR)) \ << FSP_FLAGS_POS_DATA_DIR) /** Bit mask of the DATA_DIR field */ #define FSP_FLAGS_MASK_DATA_DIR_ORACLE \ @@ -581,7 +581,7 @@ fseg_alloc_free_page_general( in which the page should be initialized. If init_mtr!=mtr, but the page is already latched in mtr, do not initialize the page. */ - __attribute__((warn_unused_result, nonnull)); + MY_ATTRIBUTE((warn_unused_result, nonnull)); /**********************************************************************//** Reserves free pages from a tablespace. All mini-transactions which may use several pages from the tablespace should call this function beforehand @@ -650,7 +650,7 @@ fseg_page_is_free( fseg_header_t* seg_header, /*!< in: segment header */ ulint space, /*!< in: space id */ ulint page) /*!< in: page offset */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************************//** Frees part of a segment. This function can be used to free a segment by repeatedly calling this function in different mini-transactions. @@ -746,7 +746,7 @@ bool fsp_flags_is_valid( /*===============*/ ulint flags) /*!< in: tablespace flags */ - __attribute__((warn_unused_result, const)); + MY_ATTRIBUTE((warn_unused_result, const)); /********************************************************************//** Determine if the tablespace is compressed from dict_table_t::flags. @return TRUE if compressed, FALSE if not compressed */ diff --git a/storage/xtradb/include/fts0ast.h b/storage/xtradb/include/fts0ast.h index b2380f78b39..50f62063893 100644 --- a/storage/xtradb/include/fts0ast.h +++ b/storage/xtradb/include/fts0ast.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2007, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2007, 2016, 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 @@ -200,7 +200,7 @@ fts_ast_visit( and ignored processing an operator, currently we only ignore FTS_IGNORE operator */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*****************************************************************//** Process (nested) sub-expression, create a new result set to store the sub-expression result by processing nodes under current sub-expression @@ -213,7 +213,7 @@ fts_ast_visit_sub_exp( fts_ast_node_t* node, /*!< in: instance to traverse*/ fts_ast_callback visitor, /*!< in: callback */ void* arg) /*!< in: callback arg */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************** Create a lex instance.*/ UNIV_INTERN @@ -223,7 +223,7 @@ fts_lexer_create( ibool boolean_mode, /*!< in: query type */ const byte* query, /*!< in: query string */ ulint query_len) /*!< in: query string len */ - __attribute__((nonnull, malloc, warn_unused_result)); + MY_ATTRIBUTE((nonnull, malloc, warn_unused_result)); /******************************************************************** Free an fts_lexer_t instance.*/ UNIV_INTERN @@ -232,7 +232,7 @@ fts_lexer_free( /*===========*/ fts_lexer_t* fts_lexer) /*!< in: lexer instance to free */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /** Create an ast string object, with NUL-terminator, so the string diff --git a/storage/xtradb/include/fts0fts.h b/storage/xtradb/include/fts0fts.h index 9f7b0216d9b..68d4d333245 100644 --- a/storage/xtradb/include/fts0fts.h +++ b/storage/xtradb/include/fts0fts.h @@ -94,7 +94,10 @@ those defined in mysql file ft_global.h */ /** Threshold where our optimize thread automatically kicks in */ #define FTS_OPTIMIZE_THRESHOLD 10000000 -#define FTS_DOC_ID_MAX_STEP 10000 +/** Threshold to avoid exhausting of doc ids. Consecutive doc id difference +should not exceed FTS_DOC_ID_MAX_STEP */ +#define FTS_DOC_ID_MAX_STEP 65535 + /** Variable specifying the FTS parallel sort degree */ extern ulong fts_sort_pll_degree; @@ -408,7 +411,7 @@ fts_get_next_doc_id( /*================*/ const dict_table_t* table, /*!< in: table */ doc_id_t* doc_id) /*!< out: new document id */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Update the next and last Doc ID in the CONFIG table to be the input "doc_id" value (+ 1). We would do so after each FTS index build or @@ -421,7 +424,7 @@ fts_update_next_doc_id( const dict_table_t* table, /*!< in: table */ const char* table_name, /*!< in: table name, or NULL */ doc_id_t doc_id) /*!< in: DOC ID to set */ - __attribute__((nonnull(2))); + MY_ATTRIBUTE((nonnull(2))); /******************************************************************//** Create a new document id . @@ -437,7 +440,7 @@ fts_create_doc_id( current row that is being inserted. */ mem_heap_t* heap) /*!< in: heap */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Create a new fts_doc_ids_t. @return new fts_doc_ids_t. */ @@ -466,7 +469,7 @@ fts_trx_add_op( fts_row_state state, /*!< in: state of the row */ ib_vector_t* fts_indexes) /*!< in: FTS indexes affected (NULL=all) */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); /******************************************************************//** Free an FTS trx. */ @@ -491,7 +494,7 @@ fts_create_common_tables( index */ const char* name, /*!< in: table name */ bool skip_doc_id_index) /*!< in: Skip index on doc id */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Wrapper function of fts_create_index_tables_low(), create auxiliary tables for an FTS index @@ -503,7 +506,7 @@ fts_create_index_tables( trx_t* trx, /*!< in: transaction handle */ const dict_index_t* index) /*!< in: the FTS index instance */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Creates the column specific ancillary tables needed for supporting an FTS index on the given table. row_mysql_lock_data_dictionary must have @@ -519,7 +522,7 @@ fts_create_index_tables_low( instance */ const char* table_name, /*!< in: the table name */ table_id_t table_id) /*!< in: the table id */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Add the FTS document id hidden column. */ UNIV_INTERN @@ -528,7 +531,7 @@ fts_add_doc_id_column( /*==================*/ dict_table_t* table, /*!< in/out: Table with FTS index */ mem_heap_t* heap) /*!< in: temporary memory heap, or NULL */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /*********************************************************************//** Drops the ancillary tables needed for supporting an FTS index on the @@ -542,7 +545,7 @@ fts_drop_tables( trx_t* trx, /*!< in: transaction */ dict_table_t* table) /*!< in: table has the FTS index */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** The given transaction is about to be committed; do whatever is necessary from the FTS system's POV. @@ -552,7 +555,7 @@ dberr_t fts_commit( /*=======*/ trx_t* trx) /*!< in: transaction */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** FTS Query entry point. @@ -569,7 +572,7 @@ fts_query( in bytes */ fts_result_t** result) /*!< out: query result, to be freed by the caller.*/ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Retrieve the FTS Relevance Ranking result for doc with doc_id @@ -687,7 +690,7 @@ dberr_t fts_optimize_table( /*===============*/ dict_table_t* table) /*!< in: table to optimiza */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Startup the optimize thread and create the work queue. */ @@ -713,7 +716,7 @@ fts_drop_index_tables( /*==================*/ trx_t* trx, /*!< in: transaction */ dict_index_t* index) /*!< in: Index to drop */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Remove the table from the OPTIMIZER's list. We do wait for @@ -754,7 +757,7 @@ fts_savepoint_take( trx_t* trx, /*!< in: transaction */ fts_trx_t* fts_trx, /*!< in: fts transaction */ const char* name) /*!< in: savepoint name */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Refresh last statement savepoint. */ UNIV_INTERN @@ -762,7 +765,7 @@ void fts_savepoint_laststmt_refresh( /*===========================*/ trx_t* trx) /*!< in: transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Release the savepoint data identified by name. */ UNIV_INTERN @@ -780,13 +783,12 @@ fts_cache_destroy( /*==============*/ fts_cache_t* cache); /*!< in: cache*/ -/*********************************************************************//** -Clear cache. */ +/** Clear cache. +@param[in,out] cache fts cache */ UNIV_INTERN void fts_cache_clear( -/*============*/ - fts_cache_t* cache); /*!< in: cache */ + fts_cache_t* cache); /*********************************************************************//** Initialize things in cache. */ @@ -831,7 +833,7 @@ fts_drop_index_split_tables( /*========================*/ trx_t* trx, /*!< in: transaction */ dict_index_t* index) /*!< in: fts instance */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Run SYNC on the table, i.e., write out data from the cache to the FTS auxiliary INDEX table and clear the cache at the end. @@ -1023,7 +1025,7 @@ fts_drop_index( dict_table_t* table, /*!< in: Table where indexes are dropped */ dict_index_t* index, /*!< in: Index to be dropped */ trx_t* trx) /*!< in: Transaction for the drop */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /****************************************************************//** Rename auxiliary tables for all fts index for a table diff --git a/storage/xtradb/include/fts0priv.h b/storage/xtradb/include/fts0priv.h index b4d9e1d41ec..2d4e9d88fd1 100644 --- a/storage/xtradb/include/fts0priv.h +++ b/storage/xtradb/include/fts0priv.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2011, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2011, 2016, 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 @@ -121,7 +121,7 @@ fts_parse_sql( fts_table_t* fts_table, /*!< in: FTS aux table */ pars_info_t* info, /*!< in: info struct, or NULL */ const char* sql) /*!< in: SQL string to evaluate */ - __attribute__((nonnull(3), malloc, warn_unused_result)); + MY_ATTRIBUTE((nonnull(3), malloc, warn_unused_result)); /******************************************************************//** Evaluate a parsed SQL statement @return DB_SUCCESS or error code */ @@ -131,7 +131,7 @@ fts_eval_sql( /*=========*/ trx_t* trx, /*!< in: transaction */ que_t* graph) /*!< in: Parsed statement */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Construct the name of an ancillary FTS table for the given table. @return own: table name, must be freed with mem_free() */ @@ -141,7 +141,7 @@ fts_get_table_name( /*===============*/ const fts_table_t* fts_table) /*!< in: FTS aux table info */ - __attribute__((nonnull, malloc, warn_unused_result)); + MY_ATTRIBUTE((nonnull, malloc, warn_unused_result)); /******************************************************************//** Construct the column specification part of the SQL string for selecting the indexed FTS columns for the given table. Adds the necessary bound @@ -164,7 +164,7 @@ fts_get_select_columns_str( dict_index_t* index, /*!< in: FTS index */ pars_info_t* info, /*!< in/out: parser info */ mem_heap_t* heap) /*!< in: memory heap */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** define for fts_doc_fetch_by_doc_id() "option" value, defines whether we want to get Doc whose ID is equal to or greater or smaller than supplied @@ -191,7 +191,7 @@ fts_doc_fetch_by_doc_id( callback, /*!< in: callback to read records */ void* arg) /*!< in: callback arg */ - __attribute__((nonnull(6))); + MY_ATTRIBUTE((nonnull(6))); /*******************************************************************//** Callback function for fetch that stores the text of an FTS document, @@ -203,7 +203,7 @@ fts_query_expansion_fetch_doc( /*==========================*/ void* row, /*!< in: sel_node_t* */ void* user_arg) /*!< in: fts_doc_t* */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************** Write out a single word's data as new entry/entries in the INDEX table. @return DB_SUCCESS if all OK. */ @@ -216,7 +216,7 @@ fts_write_node( fts_table_t* fts_table, /*!< in: the FTS aux index */ fts_string_t* word, /*!< in: word in UTF-8 */ fts_node_t* node) /*!< in: node columns */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Tokenize a document. */ UNIV_INTERN @@ -227,7 +227,7 @@ fts_tokenize_document( tokenize */ fts_doc_t* result) /*!< out: if provided, save result tokens here */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /*******************************************************************//** Continue to tokenize a document. */ @@ -241,7 +241,7 @@ fts_tokenize_document_next( tokens from this tokenization */ fts_doc_t* result) /*!< out: if provided, save result tokens here */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /******************************************************************//** Initialize a document. */ UNIV_INTERN @@ -249,7 +249,7 @@ void fts_doc_init( /*=========*/ fts_doc_t* doc) /*!< in: doc to initialize */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Do a binary search for a doc id in the array @@ -263,7 +263,7 @@ fts_bsearch( int lower, /*!< in: lower bound of array*/ int upper, /*!< in: upper bound of array*/ doc_id_t doc_id) /*!< in: doc id to lookup */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Free document. */ UNIV_INTERN @@ -271,7 +271,7 @@ void fts_doc_free( /*=========*/ fts_doc_t* doc) /*!< in: document */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Free fts_optimizer_word_t instanace.*/ UNIV_INTERN @@ -279,7 +279,7 @@ void fts_word_free( /*==========*/ fts_word_t* word) /*!< in: instance to free.*/ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Read the rows from the FTS inde @return DB_SUCCESS or error code */ @@ -293,7 +293,7 @@ fts_index_fetch_nodes( const fts_string_t* word, /*!< in: the word to fetch */ fts_fetch_t* fetch) /*!< in: fetch callback.*/ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Create a fts_optimizer_word_t instance. @return new instance */ @@ -304,7 +304,7 @@ fts_word_init( fts_word_t* word, /*!< in: word to initialize */ byte* utf8, /*!< in: UTF-8 string */ ulint len) /*!< in: length of string in bytes */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Compare two fts_trx_table_t instances, we actually compare the table id's here. @@ -315,7 +315,7 @@ fts_trx_table_cmp( /*==============*/ const void* v1, /*!< in: id1 */ const void* v2) /*!< in: id2 */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Compare a table id with a trx_table_t table id. @return < 0 if n1 < n2, 0 if n1 == n2, > 0 if n1 > n2 */ @@ -325,7 +325,7 @@ fts_trx_table_id_cmp( /*=================*/ const void* p1, /*!< in: id1 */ const void* p2) /*!< in: id2 */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Commit a transaction. @return DB_SUCCESS if all OK */ @@ -334,7 +334,7 @@ dberr_t fts_sql_commit( /*===========*/ trx_t* trx) /*!< in: transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Rollback a transaction. @return DB_SUCCESS if all OK */ @@ -343,7 +343,7 @@ dberr_t fts_sql_rollback( /*=============*/ trx_t* trx) /*!< in: transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Parse an SQL string. %s is replaced with the table's id. Don't acquire the dict mutex @@ -355,7 +355,7 @@ fts_parse_sql_no_dict_lock( fts_table_t* fts_table, /*!< in: table with FTS index */ pars_info_t* info, /*!< in: parser info */ const char* sql) /*!< in: SQL string to evaluate */ - __attribute__((nonnull(3), malloc, warn_unused_result)); + MY_ATTRIBUTE((nonnull(3), malloc, warn_unused_result)); /******************************************************************//** Get value from config table. The caller must ensure that enough space is allocated for value to hold the column contents @@ -370,7 +370,7 @@ fts_config_get_value( this parameter name */ fts_string_t* value) /*!< out: value read from config table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Get value specific to an FTS index from the config table. The caller must ensure that enough space is allocated for value to hold the @@ -386,7 +386,7 @@ fts_config_get_index_value( this parameter name */ fts_string_t* value) /*!< out: value read from config table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Set the value in the config table for name. @return DB_SUCCESS or error code */ @@ -400,7 +400,7 @@ fts_config_set_value( this parameter name */ const fts_string_t* value) /*!< in: value to update */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /****************************************************************//** Set an ulint value in the config table. @return DB_SUCCESS if all OK else error code */ @@ -412,7 +412,7 @@ fts_config_set_ulint( fts_table_t* fts_table, /*!< in: the indexed FTS table */ const char* name, /*!< in: param name */ ulint int_value) /*!< in: value */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Set the value specific to an FTS index in the config table. @return DB_SUCCESS or error code */ @@ -426,7 +426,7 @@ fts_config_set_index_value( this parameter name */ fts_string_t* value) /*!< out: value read from config table */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Increment the value in the config table for column name. @return DB_SUCCESS or error code */ @@ -439,7 +439,7 @@ fts_config_increment_value( const char* name, /*!< in: increment config value for this parameter name */ ulint delta) /*!< in: increment by this much */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Increment the per index value in the config table for column name. @return DB_SUCCESS or error code */ @@ -452,7 +452,7 @@ fts_config_increment_index_value( const char* name, /*!< in: increment config value for this parameter name */ ulint delta) /*!< in: increment by this much */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Get an ulint value from the config table. @return DB_SUCCESS or error code */ @@ -464,7 +464,7 @@ fts_config_get_index_ulint( dict_index_t* index, /*!< in: FTS index */ const char* name, /*!< in: param name */ ulint* int_value) /*!< out: value */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Set an ulint value int the config table. @return DB_SUCCESS or error code */ @@ -476,7 +476,7 @@ fts_config_set_index_ulint( dict_index_t* index, /*!< in: FTS index */ const char* name, /*!< in: param name */ ulint int_value) /*!< in: value */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Get an ulint value from the config table. @return DB_SUCCESS or error code */ @@ -488,7 +488,7 @@ fts_config_get_ulint( fts_table_t* fts_table, /*!< in: the indexed FTS table */ const char* name, /*!< in: param name */ ulint* int_value) /*!< out: value */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Search cache for word. @return the word node vector if found else NULL */ @@ -500,7 +500,7 @@ fts_cache_find_word( index_cache, /*!< in: cache to search */ const fts_string_t* text) /*!< in: word to search for */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Check cache for deleted doc id. @return TRUE if deleted */ @@ -511,7 +511,7 @@ fts_cache_is_deleted_doc_id( const fts_cache_t* cache, /*!< in: cache ito search */ doc_id_t doc_id) /*!< in: doc id to search for */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Append deleted doc ids to vector and sort the vector. */ UNIV_INTERN @@ -546,7 +546,7 @@ fts_get_total_word_count( trx_t* trx, /*!< in: transaction */ dict_index_t* index, /*!< in: for this index */ ulint* total) /*!< out: total words */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /******************************************************************//** Search the index specific cache for a particular FTS index. @@ -559,7 +559,7 @@ fts_find_index_cache( cache, /*!< in: cache to search */ const dict_index_t* index) /*!< in: index to search for */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Write the table id to the given buffer (including final NUL). Buffer must be at least FTS_AUX_MIN_TABLE_ID_LENGTH bytes long. @@ -570,10 +570,10 @@ fts_write_object_id( /*================*/ ib_id_t id, /*!< in: a table/index id */ char* str, /*!< in: buffer to write the id to */ - bool hex_format __attribute__((unused))) + bool hex_format MY_ATTRIBUTE((unused))) /*!< in: true for fixed hex format, false for old ambiguous format */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Read the table id from the string generated by fts_write_object_id(). @return TRUE if parse successful */ @@ -583,7 +583,7 @@ fts_read_object_id( /*===============*/ ib_id_t* id, /*!< out: a table id */ const char* str) /*!< in: buffer to read from */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Get the table id. @return number of bytes written */ @@ -596,7 +596,7 @@ fts_get_table_id( char* table_id) /*!< out: table id, must be at least FTS_AUX_MIN_TABLE_ID_LENGTH bytes long */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Add the table to add to the OPTIMIZER's list. */ UNIV_INTERN @@ -604,7 +604,7 @@ void fts_optimize_add_table( /*===================*/ dict_table_t* table) /*!< in: table to add */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Optimize a table. */ UNIV_INTERN @@ -612,7 +612,7 @@ void fts_optimize_do_table( /*==================*/ dict_table_t* table) /*!< in: table to optimize */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Construct the prefix name of an FTS table. @return own: table name, must be freed with mem_free() */ @@ -622,7 +622,7 @@ fts_get_table_name_prefix( /*======================*/ const fts_table_t* fts_table) /*!< in: Auxiliary table type */ - __attribute__((nonnull, malloc, warn_unused_result)); + MY_ATTRIBUTE((nonnull, malloc, warn_unused_result)); /******************************************************************//** Add node positions. */ UNIV_INTERN @@ -633,7 +633,7 @@ fts_cache_node_add_positions( fts_node_t* node, /*!< in: word node */ doc_id_t doc_id, /*!< in: doc id */ ib_vector_t* positions) /*!< in: fts_token_t::positions */ - __attribute__((nonnull(2,4))); + MY_ATTRIBUTE((nonnull(2,4))); /******************************************************************//** Create the config table name for retrieving index specific value. @@ -644,7 +644,7 @@ fts_config_create_index_param_name( /*===============================*/ const char* param, /*!< in: base name of param */ const dict_index_t* index) /*!< in: index for config */ - __attribute__((nonnull, malloc, warn_unused_result)); + MY_ATTRIBUTE((nonnull, malloc, warn_unused_result)); #ifndef UNIV_NONINL #include "fts0priv.ic" diff --git a/storage/xtradb/include/fts0priv.ic b/storage/xtradb/include/fts0priv.ic index ec61691870b..88f2d67c7b8 100644 --- a/storage/xtradb/include/fts0priv.ic +++ b/storage/xtradb/include/fts0priv.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2011, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2011, 2016, 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 @@ -33,7 +33,7 @@ fts_write_object_id( /*================*/ ib_id_t id, /* in: a table/index id */ char* str, /* in: buffer to write the id to */ - bool hex_format __attribute__((unused))) + bool hex_format MY_ATTRIBUTE((unused))) /* in: true for fixed hex format, false for old ambiguous format */ { diff --git a/storage/xtradb/include/ha_prototypes.h b/storage/xtradb/include/ha_prototypes.h index 077c00d8eb0..dbb23d81eec 100644 --- a/storage/xtradb/include/ha_prototypes.h +++ b/storage/xtradb/include/ha_prototypes.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2006, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2006, 2016, 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 @@ -143,7 +143,7 @@ enum durability_properties thd_requested_durability( /*=====================*/ const THD* thd) /*!< in: thread handle */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Returns true if the transaction this thread is processing has edited @@ -195,7 +195,7 @@ innobase_mysql_cmp( const unsigned char* b, /*!< in: data field */ unsigned int b_length) /*!< in: data field length, not UNIV_SQL_NULL */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**************************************************************//** Converts a MySQL type to an InnoDB type. Note that this function returns the 'mtype' of InnoDB. InnoDB differentiates between MySQL's old <= 4.1 @@ -211,7 +211,7 @@ get_innobase_type_from_mysql_type( and unsigned integer types are 'unsigned types' */ const void* field) /*!< in: MySQL Field */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Get the variable length bounds of the given character set. */ @@ -320,7 +320,7 @@ innobase_get_stmt( /*==============*/ THD* thd, /*!< in: MySQL thread handle */ size_t* length) /*!< out: length of the SQL statement */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** This function is used to find the storage length in bytes of the first n characters for prefix indexes using a multibyte character set. The function @@ -346,7 +346,7 @@ enum icp_result innobase_index_cond( /*================*/ void* file) /*!< in/out: pointer to ha_innobase */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Returns true if the thread supports XA, global value of innodb_supports_xa if thd is NULL. @@ -499,7 +499,7 @@ innobase_format_name( const char* name, /*!< in: index or table name to format */ ibool is_index_name) /*!< in: index name */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /** Corresponds to Sql_condition:enum_warning_level. */ enum ib_log_level_t { @@ -529,7 +529,7 @@ ib_errf( ib_uint32_t code, /*!< MySQL error code */ const char* format, /*!< printf format */ ...) /*!< Args */ - __attribute__((format(printf, 4, 5))); + MY_ATTRIBUTE((format(printf, 4, 5))); /******************************************************************//** Use this when the args are passed to the format string from @@ -560,7 +560,7 @@ ib_logf( ib_log_level_t level, /*!< in: warning level */ const char* format, /*!< printf format */ ...) /*!< Args */ - __attribute__((format(printf, 2, 3))); + MY_ATTRIBUTE((format(printf, 2, 3))); /******************************************************************//** Returns the NUL terminated value of glob_hostname. @@ -606,7 +606,7 @@ innobase_next_autoinc( ulonglong step, /*!< in: AUTOINC increment step */ ulonglong offset, /*!< in: AUTOINC offset */ ulonglong max_value) /*!< in: max value for type */ - __attribute__((pure, warn_unused_result)); + MY_ATTRIBUTE((pure, warn_unused_result)); /********************************************************************//** Get the upper limit of the MySQL integral and floating-point type. @@ -616,7 +616,7 @@ ulonglong innobase_get_int_col_max_value( /*===========================*/ const Field* field) /*!< in: MySQL field */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /********************************************************************** Check if the length of the identifier exceeds the maximum allowed. diff --git a/storage/xtradb/include/handler0alter.h b/storage/xtradb/include/handler0alter.h index 66b963ae39a..3dd6c99eb6d 100644 --- a/storage/xtradb/include/handler0alter.h +++ b/storage/xtradb/include/handler0alter.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2005, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2005, 2016, 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 @@ -32,7 +32,7 @@ innobase_rec_to_mysql( const dict_index_t* index, /*!< in: index */ const ulint* offsets)/*!< in: rec_get_offsets( rec, index, ...) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Copies an InnoDB index entry to table->record[0]. */ @@ -43,7 +43,7 @@ innobase_fields_to_mysql( struct TABLE* table, /*!< in/out: MySQL table */ const dict_index_t* index, /*!< in: InnoDB index */ const dfield_t* fields) /*!< in: InnoDB index fields */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Copies an InnoDB row to table->record[0]. */ @@ -54,7 +54,7 @@ innobase_row_to_mysql( struct TABLE* table, /*!< in/out: MySQL table */ const dict_table_t* itab, /*!< in: InnoDB table */ const dtuple_t* row) /*!< in: InnoDB row */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Resets table->record[0]. */ @@ -63,7 +63,7 @@ void innobase_rec_reset( /*===============*/ struct TABLE* table) /*!< in/out: MySQL table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /** Generate the next autoinc based on a snapshot of the session auto_increment_increment and auto_increment_offset variables. */ diff --git a/storage/xtradb/include/ibuf0ibuf.h b/storage/xtradb/include/ibuf0ibuf.h index 3c8fa874dcf..0b325b68a84 100644 --- a/storage/xtradb/include/ibuf0ibuf.h +++ b/storage/xtradb/include/ibuf0ibuf.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -120,7 +120,7 @@ void ibuf_mtr_start( /*===========*/ mtr_t* mtr) /*!< out: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /***************************************************************//** Commits an insert buffer mini-transaction. */ UNIV_INLINE @@ -128,7 +128,7 @@ void ibuf_mtr_commit( /*============*/ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Initializes an ibuf bitmap page. */ UNIV_INTERN @@ -254,7 +254,7 @@ ibool ibuf_inside( /*========*/ const mtr_t* mtr) /*!< in: mini-transaction */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /***********************************************************************//** Checks if a page address is an ibuf bitmap page (level 3 page) address. @return TRUE if a bitmap page */ @@ -287,7 +287,7 @@ ibuf_page_low( is not one of the fixed address ibuf pages, or NULL, in which case a new transaction is created. */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); #ifdef UNIV_DEBUG /** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. Must not be called when recv_no_ibuf_operations==TRUE. @@ -366,23 +366,31 @@ void ibuf_delete_for_discarded_space( /*============================*/ ulint space); /*!< in: space id */ -/*********************************************************************//** -Contracts insert buffer trees by reading pages to the buffer pool. +/** Contract the change buffer by reading pages to the buffer pool. +@param[in] full If true, do a full contraction based +on PCT_IO(100). If false, the size of contract batch is determined +based on the current size of the change buffer. @return a lower limit for the combined size in bytes of entries which will be merged from ibuf trees to the pages read, 0 if ibuf is empty */ UNIV_INTERN ulint -ibuf_contract_in_background( -/*========================*/ - table_id_t table_id, /*!< in: if merge should be done only - for a specific table, for all tables - this should be 0 */ - ibool full); /*!< in: TRUE if the caller wants to - do a full contract based on PCT_IO(100). - If FALSE then the size of contract - batch is determined based on the - current size of the ibuf tree. */ +ibuf_merge_in_background( + bool full); /*!< in: TRUE if the caller wants to + do a full contract based on PCT_IO(100). + If FALSE then the size of contract + batch is determined based on the + current size of the ibuf tree. */ + +/** Contracts insert buffer trees by reading pages referring to space_id +to the buffer pool. +@returns number of pages merged.*/ +UNIV_INTERN +ulint +ibuf_merge_space( +/*=============*/ + ulint space); /*!< in: space id */ + #endif /* !UNIV_HOTBACKUP */ /*********************************************************************//** Parses a redo log record of an ibuf bitmap page init. @@ -463,7 +471,7 @@ ibuf_check_bitmap_on_import( /*========================*/ const trx_t* trx, /*!< in: transaction */ ulint space_id) /*!< in: tablespace identifier */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #define IBUF_HEADER_PAGE_NO FSP_IBUF_HEADER_PAGE_NO #define IBUF_TREE_ROOT_PAGE_NO FSP_IBUF_TREE_ROOT_PAGE_NO diff --git a/storage/xtradb/include/lock0lock.h b/storage/xtradb/include/lock0lock.h index 7858e5de2db..b6100d470cc 100644 --- a/storage/xtradb/include/lock0lock.h +++ b/storage/xtradb/include/lock0lock.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -280,7 +280,7 @@ lock_rec_expl_exist_on_page( /*========================*/ ulint space, /*!< in: space id */ ulint page_no)/*!< in: page number */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /*********************************************************************//** Checks if locks of other transactions prevent an immediate insert of a record. If they do, first tests if the query thread should anyway @@ -303,7 +303,7 @@ lock_rec_insert_check_and_lock( inserted record maybe should inherit LOCK_GAP type locks from the successor record */ - __attribute__((nonnull(2,3,4,6,7), warn_unused_result)); + MY_ATTRIBUTE((nonnull(2,3,4,6,7), warn_unused_result)); /*********************************************************************//** Checks if locks of other transactions prevent an immediate modify (update, delete mark, or delete unmark) of a clustered index record. If they do, @@ -324,7 +324,7 @@ lock_clust_rec_modify_check_and_lock( dict_index_t* index, /*!< in: clustered index */ const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ que_thr_t* thr) /*!< in: query thread */ - __attribute__((warn_unused_result, nonnull)); + MY_ATTRIBUTE((warn_unused_result, nonnull)); /*********************************************************************//** Checks if locks of other transactions prevent an immediate modify (delete mark or delete unmark) of a secondary index record. @@ -345,7 +345,7 @@ lock_sec_rec_modify_check_and_lock( que_thr_t* thr, /*!< in: query thread (can be NULL if BTR_NO_LOCKING_FLAG) */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((warn_unused_result, nonnull(2,3,4,6))); + MY_ATTRIBUTE((warn_unused_result, nonnull(2,3,4,6))); /*********************************************************************//** Like lock_clust_rec_read_check_and_lock(), but reads a secondary index record. @@ -432,7 +432,7 @@ lock_clust_rec_read_check_and_lock_alt( ulint gap_mode,/*!< in: LOCK_ORDINARY, LOCK_GAP, or LOCK_REC_NOT_GAP */ que_thr_t* thr) /*!< in: query thread */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Checks that a record is seen in a consistent read. @return true if sees, or false if an earlier version of the record @@ -464,7 +464,7 @@ lock_sec_rec_cons_read_sees( should be read or passed over by a read cursor */ const read_view_t* view) /*!< in: consistent read view */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Locks the specified database table in the mode given. If the lock cannot be granted immediately, the query thread is put to wait. @@ -479,7 +479,7 @@ lock_table( in dictionary cache */ enum lock_mode mode, /*!< in: lock mode */ que_thr_t* thr) /*!< in: query thread */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Creates a table IX lock object for a resurrected transaction. */ UNIV_INTERN @@ -544,7 +544,7 @@ lock_rec_fold( /*==========*/ ulint space, /*!< in: space */ ulint page_no)/*!< in: page number */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /*********************************************************************//** Calculates the hash value of a page file address: used in inserting or searching for a lock in the hash table. @@ -594,7 +594,7 @@ lock_is_table_exclusive( /*====================*/ const dict_table_t* table, /*!< in: table */ const trx_t* trx) /*!< in: transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Checks if a lock request lock1 has to wait for request lock2. @return TRUE if lock1 has to wait for lock2 to be removed */ @@ -618,7 +618,7 @@ lock_report_trx_id_insanity( dict_index_t* index, /*!< in: index */ const ulint* offsets, /*!< in: rec_get_offsets(rec, index) */ trx_id_t max_trx_id) /*!< in: trx_sys_get_max_trx_id() */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Prints info of a table lock. */ UNIV_INTERN @@ -645,7 +645,7 @@ lock_print_info_summary( /*====================*/ FILE* file, /*!< in: file where to print */ ibool nowait) /*!< in: whether to wait for the lock mutex */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Prints info of locks for each transaction. This function assumes that the caller holds the lock mutex and more importantly it will release the lock @@ -665,7 +665,7 @@ ulint lock_number_of_rows_locked( /*=======================*/ const trx_lock_t* trx_lock) /*!< in: transaction locks */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Gets the type of a lock. Non-inline version for using outside of the @@ -833,7 +833,7 @@ dberr_t lock_trx_handle_wait( /*=================*/ trx_t* trx) /*!< in/out: trx lock state */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Get the number of locks on a table. @return number of locks */ @@ -842,7 +842,7 @@ ulint lock_table_get_n_locks( /*===================*/ const dict_table_t* table) /*!< in: table */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifdef UNIV_DEBUG /*********************************************************************//** Checks that a transaction id is sensible, i.e., not in the future. @@ -855,7 +855,7 @@ lock_check_trx_id_sanity( const rec_t* rec, /*!< in: user record */ dict_index_t* index, /*!< in: index */ const ulint* offsets) /*!< in: rec_get_offsets(rec, index) */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Check if the transaction holds any locks on the sys tables or its records. @@ -865,7 +865,7 @@ const lock_t* lock_trx_has_sys_table_locks( /*=========================*/ const trx_t* trx) /*!< in: transaction to check */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /*******************************************************************//** Check if the transaction holds an exclusive lock on a record. @@ -878,7 +878,7 @@ lock_trx_has_rec_x_lock( const dict_table_t* table, /*!< in: table to check */ const buf_block_t* block, /*!< in: buffer block of the record */ ulint heap_no)/*!< in: record heap number */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* UNIV_DEBUG */ /** Lock modes and types */ diff --git a/storage/xtradb/include/lock0priv.h b/storage/xtradb/include/lock0priv.h index 90d5dc994a4..7a74cbdc2e3 100644 --- a/storage/xtradb/include/lock0priv.h +++ b/storage/xtradb/include/lock0priv.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2007, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2015, MariaDB Corporation This program is free software; you can redistribute it and/or modify it under @@ -115,7 +115,7 @@ lock_clust_rec_some_has_impl( const rec_t* rec, /*!< in: user record */ const dict_index_t* index, /*!< in: clustered index */ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifndef UNIV_NONINL #include "lock0priv.ic" diff --git a/storage/xtradb/include/log0online.h b/storage/xtradb/include/log0online.h index 67dc0d72b4b..5706f3af4b0 100644 --- a/storage/xtradb/include/log0online.h +++ b/storage/xtradb/include/log0online.h @@ -11,8 +11,8 @@ 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., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA +this program; if not, write to the Free Software Foundation, Inc., 51 Franklin +Street, Fifth Floor, Boston, MA 02110-1301, USA *****************************************************************************/ diff --git a/storage/xtradb/include/log0recv.h b/storage/xtradb/include/log0recv.h index 1019f43f70c..e93ec2666af 100644 --- a/storage/xtradb/include/log0recv.h +++ b/storage/xtradb/include/log0recv.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -74,7 +74,7 @@ recv_read_checkpoint_info_for_backup( lsn_t* first_header_lsn) /*!< out: lsn of of the start of the first log file */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*******************************************************************//** Scans the log segment and n_bytes_scanned is set to the length of valid log scanned. */ diff --git a/storage/xtradb/include/mach0data.h b/storage/xtradb/include/mach0data.h index d0087f56aaa..9859def0adc 100644 --- a/storage/xtradb/include/mach0data.h +++ b/storage/xtradb/include/mach0data.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, 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 @@ -53,7 +53,7 @@ ulint mach_read_from_1( /*=============*/ const byte* b) /*!< in: pointer to byte */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*******************************************************//** The following function is used to store data in two consecutive bytes. We store the most significant byte to the lower address. */ @@ -72,7 +72,7 @@ ulint mach_read_from_2( /*=============*/ const byte* b) /*!< in: pointer to two bytes */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /********************************************************//** The following function is used to convert a 16-bit data item @@ -84,7 +84,7 @@ uint16 mach_encode_2( /*==========*/ ulint n) /*!< in: integer in machine-dependent format */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /********************************************************//** The following function is used to convert a 16-bit data item from the canonical format, for fast bytewise equality test @@ -95,7 +95,7 @@ ulint mach_decode_2( /*==========*/ uint16 n) /*!< in: 16-bit integer in canonical format */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /*******************************************************//** The following function is used to store data in 3 consecutive bytes. We store the most significant byte to the lowest address. */ @@ -114,7 +114,7 @@ ulint mach_read_from_3( /*=============*/ const byte* b) /*!< in: pointer to 3 bytes */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*******************************************************//** The following function is used to store data in four consecutive bytes. We store the most significant byte to the lowest address. */ @@ -133,7 +133,7 @@ ulint mach_read_from_4( /*=============*/ const byte* b) /*!< in: pointer to four bytes */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*********************************************************//** Writes a ulint in a compressed form (1..5 bytes). @return stored size in bytes */ @@ -151,7 +151,7 @@ ulint mach_get_compressed_size( /*=====================*/ ulint n) /*!< in: ulint integer to be stored */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /*********************************************************//** Reads a ulint in a compressed form. @return read integer */ @@ -160,7 +160,7 @@ ulint mach_read_compressed( /*=================*/ const byte* b) /*!< in: pointer to memory from where to read */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*******************************************************//** The following function is used to store data in 6 consecutive bytes. We store the most significant byte to the lowest address. */ @@ -179,7 +179,7 @@ ib_uint64_t mach_read_from_6( /*=============*/ const byte* b) /*!< in: pointer to 6 bytes */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*******************************************************//** The following function is used to store data in 7 consecutive bytes. We store the most significant byte to the lowest address. */ @@ -198,7 +198,7 @@ ib_uint64_t mach_read_from_7( /*=============*/ const byte* b) /*!< in: pointer to 7 bytes */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*******************************************************//** The following function is used to store data in 8 consecutive bytes. We store the most significant byte to the lowest address. */ @@ -217,7 +217,7 @@ ib_uint64_t mach_read_from_8( /*=============*/ const byte* b) /*!< in: pointer to 8 bytes */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*********************************************************//** Writes a 64-bit integer in a compressed form (5..9 bytes). @return size in bytes */ @@ -243,7 +243,7 @@ ib_uint64_t mach_ull_read_compressed( /*=====================*/ const byte* b) /*!< in: pointer to memory from where to read */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*********************************************************//** Writes a 64-bit integer in a compressed form (1..11 bytes). @return size in bytes */ @@ -261,7 +261,7 @@ ulint mach_ull_get_much_compressed_size( /*==============================*/ ib_uint64_t n) /*!< in: 64-bit integer to be stored */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /*********************************************************//** Reads a 64-bit integer in a compressed form. @return the value read */ @@ -270,7 +270,7 @@ ib_uint64_t mach_ull_read_much_compressed( /*==========================*/ const byte* b) /*!< in: pointer to memory from where to read */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*********************************************************//** Reads a ulint in a compressed form if the log record fully contains it. @return pointer to end of the stored field, NULL if not complete */ @@ -301,7 +301,7 @@ double mach_double_read( /*=============*/ const byte* b) /*!< in: pointer to memory from where to read */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*********************************************************//** Writes a double. It is stored in a little-endian format. */ UNIV_INLINE @@ -318,7 +318,7 @@ float mach_float_read( /*============*/ const byte* b) /*!< in: pointer to memory from where to read */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*********************************************************//** Writes a float. It is stored in a little-endian format. */ UNIV_INLINE @@ -336,7 +336,7 @@ mach_read_from_n_little_endian( /*===========================*/ const byte* buf, /*!< in: from where to read */ ulint buf_size) /*!< in: from how many bytes to read */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*********************************************************//** Writes a ulint in the little-endian format. */ UNIV_INLINE @@ -354,7 +354,7 @@ ulint mach_read_from_2_little_endian( /*===========================*/ const byte* buf) /*!< in: from where to read */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*********************************************************//** Writes a ulint in the little-endian format. */ UNIV_INLINE diff --git a/storage/xtradb/include/mem0mem.h b/storage/xtradb/include/mem0mem.h index f30034f3074..de9b8b29fd9 100644 --- a/storage/xtradb/include/mem0mem.h +++ b/storage/xtradb/include/mem0mem.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2010, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -353,7 +353,7 @@ mem_heap_printf( /*============*/ mem_heap_t* heap, /*!< in: memory heap */ const char* format, /*!< in: format string */ - ...) __attribute__ ((format (printf, 2, 3))); + ...) MY_ATTRIBUTE ((format (printf, 2, 3))); #ifdef MEM_PERIODIC_CHECK /******************************************************************//** diff --git a/storage/xtradb/include/mem0mem.ic b/storage/xtradb/include/mem0mem.ic index 0d983d69e1a..63e68150b61 100644 --- a/storage/xtradb/include/mem0mem.ic +++ b/storage/xtradb/include/mem0mem.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2010, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -476,9 +476,9 @@ void mem_heap_free_func( /*===============*/ mem_heap_t* heap, /*!< in, own: heap to be freed */ - const char* file_name __attribute__((unused)), + const char* file_name MY_ATTRIBUTE((unused)), /*!< in: file name where freed */ - ulint line __attribute__((unused))) + ulint line MY_ATTRIBUTE((unused))) { mem_block_t* block; mem_block_t* prev_block; diff --git a/storage/xtradb/include/mtr0mtr.h b/storage/xtradb/include/mtr0mtr.h index c9199153138..23992598f2e 100644 --- a/storage/xtradb/include/mtr0mtr.h +++ b/storage/xtradb/include/mtr0mtr.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. This program is free software; you can redistribute it and/or modify it under @@ -228,7 +228,7 @@ mtr_start( { mtr_start_trx(mtr, NULL); } - __attribute__((nonnull)) + MY_ATTRIBUTE((nonnull)) /***************************************************************//** Commits a mini-transaction. */ UNIV_INTERN @@ -236,7 +236,7 @@ void mtr_commit( /*=======*/ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************//** Sets and returns a savepoint in mtr. @return savepoint */ @@ -341,7 +341,7 @@ mtr_memo_release( mtr_t* mtr, /*!< in/out: mini-transaction */ void* object, /*!< in: object */ ulint type) /*!< in: object type: MTR_MEMO_S_LOCK, ... */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifdef UNIV_DEBUG # ifndef UNIV_HOTBACKUP /**********************************************************//** @@ -354,7 +354,7 @@ mtr_memo_contains( mtr_t* mtr, /*!< in: mtr */ const void* object, /*!< in: object to search */ ulint type) /*!< in: type of object */ - __attribute__((warn_unused_result, nonnull)); + MY_ATTRIBUTE((warn_unused_result, nonnull)); /**********************************************************//** Checks if memo contains the given page. diff --git a/storage/xtradb/include/mtr0mtr.ic b/storage/xtradb/include/mtr0mtr.ic index aade8c3d82a..a6d9df09925 100644 --- a/storage/xtradb/include/mtr0mtr.ic +++ b/storage/xtradb/include/mtr0mtr.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, 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 @@ -37,7 +37,7 @@ ibool mtr_block_dirtied( /*==============*/ const buf_block_t* block) /*!< in: block being x-fixed */ - __attribute__((nonnull,warn_unused_result)); + MY_ATTRIBUTE((nonnull,warn_unused_result)); /***************************************************************//** Starts a mini-transaction. */ diff --git a/storage/xtradb/include/os0file.h b/storage/xtradb/include/os0file.h index 453536beba4..2a385c9bf58 100644 --- a/storage/xtradb/include/os0file.h +++ b/storage/xtradb/include/os0file.h @@ -1,6 +1,6 @@ /*********************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. Copyright (c) 2013, 2015, MariaDB Corporation. @@ -659,7 +659,7 @@ pfs_os_file_create_simple_func( value */ const char* src_file,/*!< in: file name where func invoked */ ulint src_line)/*!< in: line where the func invoked */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /****************************************************************//** NOTE! Please use the corresponding macro @@ -686,7 +686,7 @@ pfs_os_file_create_simple_no_error_handling_func( value*/ const char* src_file,/*!< in: file name where func invoked */ ulint src_line)/*!< in: line where the func invoked */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /****************************************************************//** NOTE! Please use the corresponding macro os_file_create(), not directly @@ -716,7 +716,7 @@ pfs_os_file_create_func( value */ const char* src_file,/*!< in: file name where func invoked */ ulint src_line)/*!< in: line where the func invoked */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************************//** NOTE! Please use the corresponding macro os_file_close(), not directly @@ -903,7 +903,7 @@ os_offset_t os_file_get_size( /*=============*/ os_file_t file) /*!< in: handle to a file */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /***********************************************************************//** Write the specified number of zeros to a newly created file. @return TRUE if success */ @@ -915,7 +915,7 @@ os_file_set_size( null-terminated string */ os_file_t file, /*!< in: handle to a file */ os_offset_t size) /*!< in: file size */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************************//** Truncates a file at its current position. @return TRUE if success */ diff --git a/storage/xtradb/include/os0sync.h b/storage/xtradb/include/os0sync.h index 0f93f3ff074..f6207555f1a 100644 --- a/storage/xtradb/include/os0sync.h +++ b/storage/xtradb/include/os0sync.h @@ -530,20 +530,13 @@ os_atomic_test_and_set(volatile lock_word_t* ptr) } /** Do an atomic release. - -In theory __sync_lock_release should be used to release the lock. -Unfortunately, it does not work properly alone. The workaround is -that more conservative __sync_lock_test_and_set is used instead. - -Performance regression was observed at some conditions for Intel -architecture. Disable release barrier on Intel architecture for now. @param[in,out] ptr Memory location to write to @return the previous value */ inline -lock_word_t +void os_atomic_clear(volatile lock_word_t* ptr) { - return(__sync_lock_test_and_set(ptr, 0)); + __sync_lock_release(ptr); } # elif defined(HAVE_IB_GCC_ATOMIC_TEST_AND_SET) @@ -907,15 +900,7 @@ for synchronization */ } while (0); /** barrier definitions for memory ordering */ -#ifdef IB_STRONG_MEMORY_MODEL -/* Performance regression was observed at some conditions for Intel -architecture. Disable memory barrier for Intel architecture for now. */ -# define os_rmb do { } while(0) -# define os_wmb do { } while(0) -# define os_isync do { } while(0) -# define IB_MEMORY_BARRIER_STARTUP_MSG \ - "Memory barrier is not used" -#elif defined(HAVE_IB_GCC_ATOMIC_THREAD_FENCE) +#if defined(HAVE_IB_GCC_ATOMIC_THREAD_FENCE) # define HAVE_MEMORY_BARRIER # define os_rmb __atomic_thread_fence(__ATOMIC_ACQUIRE) # define os_wmb __atomic_thread_fence(__ATOMIC_RELEASE) diff --git a/storage/xtradb/include/os0thread.h b/storage/xtradb/include/os0thread.h index dcf809eec0d..815faf97319 100644 --- a/storage/xtradb/include/os0thread.h +++ b/storage/xtradb/include/os0thread.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, 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 @@ -139,7 +139,7 @@ os_thread_exit( /*===========*/ void* exit_value) /*!< in: exit value; in Windows this void* is cast as a DWORD */ - UNIV_COLD __attribute__((noreturn)); + UNIV_COLD MY_ATTRIBUTE((noreturn)); /*****************************************************************//** Returns the thread identifier of current thread. @return current thread identifier */ diff --git a/storage/xtradb/include/page0cur.h b/storage/xtradb/include/page0cur.h index b1ad49b4915..f04667ff29c 100644 --- a/storage/xtradb/include/page0cur.h +++ b/storage/xtradb/include/page0cur.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -180,7 +180,7 @@ page_cur_tuple_insert( mem_heap_t** heap, /*!< in/out: pointer to memory heap, or NULL */ ulint n_ext, /*!< in: number of externally stored columns */ mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */ - __attribute__((nonnull(1,2,3,4,5), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2,3,4,5), warn_unused_result)); #endif /* !UNIV_HOTBACKUP */ /***********************************************************//** Inserts a record next to page cursor. Returns pointer to inserted record if @@ -218,7 +218,7 @@ page_cur_insert_rec_low( const rec_t* rec, /*!< in: pointer to a physical record */ ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */ - __attribute__((nonnull(1,2,3,4), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result)); /***********************************************************//** Inserts a record next to page cursor on a compressed and uncompressed page. Returns pointer to inserted record if succeed, i.e., @@ -240,7 +240,7 @@ page_cur_insert_rec_zip( const rec_t* rec, /*!< in: pointer to a physical record */ ulint* offsets,/*!< in/out: rec_get_offsets(rec, index) */ mtr_t* mtr) /*!< in: mini-transaction handle, or NULL */ - __attribute__((nonnull(1,2,3,4), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result)); /*************************************************************//** Copies records from page to a newly created page, from a given record onward, including that record. Infimum and supremum records are not copied. diff --git a/storage/xtradb/include/page0page.h b/storage/xtradb/include/page0page.h index 2da5d793fa9..cb43c937757 100644 --- a/storage/xtradb/include/page0page.h +++ b/storage/xtradb/include/page0page.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -169,7 +169,7 @@ page_t* page_align( /*=======*/ const void* ptr) /*!< in: pointer to page frame */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /************************************************************//** Gets the offset within a page. @return offset from the start of the page */ @@ -178,7 +178,7 @@ ulint page_offset( /*========*/ const void* ptr) /*!< in: pointer to page frame */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /*************************************************************//** Returns the max trx id field value. */ UNIV_INLINE @@ -236,7 +236,7 @@ page_header_get_offs( /*=================*/ const page_t* page, /*!< in: page */ ulint field) /*!< in: PAGE_FREE, ... */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*************************************************************//** Returns the pointer stored in the given header field, or NULL. */ @@ -296,7 +296,7 @@ page_rec_get_nth_const( /*===================*/ const page_t* page, /*!< in: page */ ulint nth) /*!< in: nth record */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /************************************************************//** Returns the nth record of the record list. This is the inverse function of page_rec_get_n_recs_before(). @@ -307,7 +307,7 @@ page_rec_get_nth( /*=============*/ page_t* page, /*< in: page */ ulint nth) /*!< in: nth record */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifndef UNIV_HOTBACKUP /************************************************************//** @@ -320,7 +320,7 @@ rec_t* page_get_middle_rec( /*================*/ page_t* page) /*!< in: page */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************//** Compares a data tuple to a physical record. Differs from the function cmp_dtuple_rec_with_match in the way that the record must reside on an @@ -528,7 +528,7 @@ bool page_is_leaf( /*=========*/ const page_t* page) /*!< in: page */ - __attribute__((pure)); + MY_ATTRIBUTE((nonnull, pure)); /************************************************************//** Determine whether the page is empty. @return true if the page is empty (PAGE_N_RECS = 0) */ @@ -537,7 +537,7 @@ bool page_is_empty( /*==========*/ const page_t* page) /*!< in: page */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /************************************************************//** Determine whether the page contains garbage. @return true if the page contains garbage (PAGE_GARBAGE is not 0) */ @@ -546,7 +546,7 @@ bool page_has_garbage( /*=============*/ const page_t* page) /*!< in: page */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /************************************************************//** Gets the pointer to the next record on the page. @return pointer to next record */ @@ -618,7 +618,7 @@ ibool page_rec_is_user_rec_low( /*=====================*/ ulint offset) /*!< in: record offset on page */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /************************************************************//** TRUE if the record is the supremum record on a page. @return TRUE if the supremum record */ @@ -627,7 +627,7 @@ ibool page_rec_is_supremum_low( /*=====================*/ ulint offset) /*!< in: record offset on page */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /************************************************************//** TRUE if the record is the infimum record on a page. @return TRUE if the infimum record */ @@ -636,7 +636,7 @@ ibool page_rec_is_infimum_low( /*====================*/ ulint offset) /*!< in: record offset on page */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /************************************************************//** TRUE if the record is a user record on the page. @@ -646,7 +646,7 @@ ibool page_rec_is_user_rec( /*=================*/ const rec_t* rec) /*!< in: record */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /************************************************************//** TRUE if the record is the supremum record on a page. @return TRUE if the supremum record */ @@ -655,7 +655,7 @@ ibool page_rec_is_supremum( /*=================*/ const rec_t* rec) /*!< in: record */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /************************************************************//** TRUE if the record is the infimum record on a page. @@ -665,7 +665,7 @@ ibool page_rec_is_infimum( /*================*/ const rec_t* rec) /*!< in: record */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /***************************************************************//** Looks for the record which owns the given record. @return the owner record */ @@ -685,7 +685,7 @@ page_rec_write_field( ulint i, /*!< in: index of the field to update */ ulint val, /*!< in: value to write */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* !UNIV_HOTBACKUP */ /************************************************************//** Returns the maximum combined size of records which can be inserted on top @@ -715,7 +715,7 @@ ulint page_get_free_space_of_empty( /*=========================*/ ulint comp) /*!< in: nonzero=compact page format */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /**********************************************************//** Returns the base extra size of a physical record. This is the size of the fixed header, independent of the record size. @@ -801,7 +801,7 @@ page_create_zip( ulint level, /*!< in: the B-tree level of the page */ trx_id_t max_trx_id, /*!< in: PAGE_MAX_TRX_ID */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************//** Empty a previously created B-tree index page. */ UNIV_INTERN @@ -811,7 +811,7 @@ page_create_empty( buf_block_t* block, /*!< in/out: B-tree block */ dict_index_t* index, /*!< in: the index of the page */ mtr_t* mtr) /*!< in/out: mini-transaction */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); /*************************************************************//** Differs from page_copy_rec_list_end, because this function does not touch the lock table and max trx id on page or compress the page. @@ -850,7 +850,7 @@ page_copy_rec_list_end( rec_t* rec, /*!< in: record on page */ dict_index_t* index, /*!< in: record descriptor */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Copies records from page to new_page, up to the given record, NOT including that record. Infimum and supremum records are not copied. @@ -872,7 +872,7 @@ page_copy_rec_list_start( rec_t* rec, /*!< in: record on page */ dict_index_t* index, /*!< in: record descriptor */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Deletes records from a page from a given record onward, including that record. The infimum and supremum records are not deleted. */ @@ -889,7 +889,7 @@ page_delete_rec_list_end( records in the end of the chain to delete, or ULINT_UNDEFINED if not known */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Deletes records from page, up to the given record, NOT including that record. Infimum and supremum records are not deleted. */ @@ -901,7 +901,7 @@ page_delete_rec_list_start( buf_block_t* block, /*!< in: buffer block of the page */ dict_index_t* index, /*!< in: record descriptor */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*************************************************************//** Moves record list end to another page. Moved records include split_rec. @@ -922,7 +922,7 @@ page_move_rec_list_end( rec_t* split_rec, /*!< in: first record to move */ dict_index_t* index, /*!< in: record descriptor */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull(1, 2, 4, 5))); + MY_ATTRIBUTE((nonnull(1, 2, 4, 5))); /*************************************************************//** Moves record list start to another page. Moved records do not include split_rec. @@ -942,7 +942,7 @@ page_move_rec_list_start( rec_t* split_rec, /*!< in: first record not to move */ dict_index_t* index, /*!< in: record descriptor */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull(1, 2, 4, 5))); + MY_ATTRIBUTE((nonnull(1, 2, 4, 5))); /****************************************************************//** Splits a directory slot which owns too many records. */ UNIV_INTERN @@ -953,7 +953,7 @@ page_dir_split_slot( page_zip_des_t* page_zip,/*!< in/out: compressed page whose uncompressed part will be written, or NULL */ ulint slot_no)/*!< in: the directory slot */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /*************************************************************//** Tries to balance the given directory slot with too few records with the upper neighbor, so that there are at least the minimum number @@ -966,7 +966,7 @@ page_dir_balance_slot( page_t* page, /*!< in/out: index page */ page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */ ulint slot_no)/*!< in: the directory slot */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /**********************************************************//** Parses a log record of a record list end or start deletion. @return end of log record or NULL */ diff --git a/storage/xtradb/include/page0types.h b/storage/xtradb/include/page0types.h index 74ad6f72f7e..3b53de6cc2b 100644 --- a/storage/xtradb/include/page0types.h +++ b/storage/xtradb/include/page0types.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -133,7 +133,7 @@ page_zip_rec_set_deleted( page_zip_des_t* page_zip,/*!< in/out: compressed page */ const byte* rec, /*!< in: record on the uncompressed page */ ulint flag) /*!< in: the deleted flag (nonzero=TRUE) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Write the "owned" flag of a record on a compressed page. The n_owned field @@ -145,7 +145,7 @@ page_zip_rec_set_owned( page_zip_des_t* page_zip,/*!< in/out: compressed page */ const byte* rec, /*!< in: record on the uncompressed page */ ulint flag) /*!< in: the owned flag (nonzero=TRUE) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Shift the dense page directory when a record is deleted. */ @@ -158,7 +158,7 @@ page_zip_dir_delete( dict_index_t* index, /*!< in: index of rec */ const ulint* offsets,/*!< in: rec_get_offsets(rec) */ const byte* free) /*!< in: previous start of the free list */ - __attribute__((nonnull(1,2,3,4))); + MY_ATTRIBUTE((nonnull(1,2,3,4))); /**********************************************************************//** Add a slot to the dense page directory. */ @@ -169,5 +169,5 @@ page_zip_dir_add_slot( page_zip_des_t* page_zip, /*!< in/out: compressed page */ ulint is_clustered) /*!< in: nonzero for clustered index, zero for others */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif diff --git a/storage/xtradb/include/page0zip.h b/storage/xtradb/include/page0zip.h index 41eb1e35d78..81068e7bd29 100644 --- a/storage/xtradb/include/page0zip.h +++ b/storage/xtradb/include/page0zip.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2005, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. This program is free software; you can redistribute it and/or modify it under @@ -63,7 +63,7 @@ ulint page_zip_get_size( /*==============*/ const page_zip_des_t* page_zip) /*!< in: compressed page */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /**********************************************************************//** Set the size of a compressed page in bytes. */ UNIV_INLINE @@ -86,7 +86,7 @@ page_zip_rec_needs_ext( ulint n_fields, /*!< in: number of fields in the record; ignored if zip_size == 0 */ ulint zip_size) /*!< in: compressed page size in bytes, or 0 */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /**********************************************************************//** Determine the guaranteed free space on an empty page. @@ -97,7 +97,7 @@ page_zip_empty_size( /*================*/ ulint n_fields, /*!< in: number of columns in the index */ ulint zip_size) /*!< in: compressed page size in bytes */ - __attribute__((const)); + MY_ATTRIBUTE((const)); #endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** @@ -132,7 +132,7 @@ page_zip_compress( dict_index_t* index, /*!< in: index of the B-tree node */ ulint level, /*!< in: compression level */ mtr_t* mtr) /*!< in: mini-transaction, or NULL */ - __attribute__((nonnull(1,3))); + MY_ATTRIBUTE((nonnull(1,2,3))); /**********************************************************************//** Decompress a page. This function should tolerate errors on the compressed @@ -150,7 +150,7 @@ page_zip_decompress( FALSE=verify but do not copy some page header fields that should not change after page creation */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); #ifdef UNIV_DEBUG /**********************************************************************//** @@ -179,7 +179,7 @@ page_zip_validate_low( const dict_index_t* index, /*!< in: index of the page, if known */ ibool sloppy) /*!< in: FALSE=strict, TRUE=ignore the MIN_REC_FLAG */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); /**********************************************************************//** Check that the compressed and decompressed pages match. */ UNIV_INTERN @@ -189,7 +189,7 @@ page_zip_validate( const page_zip_des_t* page_zip,/*!< in: compressed page */ const page_t* page, /*!< in: uncompressed page */ const dict_index_t* index) /*!< in: index of the page, if known */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); #endif /* UNIV_ZIP_DEBUG */ #ifndef UNIV_INNOCHECKSUM @@ -203,7 +203,7 @@ page_zip_max_ins_size( /*==================*/ const page_zip_des_t* page_zip,/*!< in: compressed page */ ibool is_clust)/*!< in: TRUE if clustered index */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /**********************************************************************//** Determine if enough space is available in the modification log. @@ -217,7 +217,7 @@ page_zip_available( ulint length, /*!< in: combined size of the record */ ulint create) /*!< in: nonzero=add the record to the heap */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /**********************************************************************//** Write data to the uncompressed header portion of a page. The data must @@ -230,7 +230,7 @@ page_zip_write_header( const byte* str, /*!< in: address on the uncompressed page */ ulint length, /*!< in: length of the data */ mtr_t* mtr) /*!< in: mini-transaction, or NULL */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); /**********************************************************************//** Write an entire record on the compressed page. The data must already @@ -244,7 +244,7 @@ page_zip_write_rec( dict_index_t* index, /*!< in: the index the record belongs to */ const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ ulint create) /*!< in: nonzero=insert, zero=update */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /***********************************************************//** Parses a log record of writing a BLOB pointer of a record. @@ -273,7 +273,7 @@ page_zip_write_blob_ptr( ulint n, /*!< in: column index */ mtr_t* mtr) /*!< in: mini-transaction handle, or NULL if no logging is needed */ - __attribute__((nonnull(1,2,3,4))); + MY_ATTRIBUTE((nonnull(1,2,3,4))); /***********************************************************//** Parses a log record of writing the node pointer of a record. @@ -298,7 +298,7 @@ page_zip_write_node_ptr( ulint size, /*!< in: data size of rec */ ulint ptr, /*!< in: node pointer */ mtr_t* mtr) /*!< in: mini-transaction, or NULL */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); /**********************************************************************//** Write the trx_id and roll_ptr of a record on a B-tree leaf node page. */ @@ -312,7 +312,7 @@ page_zip_write_trx_id_and_roll_ptr( ulint trx_id_col,/*!< in: column number of TRX_ID in rec */ trx_id_t trx_id, /*!< in: transaction identifier */ roll_ptr_t roll_ptr)/*!< in: roll_ptr */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Write the "deleted" flag of a record on a compressed page. The flag must @@ -324,7 +324,7 @@ page_zip_rec_set_deleted( page_zip_des_t* page_zip,/*!< in/out: compressed page */ const byte* rec, /*!< in: record on the uncompressed page */ ulint flag) /*!< in: the deleted flag (nonzero=TRUE) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Write the "owned" flag of a record on a compressed page. The n_owned field @@ -336,7 +336,7 @@ page_zip_rec_set_owned( page_zip_des_t* page_zip,/*!< in/out: compressed page */ const byte* rec, /*!< in: record on the uncompressed page */ ulint flag) /*!< in: the owned flag (nonzero=TRUE) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Insert a record to the dense page directory. */ @@ -363,7 +363,7 @@ page_zip_dir_delete( const ulint* offsets, /*!< in: rec_get_offsets(rec) */ const byte* free) /*!< in: previous start of the free list */ - __attribute__((nonnull(1,2,3,4))); + MY_ATTRIBUTE((nonnull(1,2,3,4))); /**********************************************************************//** Add a slot to the dense page directory. */ @@ -374,7 +374,7 @@ page_zip_dir_add_slot( page_zip_des_t* page_zip, /*!< in/out: compressed page */ ulint is_clustered) /*!< in: nonzero for clustered index, zero for others */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /***********************************************************//** Parses a log record of writing to the header of a page. @@ -402,7 +402,7 @@ page_zip_write_header( const byte* str, /*!< in: address on the uncompressed page */ ulint length, /*!< in: length of the data */ mtr_t* mtr) /*!< in: mini-transaction, or NULL */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); /**********************************************************************//** Reorganize and compress a page. This is a low-level operation for @@ -425,7 +425,7 @@ page_zip_reorganize( m_start, m_end, m_nonempty */ dict_index_t* index, /*!< in: index of the B-tree node */ mtr_t* mtr) /*!< in: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifndef UNIV_HOTBACKUP /**********************************************************************//** Copy the records of a page byte for byte. Do not copy the page header @@ -444,7 +444,7 @@ page_zip_copy_recs( const page_t* src, /*!< in: page */ dict_index_t* index, /*!< in: index of the B-tree */ mtr_t* mtr) /*!< in: mini-transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* !UNIV_HOTBACKUP */ /**********************************************************************//** @@ -458,7 +458,7 @@ page_zip_parse_compress( byte* end_ptr,/*!< in: buffer end */ page_t* page, /*!< out: uncompressed page */ page_zip_des_t* page_zip)/*!< out: compressed page */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); #endif /* !UNIV_INNOCHECKSUM */ @@ -472,7 +472,7 @@ page_zip_calc_checksum( const void* data, /*!< in: compressed page */ ulint size, /*!< in: size of compressed page */ srv_checksum_algorithm_t algo) /*!< in: algorithm to use */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Verify a compressed page's checksum. @@ -509,7 +509,7 @@ page_zip_parse_compress_no_data( page_t* page, /*!< in: uncompressed page */ page_zip_des_t* page_zip, /*!< out: compressed page */ dict_index_t* index) /*!< in: index */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); /**********************************************************************//** Reset the counters used for filling diff --git a/storage/xtradb/include/pars0pars.h b/storage/xtradb/include/pars0pars.h index 65ff7533828..73585c78a6a 100644 --- a/storage/xtradb/include/pars0pars.h +++ b/storage/xtradb/include/pars0pars.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -472,7 +472,7 @@ pars_complete_graph_for_exec( query graph, or NULL for dummy graph */ trx_t* trx, /*!< in: transaction handle */ mem_heap_t* heap) /*!< in: memory heap from which allocated */ - __attribute__((nonnull(2,3), warn_unused_result)); + MY_ATTRIBUTE((nonnull(2,3), warn_unused_result)); /****************************************************************//** Create parser info struct. @@ -628,7 +628,7 @@ pars_info_bind_ull_literal( pars_info_t* info, /*!< in: info struct */ const char* name, /*!< in: name */ const ib_uint64_t* val) /*!< in: value */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /****************************************************************//** Add bound id. */ diff --git a/storage/xtradb/include/read0read.h b/storage/xtradb/include/read0read.h index 0352f129c30..2d6885884f7 100644 --- a/storage/xtradb/include/read0read.h +++ b/storage/xtradb/include/read0read.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -116,7 +116,7 @@ read_view_sees_trx_id( /*==================*/ const read_view_t* view, /*!< in: read view */ trx_id_t trx_id) /*!< in: trx id */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Prints a read view to file. */ UNIV_INTERN diff --git a/storage/xtradb/include/rem0cmp.h b/storage/xtradb/include/rem0cmp.h index cb3c85ac2c8..65116229fdc 100644 --- a/storage/xtradb/include/rem0cmp.h +++ b/storage/xtradb/include/rem0cmp.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -174,7 +174,7 @@ cmp_dtuple_rec_with_match_low( bytes within the first field not completely matched; when function returns, contains the value for current comparison */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #define cmp_dtuple_rec_with_match(tuple,rec,offsets,fields,bytes) \ cmp_dtuple_rec_with_match_low( \ tuple,rec,offsets,dtuple_get_n_fields_cmp(tuple),fields,bytes) @@ -218,7 +218,7 @@ cmp_rec_rec_simple( struct TABLE* table) /*!< in: MySQL table, for reporting duplicate key value if applicable, or NULL */ - __attribute__((nonnull(1,2,3,4), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result)); /*************************************************************//** This function is used to compare two physical records. Only the common first fields are compared, and if an externally stored field is diff --git a/storage/xtradb/include/rem0rec.h b/storage/xtradb/include/rem0rec.h index 51c09bdc3ec..d72f2760a8c 100644 --- a/storage/xtradb/include/rem0rec.h +++ b/storage/xtradb/include/rem0rec.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -98,7 +98,7 @@ rec_get_next_ptr_const( /*===================*/ const rec_t* rec, /*!< in: physical record */ ulint comp) /*!< in: nonzero=compact page format */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to get the pointer of the next chained record on the same page. @@ -109,7 +109,7 @@ rec_get_next_ptr( /*=============*/ rec_t* rec, /*!< in: physical record */ ulint comp) /*!< in: nonzero=compact page format */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to get the offset of the next chained record on the same page. @@ -120,7 +120,7 @@ rec_get_next_offs( /*==============*/ const rec_t* rec, /*!< in: physical record */ ulint comp) /*!< in: nonzero=compact page format */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to set the next record offset field of an old-style record. */ @@ -130,7 +130,7 @@ rec_set_next_offs_old( /*==================*/ rec_t* rec, /*!< in: old-style physical record */ ulint next) /*!< in: offset of the next record */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** The following function is used to set the next record offset field of a new-style record. */ @@ -140,7 +140,7 @@ rec_set_next_offs_new( /*==================*/ rec_t* rec, /*!< in/out: new-style physical record */ ulint next) /*!< in: offset of the next record */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** The following function is used to get the number of fields in an old-style record. @@ -150,7 +150,7 @@ ulint rec_get_n_fields_old( /*=================*/ const rec_t* rec) /*!< in: physical record */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to get the number of fields in a record. @@ -161,7 +161,7 @@ rec_get_n_fields( /*=============*/ const rec_t* rec, /*!< in: physical record */ const dict_index_t* index) /*!< in: record descriptor */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to get the number of records owned by the previous directory record. @@ -171,7 +171,7 @@ ulint rec_get_n_owned_old( /*================*/ const rec_t* rec) /*!< in: old-style physical record */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to set the number of owned records. */ UNIV_INLINE @@ -180,7 +180,7 @@ rec_set_n_owned_old( /*================*/ rec_t* rec, /*!< in: old-style physical record */ ulint n_owned) /*!< in: the number of owned */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** The following function is used to get the number of records owned by the previous directory record. @@ -190,7 +190,7 @@ ulint rec_get_n_owned_new( /*================*/ const rec_t* rec) /*!< in: new-style physical record */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to set the number of owned records. */ UNIV_INLINE @@ -200,7 +200,7 @@ rec_set_n_owned_new( rec_t* rec, /*!< in/out: new-style physical record */ page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */ ulint n_owned)/*!< in: the number of owned */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /******************************************************//** The following function is used to retrieve the info bits of a record. @@ -211,7 +211,7 @@ rec_get_info_bits( /*==============*/ const rec_t* rec, /*!< in: physical record */ ulint comp) /*!< in: nonzero=compact page format */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to set the info bits of a record. */ UNIV_INLINE @@ -220,7 +220,7 @@ rec_set_info_bits_old( /*==================*/ rec_t* rec, /*!< in: old-style physical record */ ulint bits) /*!< in: info bits */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** The following function is used to set the info bits of a record. */ UNIV_INLINE @@ -229,7 +229,7 @@ rec_set_info_bits_new( /*==================*/ rec_t* rec, /*!< in/out: new-style physical record */ ulint bits) /*!< in: info bits */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** The following function retrieves the status bits of a new-style record. @return status bits */ @@ -238,7 +238,7 @@ ulint rec_get_status( /*===========*/ const rec_t* rec) /*!< in: physical record */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to set the status bits of a new-style record. */ @@ -248,7 +248,7 @@ rec_set_status( /*===========*/ rec_t* rec, /*!< in/out: physical record */ ulint bits) /*!< in: info bits */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** The following function is used to retrieve the info and status @@ -260,7 +260,7 @@ rec_get_info_and_status_bits( /*=========================*/ const rec_t* rec, /*!< in: physical record */ ulint comp) /*!< in: nonzero=compact page format */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to set the info and status bits of a record. (Only compact records have status bits.) */ @@ -270,7 +270,7 @@ rec_set_info_and_status_bits( /*=========================*/ rec_t* rec, /*!< in/out: compact physical record */ ulint bits) /*!< in: info bits */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** The following function tells if record is delete marked. @@ -281,7 +281,7 @@ rec_get_deleted_flag( /*=================*/ const rec_t* rec, /*!< in: physical record */ ulint comp) /*!< in: nonzero=compact page format */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to set the deleted bit. */ UNIV_INLINE @@ -290,7 +290,7 @@ rec_set_deleted_flag_old( /*=====================*/ rec_t* rec, /*!< in: old-style physical record */ ulint flag) /*!< in: nonzero if delete marked */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** The following function is used to set the deleted bit. */ UNIV_INLINE @@ -300,7 +300,7 @@ rec_set_deleted_flag_new( rec_t* rec, /*!< in/out: new-style physical record */ page_zip_des_t* page_zip,/*!< in/out: compressed page, or NULL */ ulint flag) /*!< in: nonzero if delete marked */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /******************************************************//** The following function tells if a new-style record is a node pointer. @return TRUE if node pointer */ @@ -309,7 +309,7 @@ ibool rec_get_node_ptr_flag( /*==================*/ const rec_t* rec) /*!< in: physical record */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to get the order number of an old-style record in the heap of the index page. @@ -319,7 +319,7 @@ ulint rec_get_heap_no_old( /*================*/ const rec_t* rec) /*!< in: physical record */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to set the heap number field in an old-style record. */ @@ -329,7 +329,7 @@ rec_set_heap_no_old( /*================*/ rec_t* rec, /*!< in: physical record */ ulint heap_no)/*!< in: the heap number */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** The following function is used to get the order number of a new-style record in the heap of the index page. @@ -339,7 +339,7 @@ ulint rec_get_heap_no_new( /*================*/ const rec_t* rec) /*!< in: physical record */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to set the heap number field in a new-style record. */ @@ -349,7 +349,7 @@ rec_set_heap_no_new( /*================*/ rec_t* rec, /*!< in/out: physical record */ ulint heap_no)/*!< in: the heap number */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** The following function is used to test whether the data offsets in the record are stored in one-byte or two-byte format. @@ -359,7 +359,7 @@ ibool rec_get_1byte_offs_flag( /*====================*/ const rec_t* rec) /*!< in: physical record */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** The following function is used to set the 1-byte offsets flag. */ @@ -369,7 +369,7 @@ rec_set_1byte_offs_flag( /*====================*/ rec_t* rec, /*!< in: physical record */ ibool flag) /*!< in: TRUE if 1byte form */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** Returns the offset of nth field end if the record is stored in the 1-byte @@ -382,7 +382,7 @@ rec_1_get_field_end_info( /*=====================*/ const rec_t* rec, /*!< in: record */ ulint n) /*!< in: field index */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** Returns the offset of nth field end if the record is stored in the 2-byte @@ -396,7 +396,7 @@ rec_2_get_field_end_info( /*=====================*/ const rec_t* rec, /*!< in: record */ ulint n) /*!< in: field index */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** Returns nonzero if the field is stored off-page. @@ -408,7 +408,7 @@ rec_2_is_field_extern( /*==================*/ const rec_t* rec, /*!< in: record */ ulint n) /*!< in: field index */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** Determine how many of the first n columns in a compact @@ -421,7 +421,7 @@ rec_get_n_extern_new( const rec_t* rec, /*!< in: compact physical record */ const dict_index_t* index, /*!< in: record descriptor */ ulint n) /*!< in: number of columns to scan */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************//** The following function determines the offsets to each field @@ -446,9 +446,9 @@ rec_get_offsets_func( #endif /* UNIV_DEBUG */ mem_heap_t** heap) /*!< in/out: memory heap */ #ifdef UNIV_DEBUG - __attribute__((nonnull(1,2,5,7),warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2,5,7),warn_unused_result)); #else /* UNIV_DEBUG */ - __attribute__((nonnull(1,2,5),warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2,5),warn_unused_result)); #endif /* UNIV_DEBUG */ #ifdef UNIV_DEBUG @@ -475,7 +475,7 @@ rec_get_offsets_reverse( 0=leaf node */ ulint* offsets)/*!< in/out: array consisting of offsets[0] allocated elements */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifdef UNIV_DEBUG /************************************************************//** Validates offsets returned by rec_get_offsets(). @@ -488,7 +488,7 @@ rec_offs_validate( const dict_index_t* index, /*!< in: record descriptor or NULL */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull(3), warn_unused_result)); + MY_ATTRIBUTE((nonnull(3), warn_unused_result)); /************************************************************//** Updates debug data in offsets, in order to avoid bogus rec_offs_validate() failures. */ @@ -500,7 +500,7 @@ rec_offs_make_valid( const dict_index_t* index, /*!< in: record descriptor */ ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #else # define rec_offs_make_valid(rec, index, offsets) ((void) 0) #endif /* UNIV_DEBUG */ @@ -517,7 +517,7 @@ rec_get_nth_field_offs_old( ulint n, /*!< in: index of the field */ ulint* len) /*!< out: length of the field; UNIV_SQL_NULL if SQL null */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #define rec_get_nth_field_old(rec, n, len) \ ((rec) + rec_get_nth_field_offs_old(rec, n, len)) /************************************************************//** @@ -531,7 +531,7 @@ rec_get_nth_field_size( /*===================*/ const rec_t* rec, /*!< in: record */ ulint n) /*!< in: index of the field */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /************************************************************//** The following function is used to get an offset to the nth data field in a record. @@ -544,7 +544,7 @@ rec_get_nth_field_offs( ulint n, /*!< in: index of the field */ ulint* len) /*!< out: length of the field; UNIV_SQL_NULL if SQL null */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #define rec_get_nth_field(rec, offsets, n, len) \ ((rec) + rec_get_nth_field_offs(offsets, n, len)) /******************************************************//** @@ -556,7 +556,7 @@ ulint rec_offs_comp( /*==========*/ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** Determine if the offsets are for a record containing externally stored columns. @@ -566,7 +566,7 @@ ulint rec_offs_any_extern( /*================*/ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** Determine if the offsets are for a record containing null BLOB pointers. @return first field containing a null BLOB pointer, or NULL if none found */ @@ -576,7 +576,7 @@ rec_offs_any_null_extern( /*=====================*/ const rec_t* rec, /*!< in: record */ const ulint* offsets) /*!< in: rec_get_offsets(rec) */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** Returns nonzero if the extern bit is set in nth field of rec. @return nonzero if externally stored */ @@ -586,7 +586,7 @@ rec_offs_nth_extern( /*================*/ const ulint* offsets,/*!< in: array returned by rec_get_offsets() */ ulint n) /*!< in: nth field */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** Returns nonzero if the SQL NULL bit is set in nth field of rec. @return nonzero if SQL NULL */ @@ -596,7 +596,7 @@ rec_offs_nth_sql_null( /*==================*/ const ulint* offsets,/*!< in: array returned by rec_get_offsets() */ ulint n) /*!< in: nth field */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** Gets the physical size of a field. @return length of field */ @@ -606,7 +606,7 @@ rec_offs_nth_size( /*==============*/ const ulint* offsets,/*!< in: array returned by rec_get_offsets() */ ulint n) /*!< in: nth field */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /******************************************************//** Returns the number of extern bits set in a record. @@ -616,7 +616,7 @@ ulint rec_offs_n_extern( /*==============*/ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /***********************************************************//** This is used to modify the value of an already existing field in a record. The previous value must have exactly the same size as the new value. If len @@ -636,7 +636,7 @@ rec_set_nth_field( length as the previous value. If SQL null, previous value must be SQL null. */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); /**********************************************************//** The following function returns the data size of an old-style physical record, that is the sum of field lengths. SQL null fields @@ -648,7 +648,7 @@ ulint rec_get_data_size_old( /*==================*/ const rec_t* rec) /*!< in: physical record */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /**********************************************************//** The following function returns the number of allocated elements for an array of offsets. @@ -658,7 +658,7 @@ ulint rec_offs_get_n_alloc( /*=================*/ const ulint* offsets)/*!< in: array for rec_get_offsets() */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /**********************************************************//** The following function sets the number of allocated elements for an array of offsets. */ @@ -669,7 +669,7 @@ rec_offs_set_n_alloc( ulint* offsets, /*!< out: array for rec_get_offsets(), must be allocated */ ulint n_alloc) /*!< in: number of elements */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #define rec_offs_init(offsets) \ rec_offs_set_n_alloc(offsets, (sizeof offsets) / sizeof *offsets) /**********************************************************//** @@ -680,7 +680,7 @@ ulint rec_offs_n_fields( /*==============*/ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /**********************************************************//** The following function returns the data size of a physical record, that is the sum of field lengths. SQL null fields @@ -692,7 +692,7 @@ ulint rec_offs_data_size( /*===============*/ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /**********************************************************//** Returns the total size of record minus data size of record. The value returned by the function is the distance from record @@ -703,7 +703,7 @@ ulint rec_offs_extra_size( /*================*/ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /**********************************************************//** Returns the total size of a physical record. @return size */ @@ -712,7 +712,7 @@ ulint rec_offs_size( /*==========*/ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); #ifdef UNIV_DEBUG /**********************************************************//** Returns a pointer to the start of the record. @@ -723,7 +723,7 @@ rec_get_start( /*==========*/ const rec_t* rec, /*!< in: pointer to record */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); /**********************************************************//** Returns a pointer to the end of the record. @return pointer to end */ @@ -733,7 +733,7 @@ rec_get_end( /*========*/ const rec_t* rec, /*!< in: pointer to record */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); #else /* UNIV_DEBUG */ # define rec_get_start(rec, offsets) ((rec) - rec_offs_extra_size(offsets)) # define rec_get_end(rec, offsets) ((rec) + rec_offs_data_size(offsets)) @@ -748,7 +748,7 @@ rec_copy( void* buf, /*!< in: buffer */ const rec_t* rec, /*!< in: physical record */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifndef UNIV_HOTBACKUP /**********************************************************//** Determines the size of a data tuple prefix in a temporary file. @@ -761,7 +761,7 @@ rec_get_converted_size_temp( const dfield_t* fields, /*!< in: array of data fields */ ulint n_fields,/*!< in: number of data fields */ ulint* extra) /*!< out: extra size */ - __attribute__((warn_unused_result, nonnull)); + MY_ATTRIBUTE((warn_unused_result, nonnull)); /******************************************************//** Determine the offset to each field in temporary file. @@ -774,7 +774,7 @@ rec_init_offsets_temp( const dict_index_t* index, /*!< in: record descriptor */ ulint* offsets)/*!< in/out: array of offsets; in: n=rec_offs_n_fields(offsets) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************//** Builds a temporary file record out of a data tuple. @@ -787,7 +787,7 @@ rec_convert_dtuple_to_temp( const dict_index_t* index, /*!< in: record descriptor */ const dfield_t* fields, /*!< in: array of data fields */ ulint n_fields) /*!< in: number of fields */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**************************************************************//** Copies the first n fields of a physical record to a new physical record in @@ -805,7 +805,7 @@ rec_copy_prefix_to_buf( for the copied prefix, or NULL */ ulint* buf_size) /*!< in/out: buffer size */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /************************************************************//** Folds a prefix of a physical record to a ulint. @return the folded value */ @@ -821,7 +821,7 @@ rec_fold( ulint n_bytes, /*!< in: number of bytes to fold in an incomplete last field */ index_id_t tree_id) /*!< in: index tree id */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); #endif /* !UNIV_HOTBACKUP */ /*********************************************************//** Builds a physical record out of a data tuple and @@ -837,7 +837,7 @@ rec_convert_dtuple_to_rec( const dtuple_t* dtuple, /*!< in: data tuple */ ulint n_ext) /*!< in: number of externally stored columns */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /**********************************************************//** Returns the extra size of an old-style physical record if we know its data size and number of fields. @@ -849,7 +849,7 @@ rec_get_converted_extra_size( ulint data_size, /*!< in: data size */ ulint n_fields, /*!< in: number of fields */ ulint n_ext) /*!< in: number of externally stored columns */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /**********************************************************//** Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. @return total size */ @@ -861,7 +861,7 @@ rec_get_converted_size_comp_prefix( const dfield_t* fields, /*!< in: array of data fields */ ulint n_fields,/*!< in: number of data fields */ ulint* extra) /*!< out: extra size */ - __attribute__((warn_unused_result, nonnull(1,2))); + MY_ATTRIBUTE((warn_unused_result, nonnull(1,2))); /**********************************************************//** Determines the size of a data tuple in ROW_FORMAT=COMPACT. @return total size */ @@ -877,7 +877,7 @@ rec_get_converted_size_comp( const dfield_t* fields, /*!< in: array of data fields */ ulint n_fields,/*!< in: number of data fields */ ulint* extra) /*!< out: extra size */ - __attribute__((nonnull(1,3))); + MY_ATTRIBUTE((nonnull(1,3))); /**********************************************************//** The following function returns the size of a data tuple when converted to a physical record. @@ -889,7 +889,7 @@ rec_get_converted_size( dict_index_t* index, /*!< in: record descriptor */ const dtuple_t* dtuple, /*!< in: data tuple */ ulint n_ext) /*!< in: number of externally stored columns */ - __attribute__((warn_unused_result, nonnull)); + MY_ATTRIBUTE((warn_unused_result, nonnull)); #ifndef UNIV_HOTBACKUP /**************************************************************//** Copies the first n fields of a physical record to a data tuple. @@ -904,7 +904,7 @@ rec_copy_prefix_to_dtuple( ulint n_fields, /*!< in: number of fields to copy */ mem_heap_t* heap) /*!< in: memory heap */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* !UNIV_HOTBACKUP */ /***************************************************************//** Validates the consistency of a physical record. @@ -915,7 +915,7 @@ rec_validate( /*=========*/ const rec_t* rec, /*!< in: physical record */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /***************************************************************//** Prints an old-style physical record. */ UNIV_INTERN @@ -924,7 +924,7 @@ rec_print_old( /*==========*/ FILE* file, /*!< in: file where to print */ const rec_t* rec) /*!< in: physical record */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifndef UNIV_HOTBACKUP /***************************************************************//** Prints a physical record in ROW_FORMAT=COMPACT. Ignores the @@ -936,7 +936,7 @@ rec_print_comp( FILE* file, /*!< in: file where to print */ const rec_t* rec, /*!< in: physical record */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /***************************************************************//** Prints a physical record. */ UNIV_INTERN @@ -946,7 +946,7 @@ rec_print_new( FILE* file, /*!< in: file where to print */ const rec_t* rec, /*!< in: physical record */ const ulint* offsets)/*!< in: array returned by rec_get_offsets() */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /***************************************************************//** Prints a physical record. */ UNIV_INTERN @@ -956,7 +956,7 @@ rec_print( FILE* file, /*!< in: file where to print */ const rec_t* rec, /*!< in: physical record */ const dict_index_t* index) /*!< in: record descriptor */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); # ifdef UNIV_DEBUG /************************************************************//** @@ -968,7 +968,7 @@ rec_get_trx_id( /*===========*/ const rec_t* rec, /*!< in: record */ const dict_index_t* index) /*!< in: clustered index */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); # endif /* UNIV_DEBUG */ #endif /* UNIV_HOTBACKUP */ diff --git a/storage/xtradb/include/rem0rec.ic b/storage/xtradb/include/rem0rec.ic index a539320dd2a..5811a77a48b 100644 --- a/storage/xtradb/include/rem0rec.ic +++ b/storage/xtradb/include/rem0rec.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -1540,7 +1540,8 @@ rec_copy( ulint extra_len; ulint data_len; - ut_ad(rec && buf); + ut_ad(rec != NULL); + ut_ad(buf != NULL); ut_ad(rec_offs_validate(rec, NULL, offsets)); ut_ad(rec_validate(rec, offsets)); diff --git a/storage/xtradb/include/row0ftsort.h b/storage/xtradb/include/row0ftsort.h index eeef10f3397..7c9ed23645c 100644 --- a/storage/xtradb/include/row0ftsort.h +++ b/storage/xtradb/include/row0ftsort.h @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 2010, 2012, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, MariaDB Corporation. +Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -193,7 +193,7 @@ row_fts_psort_info_init( instantiated */ fts_psort_t** merge) /*!< out: parallel merge info to be instantiated */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Clean up and deallocate FTS parallel sort structures, and close temparary merge sort files */ @@ -281,5 +281,5 @@ row_fts_merge_insert( fts_psort_t* psort_info, /*!< parallel sort info */ ulint id) /* !< in: which auxiliary table's data to insert to */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* row0ftsort_h */ diff --git a/storage/xtradb/include/row0import.h b/storage/xtradb/include/row0import.h index aa46fdb7c27..a821c230a3b 100644 --- a/storage/xtradb/include/row0import.h +++ b/storage/xtradb/include/row0import.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2012, 2016, 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 @@ -46,7 +46,7 @@ row_import_for_mysql( dict_table_t* table, /*!< in/out: table */ row_prebuilt_t* prebuilt) /*!< in: prebuilt struct in MySQL */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*****************************************************************//** Update the DICT_TF2_DISCARDED flag in SYS_TABLES. @@ -64,7 +64,7 @@ row_import_update_discarded_flag( bool dict_locked) /*!< in: Set to true if the caller already owns the dict_sys_t:: mutex. */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*****************************************************************//** Update the (space, root page) of a table's indexes from the values @@ -83,7 +83,7 @@ row_import_update_index_root( bool dict_locked) /*!< in: Set to true if the caller already owns the dict_sys_t:: mutex. */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifndef UNIV_NONINL #include "row0import.ic" #endif diff --git a/storage/xtradb/include/row0ins.h b/storage/xtradb/include/row0ins.h index 2a892d2f5df..71ee39070ef 100644 --- a/storage/xtradb/include/row0ins.h +++ b/storage/xtradb/include/row0ins.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -53,7 +53,7 @@ row_ins_check_foreign_constraint( table, else the referenced table */ dtuple_t* entry, /*!< in: index entry for index */ que_thr_t* thr) /*!< in: query thread */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Creates an insert node struct. @return own: insert node struct */ @@ -98,7 +98,7 @@ row_ins_clust_index_entry_low( dtuple_t* entry, /*!< in/out: index entry to insert */ ulint n_ext, /*!< in: number of externally stored columns */ que_thr_t* thr) /*!< in: query thread or NULL */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***************************************************************//** Tries to insert an entry into a secondary index. If a record with exactly the same fields is found, the other record is necessarily marked deleted. @@ -123,7 +123,7 @@ row_ins_sec_index_entry_low( trx_id_t trx_id, /*!< in: PAGE_MAX_TRX_ID during row_log_table_apply(), or 0 */ que_thr_t* thr) /*!< in: query thread */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***************************************************************//** Tries to insert the externally stored fields (off-page columns) of a clustered index entry. @@ -142,7 +142,7 @@ row_ins_index_entry_big_rec_func( const void* thd, /*!< in: connection, or NULL */ #endif /* DBUG_OFF */ ulint line) /*!< in: line number of caller */ - __attribute__((nonnull(1,2,3,4,5,6), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2,3,4,5,6), warn_unused_result)); #ifdef DBUG_OFF # define row_ins_index_entry_big_rec(e,big,ofs,heap,index,thd,file,line) \ row_ins_index_entry_big_rec_func(e,big,ofs,heap,index,file,line) @@ -164,7 +164,7 @@ row_ins_clust_index_entry( dtuple_t* entry, /*!< in/out: index entry to insert */ que_thr_t* thr, /*!< in: query thread */ ulint n_ext) /*!< in: number of externally stored columns */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***************************************************************//** Inserts an entry into a secondary index. Tries first optimistic, then pessimistic descent down the tree. If the entry matches enough @@ -178,7 +178,7 @@ row_ins_sec_index_entry( dict_index_t* index, /*!< in: secondary index */ dtuple_t* entry, /*!< in/out: index entry to insert */ que_thr_t* thr) /*!< in: query thread */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************//** Inserts a row to a table. This is a high-level function used in SQL execution graphs. diff --git a/storage/xtradb/include/row0log.h b/storage/xtradb/include/row0log.h index e127504c484..5ff148ff045 100644 --- a/storage/xtradb/include/row0log.h +++ b/storage/xtradb/include/row0log.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2011, 2016, 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 @@ -58,7 +58,7 @@ row_log_allocate( const ulint* col_map,/*!< in: mapping of old column numbers to new ones, or NULL if !table */ const char* path) /*!< in: where to create temporary file */ - __attribute__((nonnull(1), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1), warn_unused_result)); /******************************************************//** Free the row log for an index that was being created online. */ @@ -67,7 +67,7 @@ void row_log_free( /*=========*/ row_log_t*& log) /*!< in,own: row log */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** Free the row log for an index on which online creation was aborted. */ @@ -76,7 +76,7 @@ void row_log_abort_sec( /*==============*/ dict_index_t* index) /*!< in/out: index (x-latched) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************//** Try to log an operation to a secondary index that is @@ -91,7 +91,7 @@ row_log_online_op_try( const dtuple_t* tuple, /*!< in: index tuple */ trx_id_t trx_id) /*!< in: transaction ID for insert, or 0 for delete */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************//** Logs an operation to a secondary index that is (or was) being created. */ UNIV_INTERN @@ -102,7 +102,7 @@ row_log_online_op( const dtuple_t* tuple, /*!< in: index tuple */ trx_id_t trx_id) /*!< in: transaction ID for insert, or 0 for delete */ - UNIV_COLD __attribute__((nonnull)); + UNIV_COLD MY_ATTRIBUTE((nonnull)); /******************************************************//** Gets the error status of the online index rebuild log. @@ -113,7 +113,7 @@ row_log_table_get_error( /*====================*/ const dict_index_t* index) /*!< in: clustered index of a table that is being rebuilt online */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************//** Logs a delete operation to a table that is being rebuilt. @@ -129,7 +129,7 @@ row_log_table_delete( const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */ const byte* sys) /*!< in: DB_TRX_ID,DB_ROLL_PTR that should be logged, or NULL to use those in rec */ - UNIV_COLD __attribute__((nonnull(1,2,3))); + UNIV_COLD MY_ATTRIBUTE((nonnull(1,2,3))); /******************************************************//** Logs an update operation to a table that is being rebuilt. @@ -145,7 +145,7 @@ row_log_table_update( const ulint* offsets,/*!< in: rec_get_offsets(rec,index) */ const dtuple_t* old_pk) /*!< in: row_log_table_get_pk() before the update */ - UNIV_COLD __attribute__((nonnull(1,2,3))); + UNIV_COLD MY_ATTRIBUTE((nonnull(1,2,3))); /******************************************************//** Constructs the old PRIMARY KEY and DB_TRX_ID,DB_ROLL_PTR @@ -165,7 +165,7 @@ row_log_table_get_pk( byte* sys, /*!< out: DB_TRX_ID,DB_ROLL_PTR for row_log_table_delete(), or NULL */ mem_heap_t** heap) /*!< in/out: memory heap where allocated */ - UNIV_COLD __attribute__((nonnull(1,2,5), warn_unused_result)); + UNIV_COLD MY_ATTRIBUTE((nonnull(1,2,5), warn_unused_result)); /******************************************************//** Logs an insert to a table that is being rebuilt. @@ -179,7 +179,7 @@ row_log_table_insert( dict_index_t* index, /*!< in/out: clustered index, S-latched or X-latched */ const ulint* offsets)/*!< in: rec_get_offsets(rec,index) */ - UNIV_COLD __attribute__((nonnull)); + UNIV_COLD MY_ATTRIBUTE((nonnull)); /******************************************************//** Notes that a BLOB is being freed during online ALTER TABLE. */ UNIV_INTERN @@ -188,7 +188,7 @@ row_log_table_blob_free( /*====================*/ dict_index_t* index, /*!< in/out: clustered index, X-latched */ ulint page_no)/*!< in: starting page number of the BLOB */ - UNIV_COLD __attribute__((nonnull)); + UNIV_COLD MY_ATTRIBUTE((nonnull)); /******************************************************//** Notes that a BLOB is being allocated during online ALTER TABLE. */ UNIV_INTERN @@ -197,7 +197,7 @@ row_log_table_blob_alloc( /*=====================*/ dict_index_t* index, /*!< in/out: clustered index, X-latched */ ulint page_no)/*!< in: starting page number of the BLOB */ - UNIV_COLD __attribute__((nonnull)); + UNIV_COLD MY_ATTRIBUTE((nonnull)); /******************************************************//** Apply the row_log_table log to a table upon completing rebuild. @return DB_SUCCESS, or error code on failure */ @@ -210,7 +210,7 @@ row_log_table_apply( /*!< in: old table */ struct TABLE* table) /*!< in/out: MySQL table (for reporting duplicates) */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************//** Get the latest transaction ID that has invoked row_log_online_op() @@ -221,7 +221,7 @@ trx_id_t row_log_get_max_trx( /*================*/ dict_index_t* index) /*!< in: index, must be locked */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************//** Merge the row log to the index upon completing index creation. @@ -235,7 +235,7 @@ row_log_apply( dict_index_t* index, /*!< in/out: secondary index */ struct TABLE* table) /*!< in/out: MySQL table (for reporting duplicates) */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifndef UNIV_NONINL #include "row0log.ic" diff --git a/storage/xtradb/include/row0merge.h b/storage/xtradb/include/row0merge.h index 53164b5197f..04d4010ad48 100644 --- a/storage/xtradb/include/row0merge.h +++ b/storage/xtradb/include/row0merge.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2005, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2015, 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -144,7 +144,7 @@ row_merge_dup_report( /*=================*/ row_merge_dup_t* dup, /*!< in/out: for reporting duplicates */ const dfield_t* entry) /*!< in: duplicate index entry */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Sets an exclusive lock on a table, for the duration of creating indexes. @return error code or DB_SUCCESS */ @@ -155,7 +155,7 @@ row_merge_lock_table( trx_t* trx, /*!< in/out: transaction */ dict_table_t* table, /*!< in: table to lock */ enum lock_mode mode) /*!< in: LOCK_X or LOCK_S */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Drop indexes that were created before an error occurred. The data dictionary must have been locked exclusively by the caller, @@ -166,7 +166,7 @@ row_merge_drop_indexes_dict( /*========================*/ trx_t* trx, /*!< in/out: dictionary transaction */ table_id_t table_id)/*!< in: table identifier */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Drop those indexes which were created before an error occurred. The data dictionary must have been locked exclusively by the caller, @@ -179,7 +179,7 @@ row_merge_drop_indexes( dict_table_t* table, /*!< in/out: table containing the indexes */ ibool locked) /*!< in: TRUE=table locked, FALSE=may need to do a lazy drop */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Drop all partially created indexes during crash recovery. */ UNIV_INTERN @@ -195,7 +195,7 @@ UNIV_INTERN int row_merge_file_create_low( const char* path) - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /*********************************************************************//** Destroy a merge file. And de-register the file from Performance Schema if UNIV_PFS_IO is defined. */ @@ -231,7 +231,7 @@ row_merge_rename_tables_dict( old_table->name */ const char* tmp_name, /*!< in: new name for old_table */ trx_t* trx) /*!< in/out: dictionary transaction */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Rename an index in the dictionary that was created. The data @@ -245,7 +245,7 @@ row_merge_rename_index_to_add( trx_t* trx, /*!< in/out: transaction */ table_id_t table_id, /*!< in: table identifier */ index_id_t index_id) /*!< in: index identifier */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Rename an index in the dictionary that is to be dropped. The data dictionary must have been locked exclusively by the caller, because @@ -258,7 +258,7 @@ row_merge_rename_index_to_drop( trx_t* trx, /*!< in/out: transaction */ table_id_t table_id, /*!< in: table identifier */ index_id_t index_id) /*!< in: index identifier */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Create the index and load in to the dictionary. @return index, or NULL on error */ @@ -294,7 +294,7 @@ row_merge_drop_table( /*=================*/ trx_t* trx, /*!< in: transaction */ dict_table_t* table) /*!< in: table instance to drop */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Build indexes on a table by reading a clustered index, creating a temporary file containing index entries, merge sorting @@ -327,7 +327,7 @@ row_merge_build_indexes( AUTO_INCREMENT column, or ULINT_UNDEFINED if none is added */ ib_sequence_t& sequence) /*!< in/out: autoinc sequence */ - __attribute__((nonnull(1,2,3,5,6,8), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2,3,5,6,8), warn_unused_result)); /********************************************************************//** Write a buffer to a block. */ UNIV_INTERN @@ -337,7 +337,7 @@ row_merge_buf_write( const row_merge_buf_t* buf, /*!< in: sorted buffer */ const merge_file_t* of, /*!< in: output file */ row_merge_block_t* block) /*!< out: buffer for writing to file */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Sort a buffer. */ UNIV_INTERN @@ -347,7 +347,7 @@ row_merge_buf_sort( row_merge_buf_t* buf, /*!< in/out: sort buffer */ row_merge_dup_t* dup) /*!< in/out: reporter of duplicates (NULL if non-unique index) */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /********************************************************************//** Write a merge block to the file system. @return TRUE if request was successful, FALSE if fail */ @@ -371,7 +371,7 @@ row_merge_buf_t* row_merge_buf_empty( /*================*/ row_merge_buf_t* buf) /*!< in,own: sort buffer */ - __attribute__((warn_unused_result, nonnull)); + MY_ATTRIBUTE((warn_unused_result, nonnull)); /** Create a merge file in the given location. @param[out] merge_file merge file structure @@ -412,7 +412,7 @@ row_merge_buf_t* row_merge_buf_create( /*=================*/ dict_index_t* index) /*!< in: secondary index */ - __attribute__((warn_unused_result, nonnull, malloc)); + MY_ATTRIBUTE((warn_unused_result, nonnull, malloc)); /*********************************************************************//** Deallocate a sort buffer. */ UNIV_INTERN @@ -420,7 +420,7 @@ void row_merge_buf_free( /*===============*/ row_merge_buf_t* buf) /*!< in,own: sort buffer to be freed */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Destroy a merge file. */ UNIV_INTERN @@ -428,7 +428,7 @@ void row_merge_file_destroy( /*===================*/ merge_file_t* merge_file) /*!< in/out: merge file structure */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Read a merge block from the file system. @return TRUE if request was successful, FALSE if fail */ diff --git a/storage/xtradb/include/row0mysql.h b/storage/xtradb/include/row0mysql.h index e6a201be7a5..52e82da668d 100644 --- a/storage/xtradb/include/row0mysql.h +++ b/storage/xtradb/include/row0mysql.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2000, 2016, 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 @@ -168,7 +168,7 @@ row_mysql_handle_errors( trx_t* trx, /*!< in: transaction */ que_thr_t* thr, /*!< in: query thread, or NULL */ trx_savept_t* savept) /*!< in: savepoint, or NULL */ - __attribute__((nonnull(1,2))); + MY_ATTRIBUTE((nonnull(1,2))); /********************************************************************//** Create a prebuilt struct for a MySQL table handle. @return own: a prebuilt struct */ @@ -210,7 +210,7 @@ row_lock_table_autoinc_for_mysql( /*=============================*/ row_prebuilt_t* prebuilt) /*!< in: prebuilt struct in the MySQL table handle */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Sets a table lock on the table mentioned in prebuilt. @return error code or DB_SUCCESS */ @@ -226,7 +226,7 @@ row_lock_table_for_mysql( prebuilt->select_lock_type */ ulint mode) /*!< in: lock mode of table (ignored if table==NULL) */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /*********************************************************************//** Does an insert for MySQL. @return error code or DB_SUCCESS */ @@ -237,7 +237,7 @@ row_insert_for_mysql( byte* mysql_rec, /*!< in: row in the MySQL format */ row_prebuilt_t* prebuilt) /*!< in: prebuilt struct in MySQL handle */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Builds a dummy query graph used in selects. */ UNIV_INTERN @@ -277,7 +277,7 @@ row_update_for_mysql( the MySQL format */ row_prebuilt_t* prebuilt) /*!< in: prebuilt struct in MySQL handle */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** This can only be used when srv_locks_unsafe_for_binlog is TRUE or this session is using a READ COMMITTED or READ UNCOMMITTED isolation level. @@ -298,7 +298,7 @@ row_unlock_for_mysql( the records under pcur and clust_pcur, and we do not need to reposition the cursors. */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Checks if a table name contains the string "/#sql" which denotes temporary tables in MySQL. @@ -307,7 +307,7 @@ UNIV_INTERN bool row_is_mysql_tmp_table_name( /*========================*/ - const char* name) __attribute__((warn_unused_result)); + const char* name) MY_ATTRIBUTE((warn_unused_result)); /*!< in: table name in the form 'database/tablename' */ @@ -332,7 +332,7 @@ row_update_cascade_for_mysql( upd_node_t* node, /*!< in: update node used in the cascade or set null operation */ dict_table_t* table) /*!< in: table where we do the operation */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Locks the data dictionary exclusively for performing a table create or other data dictionary modification operation. */ @@ -409,7 +409,7 @@ row_create_index_for_mysql( index columns, which are then checked for not being too large. */ - __attribute__((nonnull(1,2), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2), warn_unused_result)); /*********************************************************************//** Scans a table create SQL string and adds to the data dictionary the foreign key constraints declared in the string. This function @@ -435,7 +435,7 @@ row_table_add_foreign_constraints( ibool reject_fks) /*!< in: if TRUE, fail with error code DB_CANNOT_ADD_CONSTRAINT if any foreign keys are found. */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** The master thread in srv0srv.cc calls this regularly to drop tables which we must drop in background after queries to them have ended. Such lazy @@ -464,7 +464,7 @@ row_mysql_lock_table( dict_table_t* table, /*!< in: table to lock */ enum lock_mode mode, /*!< in: LOCK_X or LOCK_S */ const char* op_info) /*!< in: string for trx->op_info */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Truncates a table for MySQL. @@ -475,7 +475,7 @@ row_truncate_table_for_mysql( /*=========================*/ dict_table_t* table, /*!< in: table handle */ trx_t* trx) /*!< in: transaction handle */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Drops a table for MySQL. If the name of the dropped table ends in one of "innodb_monitor", "innodb_lock_monitor", "innodb_tablespace_monitor", @@ -497,7 +497,7 @@ row_drop_table_for_mysql( bool nonatomic = true) /*!< in: whether it is permitted to release and reacquire dict_operation_lock */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Drop all temporary tables during crash recovery. */ UNIV_INTERN @@ -516,7 +516,7 @@ row_discard_tablespace_for_mysql( /*=============================*/ const char* name, /*!< in: table name */ trx_t* trx) /*!< in: transaction handle */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*****************************************************************//** Imports a tablespace. The space id in the .ibd file must match the space id of the table in the data dictionary. @@ -527,7 +527,7 @@ row_import_tablespace_for_mysql( /*============================*/ dict_table_t* table, /*!< in/out: table */ row_prebuilt_t* prebuilt) /*!< in: prebuilt struct in MySQL */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Drops a database for MySQL. @return error code or DB_SUCCESS */ @@ -537,7 +537,7 @@ row_drop_database_for_mysql( /*========================*/ const char* name, /*!< in: database name which ends to '/' */ trx_t* trx) /*!< in: transaction handle */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Renames a table for MySQL. @return error code or DB_SUCCESS */ @@ -549,7 +549,7 @@ row_rename_table_for_mysql( const char* new_name, /*!< in: new table name */ trx_t* trx, /*!< in/out: transaction */ bool commit) /*!< in: whether to commit trx */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Checks that the index contains entries in an ascending order, unique constraint is not broken, and calculates the number of index entries @@ -564,7 +564,7 @@ row_check_index_for_mysql( const dict_index_t* index, /*!< in: index */ ulint* n_rows) /*!< out: number of entries seen in the consistent read */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Determines if a table is a magic monitor table. @return true if monitor table */ @@ -574,7 +574,7 @@ row_is_magic_monitor_table( /*=======================*/ const char* table_name) /*!< in: name of the table, in the form database/table_name */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Initialize this module */ UNIV_INTERN @@ -599,7 +599,7 @@ row_mysql_table_id_reassign( dict_table_t* table, /*!< in/out: table */ trx_t* trx, /*!< in/out: transaction */ table_id_t* new_id) /*!< out: new table id */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /* A struct describing a place for an individual column in the MySQL row format which is presented to the table handler in ha_innobase. diff --git a/storage/xtradb/include/row0purge.h b/storage/xtradb/include/row0purge.h index 888289a6c79..5df899bc399 100644 --- a/storage/xtradb/include/row0purge.h +++ b/storage/xtradb/include/row0purge.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -47,7 +47,7 @@ row_purge_node_create( que_thr_t* parent, /*!< in: parent node, i.e., a thr node */ mem_heap_t* heap) /*!< in: memory heap where created */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************//** Determines if it is possible to remove a secondary index entry. Removal is possible if the secondary index entry does not refer to any @@ -70,7 +70,7 @@ row_purge_poss_sec( purge_node_t* node, /*!< in/out: row purge node */ dict_index_t* index, /*!< in: secondary index */ const dtuple_t* entry) /*!< in: secondary index entry */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*************************************************************** Does the purge operation for a single undo log record. This is a high-level function used in an SQL execution graph. @@ -80,7 +80,7 @@ que_thr_t* row_purge_step( /*===========*/ que_thr_t* thr) /*!< in: query thread */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /* Purge node structure */ diff --git a/storage/xtradb/include/row0quiesce.h b/storage/xtradb/include/row0quiesce.h index 1d6d11291b8..35d8184d33c 100644 --- a/storage/xtradb/include/row0quiesce.h +++ b/storage/xtradb/include/row0quiesce.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2012, 2016, 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 @@ -43,7 +43,7 @@ row_quiesce_table_start( /*====================*/ dict_table_t* table, /*!< in: quiesce this table */ trx_t* trx) /*!< in/out: transaction/session */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*********************************************************************//** Set a table's quiesce state. @@ -55,7 +55,7 @@ row_quiesce_set_state( dict_table_t* table, /*!< in: quiesce this table */ ib_quiesce_t state, /*!< in: quiesce state to set */ trx_t* trx) /*!< in/out: transaction */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Cleanup after table quiesce. */ @@ -65,7 +65,7 @@ row_quiesce_table_complete( /*=======================*/ dict_table_t* table, /*!< in: quiesce this table */ trx_t* trx) /*!< in/out: transaction/session */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifndef UNIV_NONINL #include "row0quiesce.ic" diff --git a/storage/xtradb/include/row0row.h b/storage/xtradb/include/row0row.h index a4e5e0dd2fa..b04068c5a5d 100644 --- a/storage/xtradb/include/row0row.h +++ b/storage/xtradb/include/row0row.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -47,7 +47,7 @@ row_get_trx_id_offset( /*==================*/ const dict_index_t* index, /*!< in: clustered index */ const ulint* offsets)/*!< in: record offsets */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Reads the trx id field from a clustered index record. @return value of the field */ @@ -58,7 +58,7 @@ row_get_rec_trx_id( const rec_t* rec, /*!< in: record */ const dict_index_t* index, /*!< in: clustered index */ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Reads the roll pointer field from a clustered index record. @return value of the field */ @@ -69,7 +69,7 @@ row_get_rec_roll_ptr( const rec_t* rec, /*!< in: record */ const dict_index_t* index, /*!< in: clustered index */ const ulint* offsets)/*!< in: rec_get_offsets(rec, index) */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*****************************************************************//** When an insert or purge to a table is performed, this function builds the entry to be inserted into or purged from an index on the table. @@ -88,7 +88,7 @@ row_build_index_entry_low( mem_heap_t* heap) /*!< in: memory heap from which the memory for the index entry is allocated */ - __attribute__((warn_unused_result, nonnull(1,3,4))); + MY_ATTRIBUTE((warn_unused_result, nonnull(1,3,4))); /*****************************************************************//** When an insert or purge to a table is performed, this function builds the entry to be inserted into or purged from an index on the table. @@ -107,7 +107,7 @@ row_build_index_entry( mem_heap_t* heap) /*!< in: memory heap from which the memory for the index entry is allocated */ - __attribute__((warn_unused_result, nonnull(1,3,4))); + MY_ATTRIBUTE((warn_unused_result, nonnull(1,3,4))); /*******************************************************************//** An inverse function to row_build_index_entry. Builds a row from a record in a clustered index. @@ -155,7 +155,7 @@ row_build( prefixes, or NULL */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ - __attribute__((nonnull(2,3,9))); + MY_ATTRIBUTE((nonnull(2,3,9))); /*******************************************************************//** Converts an index record to a typed data tuple. @return index entry built; does not set info_bits, and the data fields @@ -171,7 +171,7 @@ row_rec_to_index_entry_low( stored columns */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Converts an index record to a typed data tuple. NOTE that externally stored (often big) fields are NOT copied to heap. @@ -187,7 +187,7 @@ row_rec_to_index_entry( stored columns */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Builds from a secondary index record a row reference with which we can search the clustered index record. @@ -210,7 +210,7 @@ row_build_row_ref( as long as the row reference is used! */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Builds from a secondary index record a row reference with which we can search the clustered index record. */ @@ -232,7 +232,7 @@ row_build_row_ref_in_tuple( ulint* offsets,/*!< in: rec_get_offsets(rec, index) or NULL */ trx_t* trx) /*!< in: transaction or NULL */ - __attribute__((nonnull(1,2,3))); + MY_ATTRIBUTE((nonnull(1,2,3))); /*******************************************************************//** Builds from a secondary index record a row reference with which we can search the clustered index record. */ @@ -263,7 +263,7 @@ row_search_on_row_ref( const dict_table_t* table, /*!< in: table */ const dtuple_t* ref, /*!< in: row reference */ mtr_t* mtr) /*!< in/out: mtr */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*********************************************************************//** Fetches the clustered index record for a secondary index record. The latches on the secondary index record are preserved. @@ -277,7 +277,7 @@ row_get_clust_rec( dict_index_t* index, /*!< in: secondary index */ dict_index_t** clust_index,/*!< out: clustered index */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** Result of row_search_index_entry */ enum row_search_result { @@ -305,7 +305,7 @@ row_search_index_entry( btr_pcur_t* pcur, /*!< in/out: persistent cursor, which must be closed by the caller */ mtr_t* mtr) /*!< in: mtr */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #define ROW_COPY_DATA 1 #define ROW_COPY_POINTERS 2 @@ -334,7 +334,7 @@ row_raw_format( char* buf, /*!< out: output buffer */ ulint buf_size) /*!< in: output buffer size in bytes */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifndef UNIV_NONINL #include "row0row.ic" diff --git a/storage/xtradb/include/row0sel.h b/storage/xtradb/include/row0sel.h index c8be80f89d9..fd5bc755a22 100644 --- a/storage/xtradb/include/row0sel.h +++ b/storage/xtradb/include/row0sel.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -168,7 +168,7 @@ row_search_for_mysql( then prebuilt must have a pcur with stored position! In opening of a cursor 'direction' should be 0. */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Checks if MySQL at the moment is allowed for this table to retrieve a consistent read result, or store it to the query cache. @@ -190,7 +190,7 @@ row_search_max_autoinc( dict_index_t* index, /*!< in: index to search */ const char* col_name, /*!< in: autoinc column name */ ib_uint64_t* value) /*!< out: AUTOINC value read */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /** A structure for caching column values for prefetched rows */ struct sel_buf_t{ diff --git a/storage/xtradb/include/row0uins.h b/storage/xtradb/include/row0uins.h index ebf4881208a..89e334e5433 100644 --- a/storage/xtradb/include/row0uins.h +++ b/storage/xtradb/include/row0uins.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -46,7 +46,7 @@ dberr_t row_undo_ins( /*=========*/ undo_node_t* node) /*!< in: row undo node */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifndef UNIV_NONINL #include "row0uins.ic" #endif diff --git a/storage/xtradb/include/row0umod.h b/storage/xtradb/include/row0umod.h index f89d5a334fc..4f1d8e1f66c 100644 --- a/storage/xtradb/include/row0umod.h +++ b/storage/xtradb/include/row0umod.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -43,7 +43,7 @@ row_undo_mod( /*=========*/ undo_node_t* node, /*!< in: row undo node */ que_thr_t* thr) /*!< in: query thread */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #ifndef UNIV_NONINL #include "row0umod.ic" diff --git a/storage/xtradb/include/row0upd.h b/storage/xtradb/include/row0upd.h index 27dedeb65a7..e59ec58b63c 100644 --- a/storage/xtradb/include/row0upd.h +++ b/storage/xtradb/include/row0upd.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -91,7 +91,7 @@ upd_get_field_by_field_no( /*======================*/ const upd_t* update, /*!< in: update vector */ ulint no) /*!< in: field_no */ - __attribute__((nonnull, pure)); + MY_ATTRIBUTE((nonnull, pure)); /*********************************************************************//** Writes into the redo log the values of trx id and roll ptr and enough info to determine their positions within a clustered index record. @@ -174,7 +174,7 @@ bool row_upd_changes_disowned_external( /*==============================*/ const upd_t* update) /*!< in: update vector */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* !UNIV_HOTBACKUP */ /***********************************************************//** Replaces the new column values stored in the update vector to the @@ -207,7 +207,7 @@ row_upd_build_sec_rec_difference_binary( const ulint* offsets,/*!< in: rec_get_offsets(rec, index) */ const dtuple_t* entry, /*!< in: entry to insert */ mem_heap_t* heap) /*!< in: memory heap from which allocated */ - __attribute__((warn_unused_result, nonnull)); + MY_ATTRIBUTE((warn_unused_result, nonnull)); /***************************************************************//** Builds an update vector from those fields, excluding the roll ptr and trx id fields, which in an index entry differ from a record that has @@ -227,7 +227,7 @@ row_upd_build_difference_binary( trx_t* trx, /*!< in: transaction (for diagnostics), or NULL */ mem_heap_t* heap) /*!< in: memory heap from which allocated */ - __attribute__((nonnull(1,2,3,7), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2,3,7), warn_unused_result)); /***********************************************************//** Replaces the new column values stored in the update vector to the index entry given. */ @@ -250,7 +250,7 @@ row_upd_index_replace_new_col_vals_index_pos( does not work for non-clustered indexes. */ mem_heap_t* heap) /*!< in: memory heap for allocating and copying the new values */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /***********************************************************//** Replaces the new column values stored in the update vector to the index entry given. */ @@ -269,7 +269,7 @@ row_upd_index_replace_new_col_vals( an upd_field is the clustered index position */ mem_heap_t* heap) /*!< in: memory heap for allocating and copying the new values */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /***********************************************************//** Replaces the new column values stored in the update vector. */ UNIV_INTERN @@ -311,7 +311,7 @@ row_upd_changes_ord_field_binary_func( compile time */ const row_ext_t*ext) /*!< NULL, or prefixes of the externally stored columns in the old row */ - __attribute__((nonnull(1,2), warn_unused_result)); + MY_ATTRIBUTE((nonnull(1,2), warn_unused_result)); #ifdef UNIV_DEBUG # define row_upd_changes_ord_field_binary(index,update,thr,row,ext) \ row_upd_changes_ord_field_binary_func(index,update,thr,row,ext) @@ -338,7 +338,7 @@ row_upd_changes_doc_id( /*===================*/ dict_table_t* table, /*!< in: table */ upd_field_t* upd_field) /*!< in: field to check */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************//** Checks if an update vector changes an ordering field of an index record. This function is fast if the update vector is short or the number of ordering diff --git a/storage/xtradb/include/row0vers.h b/storage/xtradb/include/row0vers.h index 1df5b4d3e98..7b850215701 100644 --- a/storage/xtradb/include/row0vers.h +++ b/storage/xtradb/include/row0vers.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -110,7 +110,7 @@ row_vers_build_for_consistent_read( if the history is missing or the record does not exist in the view, that is, it was freshly inserted afterwards */ - __attribute__((nonnull(1,2,3,4,5,6,7))); + MY_ATTRIBUTE((nonnull(1,2,3,4,5,6,7))); /*****************************************************************//** Constructs the last committed version of a clustered index record, @@ -136,7 +136,7 @@ row_vers_build_for_semi_consistent_read( const rec_t** old_vers)/*!< out: rec, old version, or NULL if the record does not exist in the view, that is, it was freshly inserted afterwards */ - __attribute__((nonnull(1,2,3,4,5))); + MY_ATTRIBUTE((nonnull(1,2,3,4,5))); #ifndef UNIV_NONINL diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index 018852a7f92..f4557a08762 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -1,9 +1,9 @@ /***************************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2008, 2009, Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2014, SkySQL Ab. All Rights Reserved. +Copyright (c) 2013, 2016, MariaDB Corporation Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -1032,7 +1032,7 @@ UNIV_INTERN os_thread_ret_t DECLARE_THREAD(srv_purge_coordinator_thread)( /*=========================================*/ - void* arg __attribute__((unused))); /*!< in: a dummy parameter + void* arg MY_ATTRIBUTE((unused))); /*!< in: a dummy parameter required by os_thread_create */ /*********************************************************************//** @@ -1042,7 +1042,7 @@ UNIV_INTERN os_thread_ret_t DECLARE_THREAD(srv_worker_thread)( /*==============================*/ - void* arg __attribute__((unused))); /*!< in: a dummy parameter + void* arg MY_ATTRIBUTE((unused))); /*!< in: a dummy parameter required by os_thread_create */ } /* extern "C" */ diff --git a/storage/xtradb/include/srv0start.h b/storage/xtradb/include/srv0start.h index 40d502f4459..963b767f0fb 100644 --- a/storage/xtradb/include/srv0start.h +++ b/storage/xtradb/include/srv0start.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, 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 @@ -105,7 +105,7 @@ srv_path_copy( ulint dest_len, /*!< in: max bytes to copy */ const char* basedir, /*!< in: base directory */ const char* table_name) /*!< in: source table name */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*****************************************************************//** Get the meta-data filename from the table name. */ @@ -116,7 +116,7 @@ srv_get_meta_data_filename( dict_table_t* table, /*!< in: table */ char* filename, /*!< out: filename */ ulint max_len) /*!< in: filename max length */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /** Log sequence number at shutdown */ extern lsn_t srv_shutdown_lsn; diff --git a/storage/xtradb/include/sync0arr.h b/storage/xtradb/include/sync0arr.h index a3a326a0d1d..9292026ff13 100644 --- a/storage/xtradb/include/sync0arr.h +++ b/storage/xtradb/include/sync0arr.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, 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 @@ -110,7 +110,7 @@ sync_array_print_long_waits( /*========================*/ os_thread_id_t* waiter, /*!< out: longest waiting thread */ const void** sema) /*!< out: longest-waited-for semaphore */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /********************************************************************//** Validates the integrity of the wait array. Checks that the number of reserved cells equals the count variable. */ diff --git a/storage/xtradb/include/sync0rw.h b/storage/xtradb/include/sync0rw.h index cef2008c4ea..95d38d3be92 100644 --- a/storage/xtradb/include/sync0rw.h +++ b/storage/xtradb/include/sync0rw.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -367,7 +367,7 @@ ibool rw_lock_s_lock_low( /*===============*/ rw_lock_t* lock, /*!< in: pointer to rw-lock */ - ulint pass __attribute__((unused)), + ulint pass MY_ATTRIBUTE((unused)), /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name, /*!< in: file name where lock requested */ @@ -630,7 +630,7 @@ rw_lock_own( rw_lock_t* lock, /*!< in: rw-lock */ ulint lock_type) /*!< in: lock type: RW_LOCK_SHARED, RW_LOCK_EX */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /******************************************************************//** Checks if the thread has locked the priority rw-lock in the specified mode, with the pass value == 0. */ @@ -641,7 +641,7 @@ rw_lock_own( prio_rw_lock_t* lock, /*!< in: rw-lock */ ulint lock_type) /*!< in: lock type: RW_LOCK_SHARED, RW_LOCK_EX */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); #endif /* UNIV_SYNC_DEBUG */ /******************************************************************//** Checks if somebody has locked the rw-lock in the specified mode. */ diff --git a/storage/xtradb/include/sync0rw.ic b/storage/xtradb/include/sync0rw.ic index b65e48e0881..91d1e1b0cfc 100644 --- a/storage/xtradb/include/sync0rw.ic +++ b/storage/xtradb/include/sync0rw.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -363,7 +363,7 @@ ibool rw_lock_s_lock_low( /*===============*/ rw_lock_t* lock, /*!< in: pointer to rw-lock */ - ulint pass __attribute__((unused)), + ulint pass MY_ATTRIBUTE((unused)), /*!< in: pass value; != 0, if the lock will be passed to another thread to unlock */ const char* file_name, /*!< in: file name where lock requested */ diff --git a/storage/xtradb/include/sync0sync.h b/storage/xtradb/include/sync0sync.h index 2b794059399..af445aeb84c 100644 --- a/storage/xtradb/include/sync0sync.h +++ b/storage/xtradb/include/sync0sync.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2012, Facebook Inc. @@ -569,7 +569,7 @@ ibool mutex_own( /*======*/ const ib_mutex_t* mutex) /*!< in: mutex */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /******************************************************************//** Checks that the current thread owns the priority mutex. Works only in the debug version. @@ -579,7 +579,7 @@ ibool mutex_own( /*======*/ const ib_prio_mutex_t* mutex) /*!< in: priority mutex */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); #endif /* UNIV_DEBUG */ #ifdef UNIV_SYNC_DEBUG /******************************************************************//** @@ -594,7 +594,7 @@ sync_thread_add_level( ulint level, /*!< in: level in the latching order; if SYNC_LEVEL_VARYING, nothing is done */ ibool relock) /*!< in: TRUE if re-entering an x-lock */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /******************************************************************//** Removes a latch from the thread level array if it is found there. @return TRUE if found in the array; it is no error if the latch is @@ -624,7 +624,7 @@ sync_thread_levels_nonempty_gen( /*============================*/ ibool dict_mutex_allowed) /*!< in: TRUE if dictionary mutex is allowed to be owned by the thread */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /******************************************************************//** Checks if the level array for the current thread is empty, except for data dictionary latches. */ @@ -641,7 +641,7 @@ sync_thread_levels_nonempty_trx( ibool has_search_latch) /*!< in: TRUE if and only if the thread is supposed to hold btr_search_latch */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); /******************************************************************//** Gets the debug information for a reserved mutex. */ diff --git a/storage/xtradb/include/sync0sync.ic b/storage/xtradb/include/sync0sync.ic index 83f28bfeded..fb24c0ec244 100644 --- a/storage/xtradb/include/sync0sync.ic +++ b/storage/xtradb/include/sync0sync.ic @@ -181,6 +181,11 @@ mutex_exit_func( to wake up possible hanging threads if they are missed in mutex_signal_object. */ + /* We add a memory barrier to prevent reading of the + number of waiters before releasing the lock. */ + + os_mb; + if (mutex_get_waiters(mutex) != 0) { mutex_signal_object(mutex); diff --git a/storage/xtradb/include/trx0rec.h b/storage/xtradb/include/trx0rec.h index 96e7d595035..359937e3583 100644 --- a/storage/xtradb/include/trx0rec.h +++ b/storage/xtradb/include/trx0rec.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -86,7 +86,7 @@ ulint trx_undo_rec_get_offset( /*====================*/ undo_no_t undo_no) /*!< in: undo no read from node */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /**********************************************************************//** Returns the start of the undo record data area. */ @@ -109,7 +109,7 @@ trx_undo_rec_get_pars( externally stored fild */ undo_no_t* undo_no, /*!< out: undo log record number */ table_id_t* table_id) /*!< out: table id */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*******************************************************************//** Builds a row reference from an undo log record. @return pointer to remaining part of undo record */ @@ -201,7 +201,7 @@ trx_undo_rec_get_partial_row( only in the assertion. */ mem_heap_t* heap) /*!< in: memory heap from which the memory needed is allocated */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************************//** Writes information to an undo log about an insert, update, or a delete marking of a clustered index record. This information is used in a rollback of the @@ -233,7 +233,7 @@ trx_undo_report_row_operation( inserted undo log record, 0 if BTR_NO_UNDO_LOG flag was specified */ - __attribute__((nonnull(4,10), warn_unused_result)); + MY_ATTRIBUTE((nonnull(3,4,10), warn_unused_result)); /******************************************************************//** Copies an undo record to heap. This function can be called if we know that the undo log record exists. @@ -244,7 +244,7 @@ trx_undo_get_undo_rec_low( /*======================*/ roll_ptr_t roll_ptr, /*!< in: roll pointer to record */ mem_heap_t* heap) /*!< in: memory heap where copied */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Build a previous version of a clustered index record. The caller must hold a latch on the index page of the clustered index record. @@ -268,7 +268,7 @@ trx_undo_prev_version_build( rec_t** old_vers)/*!< out, own: previous version, or NULL if rec is the first inserted version, or if history data has been deleted */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #endif /* !UNIV_HOTBACKUP */ /***********************************************************//** Parses a redo log record of adding an undo log record. diff --git a/storage/xtradb/include/trx0roll.h b/storage/xtradb/include/trx0roll.h index 629b41569f6..b2e9d8a077f 100644 --- a/storage/xtradb/include/trx0roll.h +++ b/storage/xtradb/include/trx0roll.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -126,7 +126,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(trx_rollback_or_clean_all_recovered)( /*================================================*/ - void* arg __attribute__((unused))); + void* arg MY_ATTRIBUTE((unused))); /*!< in: a dummy parameter required by os_thread_create */ /*********************************************************************//** @@ -153,7 +153,7 @@ dberr_t trx_rollback_for_mysql( /*===================*/ trx_t* trx) /*!< in/out: transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*******************************************************************//** Rollback the latest SQL statement for MySQL. @return error code or DB_SUCCESS */ @@ -162,7 +162,7 @@ dberr_t trx_rollback_last_sql_stat_for_mysql( /*=================================*/ trx_t* trx) /*!< in/out: transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*******************************************************************//** Rollback a transaction to a given savepoint or do a complete rollback. @return error code or DB_SUCCESS */ @@ -174,7 +174,7 @@ trx_rollback_to_savepoint( trx_savept_t* savept) /*!< in: pointer to savepoint undo number, if partial rollback requested, or NULL for complete rollback */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /*******************************************************************//** Rolls back a transaction back to a named savepoint. Modifications after the savepoint are undone but InnoDB does NOT release the corresponding locks @@ -196,7 +196,7 @@ trx_rollback_to_savepoint_for_mysql( information to remove the binlog entries of the queries executed after the savepoint */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Creates a named savepoint. If the transaction is not yet started, starts it. If there is already a savepoint of the same name, this call erases that old @@ -213,7 +213,7 @@ trx_savepoint_for_mysql( position corresponding to this connection at the time of the savepoint */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /*******************************************************************//** Releases a named savepoint. Savepoints which were set after this savepoint are deleted. @@ -225,7 +225,7 @@ trx_release_savepoint_for_mysql( /*============================*/ trx_t* trx, /*!< in: transaction handle */ const char* savepoint_name) /*!< in: savepoint name */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /*******************************************************************//** Frees savepoint structs starting from savep. */ UNIV_INTERN diff --git a/storage/xtradb/include/trx0sys.h b/storage/xtradb/include/trx0sys.h index d8067e1f936..0c18b657fd7 100644 --- a/storage/xtradb/include/trx0sys.h +++ b/storage/xtradb/include/trx0sys.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -291,7 +291,7 @@ ibool trx_in_trx_list( /*============*/ const trx_t* in_trx) /*!< in: transaction */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* UNIV_DEBUG */ #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG /***********************************************************//** @@ -302,7 +302,7 @@ ibool trx_assert_recovered( /*=================*/ trx_id_t trx_id) /*!< in: transaction identifier */ - __attribute__((warn_unused_result)); + MY_ATTRIBUTE((warn_unused_result)); #endif /* UNIV_DEBUG || UNIV_BLOB_LIGHT_DEBUG */ /*****************************************************************//** Updates the offset information about the end of the MySQL binlog entry diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h index d3b1b89e706..ec810405b5a 100644 --- a/storage/xtradb/include/trx0trx.h +++ b/storage/xtradb/include/trx0trx.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2015, MariaDB Corporation This program is free software; you can redistribute it and/or modify it under @@ -52,7 +52,7 @@ UNIV_INLINE void trx_search_latch_release_if_reserved( /*=================================*/ - trx_t* trx __attribute__((unused))); /*!< in: transaction */ + trx_t* trx MY_ATTRIBUTE((unused))); /*!< in: transaction */ /******************************************************************//** Set detailed error message for the transaction. */ UNIV_INTERN @@ -106,7 +106,7 @@ void trx_free_prepared( /*==============*/ trx_t* trx) /*!< in, own: trx object */ - UNIV_COLD __attribute__((nonnull)); + UNIV_COLD MY_ATTRIBUTE((nonnull)); /********************************************************************//** Frees a transaction object for MySQL. */ UNIV_INTERN @@ -172,7 +172,7 @@ trx_start_for_ddl_low( /*==================*/ trx_t* trx, /*!< in/out: transaction */ trx_dict_op_t op) /*!< in: dictionary operation type */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifdef UNIV_DEBUG #define trx_start_for_ddl(t, o) \ @@ -194,7 +194,7 @@ void trx_commit( /*=======*/ trx_t* trx) /*!< in/out: transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /****************************************************************//** Commits a transaction and a mini-transaction. */ UNIV_INTERN @@ -204,7 +204,7 @@ trx_commit_low( trx_t* trx, /*!< in/out: transaction */ mtr_t* mtr) /*!< in/out: mini-transaction (will be committed), or NULL if trx made no modifications */ - __attribute__((nonnull(1))); + MY_ATTRIBUTE((nonnull(1))); /****************************************************************//** Cleans up a transaction at database startup. The cleanup is needed if the transaction already got to the middle of a commit when the database @@ -258,7 +258,7 @@ void trx_commit_complete_for_mysql( /*==========================*/ trx_t* trx) /*!< in/out: transaction */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Marks the latest SQL statement ended. */ UNIV_INTERN @@ -286,7 +286,7 @@ trx_clone_read_view( /*================*/ trx_t* trx, /*!< in: receiver transaction */ trx_t* from_trx) /*!< in: donor transaction */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /****************************************************************//** Prepares a transaction for commit/rollback. */ UNIV_INTERN @@ -331,7 +331,7 @@ trx_print_low( /*!< in: length of trx->lock.trx_locks */ ulint heap_size) /*!< in: mem_heap_get_size(trx->lock.lock_heap) */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Prints info about a transaction. @@ -345,7 +345,7 @@ trx_print_latched( const trx_t* trx, /*!< in: transaction */ ulint max_query_len) /*!< in: max query length to print, or 0 to use the default max length */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Prints info about a transaction. @@ -358,7 +358,7 @@ trx_print( const trx_t* trx, /*!< in: transaction */ ulint max_query_len) /*!< in: max query length to print, or 0 to use the default max length */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /**********************************************************************//** Determine if a transaction is a dictionary operation. @@ -368,7 +368,7 @@ enum trx_dict_op_t trx_get_dict_operation( /*===================*/ const trx_t* trx) /*!< in: transaction */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /**********************************************************************//** Flag a transaction a dictionary operation. */ UNIV_INLINE @@ -397,7 +397,7 @@ trx_state_eq( if state != TRX_STATE_NOT_STARTED asserts that trx->state != TRX_STATE_NOT_STARTED */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); # ifdef UNIV_DEBUG /**********************************************************************//** Asserts that a transaction has been started. @@ -408,7 +408,7 @@ ibool trx_assert_started( /*===============*/ const trx_t* trx) /*!< in: transaction */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); # endif /* UNIV_DEBUG */ /**********************************************************************//** diff --git a/storage/xtradb/include/trx0trx.ic b/storage/xtradb/include/trx0trx.ic index 787931dc4b6..8582b63f806 100644 --- a/storage/xtradb/include/trx0trx.ic +++ b/storage/xtradb/include/trx0trx.ic @@ -171,7 +171,7 @@ UNIV_INLINE void trx_search_latch_release_if_reserved( /*=================================*/ - trx_t* trx __attribute__((unused))) /*!< in: transaction */ + trx_t* trx MY_ATTRIBUTE((unused))) /*!< in: transaction */ { ut_ad(!trx->has_search_latch); } diff --git a/storage/xtradb/include/trx0undo.h b/storage/xtradb/include/trx0undo.h index 660551961a6..190308112ba 100644 --- a/storage/xtradb/include/trx0undo.h +++ b/storage/xtradb/include/trx0undo.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -73,7 +73,7 @@ bool trx_undo_trx_id_is_insert( /*======================*/ const byte* trx_id) /*!< in: DB_TRX_ID, followed by DB_ROLL_PTR */ - __attribute__((nonnull, pure, warn_unused_result)); + MY_ATTRIBUTE((nonnull, pure, warn_unused_result)); #endif /* !UNIV_HOTBACKUP */ /*****************************************************************//** Writes a roll ptr to an index page. In case that the size changes in @@ -214,7 +214,7 @@ trx_undo_add_page( mtr_t* mtr) /*!< in: mtr which does not have a latch to any undo log page; the caller must have reserved the rollback segment mutex */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /********************************************************************//** Frees the last undo log page. The caller must hold the rollback segment mutex. */ @@ -229,7 +229,7 @@ trx_undo_free_last_page_func( mtr_t* mtr) /*!< in/out: mini-transaction which does not have a latch to any undo log page or which has allocated the undo log page */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifdef UNIV_DEBUG # define trx_undo_free_last_page(trx,undo,mtr) \ trx_undo_free_last_page_func(trx,undo,mtr) @@ -249,7 +249,7 @@ trx_undo_truncate_end( trx_undo_t* undo, /*!< in/out: undo log */ undo_no_t limit) /*!< in: all undo records with undo number >= this value should be truncated */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); /***********************************************************************//** Truncates an undo log from the start. This function is used during a purge @@ -291,7 +291,7 @@ trx_undo_assign_undo( /*=================*/ trx_t* trx, /*!< in: transaction */ ulint type) /*!< in: TRX_UNDO_INSERT or TRX_UNDO_UPDATE */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); /******************************************************************//** Sets the state of the undo log segment at a transaction finish. @return undo log segment header page, x-latched */ @@ -341,7 +341,7 @@ void trx_undo_free_prepared( /*===================*/ trx_t* trx) /*!< in/out: PREPARED transaction */ - UNIV_COLD __attribute__((nonnull)); + UNIV_COLD MY_ATTRIBUTE((nonnull)); #endif /* !UNIV_HOTBACKUP */ /***********************************************************//** Parses the redo log entry of an undo log page initialization. diff --git a/storage/xtradb/include/univ.i b/storage/xtradb/include/univ.i index 528abe183c7..5320776c042 100644 --- a/storage/xtradb/include/univ.i +++ b/storage/xtradb/include/univ.i @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2013, 2015, MariaDB Corporation. @@ -45,10 +45,10 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 6 -#define INNODB_VERSION_BUGFIX 30 +#define INNODB_VERSION_BUGFIX 31 #ifndef PERCONA_INNODB_VERSION -#define PERCONA_INNODB_VERSION 76.3 +#define PERCONA_INNODB_VERSION 77.0 #endif /* Enable UNIV_LOG_ARCHIVE in XtraDB */ @@ -261,8 +261,9 @@ operations (very slow); also UNIV_DEBUG must be defined */ that are only referenced from within InnoDB, not from MySQL. We disable the GCC visibility directive on all Sun operating systems because there is no easy way to get it to work. See http://bugs.mysql.com/bug.php?id=52263. */ +#define MY_ATTRIBUTE __attribute__ #if defined(__GNUC__) && (__GNUC__ >= 4) && !defined(sun) || defined(__INTEL_COMPILER) -# define UNIV_INTERN __attribute__((visibility ("hidden"))) +# define UNIV_INTERN MY_ATTRIBUTE((visibility ("hidden"))) #else # define UNIV_INTERN #endif @@ -277,7 +278,7 @@ appears close together improving code locality of non-cold parts of program. The paths leading to call of cold functions within code are marked as unlikely by the branch prediction mechanism. optimize a rarely invoked function for size instead for speed. */ -# define UNIV_COLD __attribute__((cold)) +# define UNIV_COLD MY_ATTRIBUTE((cold)) #else # define UNIV_COLD /* empty */ #endif @@ -583,7 +584,7 @@ contains the sum of the following flag and the locally stored len. */ #if defined(__GNUC__) && (__GNUC__ > 2) && ! defined(__INTEL_COMPILER) #define HAVE_GCC_GT_2 /* Tell the compiler that variable/function is unused. */ -# define UNIV_UNUSED __attribute__ ((unused)) +# define UNIV_UNUSED MY_ATTRIBUTE ((unused)) #else # define UNIV_UNUSED #endif /* CHECK FOR GCC VER_GT_2 */ diff --git a/storage/xtradb/include/ut0byte.h b/storage/xtradb/include/ut0byte.h index 5bdd553ca80..4893ab9f9af 100644 --- a/storage/xtradb/include/ut0byte.h +++ b/storage/xtradb/include/ut0byte.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -39,7 +39,7 @@ ut_ull_create( /*==========*/ ulint high, /*!< in: high-order 32 bits */ ulint low) /*!< in: low-order 32 bits */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /********************************************************//** Rounds a 64-bit integer downward to a multiple of a power of 2. @@ -80,7 +80,7 @@ ut_align_down( /*==========*/ const void* ptr, /*!< in: pointer */ ulint align_no) /*!< in: align by this number */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /*********************************************************//** The following function computes the offset of a pointer from the nearest aligned address. @@ -91,7 +91,7 @@ ut_align_offset( /*============*/ const void* ptr, /*!< in: pointer */ ulint align_no) /*!< in: align by this number */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /*****************************************************************//** Gets the nth bit of a ulint. @return TRUE if nth bit is 1; 0th bit is defined to be the least significant */ diff --git a/storage/xtradb/include/ut0dbg.h b/storage/xtradb/include/ut0dbg.h index 6a4afe99597..3f5baef0a3c 100644 --- a/storage/xtradb/include/ut0dbg.h +++ b/storage/xtradb/include/ut0dbg.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -59,7 +59,7 @@ ut_dbg_assertion_failed( const char* expr, /*!< in: the failed assertion */ const char* file, /*!< in: source file containing the assertion */ ulint line) /*!< in: line number of the assertion */ - UNIV_COLD __attribute__((nonnull(2))); + UNIV_COLD MY_ATTRIBUTE((nonnull(2))); /** Abort the execution. */ # define UT_DBG_PANIC abort() diff --git a/storage/xtradb/include/ut0mem.h b/storage/xtradb/include/ut0mem.h index af7eb4e9b1d..81470358f2f 100644 --- a/storage/xtradb/include/ut0mem.h +++ b/storage/xtradb/include/ut0mem.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -87,7 +87,7 @@ ut_malloc_low( ulint n, /*!< in: number of bytes to allocate */ ibool assert_on_error) /*!< in: if TRUE, we crash mysqld if the memory cannot be allocated */ - __attribute__((malloc)); + MY_ATTRIBUTE((malloc)); /**********************************************************************//** Allocates memory. */ #define ut_malloc(n) ut_malloc_low(n, TRUE) diff --git a/storage/xtradb/include/ut0rnd.h b/storage/xtradb/include/ut0rnd.h index 53b769849a5..6ed3ee3b2e5 100644 --- a/storage/xtradb/include/ut0rnd.h +++ b/storage/xtradb/include/ut0rnd.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2009, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -96,7 +96,7 @@ ulint ut_fold_ull( /*========*/ ib_uint64_t d) /*!< in: 64-bit integer */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /*************************************************************//** Folds a character string ending in the null character. @return folded value */ @@ -105,7 +105,7 @@ ulint ut_fold_string( /*===========*/ const char* str) /*!< in: null-terminated string */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); /***********************************************************//** Looks for a prime number slightly greater than the given argument. The prime is chosen so that it is not near any power of 2. @@ -115,7 +115,7 @@ ulint ut_find_prime( /*==========*/ ulint n) /*!< in: positive number > 100 */ - __attribute__((const)); + MY_ATTRIBUTE((const)); #endif /* !UNIV_INNOCHECKSUM */ @@ -128,7 +128,7 @@ ut_fold_ulint_pair( /*===============*/ ulint n1, /*!< in: ulint */ ulint n2) /*!< in: ulint */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /*************************************************************//** Folds a binary string. @return folded value */ @@ -138,7 +138,7 @@ ut_fold_binary( /*===========*/ const byte* str, /*!< in: string of bytes */ ulint len) /*!< in: length */ - __attribute__((pure)); + MY_ATTRIBUTE((pure)); #ifndef UNIV_NONINL diff --git a/storage/xtradb/include/ut0ut.h b/storage/xtradb/include/ut0ut.h index 980ac337002..2df6bf58e6a 100644 --- a/storage/xtradb/include/ut0ut.h +++ b/storage/xtradb/include/ut0ut.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -236,7 +236,7 @@ ulint ut_2_power_up( /*==========*/ ulint n) /*!< in: number != 0 */ - __attribute__((const)); + MY_ATTRIBUTE((const)); /** Determine how many bytes (groups of 8 bits) are needed to store the given number of bits. @@ -316,7 +316,7 @@ void ut_print_timestamp( /*===============*/ FILE* file) /*!< in: file where to print */ - UNIV_COLD __attribute__((nonnull)); + UNIV_COLD MY_ATTRIBUTE((nonnull)); #ifndef UNIV_INNOCHECKSUM @@ -516,7 +516,7 @@ ut_ulint_sort( ulint* aux_arr, /*!< in/out: aux array to use in sort */ ulint low, /*!< in: lower bound */ ulint high) /*!< in: upper bound */ - __attribute__((nonnull)); + MY_ATTRIBUTE((nonnull)); #ifndef UNIV_NONINL #include "ut0ut.ic" diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index 6aef3e666aa..ecf43f71b21 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2014, 2015, MariaDB Corporation This program is free software; you can redistribute it and/or modify it under @@ -429,7 +429,7 @@ ibool lock_rec_validate_page( /*===================*/ const buf_block_t* block) /*!< in: buffer block */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* UNIV_DEBUG */ /* The lock system */ @@ -513,7 +513,7 @@ Checks that a transaction id is sensible, i.e., not in the future. #ifdef UNIV_DEBUG UNIV_INTERN #else -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) #endif bool lock_check_trx_id_sanity( @@ -1641,7 +1641,7 @@ lock_rec_discard(lock_t* in_lock); /*********************************************************************//** Checks if some other transaction has a lock request in the queue. @return lock or NULL */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) const lock_t* lock_rec_other_has_expl_req( /*========================*/ @@ -1692,6 +1692,10 @@ wsrep_kill_victim( { ut_ad(lock_mutex_own()); ut_ad(trx_mutex_own(lock->trx)); + + /* quit for native mysql */ + if (!wsrep_on(trx->mysql_thd)) return; + my_bool bf_this = wsrep_thd_is_BF(trx->mysql_thd, FALSE); my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE); @@ -1778,9 +1782,11 @@ lock_rec_other_has_conflicting( #ifdef WITH_WSREP if (lock_rec_has_to_wait(TRUE, trx, mode, lock, is_supremum)) { - trx_mutex_enter(lock->trx); - wsrep_kill_victim((trx_t *)trx, (lock_t *)lock); - trx_mutex_exit(lock->trx); + if (wsrep_on(trx->mysql_thd)) { + trx_mutex_enter(lock->trx); + wsrep_kill_victim(trx, lock); + trx_mutex_exit(lock->trx); + } #else if (lock_rec_has_to_wait(trx, mode, lock, is_supremum)) { #endif /* WITH_WSREP */ @@ -2086,7 +2092,9 @@ lock_rec_create( ut_ad(index->table->n_ref_count > 0 || !index->table->can_be_evicted); #ifdef WITH_WSREP - if (c_lock && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { + if (c_lock && + wsrep_on(trx->mysql_thd) && + wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { lock_t *hash = (lock_t *)c_lock->hash; lock_t *prev = NULL; @@ -4055,7 +4063,7 @@ lock_get_next_lock( ut_ad(heap_no == ULINT_UNDEFINED); ut_ad(lock_get_type_low(lock) == LOCK_TABLE); - lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, lock); + lock = UT_LIST_GET_NEXT(un_member.tab_lock.locks, lock); } } while (lock != NULL && lock->trx->lock.deadlock_mark > ctx->mark_start); @@ -4105,7 +4113,8 @@ lock_get_first_lock( } else { *heap_no = ULINT_UNDEFINED; ut_ad(lock_get_type_low(lock) == LOCK_TABLE); - lock = UT_LIST_GET_PREV(un_member.tab_lock.locks, lock); + dict_table_t* table = lock->un_member.tab_lock.table; + lock = UT_LIST_GET_FIRST(table->locks); } ut_a(lock != NULL); @@ -4577,8 +4586,6 @@ lock_deadlock_check_and_resolve( } #endif /* WITH_WSREP */ - MONITOR_INC(MONITOR_DEADLOCK); - } else if (victim_trx_id != 0 && victim_trx_id != trx->id) { ut_ad(victim_trx_id == ctx.wait_lock->trx->id); @@ -4587,14 +4594,15 @@ lock_deadlock_check_and_resolve( lock_deadlock_found = TRUE; MONITOR_INC(MONITOR_DEADLOCK); + srv_stats.lock_deadlock_count.inc(); } - } while (victim_trx_id != 0 && victim_trx_id != trx->id); /* If the joining transaction was selected as the victim. */ if (victim_trx_id != 0) { ut_a(victim_trx_id == trx->id); + MONITOR_INC(MONITOR_DEADLOCK); srv_stats.lock_deadlock_count.inc(); lock_deadlock_fputs("*** WE ROLL BACK TRANSACTION (2)\n"); @@ -4711,10 +4719,10 @@ lock_table_create( trx_mutex_exit(c_lock->trx); } } else { - UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock); - } -#else +#endif /* WITH_WSREP */ UT_LIST_ADD_LAST(un_member.tab_lock.locks, table->locks, lock); +#ifdef WITH_WSREP + } #endif /* WITH_WSREP */ if (UNIV_UNLIKELY(type_mode & LOCK_WAIT)) { @@ -5047,7 +5055,8 @@ lock_table( dberr_t err; const lock_t* wait_for; - ut_ad(table && thr); + ut_ad(table != NULL); + ut_ad(thr != NULL); if (flags & BTR_NO_LOCKING_FLAG) { @@ -6495,7 +6504,7 @@ lock_validate_table_locks( /*********************************************************************//** Validate record locks up to a limit. @return lock at limit or NULL if no more locks in the hash bucket */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) const lock_t* lock_rec_validate( /*==============*/ diff --git a/storage/xtradb/lock/lock0wait.cc b/storage/xtradb/lock/lock0wait.cc index a87adcf94c0..c7bd223c491 100644 --- a/storage/xtradb/lock/lock0wait.cc +++ b/storage/xtradb/lock/lock0wait.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -512,7 +512,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(lock_wait_timeout_thread)( /*=====================================*/ - void* arg __attribute__((unused))) + void* arg MY_ATTRIBUTE((unused))) /* in: a dummy parameter required by os_thread_create */ { diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index a19cb70e747..0b5d27b8fd1 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Google Inc. Copyright (C) 2014, 2016, MariaDB Corporation. All Rights Reserved. @@ -2641,7 +2641,7 @@ log_archived_file_name_gen( /*=======================*/ char* buf, /*!< in: buffer where to write */ ulint buf_len,/*!< in: buffer length */ - ulint id __attribute__((unused)), + ulint id MY_ATTRIBUTE((unused)), /*!< in: group id; currently we only archive the first group */ lsn_t file_no)/*!< in: file number */ diff --git a/storage/xtradb/log/log0online.cc b/storage/xtradb/log/log0online.cc index 3f53791ed4c..63f1ef39568 100644 --- a/storage/xtradb/log/log0online.cc +++ b/storage/xtradb/log/log0online.cc @@ -11,8 +11,8 @@ 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., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA +this program; if not, write to the Free Software Foundation, Inc., 51 Franklin +Street, Fifth Floor, Boston, MA 02110-1301, USA *****************************************************************************/ diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc index 67f4050a1f1..759687e3fe5 100644 --- a/storage/xtradb/log/log0recv.cc +++ b/storage/xtradb/log/log0recv.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. Copyright (c) 2013, 2016, MariaDB Corporation. All Rights Reserved. @@ -333,7 +333,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(recv_writer_thread)( /*===============================*/ - void* arg __attribute__((unused))) + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { @@ -752,7 +752,7 @@ recv_check_cp_is_consistent( /********************************************************//** Looks for the maximum consistent checkpoint from the log groups. @return error code or DB_SUCCESS */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t recv_find_max_checkpoint( /*=====================*/ @@ -775,8 +775,38 @@ recv_find_max_checkpoint( buf = log_sys->checkpoint_buf; while (group) { + + ulint log_hdr_log_block_size; + group->state = LOG_GROUP_CORRUPTED; + /* Assert that we can reuse log_sys->checkpoint_buf to read the + part of the header that contains the log block size. */ + ut_ad(LOG_FILE_OS_FILE_LOG_BLOCK_SIZE + 4 + < OS_FILE_LOG_BLOCK_SIZE); + + fil_io(OS_FILE_READ | OS_FILE_LOG, true, group->space_id, 0, + 0, 0, OS_FILE_LOG_BLOCK_SIZE, + log_sys->checkpoint_buf, NULL, NULL); + log_hdr_log_block_size + = mach_read_from_4(log_sys->checkpoint_buf + + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE); + if (log_hdr_log_block_size == 0) { + /* 0 means default value */ + log_hdr_log_block_size = 512; + } + if (UNIV_UNLIKELY(log_hdr_log_block_size + != srv_log_block_size)) { + fprintf(stderr, + "InnoDB: Error: The block size of ib_logfile " + "%lu is not equal to innodb_log_block_size " + "%lu.\n" + "InnoDB: Error: Suggestion - Recreate log " + "files.\n", + log_hdr_log_block_size, srv_log_block_size); + return(DB_ERROR); + } + for (field = LOG_CHECKPOINT_1; field <= LOG_CHECKPOINT_2; field += LOG_CHECKPOINT_2 - LOG_CHECKPOINT_1) { @@ -3097,7 +3127,6 @@ recv_recovery_from_checkpoint_start_func( log_group_t* group; log_group_t* max_cp_group; ulint max_cp_field; - ulint log_hdr_log_block_size; lsn_t checkpoint_lsn; ib_uint64_t checkpoint_no; lsn_t group_scanned_lsn = 0; @@ -3204,21 +3233,6 @@ recv_recovery_from_checkpoint_start_func( log_hdr_buf, max_cp_group, 0); } - log_hdr_log_block_size - = mach_read_from_4(log_hdr_buf + LOG_FILE_OS_FILE_LOG_BLOCK_SIZE); - if (log_hdr_log_block_size == 0) { - /* 0 means default value */ - log_hdr_log_block_size = 512; - } - if (UNIV_UNLIKELY(log_hdr_log_block_size != srv_log_block_size)) { - fprintf(stderr, - "InnoDB: Error: The block size of ib_logfile (" ULINTPF - ") is not equal to innodb_log_block_size.\n" - "InnoDB: Error: Suggestion - Recreate log files.\n", - log_hdr_log_block_size); - return(DB_ERROR); - } - #ifdef UNIV_LOG_ARCHIVE group = UT_LIST_GET_FIRST(log_sys->log_groups); diff --git a/storage/xtradb/mem/mem0dbg.cc b/storage/xtradb/mem/mem0dbg.cc index 308c2979551..a77785a369a 100644 --- a/storage/xtradb/mem/mem0dbg.cc +++ b/storage/xtradb/mem/mem0dbg.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -248,7 +248,7 @@ void mem_field_erase( /*============*/ byte* buf, /*!< in: memory field */ - ulint n __attribute__((unused))) + ulint n MY_ATTRIBUTE((unused))) /*!< in: how many bytes the user requested */ { byte* usr_buf; @@ -450,7 +450,7 @@ void mem_heap_validate_or_print( /*=======================*/ mem_heap_t* heap, /*!< in: memory heap */ - byte* top __attribute__((unused)), + byte* top MY_ATTRIBUTE((unused)), /*!< in: calculate and validate only until this top pointer in the heap is reached, if this pointer is NULL, ignored */ diff --git a/storage/xtradb/mtr/mtr0mtr.cc b/storage/xtradb/mtr/mtr0mtr.cc index 4010fcce7ed..a1d7261e43c 100644 --- a/storage/xtradb/mtr/mtr0mtr.cc +++ b/storage/xtradb/mtr/mtr0mtr.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, 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 @@ -59,7 +59,7 @@ mtr_block_dirtied( /*****************************************************************//** Releases the item in the slot given. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void mtr_memo_slot_release_func( /*=======================*/ @@ -106,7 +106,7 @@ mtr_memo_slot_release_func( Releases the mlocks and other objects stored in an mtr memo. They are released in the order opposite to which they were pushed to the memo. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void mtr_memo_pop_all( /*=============*/ @@ -398,7 +398,7 @@ mtr_read_ulint( /*===========*/ const byte* ptr, /*!< in: pointer from where to read */ ulint type, /*!< in: MLOG_1BYTE, MLOG_2BYTES, MLOG_4BYTES */ - mtr_t* mtr __attribute__((unused))) + mtr_t* mtr MY_ATTRIBUTE((unused))) /*!< in: mini-transaction handle */ { ut_ad(mtr->state == MTR_ACTIVE); diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc index ed16a18e548..281c75ca4f5 100644 --- a/storage/xtradb/os/os0file.cc +++ b/storage/xtradb/os/os0file.cc @@ -1,6 +1,6 @@ /*********************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. Copyright (c) 2013, 2016, MariaDB Corporation. @@ -1817,11 +1817,11 @@ void os_file_set_nocache( /*================*/ os_file_t fd /*!< in: file descriptor to alter */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), const char* file_name /*!< in: used in the diagnostic message */ - __attribute__((unused)), - const char* operation_name __attribute__((unused))) + MY_ATTRIBUTE((unused)), + const char* operation_name MY_ATTRIBUTE((unused))) /*!< in: "open" or "create"; used in the diagnostic message */ { @@ -1873,14 +1873,14 @@ short_warning: Tries to enable the atomic write feature, if available, for the specified file handle. @return TRUE if success */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) ibool os_file_set_atomic_writes( /*======================*/ const char* name /*!< in: name of the file */ - __attribute__((unused)), + MY_ATTRIBUTE((unused)), os_file_t file /*!< in: handle to the file */ - __attribute__((unused))) + MY_ATTRIBUTE((unused))) { #ifdef DFS_IOCTL_ATOMIC_WRITE_SET @@ -2826,7 +2826,7 @@ os_file_flush_func( /*******************************************************************//** Does a synchronous read operation in Posix. @return number of bytes read, -1 if error */ -static __attribute__((nonnull(2), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(2), warn_unused_result)) ssize_t os_file_pread( /*==========*/ @@ -2989,7 +2989,7 @@ os_file_pread( /*******************************************************************//** Does a synchronous write operation in Posix. @return number of bytes written, -1 if error */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) ssize_t os_file_pwrite( /*===========*/ diff --git a/storage/xtradb/os/os0sync.cc b/storage/xtradb/os/os0sync.cc index 423b94c6db0..df878c88105 100644 --- a/storage/xtradb/os/os0sync.cc +++ b/storage/xtradb/os/os0sync.cc @@ -240,7 +240,7 @@ os_event_t os_event_create(void) /*==================*/ { - os_event_t event = static_cast<os_event_t>(ut_malloc(sizeof(*event)));; + os_event_t event = static_cast<os_event_t>(ut_malloc(sizeof(*event))); os_event_create(event); diff --git a/storage/xtradb/page/page0cur.cc b/storage/xtradb/page/page0cur.cc index 97405261392..76e4c2aed9b 100644 --- a/storage/xtradb/page/page0cur.cc +++ b/storage/xtradb/page/page0cur.cc @@ -1055,6 +1055,26 @@ use_heap: insert_rec = rec_copy(insert_buf, rec, offsets); rec_offs_make_valid(insert_rec, index, offsets); + /* This is because assertion below is debug assertion */ +#ifdef UNIV_DEBUG + if (UNIV_UNLIKELY(current_rec == insert_rec)) { + ulint extra_len, data_len; + extra_len = rec_offs_extra_size(offsets); + data_len = rec_offs_data_size(offsets); + + fprintf(stderr, "InnoDB: Error: current_rec == insert_rec " + " extra_len %lu data_len %lu insert_buf %p rec %p\n", + extra_len, data_len, insert_buf, rec); + fprintf(stderr, "InnoDB; Physical record: \n"); + rec_print(stderr, rec, index); + fprintf(stderr, "InnoDB: Inserted record: \n"); + rec_print(stderr, insert_rec, index); + fprintf(stderr, "InnoDB: Current record: \n"); + rec_print(stderr, current_rec, index); + ut_a(current_rec != insert_rec); + } +#endif /* UNIV_DEBUG */ + /* 4. Insert the record in the linked list of records */ ut_ad(current_rec != insert_rec); diff --git a/storage/xtradb/page/page0page.cc b/storage/xtradb/page/page0page.cc index 6adbdeb95a4..a6fba4074ef 100644 --- a/storage/xtradb/page/page0page.cc +++ b/storage/xtradb/page/page0page.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. This program is free software; you can redistribute it and/or modify it under @@ -309,7 +309,7 @@ byte* page_parse_create( /*==============*/ byte* ptr, /*!< in: buffer */ - byte* end_ptr __attribute__((unused)), /*!< in: buffer end */ + byte* end_ptr MY_ATTRIBUTE((unused)), /*!< in: buffer end */ ulint comp, /*!< in: nonzero=compact page format */ buf_block_t* block, /*!< in: block or NULL */ mtr_t* mtr) /*!< in: mtr or NULL */ diff --git a/storage/xtradb/page/page0zip.cc b/storage/xtradb/page/page0zip.cc index 09da6ac6a50..63d6fe225c2 100644 --- a/storage/xtradb/page/page0zip.cc +++ b/storage/xtradb/page/page0zip.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2005, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. Copyright (c) 2014, SkySQL Ab. All Rights Reserved. @@ -135,7 +135,7 @@ Compare at most sizeof(field_ref_zero) bytes. independently of any UNIV_ debugging conditions. */ #if defined UNIV_DEBUG || defined UNIV_ZIP_DEBUG # include <stdarg.h> -__attribute__((format (printf, 1, 2))) +MY_ATTRIBUTE((format (printf, 1, 2))) /**********************************************************************//** Report a failure to decompress or compress. @return number of characters printed */ @@ -755,8 +755,8 @@ static void page_zip_free( /*==========*/ - void* opaque __attribute__((unused)), /*!< in: memory heap */ - void* address __attribute__((unused)))/*!< in: object to free */ + void* opaque MY_ATTRIBUTE((unused)), /*!< in: memory heap */ + void* address MY_ATTRIBUTE((unused)))/*!< in: object to free */ { } @@ -4814,7 +4814,8 @@ page_zip_parse_compress( ulint size; ulint trailer_size; - ut_ad(ptr && end_ptr); + ut_ad(ptr != NULL); + ut_ad(end_ptr != NULL); ut_ad(!page == !page_zip); if (UNIV_UNLIKELY(ptr + (2 + 2) > end_ptr)) { diff --git a/storage/xtradb/pars/lexyy.cc b/storage/xtradb/pars/lexyy.cc index 07476320e03..62122bb9f6f 100644 --- a/storage/xtradb/pars/lexyy.cc +++ b/storage/xtradb/pars/lexyy.cc @@ -295,7 +295,7 @@ static int yy_start = 0; /* start state number */ static int yy_did_buffer_switch_on_eof; void yyrestart (FILE *input_file ); -__attribute__((unused)) static void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); +MY_ATTRIBUTE((unused)) static void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ); static YY_BUFFER_STATE yy_create_buffer (FILE *file,int size ); void yy_delete_buffer (YY_BUFFER_STATE b ); void yy_flush_buffer (YY_BUFFER_STATE b ); @@ -916,7 +916,7 @@ char *yytext; #line 1 "pars0lex.l" /***************************************************************************** -Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -1027,7 +1027,7 @@ static int yy_init_globals (void ); /* Accessor methods to globals. These are made visible to non-reentrant scanners for convenience. */ -__attribute__((unused)) static int yylex_destroy (void ); +MY_ATTRIBUTE((unused)) static int yylex_destroy (void ); int yyget_debug (void ); @@ -2664,7 +2664,7 @@ static int yy_get_next_buffer (void) * @param new_buffer The new input buffer. * */ - __attribute__((unused)) static void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) + MY_ATTRIBUTE((unused)) static void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer ) { /* TODO. We should be able to replace this entire function body @@ -3042,7 +3042,7 @@ static int yy_init_globals (void) } /* yylex_destroy is for both reentrant and non-reentrant scanners. */ -__attribute__((unused)) static int yylex_destroy (void) +MY_ATTRIBUTE((unused)) static int yylex_destroy (void) { /* Pop the buffer stack, destroying each element. */ diff --git a/storage/xtradb/pars/make_flex.sh b/storage/xtradb/pars/make_flex.sh index 581fc2342aa..c3db8aea298 100755 --- a/storage/xtradb/pars/make_flex.sh +++ b/storage/xtradb/pars/make_flex.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved. +# Copyright (c) 1994, 2016, 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 @@ -33,15 +33,15 @@ sed -e ' s/'"$TMPFILE"'/'"$OUTFILE"'/; s/\(int offset = \)\((yy_c_buf_p) - (yytext_ptr)\);/\1(int)(\2);/; s/\(void yy\(restart\|_\(delete\|flush\)_buffer\)\)/static \1/; -s/\(void yy_switch_to_buffer\)/__attribute__((unused)) static \1/; -s/\(void yy\(push\|pop\)_buffer_state\)/__attribute__((unused)) static \1/; +s/\(void yy_switch_to_buffer\)/MY_ATTRIBUTE((unused)) static \1/; +s/\(void yy\(push\|pop\)_buffer_state\)/MY_ATTRIBUTE((unused)) static \1/; s/\(YY_BUFFER_STATE yy_create_buffer\)/static \1/; -s/\(\(int\|void\) yy[gs]et_\)/__attribute__((unused)) static \1/; +s/\(\(int\|void\) yy[gs]et_\)/MY_ATTRIBUTE((unused)) static \1/; s/\(void \*\?yy\(\(re\)\?alloc\|free\)\)/static \1/; s/\(extern \)\?\(int yy\(leng\|lineno\|_flex_debug\)\)/static \2/; -s/\(int yylex_destroy\)/__attribute__((unused)) static \1/; +s/\(int yylex_destroy\)/MY_ATTRIBUTE((unused)) static \1/; s/\(extern \)\?\(int yylex \)/UNIV_INTERN \2/; -s/^\(\(FILE\|char\) *\* *yyget\)/__attribute__((unused)) static \1/; +s/^\(\(FILE\|char\) *\* *yyget\)/MY_ATTRIBUTE((unused)) static \1/; s/^\(extern \)\?\(\(FILE\|char\) *\* *yy\)/static \2/; ' < $TMPFILE >> $OUTFILE diff --git a/storage/xtradb/pars/pars0pars.cc b/storage/xtradb/pars/pars0pars.cc index da08939d78a..e6af3d25e86 100644 --- a/storage/xtradb/pars/pars0pars.cc +++ b/storage/xtradb/pars/pars0pars.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -1926,7 +1926,7 @@ pars_create_table( sym_node_t* column_defs, /*!< in: list of column names */ sym_node_t* compact, /* in: non-NULL if COMPACT table. */ sym_node_t* block_size, /* in: block size (can be NULL) */ - void* not_fit_in_memory __attribute__((unused))) + void* not_fit_in_memory MY_ATTRIBUTE((unused))) /*!< in: a non-NULL pointer means that this is a table which in simulations should be simulated as not fitting @@ -2143,7 +2143,7 @@ UNIV_INTERN que_fork_t* pars_stored_procedure_call( /*=======================*/ - sym_node_t* sym_node __attribute__((unused))) + sym_node_t* sym_node MY_ATTRIBUTE((unused))) /*!< in: stored procedure name */ { ut_error; @@ -2203,7 +2203,7 @@ UNIV_INTERN void yyerror( /*====*/ - const char* s __attribute__((unused))) + const char* s MY_ATTRIBUTE((unused))) /*!< in: error message string */ { ut_ad(s); diff --git a/storage/xtradb/rem/rem0cmp.cc b/storage/xtradb/rem/rem0cmp.cc index 426cf9e3ac5..616ef322fb5 100644 --- a/storage/xtradb/rem/rem0cmp.cc +++ b/storage/xtradb/rem/rem0cmp.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -75,7 +75,7 @@ cmp_debug_dtuple_rec_with_match( completely matched fields; when function returns, contains the value for current comparison */ - __attribute__((nonnull, warn_unused_result)); + MY_ATTRIBUTE((nonnull, warn_unused_result)); #endif /* UNIV_DEBUG */ /*************************************************************//** This function is used to compare two data fields for which the data type @@ -659,7 +659,10 @@ cmp_dtuple_rec_with_match_low( in current field */ int ret; /* return value */ - ut_ad(dtuple && rec && matched_fields && matched_bytes); + ut_ad(dtuple != NULL); + ut_ad(rec != NULL); + ut_ad(matched_fields != NULL); + ut_ad(matched_bytes != NULL); ut_ad(dtuple_check_typed(dtuple)); ut_ad(rec_offs_validate(rec, NULL, offsets)); @@ -920,7 +923,7 @@ Compare two physical record fields. @retval 1 if rec1 field is greater than rec2 @retval -1 if rec1 field is less than rec2 @retval 0 if rec1 field equals to rec2 */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) int cmp_rec_rec_simple_field( /*=====================*/ @@ -1139,7 +1142,9 @@ cmp_rec_rec_with_match( int ret = 0; /* return value */ ulint comp; - ut_ad(rec1 && rec2 && index); + ut_ad(rec1 != NULL); + ut_ad(rec2 != NULL); + ut_ad(index != NULL); ut_ad(rec_offs_validate(rec1, index, offsets1)); ut_ad(rec_offs_validate(rec2, index, offsets2)); ut_ad(rec_offs_comp(offsets1) == rec_offs_comp(offsets2)); @@ -1375,7 +1380,9 @@ cmp_debug_dtuple_rec_with_match( int ret; /* return value */ ulint cur_field; /* current field number */ - ut_ad(dtuple && rec && matched_fields); + ut_ad(dtuple != NULL); + ut_ad(rec != NULL); + ut_ad(matched_fields != NULL); ut_ad(dtuple_check_typed(dtuple)); ut_ad(rec_offs_validate(rec, NULL, offsets)); diff --git a/storage/xtradb/rem/rem0rec.cc b/storage/xtradb/rem/rem0rec.cc index 4231309f10f..80dc7557ec7 100644 --- a/storage/xtradb/rem/rem0rec.cc +++ b/storage/xtradb/rem/rem0rec.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2016, 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 @@ -244,7 +244,7 @@ rec_get_n_extern_new( Determine the offset to each field in a leaf-page record in ROW_FORMAT=COMPACT. This is a special case of rec_init_offsets() and rec_get_offsets_func(). */ -UNIV_INLINE __attribute__((nonnull)) +UNIV_INLINE MY_ATTRIBUTE((nonnull)) void rec_init_offsets_comp_ordinary( /*===========================*/ @@ -788,7 +788,7 @@ rec_get_nth_field_offs_old( /**********************************************************//** Determines the size of a data tuple prefix in ROW_FORMAT=COMPACT. @return total size */ -UNIV_INLINE __attribute__((warn_unused_result, nonnull(1,2))) +UNIV_INLINE MY_ATTRIBUTE((warn_unused_result, nonnull(1,2))) ulint rec_get_converted_size_comp_prefix_low( /*===================================*/ @@ -1133,7 +1133,7 @@ rec_convert_dtuple_to_rec_old( /*********************************************************//** Builds a ROW_FORMAT=COMPACT record out of a data tuple. */ -UNIV_INLINE __attribute__((nonnull)) +UNIV_INLINE MY_ATTRIBUTE((nonnull)) void rec_convert_dtuple_to_rec_comp( /*===========================*/ @@ -1341,7 +1341,9 @@ rec_convert_dtuple_to_rec( { rec_t* rec; - ut_ad(buf && index && dtuple); + ut_ad(buf != NULL); + ut_ad(index != NULL); + ut_ad(dtuple != NULL); ut_ad(dtuple_validate(dtuple)); ut_ad(dtuple_check_typed(dtuple)); diff --git a/storage/xtradb/row/row0ftsort.cc b/storage/xtradb/row/row0ftsort.cc index ac0dc844b1b..a3a00620a6d 100644 --- a/storage/xtradb/row/row0ftsort.cc +++ b/storage/xtradb/row/row0ftsort.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2010, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2015, 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -560,8 +560,18 @@ row_merge_fts_doc_tokenize( dfield_dup(field, buf->heap); /* One variable length column, word with its lenght less than - fts_max_token_size, add one extra size and one extra byte */ - cur_len += 2; + fts_max_token_size, add one extra size and one extra byte. + + Since the max length for FTS token now is larger than 255, + so we will need to signify length byte itself, so only 1 to 128 + bytes can be used for 1 bytes, larger than that 2 bytes. */ + if (t_str.f_len < 128) { + /* Extra size is one byte. */ + cur_len += 2; + } else { + /* Extra size is two bytes. */ + cur_len += 3; + } /* Reserve one byte for the end marker of row_merge_block_t and we have reserved ROW_MERGE_RESERVE_SIZE (= 4) for @@ -1045,7 +1055,7 @@ row_fts_start_parallel_merge( /********************************************************************//** Insert processed FTS data to auxillary index tables. @return DB_SUCCESS if insertion runs fine */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) dberr_t row_merge_write_fts_word( /*=====================*/ diff --git a/storage/xtradb/row/row0import.cc b/storage/xtradb/row/row0import.cc index 893ffcab3da..4c7cb7d33b5 100644 --- a/storage/xtradb/row/row0import.cc +++ b/storage/xtradb/row/row0import.cc @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (c) 2012, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2015, MariaDB Corporation. +Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2016, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1336,12 +1336,15 @@ row_import::match_schema( THD* thd) UNIV_NOTHROW { /* Do some simple checks. */ + const unsigned relevant_flags = m_flags & ~DICT_TF_MASK_DATA_DIR; + const unsigned relevant_table_flags + = m_table->flags & ~DICT_TF_MASK_DATA_DIR; - if (m_flags != m_table->flags) { + if (relevant_flags != relevant_table_flags) { ib_errf(thd, IB_LOG_LEVEL_ERROR, ER_TABLE_SCHEMA_MISMATCH, - "Table flags don't match, server table has 0x%lx " - "and the meta-data file has 0x%lx", - (ulong) m_table->n_cols, (ulong) m_flags); + "Table flags don't match, server table has 0x%x " + "and the meta-data file has 0x%x", + relevant_table_flags, relevant_flags); return(DB_ERROR); } else if (m_table->n_cols != m_n_cols) { @@ -2181,7 +2184,7 @@ PageConverter::operator() ( Clean up after import tablespace failure, this function will acquire the dictionary latches on behalf of the transaction if the transaction hasn't already acquired them. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_import_discard_changes( /*=======================*/ @@ -2232,7 +2235,7 @@ row_import_discard_changes( /*****************************************************************//** Clean up after import tablespace. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_import_cleanup( /*===============*/ @@ -2267,7 +2270,7 @@ row_import_cleanup( /*****************************************************************//** Report error during tablespace import. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_import_error( /*=============*/ @@ -2295,7 +2298,7 @@ row_import_error( Adjust the root page index node and leaf node segment headers, update with the new space id. For all the table's secondary indexes. @return error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_import_adjust_root_pages_of_secondary_indexes( /*==============================================*/ @@ -2411,7 +2414,7 @@ row_import_adjust_root_pages_of_secondary_indexes( /*****************************************************************//** Ensure that dict_sys->row_id exceeds SELECT MAX(DB_ROW_ID). @return error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_import_set_sys_max_row_id( /*==========================*/ @@ -2561,7 +2564,7 @@ row_import_cfg_read_string( /*********************************************************************//** Write the meta data (index user fields) config file. @return DB_SUCCESS or error code. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_import_cfg_read_index_fields( /*=============================*/ @@ -2644,7 +2647,7 @@ row_import_cfg_read_index_fields( Read the index names and root page numbers of the indexes and set the values. Row format [root_page_no, len of str, str ... ] @return DB_SUCCESS or error code. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_import_read_index_data( /*=======================*/ @@ -2839,7 +2842,7 @@ row_import_read_indexes( /*********************************************************************//** Read the meta data (table columns) config file. Deserialise the contents of dict_col_t structure, along with the column name. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_import_read_columns( /*====================*/ @@ -2964,7 +2967,7 @@ row_import_read_columns( /*****************************************************************//** Read the contents of the <tablespace>.cfg file. @return DB_SUCCESS or error code. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_import_read_v1( /*===============*/ @@ -3130,7 +3133,7 @@ row_import_read_v1( /** Read the contents of the <tablespace>.cfg file. @return DB_SUCCESS or error code. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_import_read_meta_data( /*======================*/ @@ -3173,7 +3176,7 @@ row_import_read_meta_data( /** Read the contents of the <tablename>.cfg file. @return DB_SUCCESS or error code. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_import_read_cfg( /*================*/ diff --git a/storage/xtradb/row/row0ins.cc b/storage/xtradb/row/row0ins.cc index d02e1796f8a..8dbf093a17d 100644 --- a/storage/xtradb/row/row0ins.cc +++ b/storage/xtradb/row/row0ins.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -224,7 +224,7 @@ Does an insert operation by updating a delete-marked existing record in the index. This situation can occur if the delete-marked record is kept in the index for consistent reads. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_ins_sec_index_entry_by_modify( /*==============================*/ @@ -325,7 +325,7 @@ Does an insert operation by delete unmarking and updating a delete marked existing record in the index. This situation can occur if the delete marked record is kept in the index for consistent reads. @return DB_SUCCESS, DB_FAIL, or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_ins_clust_index_entry_by_modify( /*================================*/ @@ -433,7 +433,7 @@ row_ins_cascade_ancestor_updates_table( Returns the number of ancestor UPDATE or DELETE nodes of a cascaded update/delete node. @return number of ancestors */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) ulint row_ins_cascade_n_ancestors( /*========================*/ @@ -459,7 +459,7 @@ a cascaded update. can also be 0 if no foreign key fields changed; the returned value is ULINT_UNDEFINED if the column type in the child table is too short to fit the new value in the parent table: that means the update fails */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) ulint row_ins_cascade_calc_update_vec( /*============================*/ @@ -948,7 +948,7 @@ Perform referential actions or checks when a parent row is deleted or updated and the constraint had an ON DELETE or ON UPDATE condition which was not RESTRICT. @return DB_SUCCESS, DB_LOCK_WAIT, or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_ins_foreign_check_on_constraint( /*================================*/ @@ -1802,7 +1802,7 @@ Otherwise does searches to the indexes of referenced tables and sets shared locks which lock either the success or the failure of a constraint. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_ins_check_foreign_constraints( /*==============================*/ @@ -1943,7 +1943,7 @@ Scans a unique non-clustered index at a given index entry to determine whether a uniqueness violation has occurred for the key value of the entry. Set shared locks on possible duplicate records. @return DB_SUCCESS, DB_DUPLICATE_KEY, or DB_LOCK_WAIT */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_ins_scan_sec_index_for_duplicate( /*=================================*/ @@ -2085,7 +2085,7 @@ end_scan: @retval DB_SUCCESS_LOCKED_REC when rec is an exact match of entry or a newer version of entry (the entry should not be inserted) @retval DB_DUPLICATE_KEY when entry is a duplicate of rec */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_ins_duplicate_online( /*=====================*/ @@ -2126,7 +2126,7 @@ row_ins_duplicate_online( @retval DB_SUCCESS_LOCKED_REC when rec is an exact match of entry or a newer version of entry (the entry should not be inserted) @retval DB_DUPLICATE_KEY when entry is a duplicate of rec */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_ins_duplicate_error_in_clust_online( /*====================================*/ @@ -2169,7 +2169,7 @@ for a clustered index! record @retval DB_SUCCESS_LOCKED_REC if an exact match of the record was found in online table rebuild (flags & (BTR_KEEP_SYS_FLAG | BTR_NO_LOCKING_FLAG)) */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_ins_duplicate_error_in_clust( /*=============================*/ @@ -2625,7 +2625,7 @@ func_exit: /***************************************************************//** Starts a mini-transaction and checks if the index will be dropped. @return true if the index is to be dropped */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool row_ins_sec_mtr_start_trx_and_check_if_aborted( /*=======================================*/ @@ -3105,7 +3105,7 @@ row_ins_index_entry( /***********************************************************//** Sets the values of the dtuple fields in entry from the values of appropriate columns in row. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_ins_index_entry_set_vals( /*=========================*/ @@ -3158,7 +3158,7 @@ row_ins_index_entry_set_vals( Inserts a single index entry to the table. @return DB_SUCCESS if operation successfully completed, else error code or DB_LOCK_WAIT */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_ins_index_entry_step( /*=====================*/ @@ -3281,7 +3281,7 @@ row_ins_get_row_from_select( Inserts a row to a table. @return DB_SUCCESS if operation successfully completed, else error code or DB_LOCK_WAIT */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_ins( /*====*/ diff --git a/storage/xtradb/row/row0log.cc b/storage/xtradb/row/row0log.cc index f0b200459dd..53e375023fb 100644 --- a/storage/xtradb/row/row0log.cc +++ b/storage/xtradb/row/row0log.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2011, 2016, 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 @@ -205,7 +205,7 @@ struct row_log_t { /** Create the file or online log if it does not exist. @param[in,out] log online rebuild log @return file descriptor. */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) int row_log_tmpfile( row_log_t* log) @@ -221,7 +221,7 @@ row_log_tmpfile( /** Allocate the memory for the log buffer. @param[in,out] log_buf Buffer used for log operation @return TRUE if success, false if not */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) bool row_log_block_allocate( row_log_buf_t& log_buf) @@ -411,7 +411,7 @@ row_log_table_get_error( /******************************************************//** Starts logging an operation to a table that is being rebuilt. @return pointer to log, or NULL if no logging is necessary */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) byte* row_log_table_open( /*===============*/ @@ -446,7 +446,7 @@ err_exit: /******************************************************//** Stops logging an operation to a table that is being rebuilt. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_log_table_close_func( /*=====================*/ @@ -820,7 +820,7 @@ row_log_table_low_redundant( /******************************************************//** Logs an insert or update to a table that is being rebuilt. */ -static __attribute__((nonnull(1,2,3))) +static MY_ATTRIBUTE((nonnull(1,2,3))) void row_log_table_low( /*==============*/ @@ -1320,7 +1320,7 @@ row_log_table_blob_alloc( /******************************************************//** Converts a log record to a table row. @return converted row, or NULL if the conversion fails */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) const dtuple_t* row_log_table_apply_convert_mrec( /*=============================*/ @@ -1474,7 +1474,7 @@ blob_done: /******************************************************//** Replays an insert operation on a table that was rebuilt. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_log_table_apply_insert_low( /*===========================*/ @@ -1556,7 +1556,7 @@ row_log_table_apply_insert_low( /******************************************************//** Replays an insert operation on a table that was rebuilt. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_log_table_apply_insert( /*=======================*/ @@ -1608,7 +1608,7 @@ row_log_table_apply_insert( /******************************************************//** Deletes a record from a table that is being rebuilt. @return DB_SUCCESS or error code */ -static __attribute__((nonnull(1, 2, 4, 5), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(1, 2, 4, 5), warn_unused_result)) dberr_t row_log_table_apply_delete_low( /*===========================*/ @@ -1706,7 +1706,7 @@ flag_ok: /******************************************************//** Replays a delete operation on a table that was rebuilt. @return DB_SUCCESS or error code */ -static __attribute__((nonnull(1, 3, 4, 5, 6, 7), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(1, 3, 4, 5, 6, 7), warn_unused_result)) dberr_t row_log_table_apply_delete( /*=======================*/ @@ -1828,7 +1828,7 @@ all_done: /******************************************************//** Replays an update operation on a table that was rebuilt. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_log_table_apply_update( /*=======================*/ @@ -2191,7 +2191,7 @@ func_exit_committed: Applies an operation to a table that was rebuilt. @return NULL on failure (mrec corruption) or when out of data; pointer to next record on success */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) const mrec_t* row_log_table_apply_op( /*===================*/ @@ -2482,7 +2482,7 @@ row_log_table_apply_op( /******************************************************//** Applies operations to a table was rebuilt. @return DB_SUCCESS, or error code on failure */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_log_table_apply_ops( /*====================*/ @@ -2979,7 +2979,7 @@ row_log_get_max_trx( /******************************************************//** Applies an operation to a secondary index that was being created. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_log_apply_op_low( /*=================*/ @@ -3206,7 +3206,7 @@ func_exit: Applies an operation to a secondary index that was being created. @return NULL on failure (mrec corruption) or when out of data; pointer to next record on success */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) const mrec_t* row_log_apply_op( /*=============*/ @@ -3331,7 +3331,7 @@ corrupted: /******************************************************//** Applies operations to a secondary index that was being created. @return DB_SUCCESS, or error code on failure */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) dberr_t row_log_apply_ops( /*==============*/ diff --git a/storage/xtradb/row/row0merge.cc b/storage/xtradb/row/row0merge.cc index 9c3e9dfc885..b803a0d76c4 100644 --- a/storage/xtradb/row/row0merge.cc +++ b/storage/xtradb/row/row0merge.cc @@ -164,7 +164,7 @@ row_merge_decrypt_buf( #ifdef UNIV_DEBUG /******************************************************//** Display a merge tuple. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_merge_tuple_print( /*==================*/ @@ -199,7 +199,7 @@ row_merge_tuple_print( /******************************************************//** Encode an index record. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_merge_buf_encode( /*=================*/ @@ -236,7 +236,7 @@ row_merge_buf_encode( /******************************************************//** Allocate a sort buffer. @return own: sort buffer */ -static __attribute__((malloc, nonnull)) +static MY_ATTRIBUTE((malloc, nonnull)) row_merge_buf_t* row_merge_buf_create_low( /*=====================*/ @@ -738,7 +738,7 @@ row_merge_dup_report( /*************************************************************//** Compare two tuples. @return 1, 0, -1 if a is greater, equal, less, respectively, than b */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) int row_merge_tuple_cmp( /*================*/ @@ -817,7 +817,7 @@ UT_SORT_FUNCTION_BODY(). /**********************************************************************//** Merge sort the tuple buffer in main memory. */ -static __attribute__((nonnull(4,5))) +static MY_ATTRIBUTE((nonnull(4,5))) void row_merge_tuple_sort( /*=================*/ @@ -1393,7 +1393,7 @@ row_merge_write_eof( @param[in,out] tmpfd temporary file handle @param[in] path path to create temporary file @return file descriptor, or -1 on failure */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) int row_merge_tmpfile_if_needed( int* tmpfd, @@ -1412,7 +1412,7 @@ row_merge_tmpfile_if_needed( @param[in] nrec number of records in the file @param[in] path path to create temporary files @return file descriptor, or -1 on failure */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) int row_merge_file_create_if_needed( merge_file_t* file, @@ -1458,7 +1458,7 @@ containing the index entries for the indexes to be built. @param[in,out] block file buffer @param[in,out] tmpfd temporary file handle return DB_SUCCESS or error */ -static __attribute__((nonnull(1,2,3,4,6,9,10,16), warn_unused_result)) +static MY_ATTRIBUTE((nonnull(1,2,3,4,6,9,10,16), warn_unused_result)) dberr_t row_merge_read_clustered_index( trx_t* trx, @@ -2680,7 +2680,7 @@ row_merge_sort( /*************************************************************//** Copy externally stored columns to the data tuple. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_merge_copy_blobs( /*=================*/ @@ -3762,7 +3762,7 @@ row_merge_rename_tables_dict( /*********************************************************************//** Create and execute a query graph for creating an index. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_merge_create_index_graph( /*=========================*/ diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc index ccdfc1332a0..ba2e0047fe9 100644 --- a/storage/xtradb/row/row0mysql.cc +++ b/storage/xtradb/row/row0mysql.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2000, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2000, 2016, 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 @@ -1432,9 +1432,12 @@ error_exit: } /* Difference between Doc IDs are restricted within - 4 bytes integer. See fts_get_encoded_len() */ + 4 bytes integer. See fts_get_encoded_len(). Consecutive + doc_ids difference should not exceed + FTS_DOC_ID_MAX_STEP value. */ - if (doc_id - next_doc_id >= FTS_DOC_ID_MAX_STEP) { + if (next_doc_id > 1 + && doc_id - next_doc_id >= FTS_DOC_ID_MAX_STEP) { fprintf(stderr, "InnoDB: Doc ID " UINT64PF " is too" " big. Its difference with largest" @@ -1704,7 +1707,8 @@ row_update_for_mysql( trx_t* trx = prebuilt->trx; ulint fk_depth = 0; - ut_ad(prebuilt && trx); + ut_ad(prebuilt != NULL); + ut_ad(trx != NULL); UT_NOT_USED(mysql_rec); if (prebuilt->table->ibd_file_missing) { @@ -1926,7 +1930,8 @@ row_unlock_for_mysql( btr_pcur_t* clust_pcur = &prebuilt->clust_pcur; trx_t* trx = prebuilt->trx; - ut_ad(prebuilt && trx); + ut_ad(prebuilt != NULL); + ut_ad(trx != NULL); if (UNIV_UNLIKELY (!srv_locks_unsafe_for_binlog @@ -4621,7 +4626,7 @@ row_mysql_drop_temp_tables(void) Drop all foreign keys in a database, see Bug#18942. Called at the end of row_drop_database_for_mysql(). @return error code or DB_SUCCESS */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t drop_all_foreign_keys_in_db( /*========================*/ @@ -4813,7 +4818,7 @@ loop: Checks if a table name contains the string "/#sql" which denotes temporary tables in MySQL. @return true if temporary table */ -UNIV_INTERN __attribute__((warn_unused_result)) +UNIV_INTERN MY_ATTRIBUTE((warn_unused_result)) bool row_is_mysql_tmp_table_name( /*========================*/ @@ -4827,7 +4832,7 @@ row_is_mysql_tmp_table_name( /****************************************************************//** Delete a single constraint. @return error code or DB_SUCCESS */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_delete_constraint_low( /*======================*/ @@ -4850,7 +4855,7 @@ row_delete_constraint_low( /****************************************************************//** Delete a single constraint. @return error code or DB_SUCCESS */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_delete_constraint( /*==================*/ diff --git a/storage/xtradb/row/row0purge.cc b/storage/xtradb/row/row0purge.cc index b26ba971a95..bc2e0b0e1cb 100644 --- a/storage/xtradb/row/row0purge.cc +++ b/storage/xtradb/row/row0purge.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -69,7 +69,8 @@ row_purge_node_create( { purge_node_t* node; - ut_ad(parent && heap); + ut_ad(parent != NULL); + ut_ad(heap != NULL); node = static_cast<purge_node_t*>( mem_heap_zalloc(heap, sizeof(*node))); @@ -120,7 +121,7 @@ row_purge_reposition_pcur( Removes a delete marked clustered index record if possible. @retval true if the row was not found, or it was successfully removed @retval false if the row was modified after the delete marking */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool row_purge_remove_clust_if_poss_low( /*===============================*/ @@ -202,7 +203,7 @@ marking. @retval true if the row was not found, or it was successfully removed @retval false the purge needs to be suspended because of running out of file space. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool row_purge_remove_clust_if_poss( /*===========================*/ @@ -274,7 +275,7 @@ row_purge_poss_sec( Removes a secondary index entry if possible, by modifying the index tree. Does not try to buffer the delete. @return TRUE if success or if not found */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) ibool row_purge_remove_sec_if_poss_tree( /*==============================*/ @@ -396,7 +397,7 @@ Removes a secondary index entry without modifying the index tree, if possible. @retval true if success or if not found @retval false if row_purge_remove_sec_if_poss_tree() should be invoked */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool row_purge_remove_sec_if_poss_leaf( /*==============================*/ @@ -507,7 +508,7 @@ row_purge_remove_sec_if_poss_leaf( /***********************************************************//** Removes a secondary index entry if possible. */ -UNIV_INLINE __attribute__((nonnull(1,2))) +UNIV_INLINE MY_ATTRIBUTE((nonnull(1,2))) void row_purge_remove_sec_if_poss( /*=========================*/ @@ -554,7 +555,7 @@ Purges a delete marking of a record. @retval true if the row was not found, or it was successfully removed @retval false the purge needs to be suspended because of running out of file space */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool row_purge_del_mark( /*===============*/ @@ -745,7 +746,8 @@ row_purge_parse_undo_rec( ulint info_bits; ulint type; - ut_ad(node && thr); + ut_ad(node != NULL); + ut_ad(thr != NULL); ptr = trx_undo_rec_get_pars( undo_rec, &type, &node->cmpl_info, @@ -830,7 +832,7 @@ err_exit: /***********************************************************//** Purges the parsed record. @return true if purged, false if skipped */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool row_purge_record_func( /*==================*/ @@ -895,7 +897,7 @@ row_purge_record_func( Fetches an undo log record and does the purge for the recorded operation. If none left, or the current purge completed, returns the control to the parent node, which is always a query thread node. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_purge( /*======*/ diff --git a/storage/xtradb/row/row0quiesce.cc b/storage/xtradb/row/row0quiesce.cc index ecd6f47947b..583fbe60fb3 100644 --- a/storage/xtradb/row/row0quiesce.cc +++ b/storage/xtradb/row/row0quiesce.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2012, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2012, 2016, 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 @@ -37,7 +37,7 @@ Created 2012-02-08 by Sunny Bains. /*********************************************************************//** Write the meta data (index user fields) config file. @return DB_SUCCESS or error code. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_quiesce_write_index_fields( /*===========================*/ @@ -97,7 +97,7 @@ row_quiesce_write_index_fields( /*********************************************************************//** Write the meta data config file index information. @return DB_SUCCESS or error code. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_quiesce_write_indexes( /*======================*/ @@ -210,7 +210,7 @@ Write the meta data (table columns) config file. Serialise the contents of dict_col_t structure, along with the column name. All fields are serialized as ib_uint32_t. @return DB_SUCCESS or error code. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_quiesce_write_table( /*====================*/ @@ -293,7 +293,7 @@ row_quiesce_write_table( /*********************************************************************//** Write the meta data config file header. @return DB_SUCCESS or error code. */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_quiesce_write_header( /*=====================*/ @@ -415,7 +415,7 @@ row_quiesce_write_header( /*********************************************************************//** Write the table meta data after quiesce. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_quiesce_write_cfg( /*==================*/ @@ -530,10 +530,8 @@ row_quiesce_table_start( trx_purge_stop(); } - ut_a(table->id > 0); - for (ulint count = 0; - ibuf_contract_in_background(table->id, TRUE) != 0 + ibuf_merge_space(table->space) != 0 && !trx_is_interrupted(trx); ++count) { if (!(count % 20)) { diff --git a/storage/xtradb/row/row0row.cc b/storage/xtradb/row/row0row.cc index be786f954fb..96d25e15777 100644 --- a/storage/xtradb/row/row0row.cc +++ b/storage/xtradb/row/row0row.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -240,7 +240,9 @@ row_build( ulint offsets_[REC_OFFS_NORMAL_SIZE]; rec_offs_init(offsets_); - ut_ad(index && rec && heap); + ut_ad(index != NULL); + ut_ad(rec != NULL); + ut_ad(heap != NULL); ut_ad(dict_index_is_clust(index)); ut_ad(!mutex_own(&trx_sys->mutex)); ut_ad(!col_map || col_table); @@ -409,7 +411,9 @@ row_rec_to_index_entry_low( ulint len; ulint rec_len; - ut_ad(rec && heap && index); + ut_ad(rec != NULL); + ut_ad(heap != NULL); + ut_ad(index != NULL); /* Because this function may be invoked by row0merge.cc on a record whose header is in different format, the check rec_offs_validate(rec, index, offsets) must be avoided here. */ @@ -464,7 +468,9 @@ row_rec_to_index_entry( byte* buf; const rec_t* copy_rec; - ut_ad(rec && heap && index); + ut_ad(rec != NULL); + ut_ad(heap != NULL); + ut_ad(index != NULL); ut_ad(rec_offs_validate(rec, index, offsets)); /* Take a copy of rec to heap */ @@ -523,7 +529,9 @@ row_build_row_ref( ulint* offsets = offsets_; rec_offs_init(offsets_); - ut_ad(index && rec && heap); + ut_ad(index != NULL); + ut_ad(rec != NULL); + ut_ad(heap != NULL); ut_ad(!dict_index_is_clust(index)); offsets = rec_get_offsets(rec, index, offsets, diff --git a/storage/xtradb/row/row0sel.cc b/storage/xtradb/row/row0sel.cc index 2bebfb7a0f1..9732a5f9400 100644 --- a/storage/xtradb/row/row0sel.cc +++ b/storage/xtradb/row/row0sel.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2015, MariaDB Corporation. @@ -679,7 +679,7 @@ sel_enqueue_prefetched_row( /*********************************************************************//** Builds a previous version of a clustered index record for a consistent read @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_sel_build_prev_vers( /*====================*/ @@ -714,7 +714,7 @@ row_sel_build_prev_vers( /*********************************************************************//** Builds the last committed version of a clustered index record for a semi-consistent read. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_sel_build_committed_vers_for_mysql( /*===================================*/ @@ -812,7 +812,7 @@ row_sel_test_other_conds( Retrieves the clustered index record corresponding to a record in a non-clustered index. Does the necessary locking. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_sel_get_clust_rec( /*==================*/ @@ -1316,7 +1316,7 @@ func_exit: /*********************************************************************//** Performs a select step. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_sel( /*====*/ @@ -2564,7 +2564,7 @@ row_sel_store_row_id_to_prebuilt( /**************************************************************//** Stores a non-SQL-NULL field in the MySQL format. The counterpart of this function is row_mysql_store_col_in_innobase_format() in row0mysql.cc. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_sel_field_store_in_mysql_format_func( /*=====================================*/ @@ -2753,7 +2753,7 @@ row_sel_field_store_in_mysql_format_func( #endif /* UNIV_DEBUG */ /**************************************************************//** Convert a field in the Innobase format to a field in the MySQL format. */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) ibool row_sel_store_mysql_field_func( /*===========================*/ @@ -2906,7 +2906,7 @@ Note that the template in prebuilt may advise us to copy only a few columns to mysql_rec, other columns are left blank. All columns may not be needed in the query. @return TRUE on success, FALSE if not all columns could be retrieved */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) ibool row_sel_store_mysql_rec( /*====================*/ @@ -2973,7 +2973,7 @@ row_sel_store_mysql_rec( /*********************************************************************//** Builds a previous version of a clustered index record for a consistent read @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_sel_build_prev_vers_for_mysql( /*==============================*/ @@ -3010,7 +3010,7 @@ Retrieves the clustered index record corresponding to a record in a non-clustered index. Does the necessary locking. Used in the MySQL interface. @return DB_SUCCESS, DB_SUCCESS_LOCKED_REC, or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_sel_get_clust_rec_for_mysql( /*============================*/ diff --git a/storage/xtradb/row/row0uins.cc b/storage/xtradb/row/row0uins.cc index 849bf096492..651042fb820 100644 --- a/storage/xtradb/row/row0uins.cc +++ b/storage/xtradb/row/row0uins.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -61,7 +61,7 @@ introduced where a call to log_free_check() is bypassed. */ Removes a clustered index record. The pcur in node was positioned on the record, now it is detached. @return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_ins_remove_clust_rec( /*==========================*/ @@ -176,7 +176,7 @@ func_exit: /***************************************************************//** Removes a secondary index entry if found. @return DB_SUCCESS, DB_FAIL, or DB_OUT_OF_FILE_SPACE */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_ins_remove_sec_low( /*========================*/ @@ -251,7 +251,7 @@ func_exit_no_pcur: Removes a secondary index entry from the index if found. Tries first optimistic, then pessimistic descent down the tree. @return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_ins_remove_sec( /*====================*/ @@ -350,7 +350,7 @@ close_table: /***************************************************************//** Removes secondary index records. @return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_ins_remove_sec_rec( /*========================*/ diff --git a/storage/xtradb/row/row0umod.cc b/storage/xtradb/row/row0umod.cc index 675d4fa3632..19576d976bd 100644 --- a/storage/xtradb/row/row0umod.cc +++ b/storage/xtradb/row/row0umod.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -72,7 +72,7 @@ introduced where a call to log_free_check() is bypassed. */ /***********************************************************//** Undoes a modify in a clustered index record. @return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_mod_clust_low( /*===================*/ @@ -154,7 +154,7 @@ This is attempted when the record was inserted by updating a delete-marked record and there no longer exist transactions that would see the delete-marked record. @return DB_SUCCESS, DB_FAIL, or error code: we may run out of file space */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_mod_remove_clust_low( /*==========================*/ @@ -243,7 +243,7 @@ row_undo_mod_remove_clust_low( Undoes a modify in a clustered index record. Sets also the node state for the next round of undo. @return DB_SUCCESS or error code: we may run out of file space */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_mod_clust( /*===============*/ @@ -387,7 +387,7 @@ row_undo_mod_clust( /***********************************************************//** Delete marks or removes a secondary index entry if found. @return DB_SUCCESS, DB_FAIL, or DB_OUT_OF_FILE_SPACE */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_mod_del_mark_or_remove_sec_low( /*====================================*/ @@ -523,7 +523,7 @@ not cause problems because in row0sel.cc, in queries we always retrieve the clustered index record or an earlier version of it, if the secondary index record through which we do the search is delete-marked. @return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_mod_del_mark_or_remove_sec( /*================================*/ @@ -556,7 +556,7 @@ fields but alphabetically they stayed the same, e.g., 'abc' -> 'aBc'. @retval DB_OUT_OF_FILE_SPACE when running out of tablespace @retval DB_DUPLICATE_KEY if the value was missing and an insert would lead to a duplicate exists */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_mod_del_unmark_sec_and_undo_update( /*========================================*/ @@ -752,7 +752,7 @@ func_exit_no_pcur: /***********************************************************//** Flags a secondary index corrupted. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_undo_mod_sec_flag_corrupted( /*============================*/ @@ -784,7 +784,7 @@ row_undo_mod_sec_flag_corrupted( /***********************************************************//** Undoes a modify in secondary indexes when undo record type is UPD_DEL. @return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_mod_upd_del_sec( /*=====================*/ @@ -851,7 +851,7 @@ row_undo_mod_upd_del_sec( /***********************************************************//** Undoes a modify in secondary indexes when undo record type is DEL_MARK. @return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_mod_del_mark_sec( /*======================*/ @@ -919,7 +919,7 @@ row_undo_mod_del_mark_sec( /***********************************************************//** Undoes a modify in secondary indexes when undo record type is UPD_EXIST. @return DB_SUCCESS or DB_OUT_OF_FILE_SPACE */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo_mod_upd_exist_sec( /*=======================*/ @@ -1035,7 +1035,7 @@ row_undo_mod_upd_exist_sec( /***********************************************************//** Parses the row reference and other info in a modify undo log record. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void row_undo_mod_parse_undo_rec( /*========================*/ @@ -1112,7 +1112,8 @@ row_undo_mod( dberr_t err; ibool dict_locked; - ut_ad(node && thr); + ut_ad(node != NULL); + ut_ad(thr != NULL); ut_ad(node->state == UNDO_NODE_MODIFY); dict_locked = thr_get_trx(thr)->dict_operation_lock_mode == RW_X_LATCH; diff --git a/storage/xtradb/row/row0undo.cc b/storage/xtradb/row/row0undo.cc index 9977a1e8f04..149dc671930 100644 --- a/storage/xtradb/row/row0undo.cc +++ b/storage/xtradb/row/row0undo.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2016, 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 @@ -245,7 +245,7 @@ Fetches an undo log record and does the undo for the recorded operation. If none left, or a partial rollback completed, returns control to the parent node, which is always a query thread node. @return DB_SUCCESS if operation successfully completed, else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_undo( /*=====*/ @@ -257,7 +257,8 @@ row_undo( roll_ptr_t roll_ptr; ibool locked_data_dict; - ut_ad(node && thr); + ut_ad(node != NULL); + ut_ad(thr != NULL); trx = node->trx; diff --git a/storage/xtradb/row/row0upd.cc b/storage/xtradb/row/row0upd.cc index 725ba6f990b..924b4ccca0d 100644 --- a/storage/xtradb/row/row0upd.cc +++ b/storage/xtradb/row/row0upd.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -221,7 +221,7 @@ NOTE that this function will temporarily commit mtr and lose the pcur position! @return DB_SUCCESS or an error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_upd_check_references_constraints( /*=================================*/ @@ -415,7 +415,7 @@ wsrep_row_upd_check_foreign_constraints( dict_table_open_on_name( foreign->referenced_table_name_lookup, FALSE, FALSE, DICT_ERR_IGNORE_NONE); - opened = TRUE; + opened = (foreign->referenced_table) ? TRUE : FALSE; } if (foreign->referenced_table) { @@ -438,7 +438,7 @@ wsrep_row_upd_check_foreign_constraints( ->n_foreign_key_checks_running); if (opened == TRUE) { - dict_table_close(foreign->referenced_table, TRUE, FALSE); + dict_table_close(foreign->referenced_table, FALSE, FALSE); opened = FALSE; } } @@ -778,7 +778,7 @@ row_upd_write_sys_vals_to_log( roll_ptr_t roll_ptr,/*!< in: roll ptr of the undo log record */ byte* log_ptr,/*!< pointer to a buffer of size > 20 opened in mlog */ - mtr_t* mtr __attribute__((unused))) /*!< in: mtr */ + mtr_t* mtr MY_ATTRIBUTE((unused))) /*!< in: mtr */ { ut_ad(dict_index_is_clust(index)); ut_ad(mtr); @@ -1813,7 +1813,7 @@ row_upd_store_row( Updates a secondary index entry of a row. @return DB_SUCCESS if operation successfully completed, else error code or DB_LOCK_WAIT */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_upd_sec_index_entry( /*====================*/ @@ -2055,7 +2055,7 @@ Updates the secondary index record if it is changed in the row update or deletes it if this is a delete. @return DB_SUCCESS if operation successfully completed, else error code or DB_LOCK_WAIT */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_upd_sec_step( /*=============*/ @@ -2088,7 +2088,7 @@ updated. We must mark them as inherited in entry, so that they are not freed in a rollback. A limited version of this function used to be called btr_cur_mark_dtuple_inherited_extern(). @return TRUE if any columns were inherited */ -static __attribute__((warn_unused_result)) +static MY_ATTRIBUTE((warn_unused_result)) ibool row_upd_clust_rec_by_insert_inherit_func( /*=====================================*/ @@ -2167,7 +2167,7 @@ fields of the clustered index record change. This should be quite rare in database applications. @return DB_SUCCESS if operation successfully completed, else error code or DB_LOCK_WAIT */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_upd_clust_rec_by_insert( /*========================*/ @@ -2329,7 +2329,7 @@ Updates a clustered index record of a row when the ordering fields do not change. @return DB_SUCCESS if operation successfully completed, else error code or DB_LOCK_WAIT */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_upd_clust_rec( /*==============*/ @@ -2491,7 +2491,7 @@ func_exit: /***********************************************************//** Delete marks a clustered index record. @return DB_SUCCESS if operation successfully completed, else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_upd_del_mark_clust_rec( /*=======================*/ @@ -2584,7 +2584,7 @@ row_upd_del_mark_clust_rec( Updates the clustered index record. @return DB_SUCCESS if operation successfully completed, DB_LOCK_WAIT in case of a lock wait, else error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_upd_clust_step( /*===============*/ @@ -2813,7 +2813,7 @@ to this node, we assume that we have a persistent cursor which was on a record, and the position of the cursor is stored in the cursor. @return DB_SUCCESS if operation successfully completed, else error code or DB_LOCK_WAIT */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t row_upd( /*====*/ @@ -2822,7 +2822,8 @@ row_upd( { dberr_t err = DB_SUCCESS; - ut_ad(node && thr); + ut_ad(node != NULL); + ut_ad(thr != NULL); if (UNIV_LIKELY(node->in_mysql_interface)) { diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index 85e988e16b2..50565de69b0 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -578,16 +578,16 @@ UNIV_INTERN ib_uint64_t srv_index_page_decompressed = 0; /* Ensure status variables are on separate cache lines */ -#define CACHE_ALIGNED __attribute__ ((aligned (CACHE_LINE_SIZE))) +#define CACHE_ALIGNED MY_ATTRIBUTE((aligned (CACHE_LINE_SIZE))) UNIV_INTERN byte -counters_pad_start[CACHE_LINE_SIZE] __attribute__((unused)) = {0}; +counters_pad_start[CACHE_LINE_SIZE] MY_ATTRIBUTE((unused)) = {0}; UNIV_INTERN ulint srv_read_views_memory CACHE_ALIGNED = 0; UNIV_INTERN ulint srv_descriptors_memory CACHE_ALIGNED = 0; UNIV_INTERN byte -counters_pad_end[CACHE_LINE_SIZE] __attribute__((unused)) = {0}; +counters_pad_end[CACHE_LINE_SIZE] MY_ATTRIBUTE((unused)) = {0}; /* Set the following to 0 if you want InnoDB to write messages on stderr on startup/shutdown. */ @@ -2088,7 +2088,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(srv_monitor_thread)( /*===============================*/ - void* arg __attribute__((unused))) + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { @@ -2265,7 +2265,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(srv_error_monitor_thread)( /*=====================================*/ - void* arg __attribute__((unused))) + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { @@ -2518,7 +2518,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(srv_redo_log_follow_thread)( /*=======================================*/ - void* arg __attribute__((unused))) /*!< in: a dummy parameter + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { @@ -2966,7 +2966,7 @@ srv_master_do_active_tasks(void) /* Do an ibuf merge */ srv_main_thread_op_info = "doing insert buffer merge"; counter_time = ut_time_us(NULL); - ibuf_contract_in_background(0, FALSE); + ibuf_merge_in_background(false); MONITOR_INC_TIME_IN_MICRO_SECS( MONITOR_SRV_IBUF_MERGE_MICROSECOND, counter_time); @@ -3061,7 +3061,7 @@ srv_master_do_idle_tasks(void) /* Do an ibuf merge */ counter_time = ut_time_us(NULL); srv_main_thread_op_info = "doing insert buffer merge"; - ibuf_contract_in_background(0, TRUE); + ibuf_merge_in_background(true); MONITOR_INC_TIME_IN_MICRO_SECS( MONITOR_SRV_IBUF_MERGE_MICROSECOND, counter_time); @@ -3149,7 +3149,7 @@ srv_master_do_shutdown_tasks( /* Do an ibuf merge */ srv_main_thread_op_info = "doing insert buffer merge"; - n_bytes_merged = ibuf_contract_in_background(0, TRUE); + n_bytes_merged = ibuf_merge_in_background(true); /* Flush logs if needed */ srv_sync_log_buffer_in_background(); @@ -3189,7 +3189,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(srv_master_thread)( /*==============================*/ - void* arg __attribute__((unused))) + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { @@ -3349,7 +3349,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(srv_worker_thread)( /*==============================*/ - void* arg __attribute__((unused))) /*!< in: a dummy parameter + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { srv_slot_t* slot; @@ -3617,7 +3617,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(srv_purge_coordinator_thread)( /*=========================================*/ - void* arg __attribute__((unused))) /*!< in: a dummy parameter + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { srv_slot_t* slot; diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc index 6a3e756cb44..87ceeaf65c3 100644 --- a/storage/xtradb/srv/srv0start.cc +++ b/storage/xtradb/srv/srv0start.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2008, Google Inc. Copyright (c) 2009, Percona Inc. Copyright (c) 2013, 2015, MariaDB Corporation @@ -562,7 +562,7 @@ UNIV_INTERN void srv_normalize_path_for_win( /*=======================*/ - char* str __attribute__((unused))) /*!< in/out: null-terminated + char* str MY_ATTRIBUTE((unused))) /*!< in/out: null-terminated character string */ { #ifdef __WIN__ @@ -579,7 +579,7 @@ srv_normalize_path_for_win( /*********************************************************************//** Creates a log file. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t create_log_file( /*============*/ @@ -797,7 +797,7 @@ create_log_files_rename( /*********************************************************************//** Opens a log file. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t open_log_file( /*==========*/ @@ -825,7 +825,7 @@ open_log_file( /*********************************************************************//** Creates or opens database data files and closes them. @return DB_SUCCESS or error code */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t open_or_create_data_files( /*======================*/ diff --git a/storage/xtradb/sync/sync0sync.cc b/storage/xtradb/sync/sync0sync.cc index c699fbf2ded..7458a052224 100644 --- a/storage/xtradb/sync/sync0sync.cc +++ b/storage/xtradb/sync/sync0sync.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -435,10 +435,10 @@ ulint mutex_enter_nowait_func( /*====================*/ ib_mutex_t* mutex, /*!< in: pointer to mutex */ - const char* file_name __attribute__((unused)), + const char* file_name MY_ATTRIBUTE((unused)), /*!< in: file name where mutex requested */ - ulint line __attribute__((unused))) + ulint line MY_ATTRIBUTE((unused))) /*!< in: line where requested */ { ut_ad(mutex_validate(mutex)); diff --git a/storage/xtradb/trx/trx0purge.cc b/storage/xtradb/trx/trx0purge.cc index 9d9fe73de6e..d9e40c5d6f5 100644 --- a/storage/xtradb/trx/trx0purge.cc +++ b/storage/xtradb/trx/trx0purge.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -917,7 +917,7 @@ Fetches the next undo log record from the history list to purge. It must be released with the corresponding release function. @return copy of an undo log record or pointer to trx_purge_dummy_rec, if the whole undo log can skipped in purge; NULL if none left */ -static __attribute__((warn_unused_result, nonnull)) +static MY_ATTRIBUTE((warn_unused_result, nonnull)) trx_undo_rec_t* trx_purge_fetch_next_rec( /*=====================*/ diff --git a/storage/xtradb/trx/trx0rec.cc b/storage/xtradb/trx/trx0rec.cc index fa3fe0904b8..74a63b60286 100644 --- a/storage/xtradb/trx/trx0rec.cc +++ b/storage/xtradb/trx/trx0rec.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -1133,7 +1133,7 @@ trx_undo_rec_get_partial_row( /***********************************************************************//** Erases the unused undo log page end. @return TRUE if the page contained something, FALSE if it was empty */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) ibool trx_undo_erase_page_end( /*====================*/ @@ -1159,7 +1159,7 @@ byte* trx_undo_parse_erase_page_end( /*==========================*/ byte* ptr, /*!< in: buffer */ - byte* end_ptr __attribute__((unused)), /*!< in: buffer end */ + byte* end_ptr MY_ATTRIBUTE((unused)), /*!< in: buffer end */ page_t* page, /*!< in: page or NULL */ mtr_t* mtr) /*!< in: mtr or NULL */ { @@ -1442,7 +1442,7 @@ NOTE: the caller must have latches on the clustered index page. @retval true if the undo log has been truncated and we cannot fetch the old version @retval false if the undo log record is available */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) bool trx_undo_get_undo_rec( /*==================*/ @@ -1470,7 +1470,7 @@ trx_undo_get_undo_rec( #ifdef UNIV_DEBUG #define ATTRIB_USED_ONLY_IN_DEBUG #else /* UNIV_DEBUG */ -#define ATTRIB_USED_ONLY_IN_DEBUG __attribute__((unused)) +#define ATTRIB_USED_ONLY_IN_DEBUG MY_ATTRIBUTE((unused)) #endif /* UNIV_DEBUG */ /*******************************************************************//** diff --git a/storage/xtradb/trx/trx0roll.cc b/storage/xtradb/trx/trx0roll.cc index 4e8547c7d64..4618cf653f0 100644 --- a/storage/xtradb/trx/trx0roll.cc +++ b/storage/xtradb/trx/trx0roll.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2014, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -341,7 +341,7 @@ the row, these locks are naturally released in the rollback. Savepoints which were set after this savepoint are deleted. @return if no savepoint of the name found then DB_NO_SAVEPOINT, otherwise DB_SUCCESS */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t trx_rollback_to_savepoint_for_mysql_low( /*====================================*/ @@ -808,7 +808,7 @@ extern "C" UNIV_INTERN os_thread_ret_t DECLARE_THREAD(trx_rollback_or_clean_all_recovered)( /*================================================*/ - void* arg __attribute__((unused))) + void* arg MY_ATTRIBUTE((unused))) /*!< in: a dummy parameter required by os_thread_create */ { diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc index a3342ee36df..41f8c166190 100644 --- a/storage/xtradb/trx/trx0trx.cc +++ b/storage/xtradb/trx/trx0trx.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2015, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -1179,7 +1179,7 @@ trx_serialisation_number_get( /****************************************************************//** Assign the transaction its history serialisation number and write the update UNDO log record to the assigned rollback segment. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void trx_write_serialisation_history( /*============================*/ @@ -1266,7 +1266,7 @@ trx_write_serialisation_history( /******************************************************************** Finalize a transaction containing updates for a FTS table. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void trx_finalize_for_fts_table( /*=======================*/ @@ -1299,7 +1299,7 @@ trx_finalize_for_fts_table( /******************************************************************//** Finalize a transaction containing updates to FTS tables. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void trx_finalize_for_fts( /*=================*/ @@ -1374,7 +1374,7 @@ trx_flush_log_if_needed_low( /**********************************************************************//** If required, flushes the log to disk based on the value of innodb_flush_log_at_trx_commit. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void trx_flush_log_if_needed( /*====================*/ @@ -1389,7 +1389,7 @@ trx_flush_log_if_needed( /****************************************************************//** Commits a transaction in memory. */ -static __attribute__((nonnull)) +static MY_ATTRIBUTE((nonnull)) void trx_commit_in_memory( /*=================*/ @@ -2441,7 +2441,7 @@ which is in the prepared state @return trx on match, the trx->xid will be invalidated; note that the trx may have been committed, unless the caller is holding lock_sys->mutex */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) trx_t* trx_get_trx_by_xid_low( /*===================*/ diff --git a/storage/xtradb/trx/trx0undo.cc b/storage/xtradb/trx/trx0undo.cc index edb85a89c17..cdd23726f2e 100644 --- a/storage/xtradb/trx/trx0undo.cc +++ b/storage/xtradb/trx/trx0undo.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, 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 @@ -419,11 +419,11 @@ trx_undo_page_init( Creates a new undo log segment in file. @return DB_SUCCESS if page creation OK possible error codes are: DB_TOO_MANY_CONCURRENT_TRXS DB_OUT_OF_FILE_SPACE */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t trx_undo_seg_create( /*================*/ - trx_rseg_t* rseg __attribute__((unused)),/*!< in: rollback segment */ + trx_rseg_t* rseg MY_ATTRIBUTE((unused)),/*!< in: rollback segment */ trx_rsegf_t* rseg_hdr,/*!< in: rollback segment header, page x-latched */ ulint type, /*!< in: type of the segment: TRX_UNDO_INSERT or @@ -443,7 +443,9 @@ trx_undo_seg_create( ibool success; dberr_t err = DB_SUCCESS; - ut_ad(mtr && id && rseg_hdr); + ut_ad(mtr != NULL); + ut_ad(id != NULL); + ut_ad(rseg_hdr != NULL); ut_ad(mutex_own(&(rseg->mutex))); /* fputs(type == TRX_UNDO_INSERT @@ -827,7 +829,7 @@ byte* trx_undo_parse_discard_latest( /*==========================*/ byte* ptr, /*!< in: buffer */ - byte* end_ptr __attribute__((unused)), /*!< in: buffer end */ + byte* end_ptr MY_ATTRIBUTE((unused)), /*!< in: buffer end */ page_t* page, /*!< in: page or NULL */ mtr_t* mtr) /*!< in: mtr or NULL */ { @@ -1555,7 +1557,7 @@ Creates a new undo log. @return DB_SUCCESS if successful in creating the new undo lob object, possible error codes are: DB_TOO_MANY_CONCURRENT_TRXS DB_OUT_OF_FILE_SPACE DB_OUT_OF_MEMORY */ -static __attribute__((nonnull, warn_unused_result)) +static MY_ATTRIBUTE((nonnull, warn_unused_result)) dberr_t trx_undo_create( /*============*/ diff --git a/support-files/mariadb.service.in b/support-files/mariadb.service.in index 55202c696fb..15f41c6377f 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -45,16 +45,31 @@ Group=mysql # To allow memlock to be used as non-root user if set in configuration CapabilityBoundingSet=CAP_IPC_LOCK +# Prevent writes to /usr, /boot, and /etc +ProtectSystem=full + +# Doesn't yet work properly with SELinux enabled +# NoNewPrivileges=true + +PrivateDevices=true + +# Prevent accessing /home, /root and /run/user +ProtectHome=true + # Execute pre and post scripts as root, otherwise it does it as User= PermissionsStartOnly=true +@SYSTEMD_EXECSTARTPRE@ + # Perform automatic wsrep recovery. When server is started without wsrep, # galera_recovery simply returns an empty string. In any case, however, # the script is not expected to return with a non-zero status. # It is always safe to unset _WSREP_START_POSITION environment variable. +# Do not panic if galera_recovery script is not available. (MDEV-10538) ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION" -ExecStartPre=/bin/sh -c "VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && \ - systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1" +ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \ + VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] \ + && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1" # Needed to create system tables etc. # ExecStartPre=/usr/bin/mysql_install_db -u mysql @@ -64,7 +79,6 @@ ExecStartPre=/bin/sh -c "VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && \ # Use the [service] section and Environment="MYSQLD_OPTS=...". # This isn't a replacement for my.cnf. # _WSREP_NEW_CLUSTER is for the exclusive use of the script galera_new_cluster -@SYSTEMD_EXECSTARTPRE@ ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION @SYSTEMD_EXECSTARTPOST@ diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index 18adf0e0eac..e941f21526e 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -52,6 +52,17 @@ Group=mysql # To allow memlock to be used as non-root user if set in configuration CapabilityBoundingSet=CAP_IPC_LOCK +# Prevent writes to /usr, /boot, and /etc +ProtectSystem=full + +# Doesn't yet work properly with SELinux enabled +# NoNewPrivileges=true + +PrivateDevices=true + +# Prevent accessing /home, /root and /run/user +ProtectHome=true + # Execute pre and post scripts as root, otherwise it does it as User= PermissionsStartOnly=true @@ -59,16 +70,19 @@ PermissionsStartOnly=true # galera_recovery simply returns an empty string. In any case, however, # the script is not expected to return with a non-zero status. # It is always safe to unset _WSREP_START_POSITION%I environment variable. +# Do not panic if galera_recovery script is not available. (MDEV-10538) ExecStartPre=/bin/sh -c "systemctl unset-environment _WSREP_START_POSITION%I" -ExecStartPre=/bin/sh -c "VAR=`/usr/bin/galera_recovery \ - --defaults-file=@INSTALL_SYSCONF2DIR@/my%I.cnf`; [ $? -eq 0 ] && \ - systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1" + +ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \ + VAR=`/usr/bin/galera_recovery --defaults-file=@INSTALL_SYSCONF2DIR@/my%I.cnf`; [ $? -eq 0 ] \ + && systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1" + # Alternate: (remove ConditionPathExists above) # use [mysqld.INSTANCENAME] as sections in my.cnf # -#ExecStartPre=/bin/sh -c "VAR=`/usr/bin/galera_recovery \ -# --defaults-group-suffix=%I`; [ $? -eq 0 ] && \ -# systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1" +#ExecStartPre=/bin/sh -c "[ ! -e /usr/bin/galera_recovery ] && VAR= || \ +# VAR=`/usr/bin/galera_recovery --defaults-group-suffix=%I`; [ $? -eq 0 ] \ +# && systemctl set-environment _WSREP_START_POSITION%I=$VAR || exit 1" # Needed to create system tables etc. # ExecStartPre=/usr/bin/mysql_install_db -u mysql diff --git a/tests/mysql_client_test.c b/tests/mysql_client_test.c index 806924e8e0e..31e3150b237 100644 --- a/tests/mysql_client_test.c +++ b/tests/mysql_client_test.c @@ -18508,6 +18508,7 @@ static void test_bug58036() /* Part1: try to connect with ucs2 client character set */ conn= mysql_client_init(NULL); mysql_options(conn, MYSQL_SET_CHARSET_NAME, "ucs2"); + if (mysql_real_connect(conn, opt_host, opt_user, opt_password, opt_db ? opt_db : "test", opt_port, opt_unix_socket, 0)) @@ -18558,7 +18559,6 @@ static void test_bug58036() printf("Got mysql_change_user() error (expected): %s (%d)\n", mysql_error(conn), mysql_errno(conn)); mysql_close(conn); - DBUG_VOID_RETURN; } @@ -19417,6 +19417,7 @@ static void test_big_packet() opt_password, current_db, opt_port, opt_unix_socket, 0))) { + mysql_close(mysql_local); fprintf(stderr, "\n connection failed(%s)", mysql_error(mysql_local)); exit(1); } diff --git a/vio/viosocket.c b/vio/viosocket.c index a33de48c020..074948badec 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -190,6 +190,12 @@ size_t vio_read(Vio *vio, uchar *buf, size_t size) { DBUG_PRINT("vio_error", ("Got error %d during read", errno)); } +#ifndef DEBUG_DATA_PACKETS + else + { + DBUG_DUMP("read_data", buf, ret); + } +#endif /* DEBUG_DATA_PACKETS */ #endif /* DBUG_OFF */ DBUG_PRINT("exit", ("%d", (int) ret)); DBUG_RETURN(ret); @@ -369,6 +375,13 @@ int vio_blocking(Vio *vio, my_bool set_blocking_mode, my_bool *old_mode) DBUG_RETURN(r); } +/* + Check if vio is blocking + + @retval 0 is not blocking + @retval 1 is blocking +*/ + my_bool vio_is_blocking(Vio * vio) { @@ -523,7 +536,9 @@ int vio_keepalive(Vio* vio, my_bool set_keep_alive) my_bool vio_should_retry(Vio *vio) { - return (vio_errno(vio) == SOCKET_EINTR); + DBUG_ENTER("vio_should_retry"); + DBUG_PRINT("info", ("vio_errno: %d", vio_errno(vio))); + DBUG_RETURN(vio_errno(vio) == SOCKET_EINTR); } @@ -548,8 +563,9 @@ int vio_close(Vio *vio) { int r=0; DBUG_ENTER("vio_close"); + DBUG_PRINT("enter", ("sd: %d", mysql_socket_getfd(vio->mysql_socket))); - if (vio->type != VIO_CLOSED) + if (vio->type != VIO_CLOSED) { DBUG_ASSERT(vio->type == VIO_TYPE_TCPIP || vio->type == VIO_TYPE_SOCKET || @@ -880,6 +896,7 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout) my_socket sd= mysql_socket_getfd(vio->mysql_socket); MYSQL_SOCKET_WAIT_VARIABLES(locker, state) /* no ';' */ DBUG_ENTER("vio_io_wait"); + DBUG_PRINT("enter", ("timeout: %d", timeout)); /* Note that if zero timeout, then we will not block, so we do not need to @@ -891,7 +908,10 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout) PSI_SOCKET_SELECT, timeout); ret= my_io_wait_async(vio->async_context, event, timeout); if (ret == 0) + { + DBUG_PRINT("info", ("timeout")); errno= SOCKET_ETIMEDOUT; + } END_SOCKET_WAIT(locker,timeout); DBUG_RETURN(ret); } @@ -925,6 +945,7 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout) switch ((ret= poll(&pfd, 1, timeout))) { case -1: + DBUG_PRINT("error", ("poll returned -1")); /* On error, -1 is returned. */ break; case 0: @@ -932,6 +953,7 @@ int vio_io_wait(Vio *vio, enum enum_vio_io_event event, int timeout) Set errno to indicate a timeout error. (This is not compiled in on WIN32.) */ + DBUG_PRINT("info", ("poll timeout")); errno= SOCKET_ETIMEDOUT; break; default: diff --git a/wsrep/wsrep_dummy.c b/wsrep/wsrep_dummy.c index fa726877fcf..eae084f1979 100644 --- a/wsrep/wsrep_dummy.c +++ b/wsrep/wsrep_dummy.c @@ -84,8 +84,15 @@ static wsrep_status_t dummy_options_set( static char* dummy_options_get (wsrep_t* w) { - WSREP_DBUG_ENTER(w); - return WSREP_DUMMY(w)->options; + char *options; + + WSREP_DBUG_ENTER(w); + options= WSREP_DUMMY(w)->options; + + if (options) + options= strdup(WSREP_DUMMY(w)->options); + + return options; } static wsrep_status_t dummy_connect( diff --git a/wsrep/wsrep_loader.c b/wsrep/wsrep_loader.c index 5c4e61e1832..f4d5991339e 100644 --- a/wsrep/wsrep_loader.c +++ b/wsrep/wsrep_loader.c @@ -37,6 +37,22 @@ static wsrep_log_cb_t logger = default_logger; * Library loader **************************************************************************/ +static int wsrep_check_iface_version(const char* found, const char* iface_ver) +{ + const size_t msg_len = 128; + char msg[128]; + + if (strcmp(found, iface_ver)) { + snprintf (msg, msg_len, + "provider interface version mismatch: need '%s', found '%s'", + iface_ver, found); + logger (WSREP_LOG_ERROR, msg); + return EINVAL; + } + + return 0; +} + static int verify(const wsrep_t *wh, const char *iface_ver) { char msg[128]; @@ -50,13 +66,8 @@ static int verify(const wsrep_t *wh, const char *iface_ver) VERIFY(wh); VERIFY(wh->version); - if (strcmp(wh->version, iface_ver)) { - snprintf (msg, sizeof(msg), - "provider interface version mismatch: need '%s', found '%s'", - iface_ver, wh->version); - logger (WSREP_LOG_ERROR, msg); + if (wsrep_check_iface_version(wh->version, iface_ver)) return EINVAL; - } VERIFY(wh->init); VERIFY(wh->options_set); @@ -107,6 +118,15 @@ static wsrep_loader_fun wsrep_dlf(void *dlh, const char *sym) return alias.dlfun; } +static int wsrep_check_version_symbol(void *dlh) +{ + char** dlversion = NULL; + dlversion = (char**) dlsym(dlh, "wsrep_interface_version"); + if (dlversion == NULL) + return 0; + return wsrep_check_iface_version(*dlversion, WSREP_INTERFACE_VERSION); +} + extern int wsrep_dummy_loader(wsrep_t *w); int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb) @@ -152,6 +172,11 @@ int wsrep_load(const char *spec, wsrep_t **hptr, wsrep_log_cb_t log_cb) goto out; } + if (wsrep_check_version_symbol(dlh) != 0) { + ret = EINVAL; + goto out; + } + if ((ret = (*dlfun)(*hptr)) != 0) { snprintf(msg, sizeof(msg)-1, "wsrep_load(): loader failed: %s", strerror(ret)); |