diff options
author | Marc Alff <marc.alff@oracle.com> | 2011-03-10 09:43:55 +0100 |
---|---|---|
committer | Marc Alff <marc.alff@oracle.com> | 2011-03-10 09:43:55 +0100 |
commit | 3f2d2fe7b5a4d9af49ac503e7069c943675f563d (patch) | |
tree | ed3f3ff803b4c69669c7a1e83feafe9972196316 | |
parent | caee7f416f198a73c7aac978bfafb565f50fde03 (diff) | |
parent | 0b7e6f81afe24f4734b3d8ce5d85411609f8d3a0 (diff) | |
download | mariadb-git-3f2d2fe7b5a4d9af49ac503e7069c943675f563d.tar.gz |
Local merge
86 files changed, 1548 insertions, 370 deletions
diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index f38d674ae8d..78a1ec7d87d 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -42,7 +42,7 @@ static char *opt_password = 0, *current_user = 0, *default_charset= 0, *current_host= 0; static char *opt_plugin_dir= 0, *opt_default_auth= 0; static int first_error = 0; -DYNAMIC_ARRAY tables4repair; +DYNAMIC_ARRAY tables4repair, tables4rebuild; #ifdef HAVE_SMEM static char *shared_memory_base_name=0; #endif @@ -626,6 +626,27 @@ static int fix_database_storage_name(const char *name) return rc; } +static int rebuild_table(char *name) +{ + char *query, *ptr; + int rc= 0; + query= (char*)my_malloc(sizeof(char) * (12 + fixed_name_length(name) + 6 + 1), + MYF(MY_WME)); + if (!query) + return 1; + ptr= strmov(query, "ALTER TABLE "); + ptr= fix_table_name(ptr, name); + ptr= strxmov(ptr, " FORCE", NullS); + if (mysql_real_query(sock, query, (uint)(ptr - query))) + { + fprintf(stderr, "Failed to %s\n", query); + fprintf(stderr, "Error: %s\n", mysql_error(sock)); + rc= 1; + } + my_free(query); + return rc; +} + static int process_one_db(char *database) { if (what_to_do == DO_UPGRADE) @@ -739,7 +760,7 @@ static void print_result() MYSQL_ROW row; char prev[NAME_LEN*2+2]; uint i; - my_bool found_error=0; + my_bool found_error=0, table_rebuild=0; res = mysql_use_result(sock); @@ -758,8 +779,14 @@ static void print_result() */ if (found_error && opt_auto_repair && what_to_do != DO_REPAIR && strcmp(row[3],"OK")) - insert_dynamic(&tables4repair, (uchar*) prev); + { + if (table_rebuild) + insert_dynamic(&tables4rebuild, (uchar*) prev); + else + insert_dynamic(&tables4repair, (uchar*) prev); + } found_error=0; + table_rebuild=0; if (opt_silent) continue; } @@ -769,7 +796,11 @@ static void print_result() { printf("%s\n%-9s: %s", row[0], row[2], row[3]); if (strcmp(row[2],"note")) + { found_error=1; + if (opt_auto_repair && strstr(row[3], "ALTER TABLE") != NULL) + table_rebuild=1; + } } else printf("%-9s: %s", row[2], row[3]); @@ -778,7 +809,12 @@ static void print_result() } /* add the last table to be repaired to the list */ if (found_error && opt_auto_repair && what_to_do != DO_REPAIR) - insert_dynamic(&tables4repair, (uchar*) prev); + { + if (table_rebuild) + insert_dynamic(&tables4rebuild, (uchar*) prev); + else + insert_dynamic(&tables4repair, (uchar*) prev); + } mysql_free_result(res); } @@ -876,7 +912,8 @@ int main(int argc, char **argv) } if (opt_auto_repair && - my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64)) + (my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64) || + my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,64))) { first_error = 1; goto end; @@ -894,7 +931,7 @@ int main(int argc, char **argv) { uint i; - if (!opt_silent && tables4repair.elements) + if (!opt_silent && (tables4repair.elements || tables4rebuild.elements)) puts("\nRepairing tables"); what_to_do = DO_REPAIR; for (i = 0; i < tables4repair.elements ; i++) @@ -902,11 +939,16 @@ int main(int argc, char **argv) char *name= (char*) dynamic_array_ptr(&tables4repair, i); handle_request_for_tables(name, fixed_name_length(name)); } + for (i = 0; i < tables4rebuild.elements ; i++) + rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i)); } end: dbDisconnect(current_host); if (opt_auto_repair) + { delete_dynamic(&tables4repair); + delete_dynamic(&tables4rebuild); + } my_free(opt_password); #ifdef HAVE_SMEM my_free(shared_memory_base_name); diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index 7c4778112df..ef1677db1c0 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -29,6 +29,8 @@ SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@") SET(CMAKE_MAKE_PROGRAM "@CMAKE_MAKE_PROGRAM@") SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@") +SET(VERSION "@VERSION@") + SET(MYSQL_DOCS_LOCATION "@MYSQL_DOCS_LOCATION@") @@ -100,6 +102,10 @@ CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.h CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc ${PACKAGE_DIR}/sql/sql_yacc.cc COPYONLY) +# Copy spec files +CONFIGURE_FILE(${CMAKE_BINARY_DIR}/support-files/mysql.${VERSION}.spec + ${PACKAGE_DIR}/support-files/mysql.${VERSION}.spec COPYONLY) + # Add documentation, if user has specified where to find them IF(MYSQL_DOCS_LOCATION) MESSAGE("Copying documentation files from " ${MYSQL_DOCS_LOCATION}) diff --git a/include/my_pthread.h b/include/my_pthread.h index b8608a97849..e5215648791 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -806,8 +806,7 @@ extern pthread_mutexattr_t my_errorcheck_mutexattr; typedef ulong my_thread_id; extern my_bool my_thread_global_init(void); -extern my_bool my_thread_basic_global_init(void); -extern void my_thread_basic_global_reinit(void); +extern void my_thread_global_reinit(void); extern void my_thread_global_end(void); extern my_bool my_thread_init(void); extern void my_thread_end(void); diff --git a/include/my_sys.h b/include/my_sys.h index fb8fa6e7a3e..f0b2c1a0636 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -641,7 +641,6 @@ extern int my_error_register(const char** (*get_errmsgs) (), extern const char **my_error_unregister(int first, int last); extern void my_message(uint my_err, const char *str,myf MyFlags); extern void my_message_stderr(uint my_err, const char *str, myf MyFlags); -extern my_bool my_basic_init(void); extern my_bool my_init(void); extern void my_end(int infoflag); extern int my_redel(const char *from, const char *to, int MyFlags); diff --git a/mysql-test/collections/default.daily b/mysql-test/collections/default.daily index 75c03d4d47b..665da0d152c 100644 --- a/mysql-test/collections/default.daily +++ b/mysql-test/collections/default.daily @@ -1,15 +1,15 @@ -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=row --vardir=var-row --mysqld=--binlog-format=row -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --mysqld=--binlog-format=row --ps-protocol -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-embedded --embedded -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps --vardir=var-ps --ps-protocol -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps_funcs1 --vardir=var-ps_funcs_1 --suite=funcs_1 --ps-protocol -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=funcs2 --vardir=var-funcs2 --suite=funcs_2 -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=partitions --vardir=var-parts --suite=parts -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=stress --vardir=var-stress --suite=stress -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=jp --vardir=var-jp --suite=jp -perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=nist --vardir=var-nist --suite=nist +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=normal --vardir=var-normal --report-features --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=n_mix --vardir=var-n_mix --mysqld=--binlog-format=mixed --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=row --vardir=var-row --mysqld=--binlog-format=row --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps_row --vardir=var-ps_row --mysqld=--binlog-format=row --ps-protocol --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=embedded --vardir=var-embedded --embedded --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps --vardir=var-ps --ps-protocol --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=funcs_1 --vardir=var-funcs_1 --suite=funcs_1 --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=ps_funcs1 --vardir=var-ps_funcs_1 --suite=funcs_1 --ps-protocol --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=funcs2 --vardir=var-funcs2 --suite=funcs_2 --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=partitions --vardir=var-parts --suite=parts --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=stress --vardir=var-stress --suite=stress --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=jp --vardir=var-jp --suite=jp --skip-test-list=collections/disabled-daily.list +perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=nist --vardir=var-nist --suite=nist --skip-test-list=collections/disabled-daily.list perl mysql-test-run.pl --force --timer --debug-server --parallel=auto --experimental=collections/default.experimental --comment=nist+ps --vardir=var-ps_nist --suite=nist --ps-protocol diff --git a/mysql-test/collections/default.experimental b/mysql-test/collections/default.experimental index 4871d2df796..a95419fbc19 100644 --- a/mysql-test/collections/default.experimental +++ b/mysql-test/collections/default.experimental @@ -14,8 +14,6 @@ main.sp @solaris # Bug#47791 2010-01-20 alik Several tes main.type_float @freebsd # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server main.wait_timeout @solaris # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris -rpl.rpl_heartbeat_basic # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again -rpl.rpl_heartbeat_2slaves # BUG#43828 2009-10-22 luis fails sporadically rpl.rpl_innodb_bug28430 # Bug#46029 sys_vars.max_sp_recursion_depth_func @solaris # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun diff --git a/mysql-test/collections/default.weekly b/mysql-test/collections/default.weekly index a1339fcf0fc..40f0548f374 100755 --- a/mysql-test/collections/default.weekly +++ b/mysql-test/collections/default.weekly @@ -1,7 +1,7 @@ -perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 main.alter_table-big main.archive-big main.count_distinct3 main.create-big main.events_stress main.events_time_zone main.information_schema-big main.log_tables-big main.merge-big main.mysqlbinlog_row_big main.read_many_rows_innodb main.ssl-big main.sum_distinct-big main.type_newdecimal-big main.variables-big parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_2_innodb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb funcs_1.myisam_views-big -perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam -perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-row-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=row -perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-mixed-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=mixed -perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb -perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-row-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=row -perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-mixed-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=mixed +perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 main.alter_table-big main.archive-big main.count_distinct3 main.create-big main.events_stress main.events_time_zone main.information_schema-big main.log_tables-big main.merge-big main.mysqlbinlog_row_big main.read_many_rows_innodb main.ssl-big main.sum_distinct-big main.type_newdecimal-big main.variables-big parts.part_supported_sql_func_innodb parts.partition_alter1_1_2_innodb parts.partition_alter1_2_innodb parts.partition_alter2_1_1_innodb parts.partition_alter2_1_2_innodb parts.partition_alter2_2_2_innodb parts.partition_alter4_innodb funcs_1.myisam_views-big --skip-test-list=collections/disabled-weekly.list +perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --skip-test-list=collections/disabled-weekly.list +perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-row-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=row --skip-test-list=collections/disabled-weekly.list +perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-mixed-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=mixed --skip-test-list=collections/disabled-weekly.list +perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --skip-test-list=collections/disabled-weekly.list +perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-row-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=row --skip-test-list=collections/disabled-weekly.list +perl mysql-test-run.pl --timer --force --debug-server --parallel=auto --comment=eits-rpl-binlog-mixed-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=mixed --skip-test-list=collections/disabled-weekly.list diff --git a/mysql-test/collections/disabled-daily.list b/mysql-test/collections/disabled-daily.list new file mode 100644 index 00000000000..6edb3d1d0b3 --- /dev/null +++ b/mysql-test/collections/disabled-daily.list @@ -0,0 +1,9 @@ +rpl.rpl_semi_sync_event : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +rpl.rpl_semi_sync : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_master_enabled_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_master_timeout_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_master_trace_level_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_master_wait_no_slave_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_slave_enabled_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_slave_trace_level_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.all_vars : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. diff --git a/mysql-test/collections/disabled-weekly.list b/mysql-test/collections/disabled-weekly.list new file mode 100644 index 00000000000..6edb3d1d0b3 --- /dev/null +++ b/mysql-test/collections/disabled-weekly.list @@ -0,0 +1,9 @@ +rpl.rpl_semi_sync_event : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +rpl.rpl_semi_sync : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_master_enabled_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_master_timeout_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_master_trace_level_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_master_wait_no_slave_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_slave_enabled_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.rpl_semi_sync_slave_trace_level_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. +sys_vars.all_vars : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed. diff --git a/mysql-test/include/wait_for_status_var.inc b/mysql-test/include/wait_for_status_var.inc index 5c68254f00e..86831164c71 100644 --- a/mysql-test/include/wait_for_status_var.inc +++ b/mysql-test/include/wait_for_status_var.inc @@ -61,7 +61,7 @@ let $_show_status_value= query_get_value("SHOW $status_type STATUS LIKE '$status # Set way of comparing let $_query= SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value'); -if ($is_number) +if ($_is_number) { let $_query= SELECT NOT($_show_status_value $_status_var_comparsion $status_var_value); } @@ -70,7 +70,7 @@ while (`$_query`) { if (!$_status_timeout_counter) { - --echo **** ERROR: failed while waiting for $status_type $status_var $_status_var_comparison $status_var_value **** + --echo **** ERROR: failed while waiting for $status_type $status_var $_status_var_comparsion $status_var_value **** --echo Note: the following output may have changed since the failure was detected --echo **** Showing STATUS, PROCESSLIST **** eval SHOW $status_type STATUS LIKE '$status_var'; diff --git a/mysql-test/r/ctype_latin1.result b/mysql-test/r/ctype_latin1.result index 6f773270dff..7a8f07e912b 100644 --- a/mysql-test/r/ctype_latin1.result +++ b/mysql-test/r/ctype_latin1.result @@ -3246,5 +3246,20 @@ maketime(`a`,`a`,`a`) DROP TABLE t1; SET sql_mode=default; # +# Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters +# +SET NAMES utf8; +EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 'abcdó' AS `abcdó`,_latin1'abcd\xC3\xB3' AS `abcdó`,_utf8'abcd\xC3\xB3' AS `abcdó` +SET NAMES latin1; +EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 'abcdó' AS `abcdó`,_latin1'abcd\xC3\xB3' AS `abcdó`,_utf8'abcd\xC3\xB3' AS `abcdó` +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_sjis.result b/mysql-test/r/ctype_sjis.result index 78827b5b907..abeb19c0c8f 100644 --- a/mysql-test/r/ctype_sjis.result +++ b/mysql-test/r/ctype_sjis.result @@ -218,6 +218,12 @@ hex(a) hex(lower(a)) hex(upper(a)) 8352835E 8352835E 8352835E 8372835E 8372835E 8372835E DROP TABLE t1; +# +# Bug#11766519 - Bug#59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED. +# +SELECT QUOTE('ƒ\'); +QUOTE('ƒ\') +'ƒ\' # End of 5.1 tests # # Start of 5.5 tests diff --git a/mysql-test/r/ctype_ucs.result b/mysql-test/r/ctype_ucs.result index 0ee80b921a1..e41544f2197 100644 --- a/mysql-test/r/ctype_ucs.result +++ b/mysql-test/r/ctype_ucs.result @@ -990,8 +990,8 @@ old_password(name) 14e500b131773991 select quote(name) from bug20536; quote(name) -???????? -???????????????? +'test1' +'\'test\\_2\'' drop table bug20536; set names ucs2; ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2' @@ -1238,6 +1238,17 @@ CREATE VIEW v1 AS SELECT 1 from t1 WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); DROP VIEW v1; DROP TABLE t1; +# +# Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed. +# +SELECT HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850)); +HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850)) +00 +SELECT CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED); +CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED) +0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '' End of 5.0 tests # # Start of 5.5 tests diff --git a/mysql-test/r/ctype_utf16.result b/mysql-test/r/ctype_utf16.result index beafbf80e1e..ebb1bd443a2 100644 --- a/mysql-test/r/ctype_utf16.result +++ b/mysql-test/r/ctype_utf16.result @@ -30,13 +30,13 @@ binary 'a a' > 'a' binary 'a \0' > 'a' binary 'a\0' > 'a' 1 1 1 select hex(_utf16 0x44); hex(_utf16 0x44) -00000044 +0044 select hex(_utf16 0x3344); hex(_utf16 0x3344) 3344 select hex(_utf16 0x113344); hex(_utf16 0x113344) -000000113344 +00113344 CREATE TABLE t1 (word VARCHAR(64), word2 CHAR(64)) CHARACTER SET utf16; INSERT INTO t1 VALUES (_koi8r 0xF2, _koi8r 0xF2), (X'2004',X'2004'); SELECT hex(word) FROM t1 ORDER BY word; @@ -434,10 +434,10 @@ aardvarz DROP TABLE t1; SELECT hex(cast(0xAA as char character set utf16)); hex(cast(0xAA as char character set utf16)) -000000AA +00AA SELECT hex(convert(0xAA using utf16)); hex(convert(0xAA using utf16)) -000000AA +00AA CREATE TABLE t1 (a char(10) character set utf16); INSERT INTO t1 VALUES (0x1),(0x11),(0x111),(0x1111),(0x11111); SELECT HEX(a) FROM t1; @@ -1102,5 +1102,20 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1, t2; # +# Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure +# +SELECT CASE _latin1'a' WHEN _utf16'a' THEN 'A' END; +CASE _latin1'a' WHEN _utf16'a' THEN 'A' END +A +SELECT CASE _utf16'a' WHEN _latin1'a' THEN 'A' END; +CASE _utf16'a' WHEN _latin1'a' THEN 'A' END +A +CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf16); +INSERT INTO t1 VALUES ('a'); +SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1; +CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END +b +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_utf32.result b/mysql-test/r/ctype_utf32.result index 37d5aa98be3..d749383d249 100644 --- a/mysql-test/r/ctype_utf32.result +++ b/mysql-test/r/ctype_utf32.result @@ -1152,5 +1152,20 @@ d f DROP TABLE t1; # +# Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure +# +SELECT CASE _latin1'a' WHEN _utf32'a' THEN 'A' END; +CASE _latin1'a' WHEN _utf32'a' THEN 'A' END +A +SELECT CASE _utf32'a' WHEN _latin1'a' THEN 'A' END; +CASE _utf32'a' WHEN _latin1'a' THEN 'A' END +A +CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf32); +INSERT INTO t1 VALUES ('a'); +SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1; +CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END +b +DROP TABLE t1; +# # End of 5.5 tests # diff --git a/mysql-test/r/ctype_utf8.result b/mysql-test/r/ctype_utf8.result index ababfe51621..ea6f00e2581 100644 --- a/mysql-test/r/ctype_utf8.result +++ b/mysql-test/r/ctype_utf8.result @@ -4969,5 +4969,20 @@ GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size)); ERROR 23000: Duplicate entry '107374182410737418241' for key 'group_key' DROP TABLE t1; # +# Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters +# +SET NAMES latin1; +EXPLAIN EXTENDED SELECT 'abcdÃÂÃÄÅ', _latin1'abcdÃÂÃÄÅ', _utf8'abcdÃÂÃÄÅ' AS u; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 'abcdÃÂÃÄÅ' AS `abcdÃÂÃÄÅ`,_latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÃÂÃÄÅ`,_utf8'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `u` +SET NAMES utf8; +EXPLAIN EXTENDED SELECT 'abcdÃÂÃÄÅ', _latin1'abcdÃÂÃÄÅ', _utf8'abcdÃÂÃÄÅ'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 'abcdÃÂÃÄÅ' AS `abcdÃÂÃÄÅ`,_latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÃÂÂÃÄÅ`,_utf8'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcdÃÂÃÄÅ` +# # End of 5.5 tests # diff --git a/mysql-test/r/flush.result b/mysql-test/r/flush.result index b1e2e48eca8..bbfea2dade8 100644 --- a/mysql-test/r/flush.result +++ b/mysql-test/r/flush.result @@ -451,3 +451,18 @@ unlock tables; handler t1 close; # Cleanup. drop tables t1, t2; +# +# Bug#57649 FLUSH TABLES under FLUSH TABLES <list> WITH READ LOCK leads +# to assert failure. +# +DROP TABLE IF EXISTS t1; +CREATE TABLE t1 (a INT); +FLUSH TABLES t1 WITH READ LOCK; +FLUSH TABLES; +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1; +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +ALTER TABLE t1 COMMENT 'test'; +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/r/func_encrypt_ucs2.result b/mysql-test/r/func_encrypt_ucs2.result new file mode 100644 index 00000000000..2ca40434cae --- /dev/null +++ b/mysql-test/r/func_encrypt_ucs2.result @@ -0,0 +1,19 @@ +# +# Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed. +# +SELECT CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2))); +CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2))) +9 +SELECT CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED); +CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED) +0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: '' +SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2))); +CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2))) +4 +SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED); +CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED) +0 +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'test' diff --git a/mysql-test/r/func_set.result b/mysql-test/r/func_set.result index 14ebc8203ec..ba9500bff46 100644 --- a/mysql-test/r/func_set.result +++ b/mysql-test/r/func_set.result @@ -159,3 +159,45 @@ SELECT CONVERT( a USING latin1 ) FROM t2; CONVERT( a USING latin1 ) DROP TABLE t1, t2; +# +# BUG#59405: FIND_IN_SET won't work normaly after upgrade from 5.1 to 5.5 +# +CREATE TABLE t1(days set('1','2','3','4','5','6','7')); +INSERT INTO t1 VALUES('1,2,3,4,5,6,7'), (NULL), ('1,2,3,4,5,6,7'); + +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days); +days +1,2,3,4,5,6,7 +1,2,3,4,5,6,7 +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days) IS UNKNOWN; +days +NULL +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL); +days +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL) IS UNKNOWN; +days +1,2,3,4,5,6,7 +NULL +1,2,3,4,5,6,7 +SELECT * FROM t1 WHERE FIND_IN_SET(7, days); +days +1,2,3,4,5,6,7 +1,2,3,4,5,6,7 +SELECT * FROM t1 WHERE FIND_IN_SET(8, days); +days +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days); +days +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days) IS UNKNOWN; +days +1,2,3,4,5,6,7 +NULL +1,2,3,4,5,6,7 +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL); +days +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL) IS UNKNOWN; +days +1,2,3,4,5,6,7 +NULL +1,2,3,4,5,6,7 + +DROP TABLE t1; diff --git a/mysql-test/r/grant.result b/mysql-test/r/grant.result index 38f09d3b759..49db157f35f 100644 --- a/mysql-test/r/grant.result +++ b/mysql-test/r/grant.result @@ -1452,6 +1452,199 @@ DROP DATABASE mysqltest2; DROP USER testuser@localhost; use test; +# +# Test for bug #36544 "DROP USER does not remove stored function +# privileges". +# +create database mysqltest1; +create function mysqltest1.f1() returns int return 0; +create procedure mysqltest1.p1() begin end; +# +# 1) Check that DROP USER properly removes privileges on both +# stored procedures and functions. +# +create user mysqluser1@localhost; +grant execute on function mysqltest1.f1 to mysqluser1@localhost; +grant execute on procedure mysqltest1.p1 to mysqluser1@localhost; +# Quick test that granted privileges are properly reflected +# in privilege tables and in in-memory structures. +show grants for mysqluser1@localhost; +Grants for mysqluser1@localhost +GRANT USAGE ON *.* TO 'mysqluser1'@'localhost' +GRANT EXECUTE ON PROCEDURE `mysqltest1`.`p1` TO 'mysqluser1'@'localhost' +GRANT EXECUTE ON FUNCTION `mysqltest1`.`f1` TO 'mysqluser1'@'localhost' +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +db routine_name routine_type proc_priv +mysqltest1 f1 FUNCTION Execute +mysqltest1 p1 PROCEDURE Execute +# +# Create connection 'bug_36544_con1' as 'mysqluser1@localhost'. +call mysqltest1.p1(); +select mysqltest1.f1(); +mysqltest1.f1() +0 +# +# Switch to connection 'default'. +drop user mysqluser1@localhost; +# +# Test that dropping of user is properly reflected in +# both privilege tables and in in-memory structures. +# +# Switch to connection 'bug36544_con1'. +# The connection cold be alive but should not be able to +# access to any of the stored routines. +call mysqltest1.p1(); +ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1' +select mysqltest1.f1(); +ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1' +# +# Switch to connection 'default'. +# +# Now create user with the same name and check that he +# has not inherited privileges. +create user mysqluser1@localhost; +show grants for mysqluser1@localhost; +Grants for mysqluser1@localhost +GRANT USAGE ON *.* TO 'mysqluser1'@'localhost' +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +db routine_name routine_type proc_priv +# +# Create connection 'bug_36544_con2' as 'mysqluser1@localhost'. +# Newly created user should not be able to access any of the routines. +call mysqltest1.p1(); +ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1' +select mysqltest1.f1(); +ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1' +# +# Switch to connection 'default'. +# +# 2) Check that RENAME USER properly updates privileges on both +# stored procedures and functions. +# +grant execute on function mysqltest1.f1 to mysqluser1@localhost; +grant execute on procedure mysqltest1.p1 to mysqluser1@localhost; +# +# Create one more user to make in-memory hashes non-trivial. +# User names 'mysqluser11' and 'mysqluser10' were selected +# to trigger bug discovered during code inspection. +create user mysqluser11@localhost; +grant execute on function mysqltest1.f1 to mysqluser11@localhost; +grant execute on procedure mysqltest1.p1 to mysqluser11@localhost; +# Also create a couple of tables to test for another bug +# discovered during code inspection (again table names were +# chosen especially to trigger the bug). +create table mysqltest1.t11 (i int); +create table mysqltest1.t22 (i int); +grant select on mysqltest1.t22 to mysqluser1@localhost; +grant select on mysqltest1.t11 to mysqluser1@localhost; +# Quick test that granted privileges are properly reflected +# in privilege tables and in in-memory structures. +show grants for mysqluser1@localhost; +Grants for mysqluser1@localhost +GRANT USAGE ON *.* TO 'mysqluser1'@'localhost' +GRANT SELECT ON `mysqltest1`.`t11` TO 'mysqluser1'@'localhost' +GRANT SELECT ON `mysqltest1`.`t22` TO 'mysqluser1'@'localhost' +GRANT EXECUTE ON PROCEDURE `mysqltest1`.`p1` TO 'mysqluser1'@'localhost' +GRANT EXECUTE ON FUNCTION `mysqltest1`.`f1` TO 'mysqluser1'@'localhost' +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +db routine_name routine_type proc_priv +mysqltest1 f1 FUNCTION Execute +mysqltest1 p1 PROCEDURE Execute +select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost'; +db table_name table_priv +mysqltest1 t11 Select +mysqltest1 t22 Select +# +# Switch to connection 'bug36544_con2'. +call mysqltest1.p1(); +select mysqltest1.f1(); +mysqltest1.f1() +0 +select * from mysqltest1.t11; +i +select * from mysqltest1.t22; +i +# +# Switch to connection 'default'. +rename user mysqluser1@localhost to mysqluser10@localhost; +# +# Test that there are no privileges left for mysqluser1. +# +# Switch to connection 'bug36544_con2'. +# The connection cold be alive but should not be able to +# access to any of the stored routines or tables. +call mysqltest1.p1(); +ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1' +select mysqltest1.f1(); +ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1' +select * from mysqltest1.t11; +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't11' +select * from mysqltest1.t22; +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't22' +# +# Switch to connection 'default'. +# +# Now create user with the old name and check that he +# has not inherited privileges. +create user mysqluser1@localhost; +show grants for mysqluser1@localhost; +Grants for mysqluser1@localhost +GRANT USAGE ON *.* TO 'mysqluser1'@'localhost' +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +db routine_name routine_type proc_priv +select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost'; +db table_name table_priv +# +# Create connection 'bug_36544_con3' as 'mysqluser1@localhost'. +# Newly created user should not be able to access to any of the +# stored routines or tables. +call mysqltest1.p1(); +ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.p1' +select mysqltest1.f1(); +ERROR 42000: execute command denied to user 'mysqluser1'@'localhost' for routine 'mysqltest1.f1' +select * from mysqltest1.t11; +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't11' +select * from mysqltest1.t22; +ERROR 42000: SELECT command denied to user 'mysqluser1'@'localhost' for table 't22' +# +# Switch to connection 'default'. +# +# Now check that privileges became associated with a new user +# name - mysqluser10. +# +show grants for mysqluser10@localhost; +Grants for mysqluser10@localhost +GRANT USAGE ON *.* TO 'mysqluser10'@'localhost' +GRANT SELECT ON `mysqltest1`.`t22` TO 'mysqluser10'@'localhost' +GRANT SELECT ON `mysqltest1`.`t11` TO 'mysqluser10'@'localhost' +GRANT EXECUTE ON PROCEDURE `mysqltest1`.`p1` TO 'mysqluser10'@'localhost' +GRANT EXECUTE ON FUNCTION `mysqltest1`.`f1` TO 'mysqluser10'@'localhost' +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser10' and host='localhost'; +db routine_name routine_type proc_priv +mysqltest1 f1 FUNCTION Execute +mysqltest1 p1 PROCEDURE Execute +select db, table_name, table_priv from mysql.tables_priv where user='mysqluser10' and host='localhost'; +db table_name table_priv +mysqltest1 t11 Select +mysqltest1 t22 Select +# +# Create connection 'bug_36544_con4' as 'mysqluser10@localhost'. +call mysqltest1.p1(); +select mysqltest1.f1(); +mysqltest1.f1() +0 +select * from mysqltest1.t11; +i +select * from mysqltest1.t22; +i +# +# Switch to connection 'default'. +# +# Clean-up. +drop user mysqluser1@localhost; +drop user mysqluser10@localhost; +drop user mysqluser11@localhost; +drop database mysqltest1; End of 5.0 tests set names utf8; grant select on test.* to юзер_юзер@localhost; @@ -1546,11 +1739,7 @@ fn2() 2 DROP USER 'userbug33464'@'localhost'; DROP FUNCTION fn1; -Warnings: -Warning 1403 There is no such grant defined for user 'userbug33464' on host 'localhost' on routine 'fn1' DROP FUNCTION fn2; -Warnings: -Warning 1403 There is no such grant defined for user 'userbug33464' on host 'localhost' on routine 'fn2' DROP PROCEDURE sp3; DROP USER 'userbug33464'@'localhost'; USE test; diff --git a/mysql-test/r/innodb_mysql_sync.result b/mysql-test/r/innodb_mysql_sync.result index 58948835f66..8e210a7e205 100644 --- a/mysql-test/r/innodb_mysql_sync.result +++ b/mysql-test/r/innodb_mysql_sync.result @@ -153,5 +153,15 @@ SET DEBUG_SYNC= "now SIGNAL query"; a b # Test 4: Secondary unique index, should not block reads. # Connection default +SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; +# Sending: +ALTER TABLE t1 ADD UNIQUE (b); +# Connection con1 +SET DEBUG_SYNC= "now WAIT_FOR manage"; +SELECT * FROM t1; +a b +SET DEBUG_SYNC= "now SIGNAL query"; +# Connection default +# Reaping: ALTER TABLE t1 ADD UNIQUE (b) SET DEBUG_SYNC= "RESET"; DROP TABLE t1; diff --git a/mysql-test/r/mysqlcheck.result b/mysql-test/r/mysqlcheck.result index ef46eba5ccb..42fb1945d8b 100644 --- a/mysql-test/r/mysqlcheck.result +++ b/mysql-test/r/mysqlcheck.result @@ -109,7 +109,7 @@ 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 -create table t1 (a int); +create table t1 (a int) engine=myisam; create view v1 as select * from t1; test.t1 OK test.t1 Table is already up to date @@ -117,14 +117,14 @@ test.t1 OK test.t1 Table is already up to date drop view v1; drop table t1; -create table `t``1`(a int); -create table `t 1`(a int); +create table `t``1`(a int) engine=myisam; +create table `t 1`(a int) engine=myisam; test.t 1 OK test.t`1 OK drop table `t``1`, `t 1`; create database d_bug25347; use d_bug25347; -create table t_bug25347 (a int); +create table t_bug25347 (a int) engine=myisam; create view v_bug25347 as select * from t_bug25347; insert into t_bug25347 values (1),(2),(3); flush tables; @@ -164,15 +164,15 @@ Table Op Msg_type Msg_text test.v1 check status OK information_schema.routines check note The storage engine for the table doesn't support check drop view v1; -CREATE TABLE t1(a INT); -CREATE TABLE t2(a INT); +CREATE TABLE t1(a INT) engine=myisam; +CREATE TABLE t2(a INT) engine=myisam; test.t1 Error : Incorrect information in file: './test/t1.frm' error : Corrupt test.t2 OK DROP TABLE t1, t2; End of 5.0 tests -create table t1(a int); +create table t1(a int) engine=myisam; create view v1 as select * from t1; show tables; Tables_in_test @@ -192,7 +192,7 @@ v-1 drop view v1, `v-1`; drop table t1; SET NAMES utf8; -CREATE TABLE `#mysql50#@` (a INT); +CREATE TABLE `#mysql50#@` (a INT) engine=myisam; SHOW TABLES; Tables_in_test #mysql50#@ @@ -203,7 +203,7 @@ SHOW TABLES; Tables_in_test @ DROP TABLE `@`; -CREATE TABLE `Ñ` (a INT); +CREATE TABLE `Ñ` (a INT) engine=myisam; SET NAMES DEFAULT; mysqlcheck --default-character-set="latin1" --databases test test.? @@ -216,8 +216,8 @@ DROP TABLE `Ñ`; SET NAMES DEFAULT; CREATE DATABASE `#mysql50#a@b`; USE `#mysql50#a@b`; -CREATE TABLE `#mysql50#c@d` (a INT); -CREATE TABLE t1 (a INT); +CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam; +CREATE TABLE t1 (a INT) engine=myisam; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name; TRIGGER_CATALOG TRIGGER_SCHEMA TRIGGER_NAME EVENT_MANIPULATION EVENT_OBJECT_CATALOG EVENT_OBJECT_SCHEMA EVENT_OBJECT_TABLE ACTION_ORDER ACTION_CONDITION ACTION_STATEMENT ACTION_ORIENTATION ACTION_TIMING ACTION_REFERENCE_OLD_TABLE ACTION_REFERENCE_NEW_TABLE ACTION_REFERENCE_OLD_ROW ACTION_REFERENCE_NEW_ROW CREATED SQL_MODE DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -246,12 +246,12 @@ USE test; # Bug #31821: --all-in-1 and --fix-table-names don't work together # drop table if exists `#mysql50#t1-1`; -create table `#mysql50#t1-1` (a int); +create table `#mysql50#t1-1` (a int) engine=myisam; show tables like 't1-1'; Tables_in_test (t1-1) t1-1 drop table `t1-1`; -create table `#mysql50#t1-1` (a int); +create table `#mysql50#t1-1` (a int) engine=myisam; show tables like 't1-1'; Tables_in_test (t1-1) t1-1 @@ -260,3 +260,67 @@ End of 5.1 tests # # Bug #35269: mysqlcheck behaves different depending on order of parameters # +# +# Bug#11755431 47205: MAP 'REPAIR TABLE' TO RECREATE +ANALYZE FOR +# ENGINES NOT SUPPORTING NATIVE +# +DROP TABLE IF EXISTS bug47205; +# +# Test 1: Check that ALTER TABLE ... rebuilds the table +CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY) +DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb; +INSERT INTO bug47205 VALUES ("foobar"); +FLUSH TABLE bug47205; +# Replace the FRM with a 5.0 FRM that will require upgrade +# Should indicate that ALTER TABLE ... FORCE is needed +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check error Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it! +# ALTER TABLE ... FORCE should rebuild the table +# and therefore output "affected rows: 1" +ALTER TABLE bug47205 FORCE; +affected rows: 1 +info: Records: 1 Duplicates: 0 Warnings: 0 +# Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check status OK +DROP TABLE bug47205; +# +# Test 2: InnoDB - REPAIR not supported +CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY) +DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb; +FLUSH TABLE bug47205; +# Replace the FRM with a 5.0 FRM that will require upgrade +# Should indicate that ALTER TABLE .. FORCE is needed +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check error Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it! +# Running mysqlcheck to check and upgrade +test.bug47205 +error : Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it! + +Repairing tables +# Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check status OK +DROP TABLE bug47205; +# +# Test 3: MyISAM - REPAIR supported +# Use an old FRM that will require upgrade +# Should indicate that REPAIR TABLE is needed +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check error Table upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it! +# Running mysqlcheck to check and upgrade +test.bug47205 +error : Table upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it! + +Repairing tables +test.bug47205 OK +# Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; +Table Op Msg_type Msg_text +test.bug47205 check status OK +DROP TABLE bug47205; diff --git a/mysql-test/r/partition.result b/mysql-test/r/partition.result index 1d7a08e9a7c..49e7f4a6ec9 100644 --- a/mysql-test/r/partition.result +++ b/mysql-test/r/partition.result @@ -1,5 +1,43 @@ drop table if exists t1, t2; # +# Bug#59297: Can't find record in 'tablename' on update inner join +# +CREATE TABLE t1 ( +a char(2) NOT NULL, +b char(2) NOT NULL, +c int(10) unsigned NOT NULL, +d varchar(255) DEFAULT NULL, +e varchar(1000) DEFAULT NULL, +PRIMARY KEY (a, b, c), +KEY (a), +KEY (a, b) +) +/*!50100 PARTITION BY KEY (a) +PARTITIONS 20 */; +INSERT INTO t1 (a, b, c, d, e) VALUES +('07', '03', 343, '1', '07_03_343'), +('01', '04', 343, '2', '01_04_343'), +('01', '06', 343, '3', '01_06_343'), +('01', '07', 343, '4', '01_07_343'), +('01', '08', 343, '5', '01_08_343'), +('01', '09', 343, '6', '01_09_343'), +('03', '03', 343, '7', '03_03_343'), +('03', '06', 343, '8', '03_06_343'), +('03', '07', 343, '9', '03_07_343'), +('04', '03', 343, '10', '04_03_343'), +('04', '06', 343, '11', '04_06_343'), +('05', '03', 343, '12', '05_03_343'), +('11', '03', 343, '13', '11_03_343'), +('11', '04', 343, '14', '11_04_343') +; +UPDATE t1 AS A, +(SELECT '03' AS a, '06' AS b, 343 AS c, 'last' AS d) AS B +SET A.e = B.d +WHERE A.a = '03' +AND A.b = '06' +AND A.c = 343; +DROP TABLE t1; +# # Bug#57778: failed primary key add to partitioned innodb table # inconsistent and crashes # diff --git a/mysql-test/r/xml.result b/mysql-test/r/xml.result index 4568775d3fd..8ca9ab84bf7 100644 --- a/mysql-test/r/xml.result +++ b/mysql-test/r/xml.result @@ -1124,6 +1124,14 @@ Warning 1525 Incorrect XML value: 'parse error at line 1 pos 2: END-OF-INPUT une SELECT UPDATEXML(CONVERT(_latin1'<!--' USING utf8),'1','1'); UPDATEXML(CONVERT(_latin1'<!--' USING utf8),'1','1') NULL +# +# Bug#11766725 (bug#59901): EXTRACTVALUE STILL BROKEN AFTER FIX FOR BUG #44332 +# +SELECT ExtractValue(CONVERT('<\"', BINARY(10)), 1); +ExtractValue(CONVERT('<\"', BINARY(10)), 1) +NULL +Warnings: +Warning 1525 Incorrect XML value: 'parse error at line 1 pos 11: STRING unexpected (ident or '/' wanted)' End of 5.1 tests # # Start of 5.5 tests diff --git a/mysql-test/std_data/bug47205.frm b/mysql-test/std_data/bug47205.frm Binary files differnew file mode 100644 index 00000000000..6d53b221d28 --- /dev/null +++ b/mysql-test/std_data/bug47205.frm diff --git a/mysql-test/suite/engines/iuds/r/insert_year.result b/mysql-test/suite/engines/iuds/r/insert_year.result index 69d1139c037..386c8090434 100644 --- a/mysql-test/suite/engines/iuds/r/insert_year.result +++ b/mysql-test/suite/engines/iuds/r/insert_year.result @@ -2431,7 +2431,7 @@ c1 c2 c3 c4 2155 2155 1998-12-26 1998-12-26 11:30:45 SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t3; total_rows min_value max(c2) -21 1901 2155 +21 0 2155 SELECT * FROM t3 WHERE c3 = '1998-12-11'; c1 c2 c3 c4 1990 1990 1998-12-11 1998-12-11 11:30:45 @@ -2838,7 +2838,7 @@ c1 c2 c3 c4 2155 2155 1998-12-26 1998-12-26 11:30:45 SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t3; total_rows min_value max(c2) -21 1901 2155 +21 0 2155 SELECT * FROM t3 WHERE c3 = '1998-12-11'; c1 c2 c3 c4 1990 1990 1998-12-11 1998-12-11 11:30:45 diff --git a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result index f19030834c8..fa8fb6c1eb2 100644 --- a/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result +++ b/mysql-test/suite/funcs_1/r/innodb_storedproc_06.result @@ -128,8 +128,6 @@ root@localhost db_storedproc_1 drop user 'user_1'@'localhost'; DROP PROCEDURE sp3; DROP FUNCTION fn1; -Warnings: -Warning 1403 There is no such grant defined for user 'user_1' on host 'localhost' on routine 'fn1' Testcase 3.1.6.4: ----------------- diff --git a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result index 0a117c830ee..f08165b21f8 100644 --- a/mysql-test/suite/funcs_1/r/memory_storedproc_06.result +++ b/mysql-test/suite/funcs_1/r/memory_storedproc_06.result @@ -129,8 +129,6 @@ root@localhost db_storedproc_1 drop user 'user_1'@'localhost'; DROP PROCEDURE sp3; DROP FUNCTION fn1; -Warnings: -Warning 1403 There is no such grant defined for user 'user_1' on host 'localhost' on routine 'fn1' Testcase 3.1.6.4: ----------------- diff --git a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result index 0a117c830ee..f08165b21f8 100644 --- a/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result +++ b/mysql-test/suite/funcs_1/r/myisam_storedproc_06.result @@ -129,8 +129,6 @@ root@localhost db_storedproc_1 drop user 'user_1'@'localhost'; DROP PROCEDURE sp3; DROP FUNCTION fn1; -Warnings: -Warning 1403 There is no such grant defined for user 'user_1' on host 'localhost' on routine 'fn1' Testcase 3.1.6.4: ----------------- diff --git a/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc b/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc index 0695a0724d8..3e5ca055ae1 100644 --- a/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc +++ b/mysql-test/suite/funcs_1/storedproc/storedproc_06.inc @@ -149,10 +149,6 @@ USE db_storedproc_1; drop user 'user_1'@'localhost'; DROP PROCEDURE sp3; -# This drop function shouldn't generated a warning as the -# privileges should have been removed when the user was -# dropped. Reported as Bug#36544 DROP USER does not remove -# stored function privileges DROP FUNCTION fn1; diff --git a/mysql-test/suite/large_tests/t/lock_tables_big.test b/mysql-test/suite/large_tests/t/lock_tables_big.test index 41dcff3577c..7fab19ac274 100644 --- a/mysql-test/suite/large_tests/t/lock_tables_big.test +++ b/mysql-test/suite/large_tests/t/lock_tables_big.test @@ -1,6 +1,16 @@ # # Bug#24509 cannot use more than 2048 file descriptors on windows # + +# +# This test requires approximately 6000 of files to be open simultaneously. +# Let us skip it on platforms where open files limit is too low. +let $max_open_files_limit= `SELECT @@open_files_limit < 6100`; +if ($max_open_files_limit) +{ + skip Need open_files_limit to be greater than 6100; +} + --disable_query_log create database many_tables; use many_tables; @@ -19,14 +29,14 @@ while ($i) } #lock all tables we just created (resembles mysqldump startup is doing with --all-databases operation) -#There will be 3 descriptors for each table (table.FRM, table.MYI and table.MYD files) means 9000 files +#There will be 2 descriptors for each table (table.MYI and table.MYD files) means 6000 files #descriptors altogether. For Microsoft C runtime, this is way too many. eval LOCK TABLES $table_list; unlock tables; drop database many_tables; ---disable_query_log +--enable_query_log --echo all done diff --git a/mysql-test/t/ctype_latin1.test b/mysql-test/t/ctype_latin1.test index b8aae2eae40..5d1acf107d7 100644 --- a/mysql-test/t/ctype_latin1.test +++ b/mysql-test/t/ctype_latin1.test @@ -144,5 +144,20 @@ SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1, 1, 1, ''); --source include/ctype_numconv.inc --echo # +--echo # Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters +--echo # +# Test latin1 client erroneously started with --default-character-set=utf8 +# EXPLAIN output should still be pretty readable. +# We're using 'ó' (\xC3\xB3) as a magic sequence: +# - it's "LATIN CAPITAL LETTER A WITH TILDE ABOVE + SUPERSCRIPT 3" in latin1 +# - it's "LATIN SMALL LETTER O WITH ACUTE ABOVE" in utf8. +SET NAMES utf8; +EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó'; +# Test normal latin1 +SET NAMES latin1; +EXPLAIN EXTENDED SELECT 'abcdó', _latin1'abcdó', _utf8'abcdó'; + + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_sjis.test b/mysql-test/t/ctype_sjis.test index 103039d0323..f45e6ab9b54 100644 --- a/mysql-test/t/ctype_sjis.test +++ b/mysql-test/t/ctype_sjis.test @@ -92,6 +92,14 @@ INSERT INTO t1 VALUES (0x8372835E),(0x8352835E); SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a); DROP TABLE t1; +--echo # +--echo # Bug#11766519 - Bug#59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED. +--echo # +# In the below string backslash (0x5C) is a part of a multi-byte +# character, so it should not be quoted. +SELECT QUOTE('ƒ\'); + + --echo # End of 5.1 tests diff --git a/mysql-test/t/ctype_ucs.test b/mysql-test/t/ctype_ucs.test index a6f3a2c2cbf..24e68f2dab3 100644 --- a/mysql-test/t/ctype_ucs.test +++ b/mysql-test/t/ctype_ucs.test @@ -741,6 +741,12 @@ WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1')); DROP VIEW v1; DROP TABLE t1; +--echo # +--echo # Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed. +--echo # +SELECT HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850)); +SELECT CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED); + --echo End of 5.0 tests diff --git a/mysql-test/t/ctype_utf16.test b/mysql-test/t/ctype_utf16.test index ef705474eee..2f1651d0f40 100644 --- a/mysql-test/t/ctype_utf16.test +++ b/mysql-test/t/ctype_utf16.test @@ -745,6 +745,15 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FROM t1; SHOW CREATE TABLE t2; DROP TABLE t1, t2; +--echo # +--echo # Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure +--echo # +SELECT CASE _latin1'a' WHEN _utf16'a' THEN 'A' END; +SELECT CASE _utf16'a' WHEN _latin1'a' THEN 'A' END; +CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf16); +INSERT INTO t1 VALUES ('a'); +SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1; +DROP TABLE t1; # ## TODO: add tests for all engines diff --git a/mysql-test/t/ctype_utf32.test b/mysql-test/t/ctype_utf32.test index b03284a1c7c..10d365572bf 100644 --- a/mysql-test/t/ctype_utf32.test +++ b/mysql-test/t/ctype_utf32.test @@ -831,5 +831,15 @@ SELECT * FROM t1 WHERE b BETWEEN 'a' AND 'z'; DROP TABLE t1; --echo # +--echo # Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure +--echo # +SELECT CASE _latin1'a' WHEN _utf32'a' THEN 'A' END; +SELECT CASE _utf32'a' WHEN _latin1'a' THEN 'A' END; +CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf32); +INSERT INTO t1 VALUES ('a'); +SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1; +DROP TABLE t1; + +--echo # --echo # End of 5.5 tests --echo # diff --git a/mysql-test/t/ctype_utf8.test b/mysql-test/t/ctype_utf8.test index 2aea21afe68..a519a417192 100644 --- a/mysql-test/t/ctype_utf8.test +++ b/mysql-test/t/ctype_utf8.test @@ -1550,6 +1550,16 @@ SELECT COUNT(*) FROM t1, t1 t2 GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size)); DROP TABLE t1; +--echo # +--echo # Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters +--echo # +# Emulate utf8 client erroneously started with --default-character-set=latin1, +# as in the bug report. EXPLAIN output should still be pretty readable +SET NAMES latin1; +EXPLAIN EXTENDED SELECT 'abcdÃÂÃÄÅ', _latin1'abcdÃÂÃÄÅ', _utf8'abcdÃÂÃÄÅ' AS u; +# Test normal utf8 +SET NAMES utf8; +EXPLAIN EXTENDED SELECT 'abcdÃÂÃÄÅ', _latin1'abcdÃÂÃÄÅ', _utf8'abcdÃÂÃÄÅ'; --echo # --echo # End of 5.5 tests diff --git a/mysql-test/t/disabled.def b/mysql-test/t/disabled.def index 985493481e9..063bbb9ce4b 100644 --- a/mysql-test/t/disabled.def +++ b/mysql-test/t/disabled.def @@ -16,3 +16,4 @@ read_many_rows_innodb : Bug#37635 2010-11-15 mattiasj report already exists sum_distinct-big : Bug#56927 2010-11-15 mattiasj was not tested alter_table-big : Bug#37248 2010-11-15 mattiasj was not tested create-big : Bug#37248 2010-11-15 mattiasj was not tested +archive-big : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc diff --git a/mysql-test/t/flush.test b/mysql-test/t/flush.test index 944c9c43019..52ee6d2cf87 100644 --- a/mysql-test/t/flush.test +++ b/mysql-test/t/flush.test @@ -644,3 +644,27 @@ disconnect con2; --source include/wait_until_disconnected.inc connection default; drop tables t1, t2; + + +--echo # +--echo # Bug#57649 FLUSH TABLES under FLUSH TABLES <list> WITH READ LOCK leads +--echo # to assert failure. +--echo # + +--disable_warnings +DROP TABLE IF EXISTS t1; +--enable_warnings + +CREATE TABLE t1 (a INT); +FLUSH TABLES t1 WITH READ LOCK; + +# All these triggered the assertion +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +FLUSH TABLES; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +ALTER TABLE t1 COMMENT 'test'; + +UNLOCK TABLES; +DROP TABLE t1; diff --git a/mysql-test/t/func_encrypt_ucs2.test b/mysql-test/t/func_encrypt_ucs2.test new file mode 100644 index 00000000000..8b4cd44d354 --- /dev/null +++ b/mysql-test/t/func_encrypt_ucs2.test @@ -0,0 +1,12 @@ +-- source include/have_ssl_crypto_functs.inc +-- source include/have_ucs2.inc + +--echo # +--echo # Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed. +--echo # + +SELECT CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2))); +SELECT CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED); + +SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2))); +SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED); diff --git a/mysql-test/t/func_set.test b/mysql-test/t/func_set.test index 294efa8caf1..3531864c860 100644 --- a/mysql-test/t/func_set.test +++ b/mysql-test/t/func_set.test @@ -97,3 +97,25 @@ SELECT CONVERT( a USING latin1 ) FROM t1; SELECT CONVERT( a USING latin1 ) FROM t2; DROP TABLE t1, t2; + +--echo # +--echo # BUG#59405: FIND_IN_SET won't work normaly after upgrade from 5.1 to 5.5 +--echo # + +CREATE TABLE t1(days set('1','2','3','4','5','6','7')); +INSERT INTO t1 VALUES('1,2,3,4,5,6,7'), (NULL), ('1,2,3,4,5,6,7'); + +--echo +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days); +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days) IS UNKNOWN; +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL); +SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL) IS UNKNOWN; +SELECT * FROM t1 WHERE FIND_IN_SET(7, days); +SELECT * FROM t1 WHERE FIND_IN_SET(8, days); +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days); +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days) IS UNKNOWN; +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL); +SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL) IS UNKNOWN; + +--echo +DROP TABLE t1; diff --git a/mysql-test/t/grant.test b/mysql-test/t/grant.test index 845b976c031..1e1cb6c24dc 100644 --- a/mysql-test/t/grant.test +++ b/mysql-test/t/grant.test @@ -1396,6 +1396,183 @@ DROP USER testuser@localhost; use test; --echo + +--echo # +--echo # Test for bug #36544 "DROP USER does not remove stored function +--echo # privileges". +--echo # +create database mysqltest1; +create function mysqltest1.f1() returns int return 0; +create procedure mysqltest1.p1() begin end; +--echo # +--echo # 1) Check that DROP USER properly removes privileges on both +--echo # stored procedures and functions. +--echo # +create user mysqluser1@localhost; +grant execute on function mysqltest1.f1 to mysqluser1@localhost; +grant execute on procedure mysqltest1.p1 to mysqluser1@localhost; + +--echo # Quick test that granted privileges are properly reflected +--echo # in privilege tables and in in-memory structures. +show grants for mysqluser1@localhost; +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +--echo # +--echo # Create connection 'bug_36544_con1' as 'mysqluser1@localhost'. +--connect (bug36544_con1,localhost,mysqluser1,,) +call mysqltest1.p1(); +select mysqltest1.f1(); + +--echo # +--echo # Switch to connection 'default'. +--connection default +drop user mysqluser1@localhost; + +--echo # +--echo # Test that dropping of user is properly reflected in +--echo # both privilege tables and in in-memory structures. +--echo # +--echo # Switch to connection 'bug36544_con1'. +--connection bug36544_con1 +--echo # The connection cold be alive but should not be able to +--echo # access to any of the stored routines. +--error ER_PROCACCESS_DENIED_ERROR +call mysqltest1.p1(); +--error ER_PROCACCESS_DENIED_ERROR +select mysqltest1.f1(); +--disconnect bug36544_con1 + +--echo # +--echo # Switch to connection 'default'. +--connection default +--echo # +--echo # Now create user with the same name and check that he +--echo # has not inherited privileges. +create user mysqluser1@localhost; +show grants for mysqluser1@localhost; +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +--echo # +--echo # Create connection 'bug_36544_con2' as 'mysqluser1@localhost'. +--connect (bug36544_con2,localhost,mysqluser1,,) +--echo # Newly created user should not be able to access any of the routines. +--error ER_PROCACCESS_DENIED_ERROR +call mysqltest1.p1(); +--error ER_PROCACCESS_DENIED_ERROR +select mysqltest1.f1(); +--echo # +--echo # Switch to connection 'default'. +--connection default + +--echo # +--echo # 2) Check that RENAME USER properly updates privileges on both +--echo # stored procedures and functions. +--echo # +grant execute on function mysqltest1.f1 to mysqluser1@localhost; +grant execute on procedure mysqltest1.p1 to mysqluser1@localhost; +--echo # +--echo # Create one more user to make in-memory hashes non-trivial. +--echo # User names 'mysqluser11' and 'mysqluser10' were selected +--echo # to trigger bug discovered during code inspection. +create user mysqluser11@localhost; +grant execute on function mysqltest1.f1 to mysqluser11@localhost; +grant execute on procedure mysqltest1.p1 to mysqluser11@localhost; +--echo # Also create a couple of tables to test for another bug +--echo # discovered during code inspection (again table names were +--echo # chosen especially to trigger the bug). +create table mysqltest1.t11 (i int); +create table mysqltest1.t22 (i int); +grant select on mysqltest1.t22 to mysqluser1@localhost; +grant select on mysqltest1.t11 to mysqluser1@localhost; + +--echo # Quick test that granted privileges are properly reflected +--echo # in privilege tables and in in-memory structures. +show grants for mysqluser1@localhost; +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost'; +--echo # +--echo # Switch to connection 'bug36544_con2'. +--connection bug36544_con2 +call mysqltest1.p1(); +select mysqltest1.f1(); +select * from mysqltest1.t11; +select * from mysqltest1.t22; + +--echo # +--echo # Switch to connection 'default'. +--connection default +rename user mysqluser1@localhost to mysqluser10@localhost; + +--echo # +--echo # Test that there are no privileges left for mysqluser1. +--echo # +--echo # Switch to connection 'bug36544_con2'. +--connection bug36544_con2 +--echo # The connection cold be alive but should not be able to +--echo # access to any of the stored routines or tables. +--error ER_PROCACCESS_DENIED_ERROR +call mysqltest1.p1(); +--error ER_PROCACCESS_DENIED_ERROR +select mysqltest1.f1(); +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t11; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t22; +--disconnect bug36544_con2 + +--echo # +--echo # Switch to connection 'default'. +--connection default +--echo # +--echo # Now create user with the old name and check that he +--echo # has not inherited privileges. +create user mysqluser1@localhost; +show grants for mysqluser1@localhost; +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser1' and host='localhost'; +select db, table_name, table_priv from mysql.tables_priv where user='mysqluser1' and host='localhost'; +--echo # +--echo # Create connection 'bug_36544_con3' as 'mysqluser1@localhost'. +--connect (bug36544_con3,localhost,mysqluser1,,) +--echo # Newly created user should not be able to access to any of the +--echo # stored routines or tables. +--error ER_PROCACCESS_DENIED_ERROR +call mysqltest1.p1(); +--error ER_PROCACCESS_DENIED_ERROR +select mysqltest1.f1(); +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t11; +--error ER_TABLEACCESS_DENIED_ERROR +select * from mysqltest1.t22; +--disconnect bug36544_con3 + +--echo # +--echo # Switch to connection 'default'. +--connection default +--echo # +--echo # Now check that privileges became associated with a new user +--echo # name - mysqluser10. +--echo # +show grants for mysqluser10@localhost; +select db, routine_name, routine_type, proc_priv from mysql.procs_priv where user='mysqluser10' and host='localhost'; +select db, table_name, table_priv from mysql.tables_priv where user='mysqluser10' and host='localhost'; +--echo # +--echo # Create connection 'bug_36544_con4' as 'mysqluser10@localhost'. +--connect (bug36544_con4,localhost,mysqluser10,,) +call mysqltest1.p1(); +select mysqltest1.f1(); +select * from mysqltest1.t11; +select * from mysqltest1.t22; +--disconnect bug36544_con4 + +--echo # +--echo # Switch to connection 'default'. +--connection default +--echo # +--echo # Clean-up. +drop user mysqluser1@localhost; +drop user mysqluser10@localhost; +drop user mysqluser11@localhost; +drop database mysqltest1; + + --echo End of 5.0 tests # diff --git a/mysql-test/t/innodb_mysql_sync.test b/mysql-test/t/innodb_mysql_sync.test index a8925306c70..bf1e5de1587 100644 --- a/mysql-test/t/innodb_mysql_sync.test +++ b/mysql-test/t/innodb_mysql_sync.test @@ -253,26 +253,23 @@ connection con1; --reap --echo # Test 4: Secondary unique index, should not block reads. -# This requires HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE to be supported -# by InnoDB. Adding this flag currently introduces a regression so -# this test is disabled until the regression has been fixed. --echo # Connection default connection default; -#SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; -#--echo # Sending: -#--send ALTER TABLE t1 ADD UNIQUE (b) - -#--echo # Connection con1 -#connection con1; -#SET DEBUG_SYNC= "now WAIT_FOR manage"; -#SELECT * FROM t1; -#SET DEBUG_SYNC= "now SIGNAL query"; - -#--echo # Connection default -#connection default; -#--echo # Reaping: ALTER TABLE t1 ADD UNIQUE (b) -#--reap +SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query"; +--echo # Sending: +--send ALTER TABLE t1 ADD UNIQUE (b) + +--echo # Connection con1 +connection con1; +SET DEBUG_SYNC= "now WAIT_FOR manage"; +SELECT * FROM t1; +SET DEBUG_SYNC= "now SIGNAL query"; + +--echo # Connection default +connection default; +--echo # Reaping: ALTER TABLE t1 ADD UNIQUE (b) +--reap disconnect con1; disconnect con2; diff --git a/mysql-test/t/mysqlcheck.test b/mysql-test/t/mysqlcheck.test index dd113cb4e74..8f93ac7b864 100644 --- a/mysql-test/t/mysqlcheck.test +++ b/mysql-test/t/mysqlcheck.test @@ -2,6 +2,8 @@ # Embedded server doesn't support external clients --source include/not_embedded.inc +--source include/have_innodb.inc + # check that CSV engine was compiled in, as the result of the test # depends on the presence of the log tables (which are CSV-based). --source include/have_csv.inc @@ -34,7 +36,7 @@ drop database if exists client_test_db; # # Bug #16502: mysqlcheck tries to check views # -create table t1 (a int); +create table t1 (a int) engine=myisam; create view v1 as select * from t1; --replace_result 'Table is already up to date' OK --exec $MYSQL_CHECK --analyze --databases test @@ -48,8 +50,8 @@ drop table t1; # # Bug #30654: mysqlcheck fails during upgrade of tables whose names include backticks # -create table `t``1`(a int); -create table `t 1`(a int); +create table `t``1`(a int) engine=myisam; +create table `t 1`(a int) engine=myisam; --replace_result 'Table is already up to date' OK --exec $MYSQL_CHECK --databases test drop table `t``1`, `t 1`; @@ -59,7 +61,7 @@ drop table `t``1`, `t 1`; # create database d_bug25347; use d_bug25347; -create table t_bug25347 (a int); +create table t_bug25347 (a int) engine=myisam; create view v_bug25347 as select * from t_bug25347; insert into t_bug25347 values (1),(2),(3); flush tables; @@ -91,8 +93,8 @@ drop view v1; # Bug#37527: mysqlcheck fails to report entire database # when frm file corruption # -CREATE TABLE t1(a INT); -CREATE TABLE t2(a INT); +CREATE TABLE t1(a INT) engine=myisam; +CREATE TABLE t2(a INT) engine=myisam; # backup then null t1.frm --copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t1.frm.bak --remove_file $MYSQLD_DATADIR/test/t1.frm @@ -112,7 +114,7 @@ DROP TABLE t1, t2; # # Bug #30679: 5.1 name encoding not performed for views during upgrade # -create table t1(a int); +create table t1(a int) engine=myisam; create view v1 as select * from t1; show tables; let $MYSQLD_DATADIR= `select @@datadir`; @@ -131,7 +133,7 @@ drop table t1; # triggers # SET NAMES utf8; -CREATE TABLE `#mysql50#@` (a INT); +CREATE TABLE `#mysql50#@` (a INT) engine=myisam; SHOW TABLES; SET NAMES DEFAULT; --echo mysqlcheck --fix-table-names --databases test @@ -140,7 +142,7 @@ SET NAMES utf8; SHOW TABLES; DROP TABLE `@`; -CREATE TABLE `Ñ` (a INT); +CREATE TABLE `Ñ` (a INT) engine=myisam; SET NAMES DEFAULT; --echo mysqlcheck --default-character-set="latin1" --databases test # Error returned depends on platform, replace it with "Table doesn't exist" @@ -154,8 +156,8 @@ SET NAMES DEFAULT; CREATE DATABASE `#mysql50#a@b`; USE `#mysql50#a@b`; -CREATE TABLE `#mysql50#c@d` (a INT); -CREATE TABLE t1 (a INT); +CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam; +CREATE TABLE t1 (a INT) engine=myisam; # Create 5.0 like triggers let $MYSQLTEST_VARDIR= `select @@datadir`; @@ -207,12 +209,12 @@ USE test; drop table if exists `#mysql50#t1-1`; --enable_warnings -create table `#mysql50#t1-1` (a int); +create table `#mysql50#t1-1` (a int) engine=myisam; --exec $MYSQL_CHECK --all-in-1 --fix-table-names --databases test show tables like 't1-1'; drop table `t1-1`; -create table `#mysql50#t1-1` (a int); +create table `#mysql50#t1-1` (a int) engine=myisam; --exec $MYSQL_CHECK --all-in-1 --fix-table-names test "#mysql50#t1-1" show tables like 't1-1'; drop table `t1-1`; @@ -229,3 +231,83 @@ drop table `t1-1`; --error 1 --exec $MYSQL_CHECK -aoc test "#mysql50#t1-1" + +--echo # +--echo # Bug#11755431 47205: MAP 'REPAIR TABLE' TO RECREATE +ANALYZE FOR +--echo # ENGINES NOT SUPPORTING NATIVE +--echo # + +--disable_warnings +DROP TABLE IF EXISTS bug47205; +--enable_warnings + +--echo # +--echo # Test 1: Check that ALTER TABLE ... rebuilds the table + +CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY) + DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb; + +INSERT INTO bug47205 VALUES ("foobar"); +FLUSH TABLE bug47205; + +--echo # Replace the FRM with a 5.0 FRM that will require upgrade +let $MYSQLD_DATADIR= `select @@datadir`; +--remove_file $MYSQLD_DATADIR/test/bug47205.frm +--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm + +--echo # Should indicate that ALTER TABLE ... FORCE is needed +CHECK TABLE bug47205 FOR UPGRADE; + +--echo # ALTER TABLE ... FORCE should rebuild the table +--echo # and therefore output "affected rows: 1" +--enable_info +ALTER TABLE bug47205 FORCE; +--disable_info + +--echo # Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; + +DROP TABLE bug47205; + +--echo # +--echo # Test 2: InnoDB - REPAIR not supported + +CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY) + DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb; + +FLUSH TABLE bug47205; + +--echo # Replace the FRM with a 5.0 FRM that will require upgrade +let $MYSQLD_DATADIR= `select @@datadir`; +--remove_file $MYSQLD_DATADIR/test/bug47205.frm +--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm + +--echo # Should indicate that ALTER TABLE .. FORCE is needed +CHECK TABLE bug47205 FOR UPGRADE; + +--echo # Running mysqlcheck to check and upgrade +--exec $MYSQL_CHECK --check-upgrade --auto-repair test + +--echo # Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; + +DROP TABLE bug47205; + +--echo # +--echo # Test 3: MyISAM - REPAIR supported + +--echo # Use an old FRM that will require upgrade +--copy_file std_data/bug36055.frm $MYSQLD_DATADIR/test/bug47205.frm +--copy_file std_data/bug36055.MYD $MYSQLD_DATADIR/test/bug47205.MYD +--copy_file std_data/bug36055.MYI $MYSQLD_DATADIR/test/bug47205.MYI + +--echo # Should indicate that REPAIR TABLE is needed +CHECK TABLE bug47205 FOR UPGRADE; + +--echo # Running mysqlcheck to check and upgrade +--exec $MYSQL_CHECK --check-upgrade --auto-repair test + +--echo # Table should now be ok +CHECK TABLE bug47205 FOR UPGRADE; + +DROP TABLE bug47205; diff --git a/mysql-test/t/partition.test b/mysql-test/t/partition.test index f2e8cbb2da2..7fb5f434b83 100644 --- a/mysql-test/t/partition.test +++ b/mysql-test/t/partition.test @@ -15,6 +15,49 @@ drop table if exists t1, t2; --enable_warnings --echo # +--echo # Bug#59297: Can't find record in 'tablename' on update inner join +--echo # + +CREATE TABLE t1 ( +a char(2) NOT NULL, +b char(2) NOT NULL, +c int(10) unsigned NOT NULL, +d varchar(255) DEFAULT NULL, +e varchar(1000) DEFAULT NULL, +PRIMARY KEY (a, b, c), +KEY (a), +KEY (a, b) +) +/*!50100 PARTITION BY KEY (a) +PARTITIONS 20 */; + +INSERT INTO t1 (a, b, c, d, e) VALUES +('07', '03', 343, '1', '07_03_343'), +('01', '04', 343, '2', '01_04_343'), +('01', '06', 343, '3', '01_06_343'), +('01', '07', 343, '4', '01_07_343'), +('01', '08', 343, '5', '01_08_343'), +('01', '09', 343, '6', '01_09_343'), +('03', '03', 343, '7', '03_03_343'), +('03', '06', 343, '8', '03_06_343'), +('03', '07', 343, '9', '03_07_343'), +('04', '03', 343, '10', '04_03_343'), +('04', '06', 343, '11', '04_06_343'), +('05', '03', 343, '12', '05_03_343'), +('11', '03', 343, '13', '11_03_343'), +('11', '04', 343, '14', '11_04_343') +; + +UPDATE t1 AS A, +(SELECT '03' AS a, '06' AS b, 343 AS c, 'last' AS d) AS B +SET A.e = B.d +WHERE A.a = '03' +AND A.b = '06' +AND A.c = 343; + +DROP TABLE t1; + +--echo # --echo # Bug#57778: failed primary key add to partitioned innodb table --echo # inconsistent and crashes --echo # diff --git a/mysql-test/t/xml.test b/mysql-test/t/xml.test index 3bc580fe4e5..89c0b8992b1 100644 --- a/mysql-test/t/xml.test +++ b/mysql-test/t/xml.test @@ -646,6 +646,11 @@ SELECT EXTRACTVALUE('', LPAD(0.1111E-15, '2011', 1)); SELECT UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1'); SELECT UPDATEXML(CONVERT(_latin1'<!--' USING utf8),'1','1'); +--echo # +--echo # Bug#11766725 (bug#59901): EXTRACTVALUE STILL BROKEN AFTER FIX FOR BUG #44332 +--echo # +SELECT ExtractValue(CONVERT('<\"', BINARY(10)), 1); + --echo End of 5.1 tests diff --git a/mysys/default.c b/mysys/default.c index 9a4b990f003..805dc5f3f58 100644 --- a/mysys/default.c +++ b/mysys/default.c @@ -140,7 +140,7 @@ static int search_default_file_with_ext(Process_option_func func, - Unix: /etc/ - Unix: /etc/mysql/ - Unix: --sysconfdir=<path> (compile-time option) - - ALL: getenv(DEFAULT_HOME_ENV) + - ALL: getenv("MYSQL_HOME") - ALL: --defaults-extra-file=<path> (run-time option) - Unix: ~/ @@ -1232,7 +1232,7 @@ static const char **init_default_directories(MEM_ROOT *alloc) #endif - if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV)))) + if ((env= getenv("MYSQL_HOME"))) errors += add_directory(alloc, env, dirs); /* Placeholder for --defaults-extra-file=<path> */ diff --git a/mysys/my_init.c b/mysys/my_init.c index 9a17d0d6916..4963ce9b577 100644 --- a/mysys/my_init.c +++ b/mysys/my_init.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2000, 2011 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 @@ -37,8 +37,6 @@ static my_bool win32_init_tcp_ip(); #define SCALE_USEC 10000 my_bool my_init_done= 0; -/** True if @c my_basic_init() has been called. */ -my_bool my_basic_init_done= 0; uint mysys_usage_id= 0; /* Incremented for each my_init() */ ulong my_thread_stack_size= 65536; @@ -56,23 +54,22 @@ static ulong atoi_octal(const char *str) MYSQL_FILE *mysql_stdin= NULL; static MYSQL_FILE instrumented_stdin; + /** - Perform a limited initialisation of mysys. - This initialisation is sufficient to: - - allocate memory, - - read configuration files, - - parse command lines arguments. - To complete the mysys initialisation, - call my_init(). - @return 0 on success + Initialize my_sys functions, resources and variables + + @return Initialization result + @retval 0 Success + @retval 1 Error. Couldn't initialize environment */ -my_bool my_basic_init(void) +my_bool my_init(void) { - char * str; + char *str; - if (my_basic_init_done) + if (my_init_done) return 0; - my_basic_init_done= 1; + + my_init_done= 1; mysys_usage_id++; my_umask= 0660; /* Default umask for new files */ @@ -105,41 +102,11 @@ my_bool my_basic_init(void) #if defined(HAVE_PTHREAD_INIT) pthread_init(); /* Must be called before DBUG_ENTER */ #endif - if (my_thread_basic_global_init()) - return 1; /* $HOME is needed early to parse configuration files located in ~/ */ if ((home_dir= getenv("HOME")) != 0) home_dir= intern_filename(home_dir_buff, home_dir); - return 0; -} - - -/* - Init my_sys functions and my_sys variabels - - SYNOPSIS - my_init() - - RETURN - 0 ok - 1 Couldn't initialize environment -*/ - -my_bool my_init(void) -{ - if (my_init_done) - return 0; - - my_init_done= 1; - - if (my_basic_init()) - return 1; - - if (my_thread_global_init()) - return 1; - { DBUG_ENTER("my_init"); DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown")); @@ -256,7 +223,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n", #endif /* __WIN__ */ my_init_done=0; - my_basic_init_done= 0; } /* my_end */ diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c index a672d8af818..28f6412ed5b 100644 --- a/mysys/my_thr_init.c +++ b/mysys/my_thr_init.c @@ -1,4 +1,4 @@ -/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2000, 2011 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 @@ -66,86 +66,40 @@ nptl_pthread_exit_hack_handler(void *arg __attribute((unused))) static uint get_thread_lib(void); -/** True if @c my_thread_basic_global_init() has been called. */ -static my_bool my_thread_basic_global_init_done= 0; +/** True if @c my_thread_global_init() has been called. */ +static my_bool my_thread_global_init_done= 0; -/** - Perform a minimal initialisation of mysys, when compiled with threads. - The initialisation performed is sufficient to: - - allocate memory - - perform file operations - - use charsets - - use my_errno - @sa my_basic_init - @sa my_thread_basic_global_reinit -*/ -my_bool my_thread_basic_global_init(void) -{ - int pth_ret; - - if (my_thread_basic_global_init_done) - return 0; - my_thread_basic_global_init_done= 1; - -#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP - /* - Set mutex type to "fast" a.k.a "adaptive" - - In this case the thread may steal the mutex from some other thread - that is waiting for the same mutex. This will save us some - context switches but may cause a thread to 'starve forever' while - waiting for the mutex (not likely if the code within the mutex is - short). - */ - pthread_mutexattr_init(&my_fast_mutexattr); - pthread_mutexattr_settype(&my_fast_mutexattr, - PTHREAD_MUTEX_ADAPTIVE_NP); -#endif - -#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP - /* - Set mutex type to "errorcheck" - */ - pthread_mutexattr_init(&my_errorcheck_mutexattr); - pthread_mutexattr_settype(&my_errorcheck_mutexattr, - PTHREAD_MUTEX_ERRORCHECK); -#endif - - mysql_mutex_init(key_THR_LOCK_malloc, &THR_LOCK_malloc, MY_MUTEX_INIT_FAST); - mysql_mutex_init(key_THR_LOCK_open, &THR_LOCK_open, MY_MUTEX_INIT_FAST); - mysql_mutex_init(key_THR_LOCK_charset, &THR_LOCK_charset, MY_MUTEX_INIT_FAST); - mysql_mutex_init(key_THR_LOCK_threads, &THR_LOCK_threads, MY_MUTEX_INIT_FAST); - - if ((pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0) - { - fprintf(stderr, "Can't initialize threads: error %d\n", pth_ret); - return 1; - } - - if (my_thread_init()) - return 1; - - return 0; -} /** - Re-initialize components initialized early with @c my_thread_basic_global_init. + Re-initialize components initialized early with @c my_thread_global_init. Some mutexes were initialized before the instrumentation. Destroy + create them again, now that the instrumentation is in place. This is safe, since this function() is called before creating new threads, so the mutexes are not in use. */ -void my_thread_basic_global_reinit(void) +void my_thread_global_reinit(void) { struct st_my_thread_var *tmp; - DBUG_ASSERT(my_thread_basic_global_init_done); + DBUG_ASSERT(my_thread_global_init_done); #ifdef HAVE_PSI_INTERFACE my_init_mysys_psi_keys(); #endif + mysql_mutex_destroy(&THR_LOCK_isam); + mysql_mutex_init(key_THR_LOCK_isam, &THR_LOCK_isam, MY_MUTEX_INIT_SLOW); + + mysql_mutex_destroy(&THR_LOCK_heap); + mysql_mutex_init(key_THR_LOCK_heap, &THR_LOCK_heap, MY_MUTEX_INIT_FAST); + + mysql_mutex_destroy(&THR_LOCK_net); + mysql_mutex_init(key_THR_LOCK_net, &THR_LOCK_net, MY_MUTEX_INIT_FAST); + + mysql_mutex_destroy(&THR_LOCK_myisam); + mysql_mutex_init(key_THR_LOCK_myisam, &THR_LOCK_myisam, MY_MUTEX_INIT_SLOW); + mysql_mutex_destroy(&THR_LOCK_malloc); mysql_mutex_init(key_THR_LOCK_malloc, &THR_LOCK_malloc, MY_MUTEX_INIT_FAST); @@ -158,6 +112,9 @@ void my_thread_basic_global_reinit(void) mysql_mutex_destroy(&THR_LOCK_threads); mysql_mutex_init(key_THR_LOCK_threads, &THR_LOCK_threads, MY_MUTEX_INIT_FAST); + mysql_cond_destroy(&THR_COND_threads); + mysql_cond_init(key_THR_COND_threads, &THR_COND_threads, NULL); + tmp= my_pthread_getspecific(struct st_my_thread_var*, THR_KEY_mysys); DBUG_ASSERT(tmp); @@ -181,7 +138,48 @@ void my_thread_basic_global_reinit(void) my_bool my_thread_global_init(void) { - if (my_thread_basic_global_init()) + int pth_ret; + + if (my_thread_global_init_done) + return 0; + my_thread_global_init_done= 1; + +#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP + /* + Set mutex type to "fast" a.k.a "adaptive" + + In this case the thread may steal the mutex from some other thread + that is waiting for the same mutex. This will save us some + context switches but may cause a thread to 'starve forever' while + waiting for the mutex (not likely if the code within the mutex is + short). + */ + pthread_mutexattr_init(&my_fast_mutexattr); + pthread_mutexattr_settype(&my_fast_mutexattr, + PTHREAD_MUTEX_ADAPTIVE_NP); +#endif + +#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP + /* + Set mutex type to "errorcheck" + */ + pthread_mutexattr_init(&my_errorcheck_mutexattr); + pthread_mutexattr_settype(&my_errorcheck_mutexattr, + PTHREAD_MUTEX_ERRORCHECK); +#endif + + if ((pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0) + { + fprintf(stderr, "Can't initialize threads: error %d\n", pth_ret); + return 1; + } + + mysql_mutex_init(key_THR_LOCK_malloc, &THR_LOCK_malloc, MY_MUTEX_INIT_FAST); + mysql_mutex_init(key_THR_LOCK_open, &THR_LOCK_open, MY_MUTEX_INIT_FAST); + mysql_mutex_init(key_THR_LOCK_charset, &THR_LOCK_charset, MY_MUTEX_INIT_FAST); + mysql_mutex_init(key_THR_LOCK_threads, &THR_LOCK_threads, MY_MUTEX_INIT_FAST); + + if (my_thread_init()) return 1; thd_lib_detected= get_thread_lib(); @@ -233,11 +231,6 @@ my_bool my_thread_global_init(void) install_sigabrt_handler(); #endif - if (my_thread_init()) - { - my_thread_global_end(); /* Clean up */ - return 1; - } return 0; } @@ -300,7 +293,7 @@ void my_thread_global_end(void) mysql_mutex_destroy(&LOCK_gethostbyname_r); #endif - my_thread_basic_global_init_done= 0; + my_thread_global_init_done= 0; } static my_thread_id thread_id= 0; diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 48cdaaa6c91..e4999dbbe81 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -704,11 +704,11 @@ void my_safe_print_str(const char *val, int len) { __try { - fprintf(stderr,"=%.*s\n", len, val); + fprintf(stderr, "%.*s\n", len, val); } __except(EXCEPTION_EXECUTE_HANDLER) { - fprintf(stderr,"is an invalid string pointer\n"); + fprintf(stderr, "is an invalid string pointer\n"); } } #endif /*__WIN__*/ diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 74f5e116ccf..0e70ae60068 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -4448,6 +4448,7 @@ int ha_partition::index_read_idx_map(uchar *buf, uint index, break; } } + m_last_part= part; } else { diff --git a/sql/handler.cc b/sql/handler.cc index 9ca1f3a20f8..fefc0553c88 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -3214,9 +3214,13 @@ int handler::ha_repair(THD* thd, HA_CHECK_OPT* check_opt) mark_trx_read_write(); - if ((result= repair(thd, check_opt))) - return result; - return update_frm_version(table); + result= repair(thd, check_opt); + DBUG_ASSERT(result == HA_ADMIN_NOT_IMPLEMENTED || + ha_table_flags() & HA_CAN_REPAIR); + + if (result == HA_ADMIN_OK) + result= update_frm_version(table); + return result; } diff --git a/sql/handler.h b/sql/handler.h index 3cd4acee80d..ca72640f887 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -153,6 +153,12 @@ ordered. */ #define HA_DUPLICATE_KEY_NOT_IN_ORDER (LL(1) << 36) +/* + Engine supports REPAIR TABLE. Used by CHECK TABLE FOR UPGRADE if an + incompatible table is detected. If this flag is set, CHECK TABLE FOR UPGRADE + will report ER_TABLE_NEEDS_UPGRADE, otherwise ER_TABLE_NEED_REBUILD. +*/ +#define HA_CAN_REPAIR (LL(1) << 37) /* Set of all binlog flags. Currently only contain the capabilities @@ -2010,7 +2016,10 @@ private: upon the table. */ virtual int repair(THD* thd, HA_CHECK_OPT* check_opt) - { return HA_ADMIN_NOT_IMPLEMENTED; } + { + DBUG_ASSERT(!(ha_table_flags() & HA_CAN_REPAIR)); + return HA_ADMIN_NOT_IMPLEMENTED; + } virtual void start_bulk_insert(ha_rows rows) {} virtual int end_bulk_insert() { return 0; } virtual int index_read(uchar * buf, const uchar * key, uint key_len, diff --git a/sql/item.cc b/sql/item.cc index c7787d65c22..2090a1e4eda 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2514,7 +2514,9 @@ my_decimal *Item_float::val_decimal(my_decimal *decimal_value) void Item_string::print(String *str, enum_query_type query_type) { - if (query_type == QT_ORDINARY && is_cs_specified()) + const bool print_introducer= + !(query_type & QT_WITHOUT_INTRODUCERS) && is_cs_specified(); + if (print_introducer) { str->append('_'); str->append(collation.collation->csname); @@ -2522,27 +2524,52 @@ void Item_string::print(String *str, enum_query_type query_type) str->append('\''); - if (query_type == QT_ORDINARY || - my_charset_same(str_value.charset(), system_charset_info)) + if (query_type & QT_TO_SYSTEM_CHARSET) { - str_value.print(str); - } - else - { - THD *thd= current_thd; - LEX_STRING utf8_lex_str; + if (print_introducer) + { + /* + Because we wrote an introducer, we must print str_value in its + charset, and the resulting bytes must not be changed until they + reach the end client. + But the caller is asking for system_charset_info, and may later + convert into character_set_results. That means two conversions: we + must ensure that they don't change our printed bytes. + So we print str_value in the least common denominator of the three + charsets involved: ASCII. Non-ASCII characters are printed as \xFF + sequences (which is ASCII too). This way, our bytes will not be + changed. + */ + ErrConvString tmp(str_value.ptr(), str_value.length(), &my_charset_bin); + str->append(tmp.ptr()); + } + else + { + if (my_charset_same(str_value.charset(), system_charset_info)) + str_value.print(str); // already in system_charset_info + else // need to convert + { + THD *thd= current_thd; + LEX_STRING utf8_lex_str; - thd->convert_string(&utf8_lex_str, - system_charset_info, - str_value.c_ptr_safe(), - str_value.length(), - str_value.charset()); + thd->convert_string(&utf8_lex_str, + system_charset_info, + str_value.c_ptr_safe(), + str_value.length(), + str_value.charset()); - String utf8_str(utf8_lex_str.str, - utf8_lex_str.length, - system_charset_info); + String utf8_str(utf8_lex_str.str, + utf8_lex_str.length, + system_charset_info); - utf8_str.print(str); + utf8_str.print(str); + } + } + } + else + { + // Caller wants a result in the charset of str_value. + str_value.print(str); } str->append('\''); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index df541f603ee..68c63285693 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -3054,20 +3054,59 @@ void Item_func_case::fix_length_and_dec() agg[0]= args[first_expr_num]; left_result_type= agg[0]->result_type(); + /* + As the first expression and WHEN expressions + are intermixed in args[] array THEN and ELSE items, + extract the first expression and all WHEN expressions into + a temporary array, to process them easier. + */ for (nagg= 0; nagg < ncases/2 ; nagg++) agg[nagg+1]= args[nagg*2]; nagg++; if (!(found_types= collect_cmp_types(agg, nagg))) return; + if (found_types & (1 << STRING_RESULT)) + { + /* + If we'll do string comparison, we also need to aggregate + character set and collation for first/WHEN items and + install converters for some of them to cmp_collation when necessary. + This is done because cmp_item compatators cannot compare + strings in two different character sets. + Some examples when we install converters: + + 1. Converter installed for the first expression: + + CASE latin1_item WHEN utf16_item THEN ... END + + is replaced to: + + CASE CONVERT(latin1_item USING utf16) WHEN utf16_item THEN ... END + + 2. Converter installed for the left WHEN item: + CASE utf16_item WHEN latin1_item THEN ... END + + is replaced to: + + CASE utf16_item WHEN CONVERT(latin1_item USING utf16) THEN ... END + */ + if (agg_arg_charsets_for_comparison(cmp_collation, agg, nagg)) + return; + /* + Now copy first expression and all WHEN expressions back to args[] + arrray, because some of the items might have been changed to converters + (e.g. Item_func_conv_charset, or Item_string for constants). + */ + args[first_expr_num]= agg[0]; + for (nagg= 0; nagg < ncases / 2; nagg++) + args[nagg * 2]= agg[nagg + 1]; + } for (i= 0; i <= (uint)DECIMAL_RESULT; i++) { if (found_types & (1 << i) && !cmp_items[i]) { DBUG_ASSERT((Item_result)i != ROW_RESULT); - if ((Item_result)i == STRING_RESULT && - agg_arg_charsets_for_comparison(cmp_collation, agg, nagg)) - return; if (!(cmp_items[i]= cmp_item::get_comparator((Item_result)i, cmp_collation.collation))) diff --git a/sql/item_func.cc b/sql/item_func.cc index e7ea523adb3..1908eda7d99 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -866,7 +866,7 @@ longlong Item_func_numhybrid::val_int() return 0; char *end= (char*) res->ptr() + res->length(); - CHARSET_INFO *cs= str_value.charset(); + CHARSET_INFO *cs= res->charset(); return (*(cs->cset->strtoll10))(cs, res->ptr(), &end, &err_not_used); } default: @@ -3003,6 +3003,8 @@ void Item_func_find_in_set::fix_length_and_dec() String *find=args[0]->val_str(&value); if (find) { + // find is not NULL pointer so args[0] is not a null-value + DBUG_ASSERT(!args[0]->null_value); enum_value= find_type(((Field_enum*) field)->typelib,find->ptr(), find->length(), 0); enum_bit=0; @@ -3021,11 +3023,22 @@ longlong Item_func_find_in_set::val_int() DBUG_ASSERT(fixed == 1); if (enum_value) { - ulonglong tmp=(ulonglong) args[1]->val_int(); - if (!(null_value=args[1]->null_value || args[0]->null_value)) + // enum_value is set iff args[0]->const_item() in fix_length_and_dec(). + DBUG_ASSERT(args[0]->const_item()); + + ulonglong tmp= (ulonglong) args[1]->val_int(); + null_value= args[1]->null_value; + /* + No need to check args[0]->null_value since enum_value is set iff + args[0] is a non-null const item. Note: no DBUG_ASSERT on + args[0]->null_value here because args[0] may have been replaced + by an Item_cache on which val_int() has not been called. See + BUG#11766317 + */ + if (!null_value) { if (tmp & enum_bit) - return enum_value; + return enum_value; } return 0L; } diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 0248c133f60..ad18d5dabbe 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -699,6 +699,7 @@ String *Item_func_des_encrypt::val_str(String *str) tmp_arg[res_length-1]=tail; // save extra length tmp_value.realloc(res_length+1); tmp_value.length(res_length+1); + tmp_value.set_charset(&my_charset_bin); tmp_value[0]=(char) (128 | key_number); // Real encryption bzero((char*) &ivec,sizeof(ivec)); @@ -786,6 +787,7 @@ String *Item_func_des_decrypt::val_str(String *str) if ((tail=(uint) (uchar) tmp_value[length-2]) > 8) goto wrong_key; // Wrong key tmp_value.length(length-1-tail); + tmp_value.set_charset(&my_charset_bin); return &tmp_value; error: @@ -3448,14 +3450,68 @@ String *Item_func_quote::val_str(String *str) } arg_length= arg->length(); - new_length= arg_length+2; /* for beginning and ending ' signs */ - for (from= (char*) arg->ptr(), end= from + arg_length; from < end; from++) - new_length+= get_esc_bit(escmask, (uchar) *from); + if (collation.collation->mbmaxlen == 1) + { + new_length= arg_length + 2; /* for beginning and ending ' signs */ + for (from= (char*) arg->ptr(), end= from + arg_length; from < end; from++) + new_length+= get_esc_bit(escmask, (uchar) *from); + } + else + { + new_length= (arg_length * 2) + /* For string characters */ + (2 * collation.collation->mbmaxlen); /* For quotes */ + } if (tmp_value.alloc(new_length)) goto null; + if (collation.collation->mbmaxlen > 1) + { + CHARSET_INFO *cs= collation.collation; + int mblen; + uchar *to_end; + to= (char*) tmp_value.ptr(); + to_end= (uchar*) to + new_length; + + /* Put leading quote */ + if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0) + goto null; + to+= mblen; + + for (start= (char*) arg->ptr(), end= start + arg_length; start < end; ) + { + my_wc_t wc; + bool escape; + if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) start, (uchar*) end)) <= 0) + goto null; + start+= mblen; + switch (wc) { + case 0: escape= 1; wc= '0'; break; + case '\032': escape= 1; wc= 'Z'; break; + case '\'': escape= 1; break; + case '\\': escape= 1; break; + default: escape= 0; break; + } + if (escape) + { + if ((mblen= cs->cset->wc_mb(cs, '\\', (uchar*) to, to_end)) <= 0) + goto null; + to+= mblen; + } + if ((mblen= cs->cset->wc_mb(cs, wc, (uchar*) to, to_end)) <= 0) + goto null; + to+= mblen; + } + + /* Put trailing quote */ + if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0) + goto null; + to+= mblen; + new_length= to - tmp_value.ptr(); + goto ret; + } + /* We replace characters from the end to the beginning */ @@ -3487,6 +3543,8 @@ String *Item_func_quote::val_str(String *str) } } *to= '\''; + +ret: tmp_value.length(new_length); tmp_value.set_charset(collation.collation); null_value= 0; diff --git a/sql/item_strfunc.h b/sql/item_strfunc.h index fef4f9f975d..00a0b35ef58 100644 --- a/sql/item_strfunc.h +++ b/sql/item_strfunc.h @@ -787,9 +787,10 @@ public: String *val_str(String *); void fix_length_and_dec() { - ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 + 2; - max_length= (uint32) min(max_result_length, MAX_BLOB_WIDTH); collation.set(args[0]->collation); + ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 + + 2 * collation.collation->mbmaxlen; + max_length= (uint32) min(max_result_length, MAX_BLOB_WIDTH); } }; diff --git a/sql/mysqld.cc b/sql/mysqld.cc index d6bcc18d254..53f82e02e97 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2000, 2011, 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 @@ -1273,11 +1273,14 @@ static void __cdecl kill_server(int sig_ptr) /* Send event to smem_event_connect_request for aborting */ - if (!SetEvent(smem_event_connect_request)) - { - DBUG_PRINT("error", - ("Got error: %ld from SetEvent of smem_event_connect_request", - GetLastError())); + if (opt_enable_shared_memory) + { + if (!SetEvent(smem_event_connect_request)) + { + DBUG_PRINT("error", + ("Got error: %ld from SetEvent of smem_event_connect_request", + GetLastError())); + } } #endif @@ -4228,11 +4231,14 @@ int mysqld_main(int argc, char **argv) to be able to read defaults files and parse options. */ my_progname= argv[0]; - if (my_basic_init()) +#ifndef _WIN32 + // For windows, my_init() is called from the win specific mysqld_main + if (my_init()) // init my_sys library & pthreads { - fprintf(stderr, "my_basic_init() failed."); + fprintf(stderr, "my_init() failed."); return 1; } +#endif orig_argc= argc; orig_argv= argv; @@ -4331,11 +4337,10 @@ int mysqld_main(int argc, char **argv) recreate objects which were initialised early, so that they are instrumented as well. */ - my_thread_basic_global_reinit(); + my_thread_global_reinit(); } #endif /* HAVE_PSI_INTERFACE */ - my_init(); // init my_sys library & pthreads init_error_log_mutex(); /* Set signal used to kill MySQL */ @@ -4756,6 +4761,12 @@ int mysqld_main(int argc, char **argv) /* Must be initialized early for comparison of service name */ system_charset_info= &my_charset_utf8_general_ci; + if (my_init()) + { + fprintf(stderr, "my_init() failed."); + return 1; + } + if (Service.GetOS()) /* true NT family */ { char file_path[FN_REFLEN]; diff --git a/sql/mysqld.h b/sql/mysqld.h index 08c83257e67..7fa09ba77ac 100644 --- a/sql/mysqld.h +++ b/sql/mysqld.h @@ -402,16 +402,16 @@ enum options_mysqld /** - Query type constants. - - QT_ORDINARY -- ordinary SQL query. - QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without - character set introducers). + Query type constants (usable as bitmap flags). */ enum enum_query_type { - QT_ORDINARY, - QT_IS + /// Nothing specific, ordinary SQL query. + QT_ORDINARY= 0, + /// In utf8. + QT_TO_SYSTEM_CHARSET= (1 << 0), + /// Without character set introducers. + QT_WITHOUT_INTRODUCERS= (1 << 1) }; /* query_id */ diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 998e88704d8..0d315fe1441 100644 --- a/sql/share/errmsg-utf8.txt +++ b/sql/share/errmsg-utf8.txt @@ -6397,3 +6397,8 @@ ER_STMT_CACHE_FULL ER_MULTI_UPDATE_KEY_CONFLICT eng "Primary key/partition key update is not allowed since the table is updated both as '%-.192s' and '%-.192s'." + +# When translating this error message make sure to include "ALTER TABLE" in the +# message as mysqlcheck parses the error message looking for ALTER TABLE. +ER_TABLE_NEEDS_REBUILD + eng "Table rebuild required. Please do \"ALTER TABLE `%-.32s` FORCE\" or dump/reload to fix it!" diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 9c57b3c102d..fae609c0d4d 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2000, 2011, 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 @@ -5982,18 +5982,15 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, } -/* +/** Handle an in-memory privilege structure. - SYNOPSIS - handle_grant_struct() - struct_no The number of the structure to handle (0..3). - drop If user_from is to be dropped. - user_from The the user to be searched/dropped/renamed. - user_to The new name for the user if to be renamed, - NULL otherwise. + @param struct_no The number of the structure to handle (0..5). + @param drop If user_from is to be dropped. + @param user_from The the user to be searched/dropped/renamed. + @param user_to The new name for the user if to be renamed, NULL otherwise. - DESCRIPTION + @note Scan through all elements in an in-memory grant structure and apply the requested operation. Delete from grant structure if drop is true. @@ -6003,12 +6000,13 @@ static int handle_grant_table(TABLE_LIST *tables, uint table_no, bool drop, 0 acl_users 1 acl_dbs 2 column_priv_hash - 3 procs_priv_hash + 3 proc_priv_hash + 4 func_priv_hash + 5 acl_proxy_users - RETURN - > 0 At least one element matched. - 0 OK, but no element matched. - -1 Wrong arguments to function + @retval > 0 At least one element matched. + @retval 0 OK, but no element matched. + @retval -1 Wrong arguments to function. */ static int handle_grant_struct(uint struct_no, bool drop, @@ -6023,6 +6021,7 @@ static int handle_grant_struct(uint struct_no, bool drop, ACL_DB *acl_db= NULL; ACL_PROXY_USER *acl_proxy_user= NULL; GRANT_NAME *grant_name= NULL; + HASH *grant_name_hash= NULL; DBUG_ENTER("handle_grant_struct"); DBUG_PRINT("info",("scan struct: %u search: '%s'@'%s'", struct_no, user_from->user.str, user_from->host.str)); @@ -6042,9 +6041,15 @@ static int handle_grant_struct(uint struct_no, bool drop, break; case 2: elements= column_priv_hash.records; + grant_name_hash= &column_priv_hash; break; case 3: elements= proc_priv_hash.records; + grant_name_hash= &proc_priv_hash; + break; + case 4: + elements= func_priv_hash.records; + grant_name_hash= &func_priv_hash; break; case 5: elements= acl_proxy_users.elements; @@ -6077,21 +6082,19 @@ static int handle_grant_struct(uint struct_no, bool drop, break; case 2: - grant_name= (GRANT_NAME*) my_hash_element(&column_priv_hash, idx); - user= grant_name->user; - host= grant_name->host.hostname; - break; - case 3: - grant_name= (GRANT_NAME*) my_hash_element(&proc_priv_hash, idx); + case 4: + grant_name= (GRANT_NAME*) my_hash_element(grant_name_hash, idx); user= grant_name->user; host= grant_name->host.hostname; break; + case 5: acl_proxy_user= dynamic_element(&acl_proxy_users, idx, ACL_PROXY_USER*); user= acl_proxy_user->get_user(); host= acl_proxy_user->get_host(); break; + default: MY_ASSERT_UNREACHABLE(); } @@ -6121,11 +6124,9 @@ static int handle_grant_struct(uint struct_no, bool drop, break; case 2: - my_hash_delete(&column_priv_hash, (uchar*) grant_name); - break; - case 3: - my_hash_delete(&proc_priv_hash, (uchar*) grant_name); + case 4: + my_hash_delete(grant_name_hash, (uchar*) grant_name); break; case 5: @@ -6134,6 +6135,19 @@ static int handle_grant_struct(uint struct_no, bool drop, } elements--; + /* + - If we are iterating through an array then we just have moved all + elements after the current element one position closer to its head. + This means that we have to take another look at the element at + current position as it is a new element from the array's tail. + - If we are iterating through a hash the current element was replaced + with one of elements from the tail. So we also have to take a look + at the new element in current position. + Note that in our HASH implementation hash_delete() won't move any + elements with position after current one to position before the + current (i.e. from the tail to the head), so it is safe to continue + iteration without re-starting. + */ idx--; } else if ( user_to ) @@ -6151,22 +6165,41 @@ static int handle_grant_struct(uint struct_no, bool drop, case 2: case 3: - /* - Update the grant structure with the new user name and - host name - */ - grant_name->set_user_details(user_to->host.str, grant_name->db, - user_to->user.str, grant_name->tname, - TRUE); - - /* - Since username is part of the hash key, when the user name - is renamed, the hash key is changed. Update the hash to - ensure that the position matches the new hash key value - */ - my_hash_update(&column_priv_hash, (uchar*) grant_name, - (uchar*) grant_name->hash_key, grant_name->key_length); - break; + case 4: + { + /* + Save old hash key and its length to be able properly update + element position in hash. + */ + char *old_key= grant_name->hash_key; + size_t old_key_length= grant_name->key_length; + + /* + Update the grant structure with the new user name and host name. + */ + grant_name->set_user_details(user_to->host.str, grant_name->db, + user_to->user.str, grant_name->tname, + TRUE); + + /* + Since username is part of the hash key, when the user name + is renamed, the hash key is changed. Update the hash to + ensure that the position matches the new hash key value + */ + my_hash_update(grant_name_hash, (uchar*) grant_name, (uchar*) old_key, + old_key_length); + /* + hash_update() operation could have moved element from the tail + of the hash to the current position. So we need to take a look + at the element in current position once again. + Thanks to the fact that hash_update() for our HASH implementation + won't move any elements from the tail of the hash to the positions + before the current one (a.k.a. head) it is safe to continue + iteration without restarting. + */ + idx--; + break; + } case 5: acl_proxy_user->set_user (&mem, user_to->user.str); @@ -6258,7 +6291,7 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop, } } - /* Handle procedures table. */ + /* Handle stored routines table. */ if ((found= handle_grant_table(tables, 4, drop, user_from, user_to)) < 0) { /* Handle of table failed, don't touch in-memory array. */ @@ -6275,6 +6308,15 @@ static int handle_grant_data(TABLE_LIST *tables, bool drop, if (! drop && ! user_to) goto end; } + /* Handle funcs array. */ + if (((handle_grant_struct(4, drop, user_from, user_to) && ! result) || + found) && ! result) + { + result= 1; /* At least one record/element found. */ + /* If search is requested, we do not need to search further. */ + if (! drop && ! user_to) + goto end; + } } /* Handle tables table. */ diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index eb6853751ee..dea8d38938c 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -771,8 +771,12 @@ send_result_message: size_t length; protocol->store(STRING_WITH_LEN("error"), system_charset_info); - length=my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE), - table->table_name); + if (table->table->file->ha_table_flags() & HA_CAN_REPAIR) + length= my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE), + table->table_name); + else + length= my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_REBUILD), + table->table_name); protocol->store(buf, length, system_charset_info); fatal_error=1; break; diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 8b6cc2caf10..7c020515f87 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1026,7 +1026,7 @@ bool close_cached_tables(THD *thd, TABLE_LIST *tables, table_list= table_list->next_global) { /* A check that the table was locked for write is done by the caller. */ - TABLE *table= find_table_for_mdl_upgrade(thd->open_tables, table_list->db, + TABLE *table= find_table_for_mdl_upgrade(thd, table_list->db, table_list->table_name, TRUE); /* May return NULL if this table has already been closed via an alias. */ @@ -3120,22 +3120,26 @@ TABLE *find_locked_table(TABLE *list, const char *db, const char *table_name) lock from the list of open tables, emit error if no such table found. - @param list List of TABLE objects to be searched + @param thd Thread context @param db Database name. @param table_name Name of table. @param no_error Don't emit error if no suitable TABLE instance were found. + @note This function checks if the connection holds a global IX + metadata lock. If no such lock is found, it is not safe to + upgrade the lock and ER_TABLE_NOT_LOCKED_FOR_WRITE will be + reported. + @return Pointer to TABLE instance with MDL_SHARED_NO_WRITE, MDL_SHARED_NO_READ_WRITE, or MDL_EXCLUSIVE metadata lock, NULL otherwise. */ -TABLE *find_table_for_mdl_upgrade(TABLE *list, const char *db, - const char *table_name, - bool no_error) +TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db, + const char *table_name, bool no_error) { - TABLE *tab= find_locked_table(list, db, table_name); + TABLE *tab= find_locked_table(thd->open_tables, db, table_name); if (!tab) { @@ -3143,19 +3147,29 @@ TABLE *find_table_for_mdl_upgrade(TABLE *list, const char *db, my_error(ER_TABLE_NOT_LOCKED, MYF(0), table_name); return NULL; } - else + + /* + It is not safe to upgrade the metadata lock without a global IX lock. + This can happen with FLUSH TABLES <list> WITH READ LOCK as we in these + cases don't take a global IX lock in order to be compatible with + global read lock. + */ + if (!thd->mdl_context.is_lock_owner(MDL_key::GLOBAL, "", "", + MDL_INTENTION_EXCLUSIVE)) { - while (tab->mdl_ticket != NULL && - !tab->mdl_ticket->is_upgradable_or_exclusive() && - (tab= find_locked_table(tab->next, db, table_name))) - continue; - if (!tab) - { - if (!no_error) - my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), table_name); - return 0; - } + if (!no_error) + my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), table_name); + return NULL; } + + while (tab->mdl_ticket != NULL && + !tab->mdl_ticket->is_upgradable_or_exclusive() && + (tab= find_locked_table(tab->next, db, table_name))) + continue; + + if (!tab && !no_error) + my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), table_name); + return tab; } @@ -4653,8 +4667,7 @@ open_tables_check_upgradable_mdl(THD *thd, TABLE_LIST *tables_start, Note that find_table_for_mdl_upgrade() will report an error if no suitable ticket is found. */ - if (!find_table_for_mdl_upgrade(thd->open_tables, table->db, - table->table_name, FALSE)) + if (!find_table_for_mdl_upgrade(thd, table->db, table->table_name, false)) return TRUE; } } diff --git a/sql/sql_base.h b/sql/sql_base.h index 35fa04b3674..dc8320687fc 100644 --- a/sql/sql_base.h +++ b/sql/sql_base.h @@ -1,4 +1,4 @@ -/* Copyright 2006-2008 MySQL AB, 2008-2009 Sun Microsystems, Inc. +/* Copyright (c) 2006, 2011, 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 @@ -290,7 +290,7 @@ bool tdc_open_view(THD *thd, TABLE_LIST *table_list, const char *alias, char *cache_key, uint cache_key_length, MEM_ROOT *mem_root, uint flags); void tdc_flush_unused_tables(); -TABLE *find_table_for_mdl_upgrade(TABLE *list, const char *db, +TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db, const char *table_name, bool no_error); void mark_tmp_table_for_reuse(TABLE *table); diff --git a/sql/sql_lex.h b/sql/sql_lex.h index a9abe174d6e..e6b5f23f17e 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -944,20 +944,19 @@ inline bool st_select_lex_unit::is_union () #define ALTER_CHANGE_COLUMN_DEFAULT (1L << 8) #define ALTER_KEYS_ONOFF (1L << 9) #define ALTER_CONVERT (1L << 10) -#define ALTER_FORCE (1L << 11) -#define ALTER_RECREATE (1L << 12) -#define ALTER_ADD_PARTITION (1L << 13) -#define ALTER_DROP_PARTITION (1L << 14) -#define ALTER_COALESCE_PARTITION (1L << 15) -#define ALTER_REORGANIZE_PARTITION (1L << 16) -#define ALTER_PARTITION (1L << 17) -#define ALTER_ADMIN_PARTITION (1L << 18) -#define ALTER_TABLE_REORG (1L << 19) -#define ALTER_REBUILD_PARTITION (1L << 20) -#define ALTER_ALL_PARTITION (1L << 21) -#define ALTER_REMOVE_PARTITIONING (1L << 22) -#define ALTER_FOREIGN_KEY (1L << 23) -#define ALTER_TRUNCATE_PARTITION (1L << 24) +#define ALTER_RECREATE (1L << 11) +#define ALTER_ADD_PARTITION (1L << 12) +#define ALTER_DROP_PARTITION (1L << 13) +#define ALTER_COALESCE_PARTITION (1L << 14) +#define ALTER_REORGANIZE_PARTITION (1L << 15) +#define ALTER_PARTITION (1L << 16) +#define ALTER_ADMIN_PARTITION (1L << 17) +#define ALTER_TABLE_REORG (1L << 18) +#define ALTER_REBUILD_PARTITION (1L << 19) +#define ALTER_ALL_PARTITION (1L << 20) +#define ALTER_REMOVE_PARTITIONING (1L << 21) +#define ALTER_FOREIGN_KEY (1L << 22) +#define ALTER_TRUNCATE_PARTITION (1L << 23) enum enum_alter_table_change_level { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index d9e1245bf66..367699ea6cb 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -4439,7 +4439,11 @@ static bool execute_sqlcom_select(THD *thd, TABLE_LIST *all_tables) char buff[1024]; String str(buff,(uint32) sizeof(buff), system_charset_info); str.length(0); - thd->lex->unit.print(&str, QT_ORDINARY); + /* + The warnings system requires input in utf8, @see + mysqld_show_warnings(). + */ + thd->lex->unit.print(&str, QT_TO_SYSTEM_CHARSET); str.append('\0'); push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE, ER_YES, str.ptr()); diff --git a/sql/sql_reload.cc b/sql/sql_reload.cc index 0810459cb49..a09aa5511bd 100644 --- a/sql/sql_reload.cc +++ b/sql/sql_reload.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2011, 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 @@ -220,12 +220,26 @@ bool reload_acl_and_cache(THD *thd, unsigned long options, if (tables) { for (TABLE_LIST *t= tables; t; t= t->next_local) - if (!find_table_for_mdl_upgrade(thd->open_tables, t->db, - t->table_name, FALSE)) + if (!find_table_for_mdl_upgrade(thd, t->db, t->table_name, false)) return 1; } else { + /* + It is not safe to upgrade the metadata lock without GLOBAL IX lock. + This can happen with FLUSH TABLES <list> WITH READ LOCK as we in these + cases don't take a GLOBAL IX lock in order to be compatible with + global read lock. + */ + if (thd->open_tables && + !thd->mdl_context.is_lock_owner(MDL_key::GLOBAL, "", "", + MDL_INTENTION_EXCLUSIVE)) + { + my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), + thd->open_tables->s->table_name.str); + return true; + } + for (TABLE *tab= thd->open_tables; tab; tab= tab->next) { if (! tab->mdl_ticket->is_upgradable_or_exclusive()) diff --git a/sql/sql_string.cc b/sql/sql_string.cc index d19b876a82f..66f293a82c6 100644 --- a/sql/sql_string.cc +++ b/sql/sql_string.cc @@ -252,8 +252,8 @@ bool String::copy_aligned(const char *str,uint32 arg_length, uint32 offset, CHARSET_INFO *cs) { /* How many bytes are in incomplete character */ - offset= cs->mbmaxlen - offset; /* How many zeros we should prepend */ - DBUG_ASSERT(offset && offset != cs->mbmaxlen); + offset= cs->mbminlen - offset; /* How many zeros we should prepend */ + DBUG_ASSERT(offset && offset != cs->mbminlen); uint32 aligned_length= arg_length + offset; if (alloc(aligned_length)) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2855bb0ec4a..677d2095a77 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -1917,7 +1917,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists, by parser) it is safe to cache pointer to the TABLE instances in its elements. */ - table->table= find_table_for_mdl_upgrade(thd->open_tables, table->db, + table->table= find_table_for_mdl_upgrade(thd, table->db, table->table_name, false); if (!table->table) DBUG_RETURN(true); diff --git a/sql/sql_trigger.cc b/sql/sql_trigger.cc index c2e3cd9944a..e986f6d7e92 100644 --- a/sql/sql_trigger.cc +++ b/sql/sql_trigger.cc @@ -1,4 +1,4 @@ -/* Copyright (C) 2004-2005 MySQL AB, 2008-2009 Sun Microsystems, Inc +/* Copyright (c) 2004, 2011, 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 @@ -467,8 +467,7 @@ bool mysql_create_or_drop_trigger(THD *thd, TABLE_LIST *tables, bool create) if (thd->locked_tables_mode) { /* Under LOCK TABLES we must only accept write locked tables. */ - if (!(tables->table= find_table_for_mdl_upgrade(thd->open_tables, - tables->db, + if (!(tables->table= find_table_for_mdl_upgrade(thd, tables->db, tables->table_name, FALSE))) goto end; diff --git a/sql/sql_truncate.cc b/sql/sql_truncate.cc index 909c6a08b67..67ed608f114 100644 --- a/sql/sql_truncate.cc +++ b/sql/sql_truncate.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2010, 2011, 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 @@ -327,7 +327,7 @@ bool Truncate_statement::lock_table(THD *thd, TABLE_LIST *table_ref, */ if (thd->locked_tables_mode) { - if (!(table= find_table_for_mdl_upgrade(thd->open_tables, table_ref->db, + if (!(table= find_table_for_mdl_upgrade(thd, table_ref->db, table_ref->table_name, FALSE))) DBUG_RETURN(TRUE); diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 17b8056a165..6051aa028c7 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -841,7 +841,8 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, thd->variables.sql_mode&= ~MODE_ANSI_QUOTES; lex->unit.print(&view_query, QT_ORDINARY); - lex->unit.print(&is_query, QT_IS); + lex->unit.print(&is_query, + enum_query_type(QT_TO_SYSTEM_CHARSET | QT_WITHOUT_INTRODUCERS)); thd->variables.sql_mode|= sql_mode; } diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy index 02e0d347ef7..13a1b8029f2 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -6747,7 +6747,7 @@ alter_list_item: } | FORCE_SYM { - Lex->alter_info.flags|= ALTER_FORCE; + Lex->alter_info.flags|= ALTER_RECREATE; } | alter_order_clause { diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h index fec41c12b81..a56cc3dd799 100644 --- a/storage/archive/ha_archive.h +++ b/storage/archive/ha_archive.h @@ -90,7 +90,7 @@ public: return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_CAN_BIT_FIELD | HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_STATS_RECORDS_IS_EXACT | - HA_HAS_RECORDS | + HA_HAS_RECORDS | HA_CAN_REPAIR | HA_FILE_BASED | HA_CAN_INSERT_DELAYED | HA_CAN_GEOMETRY); } ulong index_flags(uint idx, uint part, bool all_parts) const diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index 845b50e3869..9fcaf2519c6 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -106,7 +106,8 @@ public: ulonglong table_flags() const { return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT | - HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE); + HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | + HA_CAN_REPAIR); } ulong index_flags(uint idx, uint part, bool all_parts) const { diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index e39bac525b5..6614b389b1f 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -149,7 +149,8 @@ public: HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | HA_NO_PREFIX_CHAR_KEYS | HA_PRIMARY_KEY_REQUIRED_FOR_DELETE | HA_NO_TRANSACTIONS /* until fixed by WL#2952 */ | - HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY); + HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY | + HA_CAN_REPAIR); } /* This is a bitmap of flags that says how the storage engine diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 3763e6f9cef..bea92903c58 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2597,6 +2597,7 @@ innobase_alter_table_flags( | HA_INPLACE_ADD_INDEX_NO_WRITE | HA_INPLACE_DROP_INDEX_NO_READ_WRITE | HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE + | HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE | HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE | HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE); } diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index c7b6b2239ce..16457088f9c 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -639,7 +639,7 @@ ha_myisam::ha_myisam(handlerton *hton, TABLE_SHARE *table_arg) HA_DUPLICATE_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY | HA_FILE_BASED | HA_CAN_GEOMETRY | HA_NO_TRANSACTIONS | HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS | - HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT), + HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT | HA_CAN_REPAIR), can_enable_indexes(1) {} diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc index 20e736a546f..46e02306aca 100644 --- a/storage/perfschema/unittest/pfs-t.cc +++ b/storage/perfschema/unittest/pfs-t.cc @@ -1205,6 +1205,8 @@ void test_enabled() void do_all_tests() { + /* Using initialize_performance_schema(), no partial init needed. */ + test_bootstrap(); test_bad_registration(); test_init_disabled(); diff --git a/storage/perfschema/unittest/pfs_instr-oom-t.cc b/storage/perfschema/unittest/pfs_instr-oom-t.cc index 13335326932..a00afe8b36a 100644 --- a/storage/perfschema/unittest/pfs_instr-oom-t.cc +++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc @@ -199,7 +199,11 @@ void test_oom() void do_all_tests() { + PFS_atomic::init(); + test_oom(); + + PFS_atomic::cleanup(); } int main(int, char **) diff --git a/storage/perfschema/unittest/pfs_instr-t.cc b/storage/perfschema/unittest/pfs_instr-t.cc index 2ef9a5769ca..b13135aa615 100644 --- a/storage/perfschema/unittest/pfs_instr-t.cc +++ b/storage/perfschema/unittest/pfs_instr-t.cc @@ -400,10 +400,14 @@ void test_per_thread_wait() void do_all_tests() { + PFS_atomic::init(); + test_no_instruments(); test_no_instances(); test_with_instances(); test_per_thread_wait(); + + PFS_atomic::cleanup(); } int main(int, char **) diff --git a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc index 9ccaf432ba2..95dccc420d7 100644 --- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc +++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc @@ -47,7 +47,11 @@ void test_oom() void do_all_tests() { + PFS_atomic::init(); + test_oom(); + + PFS_atomic::cleanup(); } int main(int, char **) diff --git a/storage/perfschema/unittest/pfs_instr_class-t.cc b/storage/perfschema/unittest/pfs_instr_class-t.cc index f9a1ee510b1..ac34f082fe8 100644 --- a/storage/perfschema/unittest/pfs_instr_class-t.cc +++ b/storage/perfschema/unittest/pfs_instr_class-t.cc @@ -554,6 +554,8 @@ void test_instruments_reset() void do_all_tests() { + PFS_atomic::init(); + test_no_registration(); test_mutex_registration(); test_rwlock_registration(); @@ -562,6 +564,8 @@ void do_all_tests() test_file_registration(); test_table_registration(); test_instruments_reset(); + + PFS_atomic::cleanup(); } int main(int, char **) diff --git a/storage/perfschema/unittest/pfs_timer-t.cc b/storage/perfschema/unittest/pfs_timer-t.cc index d8663c5ccda..69b554c7b31 100644 --- a/storage/perfschema/unittest/pfs_timer-t.cc +++ b/storage/perfschema/unittest/pfs_timer-t.cc @@ -105,7 +105,11 @@ void test_timers() void do_all_tests() { + PFS_atomic::init(); + test_timers(); + + PFS_atomic::cleanup(); } int main(int, char **) diff --git a/strings/xml.c b/strings/xml.c index 29ce74e36a0..abe40810a97 100644 --- a/strings/xml.c +++ b/strings/xml.c @@ -165,11 +165,16 @@ static int my_xml_scan(MY_XML_PARSER *p,MY_XML_ATTR *a) } else if ( (p->cur[0] == '"') || (p->cur[0] == '\'') ) { + /* + "string" or 'string' found. + Scan until the closing quote/doublequote, or until the END-OF-INPUT. + */ p->cur++; for (; ( p->cur < p->end ) && (p->cur[0] != a->beg[0]); p->cur++) {} a->end=p->cur; - if (a->beg[0] == p->cur[0])p->cur++; + if (p->cur < p->end) /* Closing quote or doublequote has been found */ + p->cur++; a->beg++; if (!(p->flags & MY_XML_FLAG_SKIP_TEXT_NORMALIZATION)) my_xml_norm_text(a); |