Details
-
Bug
-
Status: Closed (View Workflow)
-
Blocker
-
Resolution: Fixed
-
1.1.0
-
None
-
CentOS 6
Description
A literal "USE" statement sent from a client gives unexpected results when sent through schemarouter.
use DBI;
|
use Data::Dumper;
|
|
my $dbh = DBI->connect("DBI:mysql:host=127.0.0.1;port=$ARGV[0]", "kolbe", "kolbe");
|
|
foreach $i (1, 2) {
|
$dbh->do("USE shard$i");
|
print Dumper($dbh->selectrow_array("select database()"));
|
}
|
Connecting directly to the backend instances gives the expected results. shard1 only exists on the backend on port 3307. shard2 only exists on the backend on port 3308.
[skysql@max1 ~]$ perl mysqltest.pl 3307
|
$VAR1 = 'shard1';
|
DBD::mysql::db do failed: Unknown database 'shard2' at mysqltest.pl line 7.
|
$VAR1 = 'shard1';
|
[skysql@max1 ~]$ perl mysqltest.pl 3308
|
DBD::mysql::db do failed: Unknown database 'shard1' at mysqltest.pl line 7.
|
$VAR1 = undef;
|
$VAR1 = 'shard2';
|
But going through schemarouter gives unexpected and unpredictable behavior:
[skysql@max1 ~]$ perl mysqltest.pl 3310
|
$VAR1 = undef;
|
DBD::mysql::db do failed: Unknown database 'shard2' at mysqltest.pl line 7.
|
$VAR1 = 'shard2';
|
[skysql@max1 ~]$ perl mysqltest.pl 3310
|
$VAR1 = undef;
|
DBD::mysql::db do failed: Unknown database 'shard2' at mysqltest.pl line 7.
|
$VAR1 = 'shard2';
|
[skysql@max1 ~]$ perl mysqltest.pl 3310
|
DBD::mysql::db do failed: Unknown database 'shard1' at mysqltest.pl line 7.
|
$VAR1 = undef;
|
$VAR1 = 'shard2';
|
[skysql@max1 ~]$ perl mysqltest.pl 3310
|
DBD::mysql::db do failed: Unknown database 'shard1' at mysqltest.pl line 7.
|
$VAR1 = undef;
|
$VAR1 = 'shard2';
|
[skysql@max1 ~]$ perl mysqltest.pl 3310
|
DBD::mysql::db do failed: Unknown database 'shard1' at mysqltest.pl line 7.
|
$VAR1 = undef;
|
DBD::mysql::db do failed: Unknown database 'shard2' at mysqltest.pl line 7.
|
$VAR1 = 'shard2';
|