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

Tests calling the udf spider_copy_tables fail with --view-protocol

Details

    Description

      When run with --view-protocol, these tests

      spider/bg.ha
      spider/bg.ha_part
      spider.ha
      spider/handler.ha
      spider.ha_part
      spider/handler.ha_part
      spider/bugfix.mdev_30649
      spider/bugfix.mdev_30727
      

      fail with

      mysqltest: At line 398: query '$MASTER_1_COPY_TABLES_2_1' failed: 12507: This UDF can't execute if other tables are opened 'thd->derived_tables'=0x52000002c128
       
      The result from queries just before the failure was:
      < snip >
      #  [... 19 lines elided]
      SELECT spider_copy_tables('ta_l', '0', '1');
      

      If we remove the corresponding check:

      modified   storage/spider/spd_copy_tables.cc
      @@ -753,16 +753,20 @@ long long spider_copy_tables_body(
               ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0),
               "thd->handler_tables_hash.records",
               (longlong) thd->handler_tables_hash.records);
      -    } else if (thd->derived_tables != 0)
      -    {
      -      my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
      -        ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0),
      -        "thd->derived_tables", thd->derived_tables);
      

      Then we get tripped at the next check of thd->lock.

      If we remove both checks:

      modified   storage/spider/spd_copy_tables.cc
      @@ -737,8 +737,10 @@ long long spider_copy_tables_body(
         if (
           thd->open_tables != 0 ||
           thd->handler_tables_hash.records != 0 ||
      -    thd->derived_tables != 0 ||
      -    thd->lock != 0 ||
           thd->locked_tables_list.locked_tables() ||
           thd->locked_tables_mode != LTM_NONE
         ) {
      @@ -753,16 +755,20 @@ long long spider_copy_tables_body(
               ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_NUM, MYF(0),
               "thd->handler_tables_hash.records",
               (longlong) thd->handler_tables_hash.records);
      -    } else if (thd->derived_tables != 0)
      -    {
      -      my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
      -        ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0),
      -        "thd->derived_tables", thd->derived_tables);
      -    } else if (thd->lock != 0)
      -    {
      -      my_printf_error(ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_NUM,
      -        ER_SPIDER_UDF_CANT_USE_IF_OPEN_TABLE_STR_WITH_PTR, MYF(0),
      -        "thd->lock", thd->lock);
      

      then the errors disappear, the tests pass normally but crashes in view protocol

      Attachments

        Issue Links

          Activity

            No workflow transitions have been executed yet.

            People

              ycp Yuchen Pei
              ycp Yuchen Pei
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.