Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-36324

The untested ha_spider::index_first_internal constructs broken queries

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.5, 10.6, 10.11
    • None
    • None

    Description

      The easiest way to trigger this is by disabling the GBH in 10.11+:

      # ... (setup)
      set spider_same_server_link= 1;
      set global spider_same_server_link= 1;
      set spider_select_column_mode= 0;
      set spider_disable_group_by_handler= 1;
      evalp CREATE SERVER srv FOREIGN DATA WRAPPER mysql
      OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
      CREATE TABLE t1 (c int);
      CREATE TABLE t1_s (c int)
      ENGINE=SPIDER COMMENT='wrapper "mariadb", srv "srv", table "t1"' ;
      SELECT MAX(c) FROM t1_s;
      drop table t1_s, t1;
      drop server srv;
      # ... (cleanup)
      

      Running this test results in

      mysqltest: At line 16: query 'SELECT MAX(c) FROM t1_s' failed: ER_BAD_FIELD_ERROR (1054): Unknown column 'c' in 'SELECT'
      

      The log shows that the SELECT query is translated to select max(`c`),min(`c`), missing the FROM part.

      The problem lies in ha_spider::index_first_internal, which is untested in the current spider regression test suites. That is, the following change causes no regression:

      modified   storage/spider/ha_spider.cc
      @@ -1911,6 +1911,7 @@ int ha_spider::index_prev(
       int ha_spider::index_first_internal(
         uchar *buf
       ) {
      +  abort();
         int error_num;
         backup_error_status();
         DBUG_ENTER("ha_spider::index_first_internal");
      

      The bug is the same as the failure of spider/bugfix.mdev_35874 with --view-protocol and the current draft patch of MDEV-36307 applied (bb-10.5-mdev-35452 d9d2fb9d07e47296faee79d230a38f7f9a0b3ef6)

      Attachments

        Issue Links

          Activity

            There are no comments yet on this issue.

            People

              ycp Yuchen Pei
              ycp Yuchen Pei
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

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