diff options
author | Michael Widenius <monty@askmonty.org> | 2011-11-30 22:57:18 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2011-11-30 22:57:18 +0200 |
commit | efcfb195e3fc4a2b87bfcb9ad136d46b9961f49e (patch) | |
tree | 9eb3b78e20ecf4bd9e5cd587db50d51c1f06d336 | |
parent | a7f87effa57f6486c23bf5b340c8474a635dcf71 (diff) | |
parent | 6378bdbf47af72b2f899853586faa5a2d2f0fee1 (diff) | |
download | mariadb-git-efcfb195e3fc4a2b87bfcb9ad136d46b9961f49e.tar.gz |
Merge with 5.1
51 files changed, 191 insertions, 241 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 6a3b75f2410..cf1b81d6169 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -264,7 +264,7 @@ struct st_connection pthread_cond_t cond; pthread_t tid; int query_done; - my_bool has_thread; + my_bool has_thread, mutex_inited; #endif /*EMBEDDED_LIBRARY*/ }; @@ -782,10 +782,12 @@ static int do_send_query(struct st_connection *cn, const char *q, int q_len, if (flags & QUERY_REAP_FLAG) return mysql_send_query(cn->mysql, q, q_len); - if (pthread_mutex_init(&cn->mutex, NULL) || - pthread_cond_init(&cn->cond, NULL)) + if (!cn->mutex_inited && + (pthread_mutex_init(&cn->mutex, NULL) || + pthread_cond_init(&cn->cond, NULL))) die("Error in the thread library"); + cn->mutex_inited= 1; cn->cur_query= q; cn->cur_query_len= q_len; cn->query_done= 0; @@ -815,9 +817,20 @@ static void wait_query_thread_end(struct st_connection *con) } } +static void free_embedded_data(struct st_connection *con) +{ + if (con->mutex_inited) + { + con->mutex_inited= 0; + pthread_mutex_destroy(&con->mutex); + pthread_cond_destroy(&con->cond); + } +} + #else /*EMBEDDED_LIBRARY*/ #define do_send_query(cn,q,q_len,flags) mysql_send_query(cn->mysql, q, q_len) +#define free_embedded_data(next_con) do { } while(0) #endif /*EMBEDDED_LIBRARY*/ @@ -1171,6 +1184,7 @@ void close_connections() if (next_con->util_mysql) mysql_close(next_con->util_mysql); my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR)); + free_embedded_data(next_con); } my_free(connections, MYF(MY_WME)); DBUG_VOID_RETURN; @@ -5001,6 +5015,7 @@ void do_close_connection(struct st_command *command) mysql_close(con->mysql); con->mysql= 0; + free_embedded_data(con); if (con->util_mysql) mysql_close(con->util_mysql); diff --git a/dbug/tests.c b/dbug/tests.c index d76266d34a3..e1d416d6c43 100644 --- a/dbug/tests.c +++ b/dbug/tests.c @@ -16,7 +16,7 @@ const char *func3() void func2() { - const char *s; + const char *s __attribute__((unused)); DBUG_ENTER("func2"); s=func3(); DBUG_PRINT("info", ("s=%s", s)); diff --git a/mysql-test/include/gis_keys.inc b/mysql-test/include/gis_keys.inc index ad00c7e1ef9..cc8ec68f7d1 100644 --- a/mysql-test/include/gis_keys.inc +++ b/mysql-test/include/gis_keys.inc @@ -33,6 +33,7 @@ EXPLAIN SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); +--replace_column 9 # EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); diff --git a/mysql-test/include/have_federated_plugin.inc b/mysql-test/include/have_federated_plugin.inc deleted file mode 100644 index 5c7549de53f..00000000000 --- a/mysql-test/include/have_federated_plugin.inc +++ /dev/null @@ -1,5 +0,0 @@ -if (`select plugin_library IS NULL from information_schema.plugins where plugin_name LIKE '%federated%'`) -{ - --skip federated plugin not available -} - diff --git a/mysql-test/lib/My/Options.pm b/mysql-test/lib/My/Options.pm index 6e8cf7ec919..a0713f7c07e 100644 --- a/mysql-test/lib/My/Options.pm +++ b/mysql-test/lib/My/Options.pm @@ -153,7 +153,7 @@ sub is_set { foreach my $set_opt (@$set_opts){ my ($opt_name2, $value2)= _split_option($set_opt); - if ($opt_name1 eq $opt_name2){ + if ($opt_name1 eq $opt_name2 and $value1 eq $value2){ # Option already set return 1; } diff --git a/mysql-test/lib/mtr_cases.pm b/mysql-test/lib/mtr_cases.pm index f453cb387b7..6acbe623e22 100644 --- a/mysql-test/lib/mtr_cases.pm +++ b/mysql-test/lib/mtr_cases.pm @@ -492,20 +492,32 @@ sub collect_one_suite #print_testcases(@cases); my @new_cases; - foreach my $comb (@combinations) + TEST: foreach my $test (@cases) { - foreach my $test (@cases) - { - - next if ( $test->{'skip'} ); + if ( $test->{'skip'} ) + { + push(@new_cases, $test); + next; + } - # Skip this combination if the values it provides - # already are set in master_opt or slave_opt + foreach my $comb (@combinations) + { + # Skip all other combinations if the values they change + # are already fixed in master_opt or slave_opt if (My::Options::is_set($test->{master_opt}, $comb->{comb_opt}) && My::Options::is_set($test->{slave_opt}, $comb->{comb_opt}) ){ - next; + + # Add combination name short name + $test->{combination}= $comb->{name}; + + # Add the test to new test cases list + push(@new_cases, $test); + next TEST; } + } + foreach my $comb (@combinations) + { # Copy test options my $new_test= My::Test->new(); while (my ($key, $value) = each(%$test)) { @@ -528,17 +540,6 @@ sub collect_one_suite } } - # Add the plain test if it was not already added - # as part of a combination - my %added; - foreach my $new_test (@new_cases){ - $added{$new_test->{name}}= 1; - } - foreach my $test (@cases){ - push(@new_cases, $test) unless $added{$test->{name}}; - } - - #print_testcases(@new_cases); @cases= @new_cases; #print_testcases(@cases); @@ -662,9 +663,6 @@ sub process_opts { my @opts= @{$tinfo->{$opt_name}}; $tinfo->{$opt_name} = []; - my @plugins; - my %seen; - foreach my $opt (@opts) { my $value; @@ -680,14 +678,6 @@ sub process_opts { next; } - $value= mtr_match_prefix($opt, "--plugin-load="); - if (defined $value) - { - push @plugins, $value unless $seen{$value}; - $seen{$value}=1; - next; - } - $value= mtr_match_prefix($opt, "--result-file="); if ( defined $value ) { @@ -734,11 +724,6 @@ sub process_opts { # Ok, this was a real option, add it push(@{$tinfo->{$opt_name}}, $opt); } - - if (@plugins) { - my $sep = (IS_WINDOWS) ? ';' : ':'; - push @{$tinfo->{$opt_name}}, "--plugin-load=" . join($sep, @plugins); - } } diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 417b60d8d46..bc3518ed2bc 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -2101,79 +2101,6 @@ sub environment_setup { } # -------------------------------------------------------------------------- - # Add the path where mysqld will find udf_example.so - # -------------------------------------------------------------------------- - my $lib_udf_example= - mtr_file_exists(vs_config_dirs('sql', 'udf_example.dll'), - "$basedir/sql/.libs/udf_example.so",); - - if ( $lib_udf_example ) - { - push(@ld_library_paths, dirname($lib_udf_example)); - } - - $ENV{'UDF_EXAMPLE_LIB'}= - ($lib_udf_example ? basename($lib_udf_example) : ""); - $ENV{'UDF_EXAMPLE_LIB_OPT'}= "--plugin-dir=". - ($lib_udf_example ? dirname($lib_udf_example) : ""); - - # -------------------------------------------------------------------------- - # Add the path where mysqld will find ha_example.so - # -------------------------------------------------------------------------- - if ($mysql_version_id >= 50100) { - my $plugin_filename; - if (IS_WINDOWS) - { - $plugin_filename = "ha_example.dll"; - } - else - { - $plugin_filename = "ha_example.so"; - } - my $lib_example_plugin= - mtr_file_exists(vs_config_dirs('storage/example',$plugin_filename), - "$basedir/storage/example/.libs/".$plugin_filename, - "$basedir/lib/mysql/plugin/".$plugin_filename); - $ENV{'EXAMPLE_PLUGIN'}= - ($lib_example_plugin ? basename($lib_example_plugin) : ""); - $ENV{'EXAMPLE_PLUGIN_OPT'}= "--plugin-dir=". - ($lib_example_plugin ? dirname($lib_example_plugin) : ""); - - $ENV{'HA_EXAMPLE_SO'}="'".$plugin_filename."'"; - $ENV{'EXAMPLE_PLUGIN_LOAD'}="--plugin_load=EXAMPLE=".$plugin_filename; - } - - # -------------------------------------------------------------------------- - # Add the path where mysqld will find ha_federated.so - # -------------------------------------------------------------------------- - my $fedplug_filename; - if (IS_WINDOWS) { - $fedplug_filename = "ha_federated.dll"; - } else { - $fedplug_filename = "ha_federated.so"; - } - my $lib_fed_plugin= - mtr_file_exists(vs_config_dirs('storage/federated',$fedplug_filename), - "$basedir/storage/federated/.libs/".$fedplug_filename, - "$basedir/lib/mysql/plugin/".$fedplug_filename); - - $ENV{'FEDERATED_PLUGIN'}= $fedplug_filename; - $ENV{'FEDERATED_PLUGIN_DIR'}= - ($lib_fed_plugin ? dirname($lib_fed_plugin) : ""); - - # ---------------------------------------------------- - # Add the path where mysqld will find mypluglib.so - # ---------------------------------------------------- - my $lib_simple_parser= - mtr_file_exists(vs_config_dirs('plugin/fulltext', 'mypluglib.dll'), - "$basedir/plugin/fulltext/.libs/mypluglib.so",); - - $ENV{'SIMPLE_PARSER'}= - ($lib_simple_parser ? basename($lib_simple_parser) : ""); - $ENV{'SIMPLE_PARSER_OPT'}= "--plugin-dir=". - ($lib_simple_parser ? dirname($lib_simple_parser) : ""); - - # -------------------------------------------------------------------------- # Valgrind need to be run with debug libraries otherwise it's almost # impossible to add correct supressions, that means if "/usr/lib/debug" # is available, it should be added to @@ -3926,7 +3853,7 @@ sub run_testcase ($$) { # Allow only alpanumerics pluss _ - + . in combination names, # or anything beginning with -- (the latter comes from --combination) my $combination= $tinfo->{combination}; - if ($combination && $combination !~ /^\w[-\w\.\+]+$/ + if ($combination && $combination !~ /^\w[-\w\.\+]*$/ && $combination !~ /^--/) { mtr_error("Combination '$combination' contains illegal characters"); @@ -5060,6 +4987,9 @@ sub mysqld_arguments ($$$) { } my $found_skip_core= 0; + my @plugins; + my %seen; + my $plugin; foreach my $arg ( @$extra_opts ) { # Allow --skip-core-file to be set in <testname>-[master|slave].opt file @@ -5076,6 +5006,11 @@ sub mysqld_arguments ($$$) { { ; # Dont add --skip-log-bin when mysqld have --log-slave-updates in config } + elsif ($plugin = mtr_match_prefix($arg, "--plugin-load=")) + { + push @plugins, $plugin unless $seen{$plugin}; + $seen{$plugin} = 1; + } else { mtr_add_arg($args, "%s", $arg); @@ -5092,6 +5027,11 @@ sub mysqld_arguments ($$$) { mtr_add_arg($args, "--loose-debug-sync-timeout=%s", $opt_debug_sync_timeout) unless $opt_user_args; + if (@plugins) { + my $sep = (IS_WINDOWS) ? ';' : ':'; + mtr_add_arg($args, "--plugin-load=%s" . join($sep, @plugins)); + } + return $args; } diff --git a/mysql-test/r/gis.result b/mysql-test/r/gis.result index acb55d225a7..2cf5630e90b 100644 --- a/mysql-test/r/gis.result +++ b/mysql-test/r/gis.result @@ -947,7 +947,7 @@ COUNT(*) EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref p p 28 const 1 Using where +1 SIMPLE t2 ref p p 28 const # Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 2 diff --git a/mysql-test/suite/federated/combinations b/mysql-test/suite/federated/combinations new file mode 100644 index 00000000000..18fd5f0d721 --- /dev/null +++ b/mysql-test/suite/federated/combinations @@ -0,0 +1,8 @@ +[old] +--federated +--plugin-load=$HA_FEDERATED_SO + +[X] +--federated +--plugin-load=$HA_FEDERATEDX_SO + diff --git a/mysql-test/suite/federated/federated.inc b/mysql-test/suite/federated/federated.inc index ad640dcbb61..17410846604 100644 --- a/mysql-test/suite/federated/federated.inc +++ b/mysql-test/suite/federated/federated.inc @@ -1,5 +1,4 @@ --source include/not_embedded.inc ---source have_federated_db.inc connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); diff --git a/mysql-test/suite/federated/federated_partition.test b/mysql-test/suite/federated/federated_partition.test index 6f093bfb63d..13f26ecd756 100644 --- a/mysql-test/suite/federated/federated_partition.test +++ b/mysql-test/suite/federated/federated_partition.test @@ -1,6 +1,7 @@ # # Tests for partitioned FEDERATED # +source have_federatedx.inc; source include/have_partition.inc; source include/have_innodb.inc; source federated.inc; diff --git a/mysql-test/suite/federated/federated_plugin-master.opt b/mysql-test/suite/federated/federated_plugin-master.opt deleted file mode 100644 index 027a6d949c0..00000000000 --- a/mysql-test/suite/federated/federated_plugin-master.opt +++ /dev/null @@ -1,2 +0,0 @@ ---plugin_dir=$FEDERATED_PLUGIN_DIR ---loose-federated=ON diff --git a/mysql-test/suite/federated/federated_plugin.result b/mysql-test/suite/federated/federated_plugin.result deleted file mode 100644 index b49a977d9df..00000000000 --- a/mysql-test/suite/federated/federated_plugin.result +++ /dev/null @@ -1,19 +0,0 @@ -CREATE TABLE t2(a int); -CREATE TABLE t1(a int) ENGINE=FEDERATED -CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2'; -Warnings: -Warning 1286 Unknown table engine 'FEDERATED' -Warning 1266 Using storage engine MyISAM for table 't1' -DROP TABLE t1; -INSTALL PLUGIN federated SONAME 'FEDERATED_PLUGIN'; -INSTALL PLUGIN FEDERATED SONAME 'FEDERATED_PLUGIN'; -ERROR HY000: Function 'FEDERATED' already exists -UNINSTALL PLUGIN federated; -INSTALL PLUGIN federated SONAME 'FEDERATED_PLUGIN'; -CREATE TABLE t1(a int) ENGINE=FEDERATED -CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2'; -DROP TABLE t1; -UNINSTALL PLUGIN federated; -UNINSTALL PLUGIN federated; -ERROR 42000: PLUGIN federated does not exist -DROP TABLE t2; diff --git a/mysql-test/suite/federated/federated_plugin.test b/mysql-test/suite/federated/federated_plugin.test deleted file mode 100644 index 8c465095cfa..00000000000 --- a/mysql-test/suite/federated/federated_plugin.test +++ /dev/null @@ -1,37 +0,0 @@ ---source include/have_federated_plugin.inc - -# Uninstall will not uninstall if ps has been used ---disable_ps_protocol - -connect (master,localhost,root,,test,$MASTER_MYPORT,); -connect (slave,localhost,root,,test,$SLAVE_MYPORT,); - -connection master; -CREATE TABLE t2(a int); - -connection slave; -CREATE TABLE t1(a int) ENGINE=FEDERATED - CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2'; -DROP TABLE t1; - ---replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN -eval INSTALL PLUGIN federated SONAME '$FEDERATED_PLUGIN'; ---replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN ---error ER_UDF_EXISTS -eval INSTALL PLUGIN FEDERATED SONAME '$FEDERATED_PLUGIN'; - -UNINSTALL PLUGIN federated; - ---replace_result $FEDERATED_PLUGIN FEDERATED_PLUGIN -eval INSTALL PLUGIN federated SONAME '$FEDERATED_PLUGIN'; - -CREATE TABLE t1(a int) ENGINE=FEDERATED - CONNECTION='mysql://root@localhost:$MASTER_MYPORT/test/t2'; -DROP TABLE t1; - -UNINSTALL PLUGIN federated; ---error ER_SP_DOES_NOT_EXIST -UNINSTALL PLUGIN federated; - -connection master; -DROP TABLE t2; diff --git a/mysql-test/suite/federated/federated_server.result b/mysql-test/suite/federated/federated_server.result index 2c1dd96d612..ad71a175a38 100644 --- a/mysql-test/suite/federated/federated_server.result +++ b/mysql-test/suite/federated/federated_server.result @@ -213,7 +213,7 @@ id name alter server s1 options (database 'db_bogus'); flush tables; select * from federated.t1; -ERROR 42000: Received error: 1044 : Access denied for user 'test_fed'@'localhost' to database 'db_bogus' +Got one of the listed errors drop server if exists 's1'; ERROR 42000: Access denied; you need the SUPER privilege for this operation create server 's1' foreign data wrapper 'mysql' options diff --git a/mysql-test/suite/federated/federated_server.test b/mysql-test/suite/federated/federated_server.test index ba1df04b62f..1a120f3e2ec 100644 --- a/mysql-test/suite/federated/federated_server.test +++ b/mysql-test/suite/federated/federated_server.test @@ -239,7 +239,7 @@ alter server s1 options (database 'db_bogus'); connection master; flush tables; ---error ER_DBACCESS_DENIED_ERROR +--error ER_DBACCESS_DENIED_ERROR,ER_CONNECT_TO_FOREIGN_DATA_SOURCE select * from federated.t1; connection conn_select; diff --git a/mysql-test/suite/federated/federated_transactions.test b/mysql-test/suite/federated/federated_transactions.test index cd08d310273..637df45a52a 100644 --- a/mysql-test/suite/federated/federated_transactions.test +++ b/mysql-test/suite/federated/federated_transactions.test @@ -1,3 +1,4 @@ +source have_federatedx.inc; source include/have_innodb.inc; source federated.inc; diff --git a/mysql-test/suite/federated/federated.result b/mysql-test/suite/federated/federatedx.result index 2ece1a32b4f..2ece1a32b4f 100644 --- a/mysql-test/suite/federated/federated.result +++ b/mysql-test/suite/federated/federatedx.result diff --git a/mysql-test/suite/federated/federated.test b/mysql-test/suite/federated/federatedx.test index 7789070adc3..cabcf0cea1b 100644 --- a/mysql-test/suite/federated/federated.test +++ b/mysql-test/suite/federated/federatedx.test @@ -7,6 +7,7 @@ # should work with embedded server after mysqltest is fixed --source include/not_embedded.inc --source federated.inc +--source have_federatedx.inc connection default; diff --git a/mysql-test/suite/federated/have_federated_db.inc b/mysql-test/suite/federated/have_federated_db.inc deleted file mode 100644 index 81f49aaa48e..00000000000 --- a/mysql-test/suite/federated/have_federated_db.inc +++ /dev/null @@ -1,6 +0,0 @@ -if (!`SELECT count(*) FROM information_schema.engines WHERE - (support = 'YES' OR support = 'DEFAULT') AND - engine = 'federated'`) -{ - skip Need federated engine; -} diff --git a/mysql-test/suite/federated/have_federatedx.inc b/mysql-test/suite/federated/have_federatedx.inc new file mode 100644 index 00000000000..56ce31f5b2f --- /dev/null +++ b/mysql-test/suite/federated/have_federatedx.inc @@ -0,0 +1,5 @@ +if (!`SELECT count(*) FROM information_schema.plugins WHERE + plugin_name = 'federated' AND plugin_status = 'active' AND + plugin_description LIKE '%FederatedX%'`){ + skip Need FederatedX engine; +} diff --git a/mysql-test/suite/federated/suite.opt b/mysql-test/suite/federated/have_federatedx.opt index 2cce1887441..22f40b6d3d7 100644 --- a/mysql-test/suite/federated/suite.opt +++ b/mysql-test/suite/federated/have_federatedx.opt @@ -1,2 +1 @@ ---federated --plugin-load=$HA_FEDERATEDX_SO diff --git a/mysql-test/suite/federated/suite.pm b/mysql-test/suite/federated/suite.pm new file mode 100644 index 00000000000..06458b97adc --- /dev/null +++ b/mysql-test/suite/federated/suite.pm @@ -0,0 +1,20 @@ +package My::Suite::Federated; + +@ISA = qw(My::Suite); + +############# initialization ###################### +my @combinations; + +push @combinations, 'old' + if $ENV{HA_FEDERATED_SO} and not $::mysqld_variables{'federated'}; +push @combinations, 'X' + if $ENV{HA_FEDERATEDX_SO} or $::mysqld_variables{'federated'}; + +return "Neither Federated nor FederatedX are available" unless @combinations; + +$ENV{FEDERATED_COMBINATIONS}=join ':', @combinations + unless $ENV{FEDERATED_COMBINATIONS}; + +############# return an object ###################### +bless { }; + diff --git a/mysql-test/suite/funcs_1/t/is_engines_federated.test b/mysql-test/suite/funcs_1/t/is_engines_federated.test index 81eac89c0d2..f39edefe43c 100644 --- a/mysql-test/suite/funcs_1/t/is_engines_federated.test +++ b/mysql-test/suite/funcs_1/t/is_engines_federated.test @@ -9,7 +9,7 @@ # let $engine_type= FEDERATED; ---source suite/federated/have_federated_db.inc +--source suite/federated/have_federatedx.inc --vertical_results eval SELECT * FROM information_schema.engines WHERE ENGINE = '$engine_type'; diff --git a/mysql-test/suite/innodb/r/innodb_gis.result b/mysql-test/suite/innodb/r/innodb_gis.result index 30daaf129b1..d1237942a6a 100644 --- a/mysql-test/suite/innodb/r/innodb_gis.result +++ b/mysql-test/suite/innodb/r/innodb_gis.result @@ -572,7 +572,7 @@ COUNT(*) EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref p p 28 const 2 Using where +1 SIMPLE t2 ref p p 28 const # Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 2 diff --git a/mysql-test/suite/innodb/t/innodb_bug38231.test b/mysql-test/suite/innodb/t/innodb_bug38231.test index 5021f23d07e..4cf16beba56 100644 --- a/mysql-test/suite/innodb/t/innodb_bug38231.test +++ b/mysql-test/suite/innodb/t/innodb_bug38231.test @@ -72,6 +72,7 @@ UNLOCK TABLES; # clean up -- connection con2 +-- error 0, 1205 -- reap UNLOCK TABLES; diff --git a/mysql-test/suite/innodb_plugin/r/innodb_gis.result b/mysql-test/suite/innodb_plugin/r/innodb_gis.result index 30daaf129b1..d1237942a6a 100644 --- a/mysql-test/suite/innodb_plugin/r/innodb_gis.result +++ b/mysql-test/suite/innodb_plugin/r/innodb_gis.result @@ -572,7 +572,7 @@ COUNT(*) EXPLAIN SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ref p p 28 const 2 Using where +1 SIMPLE t2 ref p p 28 const # Using where SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); COUNT(*) 2 diff --git a/mysql-test/suite/innodb_plugin/t/innodb.test b/mysql-test/suite/innodb_plugin/t/innodb.test index 03c8336f214..59e0328bb8d 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb.test +++ b/mysql-test/suite/innodb_plugin/t/innodb.test @@ -1034,11 +1034,11 @@ create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` ) insert into `t2`values ( 1 ) ; create table `t3` (`id` int( 11 ) not null default '0',key `id` ( `id` ) ,constraint `t2_id_fk` foreign key ( `id` ) references `t2` (`id` )) engine = innodb; insert into `t3`values ( 1 ) ; ---error 1451 +--error ER_ROW_IS_REFERENCED_2 delete t3,t2,t1 from t1,t2,t3 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; ---error 1451 +--error ER_ROW_IS_REFERENCED_2 update t1,t2,t3 set t3.id=5, t2.id=6, t1.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; ---error 1054 +--error ER_BAD_FIELD_ERROR update t3 set t3.id=7 where t1.id =1 and t2.id = t1.id and t3.id = t2.id; drop table t3,t2,t1; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_gis.test b/mysql-test/suite/innodb_plugin/t/innodb_gis.test index 3ad20e3dce6..dec0c8bf725 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb_gis.test +++ b/mysql-test/suite/innodb_plugin/t/innodb_gis.test @@ -1,4 +1,3 @@ ---source include/have_xtradb.inc SET storage_engine=innodb; --source include/gis_generic.inc --source include/gis_keys.inc diff --git a/mysql-test/suite/innodb_plugin/t/innodb_misc1.test b/mysql-test/suite/innodb_plugin/t/innodb_misc1.test index e9b6d72aa7d..31f9988d1ac 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb_misc1.test +++ b/mysql-test/suite/innodb_plugin/t/innodb_misc1.test @@ -1,4 +1,5 @@ -- source include/have_innodb_plugin.inc +-- source include/have_utf8.inc let $MYSQLD_DATADIR= `select @@datadir`; diff --git a/mysql-test/suite/innodb_plugin/t/innodb_mysql.test b/mysql-test/suite/innodb_plugin/t/innodb_mysql.test index fc77d9aaa8a..84cb12d3faf 100644 --- a/mysql-test/suite/innodb_plugin/t/innodb_mysql.test +++ b/mysql-test/suite/innodb_plugin/t/innodb_mysql.test @@ -5,9 +5,11 @@ # main testing code t/innodb_mysql.test -> include/mix1.inc # --- source include/have_xtradb.inc -- source include/have_query_cache.inc +# We must run this with XtraDB as otherwise we will get different EXPLAIN's +-- source include/have_xtradb.inc + let $engine_type= InnoDB; let $other_engine_type= MEMORY; # InnoDB does support FOREIGN KEYFOREIGN KEYs diff --git a/server-tools/instance-manager/guardian.cc b/server-tools/instance-manager/guardian.cc index b49b0ec0a00..1df602534e0 100644 --- a/server-tools/instance-manager/guardian.cc +++ b/server-tools/instance-manager/guardian.cc @@ -440,7 +440,7 @@ void Guardian::stop_instances() /* Request mysqld to stop. */ - bool instance_stopped= FALSE; + bool instance_stopped __attribute__((unused))= FALSE; for (int cur_attempt= 0; cur_attempt < NUM_STOP_ATTEMPTS; ++cur_attempt) { diff --git a/sql/filesort.cc b/sql/filesort.cc index ad891db3991..d2166ad701c 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -834,7 +834,7 @@ static void make_sortkey(register SORTPARAM *param, if (sort_field->need_strxnfrm) { char *from=(char*) res->ptr(); - uint tmp_length; + uint tmp_length __attribute__((unused)); if ((uchar*) from == to) { set_if_smaller(length,sort_field->length); diff --git a/sql/slave.cc b/sql/slave.cc index 813cf20464e..ff12a660883 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -513,7 +513,7 @@ terminate_slave_thread(THD *thd, while (*slave_running) // Should always be true { - int error; + int error __attribute__((unused)); DBUG_PRINT("loop", ("killing slave thread")); pthread_mutex_lock(&thd->LOCK_thd_data); diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 600bb641448..4616b5c2430 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -4722,9 +4722,6 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) */ for (tables= *start; tables ;tables= tables->next_global) { - DBUG_PRINT("tcache", ("opening table: '%s'.'%s' item: 0x%lx", - tables->db, tables->table_name, (long) tables)); - safe_to_ignore_table= FALSE; /* @@ -4737,8 +4734,11 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags) { if (tables->view) goto process_view_routines; + DBUG_PRINT("tcache", ("ignoring placeholder for derived table")); continue; } + DBUG_PRINT("tcache", ("opening table: '%s'.'%s' item: 0x%lx", + tables->db, tables->table_name, (long) tables)); /* If this TABLE_LIST object is a placeholder for an information_schema table, create a temporary table to represent the information_schema diff --git a/sql/sql_load.cc b/sql/sql_load.cc index 3a1dbef4f3f..e4ba53ac53c 100644 --- a/sql/sql_load.cc +++ b/sql/sql_load.cc @@ -140,7 +140,7 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list, */ char *tdb= thd->db ? thd->db : db; // Result is never null ulong skip_lines= ex->skip_lines; - bool transactional_table; + bool transactional_table __attribute__((unused)); DBUG_ENTER("mysql_load"); /* diff --git a/sql/sql_show.cc b/sql/sql_show.cc index 1d5d53114a3..e90c3141f84 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -739,12 +739,30 @@ public: }; +/* + Return CREATE command for table or view + + @param thd Thread handler + @param table_list Table / view + + @return + @retval 0 OK + @retval 1 Error + + @notes + table_list->db and table_list->table_name are kept unchanged to + not cause problems with SP. +*/ + bool mysqld_show_create(THD *thd, TABLE_LIST *table_list) { Protocol *protocol= thd->protocol; char buff[2048]; String buffer(buff, sizeof(buff), system_charset_info); + char *save_db, *save_table_name; + bool retval= TRUE; // Assume error + List<Item> field_list; DBUG_ENTER("mysqld_show_create"); DBUG_PRINT("enter",("db: %s table: %s",table_list->db, table_list->table_name)); @@ -752,13 +770,17 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) /* We want to preserve the tree for views. */ thd->lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW; + /* Store original names if called from SP */ + save_db= table_list->db; + save_table_name= table_list->table_name; + { Show_create_error_handler view_error_suppressor(thd, table_list); thd->push_internal_handler(&view_error_suppressor); bool error= open_normal_and_derived_tables(thd, table_list, 0); thd->pop_internal_handler(); if (error && (thd->killed || thd->main_da.is_error())) - DBUG_RETURN(TRUE); + goto error; } /* TODO: add environment variables show when it become possible */ @@ -766,7 +788,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) { my_error(ER_WRONG_OBJECT, MYF(0), table_list->db, table_list->table_name, "VIEW"); - DBUG_RETURN(TRUE); + goto error; } buffer.length(0); @@ -778,9 +800,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) view_store_create_info(thd, table_list, &buffer) : store_create_info(thd, table_list, &buffer, NULL, FALSE /* show_database */))) - DBUG_RETURN(TRUE); + goto error; - List<Item> field_list; if (table_list->view) { field_list.push_back(new Item_empty_string("View",NAME_CHAR_LEN)); @@ -801,7 +822,7 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) - DBUG_RETURN(TRUE); + goto error; protocol->prepare_for_resend(); if (table_list->view) protocol->store(table_list->view_name.str, system_charset_info); @@ -829,10 +850,17 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list) protocol->store(buffer.ptr(), buffer.length(), buffer.charset()); if (protocol->write()) - DBUG_RETURN(TRUE); + goto error; my_eof(thd); - DBUG_RETURN(FALSE); + retval= FALSE; // ok + +error: + /* Restore table list if called by stored procedure */ + table_list->db= save_db; + table_list->table_name= save_table_name; + DBUG_RETURN(retval); + } bool mysqld_show_create_db(THD *thd, char *dbname, diff --git a/sql/sql_table.cc b/sql/sql_table.cc index bb062615966..504059eb040 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -6711,7 +6711,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name, uint fast_alter_partition= 0; bool partition_changed= FALSE; #endif - bool need_lock_for_indexes= TRUE; + bool need_lock_for_indexes __attribute__((unused)) = TRUE; KEY *key_info_buffer; uint index_drop_count= 0; uint *index_drop_buffer= NULL; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 2fc6918e49f..0fe1b597d82 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -848,7 +848,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view, thd->variables.sql_mode|= sql_mode; } - DBUG_PRINT("info", ("View: %s", view_query.c_ptr_safe())); + DBUG_PRINT("info", ("View: %.*s", view_query.length(), view_query.ptr())); /* fill structure */ view->source= thd->lex->create_view_select; diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 40d33bde457..e411de7ff84 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -1513,7 +1513,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table) tmp_share.table_name_length, ident_quote_char); if (!(share= (FEDERATED_SHARE *) memdup_root(&mem_root, (char*)&tmp_share, sizeof(*share))) || - !(share->select_query= (char*) strmake_root(&mem_root, query.ptr(), query.length() + 1))) + !(share->select_query= (char*) strmake_root(&mem_root, query.ptr(), query.length()))) goto error; share->use_count= 0; diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index 74898d981e9..4e55c519a9a 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -3680,7 +3680,7 @@ static my_bool _ma_update_block_record2(MARIA_HA *info, MARIA_PINNED_PAGE page_link; uint rownr, org_empty_size, head_length; uint block_size= info->s->block_size; - uint errpos= 0; + uint errpos __attribute__((unused)) = 0; uchar *dir; pgcache_page_no_t page; struct st_row_pos_info row_pos; diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index e31e2e7816a..7819cc66ab6 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -3901,7 +3901,8 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info, _ma_check_print_error(param, "Rows lost (Found %lu of %lu); Aborting " "because safe repair was requested", - sort_info.new_info->s->state.state.records, + (ulong) sort_info.new_info->s-> + state.state.records, (ulong) start_records); share->state.state.records=start_records; goto err; diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index 6f70fdf34cf..2769d7cbd17 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -3312,7 +3312,7 @@ static uint16 translog_get_chunk_header_length(uchar *chunk) case TRANSLOG_CHUNK_LSN: { /* 0 chunk referred as LSN (head or tail) */ - translog_size_t rec_len; + translog_size_t rec_len __attribute__((unused)); uchar *start= chunk; uchar *ptr= start + 1 + 2; uint16 chunk_len, header_len; diff --git a/storage/maria/ma_recovery.c b/storage/maria/ma_recovery.c index 96504cfba2d..8702431d9a6 100644 --- a/storage/maria/ma_recovery.c +++ b/storage/maria/ma_recovery.c @@ -2892,7 +2892,7 @@ static uint end_of_redo_phase(my_bool prepare_for_undo_phase) static int run_undo_phase(uint uncommitted) { - LSN last_undo; + LSN last_undo __attribute__((unused)); DBUG_ENTER("run_undo_phase"); if (uncommitted > 0) diff --git a/storage/pbxt/src/cache_xt.cc b/storage/pbxt/src/cache_xt.cc index 090250dd802..7f39c589f7a 100644 --- a/storage/pbxt/src/cache_xt.cc +++ b/storage/pbxt/src/cache_xt.cc @@ -794,7 +794,7 @@ xtPublic void xt_ind_check_cache(XTIndexPtr ind) ASSERT_NS(ind_cac_globals.cg_free_count == free_count); /* Check the LRU list: */ - XTIndBlockPtr list_block, plist_block; + XTIndBlockPtr list_block, plist_block __attribute__((unused)); plist_block = NULL; list_block = ind_cac_globals.cg_lru_block; diff --git a/storage/xtradb/ChangeLog b/storage/xtradb/ChangeLog index f873f3a24bd..7a4cacb5b43 100644 --- a/storage/xtradb/ChangeLog +++ b/storage/xtradb/ChangeLog @@ -1,3 +1,8 @@ +2011-10-25 The InnoDB Team + + * handler/ha_innodb.cc, row/row0ins.c: + Fix Bug#13002783 PARTIALLY UNINITIALIZED CASCADE UPDATE VECTOR + 2011-08-08 The InnoDB Team * row/row0sel.c: diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c index 1ef0a9a46fb..17ca4cb1745 100644 --- a/storage/xtradb/fil/fil0fil.c +++ b/storage/xtradb/fil/fil0fil.c @@ -3448,8 +3448,8 @@ skip_info: if ((ulint) (offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)) == root_page[i]) { if (fil_page_get_type(page) != FIL_PAGE_INDEX) { file_is_corrupt = TRUE; - fprintf(stderr, " [etyp:%lld]", - offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)); + fprintf(stderr, " [etyp:%ld]", + (long) (offset / (zip_size ? zip_size : UNIV_PAGE_SIZE))); goto skip_write; } /* this is index root page */ @@ -3678,7 +3678,6 @@ func_exit: ulint page_no; ulint zip_size; ulint height; - ulint root_height = 0; rec_t* node_ptr; dict_table_t* table; dict_index_t* index; @@ -3717,7 +3716,6 @@ func_exit: if (height == ULINT_UNDEFINED) { height = btr_page_get_level(page, &mtr); - root_height = height; } if (height == 0) { diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 6161a5f10ce..6d87e9bfb49 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -2735,7 +2735,7 @@ innobase_commit_low( #ifdef MYSQL_SERVER THD *thd=current_thd; - if (thd && thd->slave_thread) { + if (thd && thd_is_replication_slave_thread(thd)) { /* Update the replication position info inside InnoDB. In embedded server, does nothing. */ const char *log_file_name, *group_relay_log_name; @@ -5367,14 +5367,15 @@ calc_row_difference( /* The field has changed */ ufield = uvect->fields + n_changed; + UNIV_MEM_INVALID(ufield, sizeof *ufield); /* Let us use a dummy dfield to make the conversion from the MySQL column format to the InnoDB format */ - dict_col_copy_type(prebuilt->table->cols + innodb_idx, - dfield_get_type(&dfield)); - if (n_len != UNIV_SQL_NULL) { + dict_col_copy_type(prebuilt->table->cols + innodb_idx, + dfield_get_type(&dfield)); + buf = row_mysql_store_col_in_innobase_format( &dfield, (byte*)buf, @@ -5382,7 +5383,7 @@ calc_row_difference( new_mysql_row_col, col_pack_len, dict_table_is_comp(prebuilt->table)); - dfield_copy_data(&ufield->new_val, &dfield); + dfield_copy(&ufield->new_val, &dfield); } else { dfield_set_null(&ufield->new_val); } @@ -10812,7 +10813,7 @@ ha_innobase::check_if_incompatible_data( if (info_row_type == ROW_TYPE_DEFAULT) info_row_type = ROW_TYPE_COMPACT; if ((info->used_fields & HA_CREATE_USED_ROW_FORMAT) && - get_row_type() != ((info->row_type == ROW_TYPE_DEFAULT) + row_type != ((info->row_type == ROW_TYPE_DEFAULT) ? ROW_TYPE_COMPACT : info->row_type)) { DBUG_PRINT("info", ("get_row_type()=%d != info->row_type=%d -> " diff --git a/storage/xtradb/row/row0ins.c b/storage/xtradb/row/row0ins.c index 6068c3547df..0bcbc14fbf6 100644 --- a/storage/xtradb/row/row0ins.c +++ b/storage/xtradb/row/row0ins.c @@ -434,11 +434,9 @@ row_ins_cascade_calc_update_vec( dict_table_t* table = foreign->foreign_table; dict_index_t* index = foreign->foreign_index; upd_t* update; - upd_field_t* ufield; dict_table_t* parent_table; dict_index_t* parent_index; upd_t* parent_update; - upd_field_t* parent_ufield; ulint n_fields_updated; ulint parent_field_no; ulint i; @@ -474,13 +472,15 @@ row_ins_cascade_calc_update_vec( dict_index_get_nth_col_no(parent_index, i)); for (j = 0; j < parent_update->n_fields; j++) { - parent_ufield = parent_update->fields + j; + const upd_field_t* parent_ufield + = &parent_update->fields[j]; if (parent_ufield->field_no == parent_field_no) { ulint min_size; const dict_col_t* col; ulint ufield_len; + upd_field_t* ufield; col = dict_index_get_nth_col(index, i); @@ -495,6 +495,7 @@ row_ins_cascade_calc_update_vec( table, dict_col_get_no(col)); ufield->orig_len = 0; + ufield->exp = NULL; ufield->new_val = parent_ufield->new_val; ufield_len = dfield_get_len(&ufield->new_val); @@ -994,10 +995,9 @@ row_ins_foreign_check_on_constraint( goto nonstandard_exit_func; } - if ((node->is_delete - && (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)) - || (!node->is_delete - && (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL))) { + if (node->is_delete + ? (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL) + : (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)) { /* Build the appropriate update vector which sets foreign->n_fields first fields in rec to SQL NULL */ @@ -1006,6 +1006,8 @@ row_ins_foreign_check_on_constraint( update->info_bits = 0; update->n_fields = foreign->n_fields; + UNIV_MEM_INVALID(update->fields, + update->n_fields * sizeof *update->fields); for (i = 0; i < foreign->n_fields; i++) { upd_field_t* ufield = &update->fields[i]; diff --git a/vio/viosocket.c b/vio/viosocket.c index 7f1ef718d96..478b5dc03bd 100644 --- a/vio/viosocket.c +++ b/vio/viosocket.c @@ -396,7 +396,9 @@ my_bool vio_poll_read(Vio *vio,uint timeout) void vio_timeout(Vio *vio, uint which, uint timeout) { #if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) +#ifndef DBUG_OFF int r; +#endif DBUG_ENTER("vio_timeout"); { @@ -410,10 +412,12 @@ void vio_timeout(Vio *vio, uint which, uint timeout) wait_timeout.tv_usec= 0; #endif - r= setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO, - IF_WIN(const char*, const void*)&wait_timeout, - sizeof(wait_timeout)); - +#ifndef DBUG_OFF + r= +#endif + setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO, + IF_WIN(const char*, const void*)&wait_timeout, + sizeof(wait_timeout)); } #ifndef DBUG_OFF diff --git a/vio/viosslfactories.c b/vio/viosslfactories.c index 3c0c2f3a7ec..31863a0830f 100644 --- a/vio/viosslfactories.c +++ b/vio/viosslfactories.c @@ -300,7 +300,8 @@ new_VioSSLConnectorFd(const char *key_file, const char *cert_file, verify= SSL_VERIFY_NONE; if (!(ssl_fd= new_VioSSLFd(key_file, cert_file, ca_file, - ca_path, cipher, TLSv1_client_method(), &dummy))) + ca_path, cipher, + (SSL_METHOD*) TLSv1_client_method(), &dummy))) { return 0; } @@ -322,7 +323,8 @@ new_VioSSLAcceptorFd(const char *key_file, const char *cert_file, struct st_VioSSLFd *ssl_fd; int verify= SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE; if (!(ssl_fd= new_VioSSLFd(key_file, cert_file, ca_file, - ca_path, cipher, TLSv1_server_method(), error))) + ca_path, cipher, + (SSL_METHOD*) TLSv1_server_method(), error))) { return 0; } |