Merge with 5.1

This commit is contained in:
Michael Widenius 2011-11-30 22:57:18 +02:00
commit efcfb195e3
51 changed files with 192 additions and 242 deletions

View File

@ -264,7 +264,7 @@ struct st_connection
pthread_cond_t cond; pthread_cond_t cond;
pthread_t tid; pthread_t tid;
int query_done; int query_done;
my_bool has_thread; my_bool has_thread, mutex_inited;
#endif /*EMBEDDED_LIBRARY*/ #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) if (flags & QUERY_REAP_FLAG)
return mysql_send_query(cn->mysql, q, q_len); return mysql_send_query(cn->mysql, q, q_len);
if (pthread_mutex_init(&cn->mutex, NULL) || if (!cn->mutex_inited &&
pthread_cond_init(&cn->cond, NULL)) (pthread_mutex_init(&cn->mutex, NULL) ||
pthread_cond_init(&cn->cond, NULL)))
die("Error in the thread library"); die("Error in the thread library");
cn->mutex_inited= 1;
cn->cur_query= q; cn->cur_query= q;
cn->cur_query_len= q_len; cn->cur_query_len= q_len;
cn->query_done= 0; 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*/ #else /*EMBEDDED_LIBRARY*/
#define do_send_query(cn,q,q_len,flags) mysql_send_query(cn->mysql, q, q_len) #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*/ #endif /*EMBEDDED_LIBRARY*/
@ -1171,6 +1184,7 @@ void close_connections()
if (next_con->util_mysql) if (next_con->util_mysql)
mysql_close(next_con->util_mysql); mysql_close(next_con->util_mysql);
my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR)); my_free(next_con->name, MYF(MY_ALLOW_ZERO_PTR));
free_embedded_data(next_con);
} }
my_free(connections, MYF(MY_WME)); my_free(connections, MYF(MY_WME));
DBUG_VOID_RETURN; DBUG_VOID_RETURN;
@ -5001,6 +5015,7 @@ void do_close_connection(struct st_command *command)
mysql_close(con->mysql); mysql_close(con->mysql);
con->mysql= 0; con->mysql= 0;
free_embedded_data(con);
if (con->util_mysql) if (con->util_mysql)
mysql_close(con->util_mysql); mysql_close(con->util_mysql);

View File

