Uploaded image for project: 'MariaDB MaxScale'
  1. MariaDB MaxScale
  2. MXS-78

"USE" statement gives unpredictable/unexpected results

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • 1.1.0
    • 1.1.0
    • schemarouter
    • 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';

      Attachments

        Activity

          People

            tturenko Timofey Turenko
            kolbe Kolbe Kegel (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.