test both federated and federatedX in the federated suite.
mysql-test/lib/My/Options.pm: My::Options::is_set() now matches both option names and values! mysql-test/lib/mtr_cases.pm: 1. don't merge --plugin-load here, it's too early 2. don't skip combinations that set --plugin-load just because the test needs another --plugin-load. Skip *only* if test's --plugin-load matches *exactly* --plugin-load of one of the combinations. 3. if skipping all combinations but one, still assign the test to the combination mysql-test/mysql-test-run.pl: 1. remove dead code - don't set variables that aren't used. 2. bugfix: allow one-letter combination names 3. in the command line, merge all --plugin-load options in one storage/federated/ha_federated.cc: bugfix: garbage character in the generated SELECT query
This commit is contained in:
parent
be505e3ebf
commit
ca5b1b5431
@ -1,5 +0,0 @@
|
||||
if (`select plugin_library IS NULL from information_schema.plugins where plugin_name LIKE '%federated%'`)
|
||||
{
|
||||
--skip federated plugin not available
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -491,20 +491,32 @@ sub collect_one_suite
|
||||
#print_testcases(@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'} );
|
||||
|
||||
# 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)) {
|
||||
@ -527,17 +539,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);
|
||||
@ -661,9 +662,6 @@ sub process_opts {
|
||||
my @opts= @{$tinfo->{$opt_name}};
|
||||
$tinfo->{$opt_name} = [];
|
||||
|
||||
my @plugins;
|
||||
my %seen;
|
||||
|
||||
foreach my $opt (@opts)
|
||||
{
|
||||
my $value;
|
||||
@ -679,14 +677,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 )
|
||||
{
|
||||
@ -733,11 +723,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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2096,79 +2096,6 @@ sub environment_setup {
|
||||
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
|
||||
# impossible to add correct supressions, that means if "/usr/lib/debug"
|
||||
@ -3917,7 +3844,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");
|
||||
@ -5050,6 +4977,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
|
||||
@ -5066,6 +4996,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);
|
||||
@ -5082,6 +5017,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;
|
||||
}
|
||||
|
||||
|
8
mysql-test/suite/federated/combinations
Normal file
8
mysql-test/suite/federated/combinations
Normal file
@ -0,0 +1,8 @@
|
||||
[old]
|
||||
--federated
|
||||
--plugin-load=$HA_FEDERATED_SO
|
||||
|
||||
[X]
|
||||
--federated
|
||||
--plugin-load=$HA_FEDERATEDX_SO
|
||||
|
@ -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,);
|
||||
|
@ -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;
|
||||
|
@ -1,2 +0,0 @@
|
||||
--plugin_dir=$FEDERATED_PLUGIN_DIR
|
||||
--loose-federated=ON
|
@ -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;
|
@ -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;
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -1,3 +1,4 @@
|
||||
source have_federatedx.inc;
|
||||
source include/have_innodb.inc;
|
||||
source federated.inc;
|
||||
|
||||
|
@ -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;
|
||||
|
@ -1,6 +0,0 @@
|
||||
if (!`SELECT count(*) FROM information_schema.engines WHERE
|
||||
(support = 'YES' OR support = 'DEFAULT') AND
|
||||
engine = 'federated'`)
|
||||
{
|
||||
skip Need federated engine;
|
||||
}
|
5
mysql-test/suite/federated/have_federatedx.inc
Normal file
5
mysql-test/suite/federated/have_federatedx.inc
Normal 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;
|
||||
}
|
@ -1,2 +1 @@
|
||||
--federated
|
||||
--plugin-load=$HA_FEDERATEDX_SO
|
20
mysql-test/suite/federated/suite.pm
Normal file
20
mysql-test/suite/federated/suite.pm
Normal 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 { };
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user