@ -16,7 +16,7 @@ const char *func3()
void func2() void func2()
{ {
const char *s; const char *s __attribute__((unused));
DBUG_ENTER("func2"); DBUG_ENTER("func2");
s=func3(); s=func3();
DBUG_PRINT("info", ("s=%s", s)); DBUG_PRINT("info", ("s=%s", s));

View File

@ -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)');
SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t1 WHERE p=POINTFROMTEXT('POINT(1 2)');
--replace_column 9 #
EXPLAIN EXPLAIN
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');

View File

@ -1,5 +0,0 @@
if (`select plugin_library IS NULL from information_schema.plugins where plugin_name LIKE '%federated%'`)
{
--skip federated plugin not available
}

View File

@ -153,7 +153,7 @@ sub is_set {
foreach my $set_opt (@$set_opts){ foreach my $set_opt (@$set_opts){
my ($opt_name2, $value2)= _split_option($set_opt); 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 # Option already set
return 1; return 1;
} }

View File

@ -492,20 +492,32 @@ sub collect_one_suite
#print_testcases(@cases); #print_testcases(@cases);
my @new_cases; my @new_cases;
foreach my $comb (@combinations) TEST: foreach my $test (@cases)
{ {
foreach my $test (@cases) if ( $test->{'skip'} )
{ {
push(@new_cases, $test);
next;
}
next if ( $test->{'skip'} ); foreach my $comb (@combinations)
{
# Skip this combination if the values it provides # Skip all other combinations if the values they change
# already are set in master_opt or slave_opt # are already fixed in master_opt or slave_opt
if (My::Options::is_set($test->{master_opt}, $comb->{comb_opt}) && if (My::Options::is_set($test->{master_opt}, $comb->{comb_opt}) &&
My::Options::is_set($test->{slave_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 # Copy test options
my $new_test= My::Test->new(); my $new_test= My::Test->new();
while (my ($key, $value) = each(%$test)) { 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); #print_testcases(@new_cases);
@cases= @new_cases; @cases= @new_cases;
#print_testcases(@cases); #print_testcases(@cases);
@ -662,9 +663,6 @@ sub process_opts {
my @opts= @{$tinfo->{$opt_name}}; my @opts= @{$tinfo->{$opt_name}};
$tinfo->{$opt_name} = []; $tinfo->{$opt_name} = [];
my @plugins;
my %seen;
foreach my $opt (@opts) foreach my $opt (@opts)
{ {
my $value; my $value;
@ -680,14 +678,6 @@ sub process_opts {
next; 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="); $value= mtr_match_prefix($opt, "--result-file=");
if ( defined $value ) if ( defined $value )
{ {
@ -734,11 +724,6 @@ sub process_opts {
# Ok, this was a real option, add it # Ok, this was a real option, add it
push(@{$tinfo->{$opt_name}}, $opt); push(@{$tinfo->{$opt_name}}, $opt);
} }
if (@plugins) {
my $sep = (IS_WINDOWS) ? ';' : ':';
push @{$tinfo->{$opt_name}}, "--plugin-load=" . join($sep, @plugins);
}
} }

View File

@ -2100,79 +2100,6 @@ sub environment_setup {
push(@ld_library_paths, "$basedir/storage/ndb/src/.libs"); push(@ld_library_paths, "$basedir/storage/ndb/src/.libs");
} }
# --------------------------------------------------------------------------
# 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 # Valgrind need to be run with debug libraries otherwise it's almost
# impossible to add correct supressions, that means if "/usr/lib/debug" # impossible to add correct supressions, that means if "/usr/lib/debug"
@ -3926,7 +3853,7 @@ sub run_testcase ($$) {
# Allow only alpanumerics pluss _ - + . in combination names, # Allow only alpanumerics pluss _ - + . in combination names,
# or anything beginning with -- (the latter comes from --combination) # or anything beginning with -- (the latter comes from --combination)
my $combination= $tinfo->{combination}; my $combination= $tinfo->{combination};
if ($combination && $combination !~ /^\w[-\w\.\+]+$/ if ($combination && $combination !~ /^\w[-\w\.\+]*$/
&& $combination !~ /^--/) && $combination !~ /^--/)
{ {
mtr_error("Combination '$combination' contains illegal characters"); mtr_error("Combination '$combination' contains illegal characters");
@ -5060,6 +4987,9 @@ sub mysqld_arguments ($$$) {
} }
my $found_skip_core= 0; my $found_skip_core= 0;
my @plugins;
my %seen;
my $plugin;
foreach my $arg ( @$extra_opts ) foreach my $arg ( @$extra_opts )
{ {
# Allow --skip-core-file to be set in <testname>-[master|slave].opt file # 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 ; # 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 else
{ {
mtr_add_arg($args, "%s", $arg); mtr_add_arg($args, "%s", $arg);
@ -5092,6 +5027,11 @@ sub mysqld_arguments ($$$) {
mtr_add_arg($args, "--loose-debug-sync-timeout=%s", mtr_add_arg($args, "--loose-debug-sync-timeout=%s",
$opt_debug_sync_timeout) unless $opt_user_args; $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; return $args;
} }

View File

@ -947,7 +947,7 @@ COUNT(*)
EXPLAIN EXPLAIN
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
id select_type table type possible_keys key key_len ref rows Extra 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)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*) COUNT(*)
2 2

View File

@ -0,0 +1,8 @@
[old]
--federated
--plugin-load=$HA_FEDERATED_SO
[X]
--federated
--plugin-load=$HA_FEDERATEDX_SO

View File

@ -1,5 +1,4 @@
--source include/not_embedded.inc --source include/not_embedded.inc
--source have_federated_db.inc
connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,); connect (master,127.0.0.1,root,,test,$MASTER_MYPORT,);
connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,); connect (slave,127.0.0.1,root,,test,$SLAVE_MYPORT,);

View File

@ -1,6 +1,7 @@
# #
# Tests for partitioned FEDERATED # Tests for partitioned FEDERATED
# #
source have_federatedx.inc;
source include/have_partition.inc; source include/have_partition.inc;
source include/have_innodb.inc; source include/have_innodb.inc;
source federated.inc; source federated.inc;

View File

@ -1,2 +0,0 @@
--plugin_dir=$FEDERATED_PLUGIN_DIR
--loose-federated=ON

View File

@ -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;

View File

@ -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;

View File

@ -213,7 +213,7 @@ id name
alter server s1 options (database 'db_bogus'); alter server s1 options (database 'db_bogus');
flush tables; flush tables;
select * from federated.t1; 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'; drop server if exists 's1';
ERROR 42000: Access denied; you need the SUPER privilege for this operation ERROR 42000: Access denied; you need the SUPER privilege for this operation
create server 's1' foreign data wrapper 'mysql' options create server 's1' foreign data wrapper 'mysql' options

View File

@ -239,7 +239,7 @@ alter server s1 options (database 'db_bogus');
connection master; connection master;
flush tables; flush tables;
--error ER_DBACCESS_DENIED_ERROR --error ER_DBACCESS_DENIED_ERROR,ER_CONNECT_TO_FOREIGN_DATA_SOURCE
select * from federated.t1; select * from federated.t1;
connection conn_select; connection conn_select;

View File

@ -1,3 +1,4 @@
source have_federatedx.inc;
source include/have_innodb.inc; source include/have_innodb.inc;
source federated.inc; source federated.inc;

View File

@ -7,6 +7,7 @@
# should work with embedded server after mysqltest is fixed # should work with embedded server after mysqltest is fixed
--source include/not_embedded.inc --source include/not_embedded.inc
--source federated.inc --source federated.inc
--source have_federatedx.inc
connection default; connection default;

View File

@ -1,6 +0,0 @@
if (!`SELECT count(*) FROM information_schema.engines WHERE
(support = 'YES' OR support = 'DEFAULT') AND
engine = 'federated'`)
{
skip Need federated engine;
}

View File

@ -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;
}

View File

@ -1,2 +1 @@
--federated
--plugin-load=$HA_FEDERATEDX_SO --plugin-load=$HA_FEDERATEDX_SO

View File

@ -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 { };

View File

@ -9,7 +9,7 @@
# #
let $engine_type= FEDERATED; let $engine_type= FEDERATED;
--source suite/federated/have_federated_db.inc --source suite/federated/have_federatedx.inc
--vertical_results --vertical_results
eval SELECT * FROM information_schema.engines eval SELECT * FROM information_schema.engines
WHERE ENGINE = '$engine_type'; WHERE ENGINE = '$engine_type';

View File

@ -572,7 +572,7 @@ COUNT(*)
EXPLAIN EXPLAIN
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
id select_type table type possible_keys key key_len ref rows Extra 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)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*) COUNT(*)
2 2

View File

@ -72,6 +72,7 @@ UNLOCK TABLES;
# clean up # clean up
-- connection con2 -- connection con2
-- error 0, 1205
-- reap -- reap
UNLOCK TABLES; UNLOCK TABLES;

View File

@ -572,7 +572,7 @@ COUNT(*)
EXPLAIN EXPLAIN
SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
id select_type table type possible_keys key key_len ref rows Extra 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)'); SELECT COUNT(*) FROM t2 WHERE p=POINTFROMTEXT('POINT(1 2)');
COUNT(*) COUNT(*)
2 2

View File

@ -1034,11 +1034,11 @@ create table `t2` (`id` int( 11 ) not null default '0',unique key `id` ( `id` )
insert into `t2`values ( 1 ) ; 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; 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 ) ; 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; 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; 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; 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; drop table t3,t2,t1;

View File

@ -1,4 +1,3 @@
--source include/have_xtradb.inc
SET storage_engine=innodb; SET storage_engine=innodb;
--source include/gis_generic.inc --source include/gis_generic.inc
--source include/gis_keys.inc --source include/gis_keys.inc

View File

@ -1,4 +1,5 @@
-- source include/have_innodb_plugin.inc -- source include/have_innodb_plugin.inc
-- source include/have_utf8.inc
let $MYSQLD_DATADIR= `select @@datadir`; let $MYSQLD_DATADIR= `select @@datadir`;

View File

@ -5,9 +5,11 @@
# main testing code t/innodb_mysql.test -> include/mix1.inc # main testing code t/innodb_mysql.test -> include/mix1.inc
# #
-- source include/have_xtradb.inc
-- source include/have_query_cache.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 $engine_type= InnoDB;
let $other_engine_type= MEMORY; let $other_engine_type= MEMORY;
# InnoDB does support FOREIGN KEYFOREIGN KEYs # InnoDB does support FOREIGN KEYFOREIGN KEYs

View File

@ -440,7 +440,7 @@ void Guardian::stop_instances()
/* Request mysqld to stop. */ /* 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) for (int cur_attempt= 0; cur_attempt < NUM_STOP_ATTEMPTS; ++cur_attempt)
{ {

View File

@ -834,7 +834,7 @@ static void make_sortkey(register SORTPARAM *param,
if (sort_field->need_strxnfrm) if (sort_field->need_strxnfrm)
{ {
char *from=(char*) res->ptr(); char *from=(char*) res->ptr();
uint tmp_length; uint tmp_length __attribute__((unused));
if ((uchar*) from == to) if ((uchar*) from == to)
{ {
set_if_smaller(length,sort_field->length); set_if_smaller(length,sort_field->length);

View File

@ -513,7 +513,7 @@ terminate_slave_thread(THD *thd,
while (*slave_running) // Should always be true while (*slave_running) // Should always be true
{ {
int error; int error __attribute__((unused));
DBUG_PRINT("loop", ("killing slave thread")); DBUG_PRINT("loop", ("killing slave thread"));
pthread_mutex_lock(&thd->LOCK_thd_data); pthread_mutex_lock(&thd->LOCK_thd_data);

View File

@ -4722,9 +4722,6 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
*/ */
for (tables= *start; tables ;tables= tables->next_global) 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; safe_to_ignore_table= FALSE;
/* /*
@ -4737,8 +4734,11 @@ int open_tables(THD *thd, TABLE_LIST **start, uint *counter, uint flags)
{ {
if (tables->view) if (tables->view)
goto process_view_routines; goto process_view_routines;
DBUG_PRINT("tcache", ("ignoring placeholder for derived table"));
continue; 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 If this TABLE_LIST object is a placeholder for an information_schema
table, create a temporary table to represent the information_schema table, create a temporary table to represent the information_schema

View File

@ -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 char *tdb= thd->db ? thd->db : db; // Result is never null
ulong skip_lines= ex->skip_lines; ulong skip_lines= ex->skip_lines;
bool transactional_table; bool transactional_table __attribute__((unused));
DBUG_ENTER("mysql_load"); DBUG_ENTER("mysql_load");
/* /*

View File

@ -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 bool
mysqld_show_create(THD *thd, TABLE_LIST *table_list) mysqld_show_create(THD *thd, TABLE_LIST *table_list)
{ {
Protocol *protocol= thd->protocol; Protocol *protocol= thd->protocol;
char buff[2048]; char buff[2048];
String buffer(buff, sizeof(buff), system_charset_info); 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_ENTER("mysqld_show_create");
DBUG_PRINT("enter",("db: %s table: %s",table_list->db, DBUG_PRINT("enter",("db: %s table: %s",table_list->db,
table_list->table_name)); 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. */ /* We want to preserve the tree for views. */
thd->lex->context_analysis_only|= CONTEXT_ANALYSIS_ONLY_VIEW; 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); Show_create_error_handler view_error_suppressor(thd, table_list);
thd->push_internal_handler(&view_error_suppressor); thd->push_internal_handler(&view_error_suppressor);
bool error= open_normal_and_derived_tables(thd, table_list, 0); bool error= open_normal_and_derived_tables(thd, table_list, 0);
thd->pop_internal_handler(); thd->pop_internal_handler();
if (error && (thd->killed || thd->main_da.is_error())) if (error && (thd->killed || thd->main_da.is_error()))
DBUG_RETURN(TRUE); goto error;
} }
/* TODO: add environment variables show when it become possible */ /* 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), my_error(ER_WRONG_OBJECT, MYF(0),
table_list->db, table_list->table_name, "VIEW"); table_list->db, table_list->table_name, "VIEW");
DBUG_RETURN(TRUE); goto error;
} }
buffer.length(0); buffer.length(0);
@ -778,9 +800,8 @@ mysqld_show_create(THD *thd, TABLE_LIST *table_list)
view_store_create_info(thd, table_list, &buffer) : view_store_create_info(thd, table_list, &buffer) :
store_create_info(thd, table_list, &buffer, NULL, store_create_info(thd, table_list, &buffer, NULL,
FALSE /* show_database */))) FALSE /* show_database */)))
DBUG_RETURN(TRUE); goto error;
List<Item> field_list;
if (table_list->view) if (table_list->view)
{ {
field_list.push_back(new Item_empty_string("View",NAME_CHAR_LEN)); 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, if (protocol->send_fields(&field_list,
Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF)) Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF))
DBUG_RETURN(TRUE); goto error;
protocol->prepare_for_resend(); protocol->prepare_for_resend();
if (table_list->view) if (table_list->view)
protocol->store(table_list->view_name.str, system_charset_info); 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()); protocol->store(buffer.ptr(), buffer.length(), buffer.charset());
if (protocol->write()) if (protocol->write())
DBUG_RETURN(TRUE); goto error;
my_eof(thd); 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, bool mysqld_show_create_db(THD *thd, char *dbname,

View File

@ -6711,7 +6711,7 @@ bool mysql_alter_table(THD *thd,char *new_db, char *new_name,
uint fast_alter_partition= 0; uint fast_alter_partition= 0;
bool partition_changed= FALSE; bool partition_changed= FALSE;
#endif #endif
bool need_lock_for_indexes= TRUE; bool need_lock_for_indexes __attribute__((unused)) = TRUE;
KEY *key_info_buffer; KEY *key_info_buffer;
uint index_drop_count= 0; uint index_drop_count= 0;
uint *index_drop_buffer= NULL; uint *index_drop_buffer= NULL;

View File

@ -848,7 +848,7 @@ static int mysql_register_view(THD *thd, TABLE_LIST *view,
thd->variables.sql_mode|= sql_mode; 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 */ /* fill structure */
view->source= thd->lex->create_view_select; view->source= thd->lex->create_view_select;

View File

@ -1513,7 +1513,7 @@ static FEDERATED_SHARE *get_share(const char *table_name, TABLE *table)
tmp_share.table_name_length, ident_quote_char); tmp_share.table_name_length, ident_quote_char);
if (!(share= (FEDERATED_SHARE *) memdup_root(&mem_root, (char*)&tmp_share, sizeof(*share))) || 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; goto error;
share->use_count= 0; share->use_count= 0;

View File

@ -3680,7 +3680,7 @@ static my_bool _ma_update_block_record2(MARIA_HA *info,
MARIA_PINNED_PAGE page_link; MARIA_PINNED_PAGE page_link;
uint rownr, org_empty_size, head_length; uint rownr, org_empty_size, head_length;
uint block_size= info->s->block_size; uint block_size= info->s->block_size;
uint errpos= 0; uint errpos __attribute__((unused)) = 0;
uchar *dir; uchar *dir;
pgcache_page_no_t page; pgcache_page_no_t page;
struct st_row_pos_info row_pos; struct st_row_pos_info row_pos;

View File

@ -3901,7 +3901,8 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info,
_ma_check_print_error(param, _ma_check_print_error(param,
"Rows lost (Found %lu of %lu); Aborting " "Rows lost (Found %lu of %lu); Aborting "
"because safe repair was requested", "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); (ulong) start_records);
share->state.state.records=start_records; share->state.state.records=start_records;
goto err; goto err;

View File

@ -3312,7 +3312,7 @@ static uint16 translog_get_chunk_header_length(uchar *chunk)
case TRANSLOG_CHUNK_LSN: case TRANSLOG_CHUNK_LSN:
{ {
/* 0 chunk referred as LSN (head or tail) */ /* 0 chunk referred as LSN (head or tail) */
translog_size_t rec_len; translog_size_t rec_len __attribute__((unused));
uchar *start= chunk; uchar *start= chunk;
uchar *ptr= start + 1 + 2; uchar *ptr= start + 1 + 2;
uint16 chunk_len, header_len; uint16 chunk_len, header_len;

View File

@ -2892,7 +2892,7 @@ static uint end_of_redo_phase(my_bool prepare_for_undo_phase)
static int run_undo_phase(uint uncommitted) static int run_undo_phase(uint uncommitted)
{ {
LSN last_undo; LSN last_undo __attribute__((unused));
DBUG_ENTER("run_undo_phase"); DBUG_ENTER("run_undo_phase");
if (uncommitted > 0) if (uncommitted > 0)

View File

@ -794,7 +794,7 @@ xtPublic void xt_ind_check_cache(XTIndexPtr ind)
ASSERT_NS(ind_cac_globals.cg_free_count == free_count); ASSERT_NS(ind_cac_globals.cg_free_count == free_count);
/* Check the LRU list: */ /* Check the LRU list: */
XTIndBlockPtr list_block, plist_block; XTIndBlockPtr list_block, plist_block __attribute__((unused));
plist_block = NULL; plist_block = NULL;
list_block = ind_cac_globals.cg_lru_block; list_block = ind_cac_globals.cg_lru_block;

View File

@ -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 2011-08-08 The InnoDB Team
* row/row0sel.c: * row/row0sel.c:

View File

@ -3448,8 +3448,8 @@ skip_info:
if ((ulint) (offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)) == root_page[i]) { if ((ulint) (offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)) == root_page[i]) {
if (fil_page_get_type(page) != FIL_PAGE_INDEX) { if (fil_page_get_type(page) != FIL_PAGE_INDEX) {
file_is_corrupt = TRUE; file_is_corrupt = TRUE;
fprintf(stderr, " [etyp:%lld]", fprintf(stderr, " [etyp:%ld]",
offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)); (long) (offset / (zip_size ? zip_size : UNIV_PAGE_SIZE)));
goto skip_write; goto skip_write;
} }
/* this is index root page */ /* this is index root page */
@ -3678,7 +3678,6 @@ func_exit:
ulint page_no; ulint page_no;
ulint zip_size; ulint zip_size;
ulint height; ulint height;
ulint root_height = 0;
rec_t* node_ptr; rec_t* node_ptr;
dict_table_t* table; dict_table_t* table;
dict_index_t* index; dict_index_t* index;
@ -3717,7 +3716,6 @@ func_exit:
if (height == ULINT_UNDEFINED) { if (height == ULINT_UNDEFINED) {
height = btr_page_get_level(page, &mtr); height = btr_page_get_level(page, &mtr);
root_height = height;
} }
if (height == 0) { if (height == 0) {

View File

@ -2735,7 +2735,7 @@ innobase_commit_low(
#ifdef MYSQL_SERVER #ifdef MYSQL_SERVER
THD *thd=current_thd; THD *thd=current_thd;
if (thd && thd->slave_thread) { if (thd && thd_is_replication_slave_thread(thd)) {
/* Update the replication position info inside InnoDB. /* Update the replication position info inside InnoDB.
In embedded server, does nothing. */ In embedded server, does nothing. */
const char *log_file_name, *group_relay_log_name; const char *log_file_name, *group_relay_log_name;
@ -5367,14 +5367,15 @@ calc_row_difference(
/* The field has changed */ /* The field has changed */
ufield = uvect->fields + n_changed; ufield = uvect->fields + n_changed;
UNIV_MEM_INVALID(ufield, sizeof *ufield);
/* Let us use a dummy dfield to make the conversion /* Let us use a dummy dfield to make the conversion
from the MySQL column format to the InnoDB format */ 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) { 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( buf = row_mysql_store_col_in_innobase_format(
&dfield, &dfield,
(byte*)buf, (byte*)buf,
@ -5382,7 +5383,7 @@ calc_row_difference(
new_mysql_row_col, new_mysql_row_col,
col_pack_len, col_pack_len,
dict_table_is_comp(prebuilt->table)); dict_table_is_comp(prebuilt->table));
dfield_copy_data(&ufield->new_val, &dfield); dfield_copy(&ufield->new_val, &dfield);
} else { } else {
dfield_set_null(&ufield->new_val); dfield_set_null(&ufield->new_val);
} }
@ -10812,7 +10813,7 @@ ha_innobase::check_if_incompatible_data(
if (info_row_type == ROW_TYPE_DEFAULT) if (info_row_type == ROW_TYPE_DEFAULT)
info_row_type = ROW_TYPE_COMPACT; info_row_type = ROW_TYPE_COMPACT;
if ((info->used_fields & HA_CREATE_USED_ROW_FORMAT) && 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)) { ? ROW_TYPE_COMPACT : info->row_type)) {
DBUG_PRINT("info", ("get_row_type()=%d != info->row_type=%d -> " DBUG_PRINT("info", ("get_row_type()=%d != info->row_type=%d -> "

View File

@ -434,11 +434,9 @@ row_ins_cascade_calc_update_vec(
dict_table_t* table = foreign->foreign_table; dict_table_t* table = foreign->foreign_table;
dict_index_t* index = foreign->foreign_index; dict_index_t* index = foreign->foreign_index;
upd_t* update; upd_t* update;
upd_field_t* ufield;
dict_table_t* parent_table; dict_table_t* parent_table;
dict_index_t* parent_index; dict_index_t* parent_index;
upd_t* parent_update; upd_t* parent_update;
upd_field_t* parent_ufield;
ulint n_fields_updated; ulint n_fields_updated;
ulint parent_field_no; ulint parent_field_no;
ulint i; ulint i;
@ -474,13 +472,15 @@ row_ins_cascade_calc_update_vec(
dict_index_get_nth_col_no(parent_index, i)); dict_index_get_nth_col_no(parent_index, i));
for (j = 0; j < parent_update->n_fields; j++) { 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) { if (parent_ufield->field_no == parent_field_no) {
ulint min_size; ulint min_size;
const dict_col_t* col; const dict_col_t* col;
ulint ufield_len; ulint ufield_len;
upd_field_t* ufield;
col = dict_index_get_nth_col(index, i); col = dict_index_get_nth_col(index, i);
@ -495,6 +495,7 @@ row_ins_cascade_calc_update_vec(
table, dict_col_get_no(col)); table, dict_col_get_no(col));
ufield->orig_len = 0; ufield->orig_len = 0;
ufield->exp = NULL;
ufield->new_val = parent_ufield->new_val; ufield->new_val = parent_ufield->new_val;
ufield_len = dfield_get_len(&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; goto nonstandard_exit_func;
} }
if ((node->is_delete if (node->is_delete
&& (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)) ? (foreign->type & DICT_FOREIGN_ON_DELETE_SET_NULL)
|| (!node->is_delete : (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL)) {
&& (foreign->type & DICT_FOREIGN_ON_UPDATE_SET_NULL))) {
/* Build the appropriate update vector which sets /* Build the appropriate update vector which sets
foreign->n_fields first fields in rec to SQL NULL */ 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->info_bits = 0;
update->n_fields = foreign->n_fields; 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++) { for (i = 0; i < foreign->n_fields; i++) {
upd_field_t* ufield = &update->fields[i]; upd_field_t* ufield = &update->fields[i];

View File

@ -396,7 +396,9 @@ my_bool vio_poll_read(Vio *vio,uint timeout)
void vio_timeout(Vio *vio, uint which, uint timeout) void vio_timeout(Vio *vio, uint which, uint timeout)
{ {
#if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO) #if defined(SO_SNDTIMEO) && defined(SO_RCVTIMEO)
#ifndef DBUG_OFF
int r; int r;
#endif
DBUG_ENTER("vio_timeout"); DBUG_ENTER("vio_timeout");
{ {
@ -410,10 +412,12 @@ void vio_timeout(Vio *vio, uint which, uint timeout)
wait_timeout.tv_usec= 0; wait_timeout.tv_usec= 0;
#endif #endif
r= setsockopt(vio->sd, SOL_SOCKET, which ? SO_SNDTIMEO : SO_RCVTIMEO, #ifndef DBUG_OFF
IF_WIN(const char*, const void*)&wait_timeout, r=
sizeof(wait_timeout)); #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 #ifndef DBUG_OFF

View File

@ -300,7 +300,8 @@ new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
verify= SSL_VERIFY_NONE; verify= SSL_VERIFY_NONE;
if (!(ssl_fd= new_VioSSLFd(key_file, cert_file, ca_file, 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; return 0;
} }
@ -322,7 +323,8 @@ new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
struct st_VioSSLFd *ssl_fd; struct st_VioSSLFd *ssl_fd;
int verify= SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE; int verify= SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE;
if (!(ssl_fd= new_VioSSLFd(key_file, cert_file, ca_file, 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; return 0;
} }