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

            ycp Yuchen Pei created issue -
            ycp Yuchen Pei made changes -
            Field Original Value New Value
            ycp Yuchen Pei made changes -
            Description When run with --view-protocol, these tests

            {noformat}
            spider/bg.ha
            spider/bg.ha_part
            spider.ha
            spider/handler.ha
            spider.ha_part
            spider/handler.ha_part
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks then the tests pass:

            {code:diff}
            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);
            - } 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);
            {code}
            When run with --view-protocol, these tests

            {noformat}
            spider/bg.ha
            spider/bg.ha_part
            spider.ha
            spider/handler.ha
            spider.ha_part
            spider/handler.ha_part
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks:

            {code:diff}
            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);
            - } 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);
            {code}

             then the errors disappear but the copy fail
            ycp Yuchen Pei made changes -
            Description When run with --view-protocol, these tests

            {noformat}
            spider/bg.ha
            spider/bg.ha_part
            spider.ha
            spider/handler.ha
            spider.ha_part
            spider/handler.ha_part
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks:

            {code:diff}
            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);
            - } 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);
            {code}

             then the errors disappear but the copy fail
            When run with --view-protocol, these tests

            {noformat}
            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
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks:

            {code:diff}
            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);
            - } 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);
            {code}

             then the errors disappear but the copy fail
            ycp Yuchen Pei made changes -
            Description When run with --view-protocol, these tests

            {noformat}
            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
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks:

            {code:diff}
            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);
            - } 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);
            {code}

             then the errors disappear but the copy fail
            When run with --view-protocol, these tests

            {noformat}
            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
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks:

            {code:diff}
            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);
            - } 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);
            {code}

             then the errors disappear, the tests pass normally but fail with wrong results (the table appears to have not been copied) in view protocol:

            {code:diff}
            spider/bugfix.mdev_30649 [ fail ]
                    Test ended at 2025-03-20 11:45:02

            CURRENT_TEST: spider/bugfix.mdev_30649
            --- /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.result 2025-02-19 10:33:44.017063336 +1100
            +++ /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.reject 2025-03-20 11:45:01.817285708 +1100
            @@ -19,11 +19,9 @@
             COMMENT='table "src dst", srv "s_2_1 s_1"';
             SELECT spider_copy_tables('t', '0', '1');
             spider_copy_tables('t', '0', '1')
            -1
            +0
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             connection child2_1;
             DROP TABLE src;
            @@ -32,8 +30,6 @@
             DROP TABLE t;
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             DROP TABLE dst;
             DROP DATABASE auto_test_local;
            {code}
            ycp Yuchen Pei made changes -
            Description When run with --view-protocol, these tests

            {noformat}
            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
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks:

            {code:diff}
            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);
            - } 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);
            {code}

             then the errors disappear, the tests pass normally but fail with wrong results (the table appears to have not been copied) in view protocol:

            {code:diff}
            spider/bugfix.mdev_30649 [ fail ]
                    Test ended at 2025-03-20 11:45:02

            CURRENT_TEST: spider/bugfix.mdev_30649
            --- /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.result 2025-02-19 10:33:44.017063336 +1100
            +++ /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.reject 2025-03-20 11:45:01.817285708 +1100
            @@ -19,11 +19,9 @@
             COMMENT='table "src dst", srv "s_2_1 s_1"';
             SELECT spider_copy_tables('t', '0', '1');
             spider_copy_tables('t', '0', '1')
            -1
            +0
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             connection child2_1;
             DROP TABLE src;
            @@ -32,8 +30,6 @@
             DROP TABLE t;
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             DROP TABLE dst;
             DROP DATABASE auto_test_local;
            {code}
            When run with --view-protocol, these tests

            {noformat}
            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
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks:

            {code:diff}
            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->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);
            {code}

             then the errors disappear, the tests pass normally but fail with wrong results (the table appears to have not been copied) in view protocol:

            {code:diff}
            spider/bugfix.mdev_30649 [ fail ]
                    Test ended at 2025-03-20 11:45:02

            CURRENT_TEST: spider/bugfix.mdev_30649
            --- /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.result 2025-02-19 10:33:44.017063336 +1100
            +++ /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.reject 2025-03-20 11:45:01.817285708 +1100
            @@ -19,11 +19,9 @@
             COMMENT='table "src dst", srv "s_2_1 s_1"';
             SELECT spider_copy_tables('t', '0', '1');
             spider_copy_tables('t', '0', '1')
            -1
            +0
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             connection child2_1;
             DROP TABLE src;
            @@ -32,8 +30,6 @@
             DROP TABLE t;
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             DROP TABLE dst;
             DROP DATABASE auto_test_local;
            {code}
            ycp Yuchen Pei made changes -
            Description When run with --view-protocol, these tests

            {noformat}
            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
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks:

            {code:diff}
            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->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);
            {code}

             then the errors disappear, the tests pass normally but fail with wrong results (the table appears to have not been copied) in view protocol:

            {code:diff}
            spider/bugfix.mdev_30649 [ fail ]
                    Test ended at 2025-03-20 11:45:02

            CURRENT_TEST: spider/bugfix.mdev_30649
            --- /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.result 2025-02-19 10:33:44.017063336 +1100
            +++ /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.reject 2025-03-20 11:45:01.817285708 +1100
            @@ -19,11 +19,9 @@
             COMMENT='table "src dst", srv "s_2_1 s_1"';
             SELECT spider_copy_tables('t', '0', '1');
             spider_copy_tables('t', '0', '1')
            -1
            +0
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             connection child2_1;
             DROP TABLE src;
            @@ -32,8 +30,6 @@
             DROP TABLE t;
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             DROP TABLE dst;
             DROP DATABASE auto_test_local;
            {code}
            When run with --view-protocol, these tests

            {noformat}
            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
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks:

            {code:diff}
            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);
            {code}

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

            {code:diff}
            spider/bugfix.mdev_30649 [ fail ]
                    Test ended at 2025-03-20 11:45:02

            CURRENT_TEST: spider/bugfix.mdev_30649
            --- /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.result 2025-02-19 10:33:44.017063336 +1100
            +++ /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.reject 2025-03-20 11:45:01.817285708 +1100
            @@ -19,11 +19,9 @@
             COMMENT='table "src dst", srv "s_2_1 s_1"';
             SELECT spider_copy_tables('t', '0', '1');
             spider_copy_tables('t', '0', '1')
            -1
            +0
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             connection child2_1;
             DROP TABLE src;
            @@ -32,8 +30,6 @@
             DROP TABLE t;
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             DROP TABLE dst;
             DROP DATABASE auto_test_local;
            {code}
            ycp Yuchen Pei made changes -
            Description When run with --view-protocol, these tests

            {noformat}
            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
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks:

            {code:diff}
            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);
            {code}

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

            {code:diff}
            spider/bugfix.mdev_30649 [ fail ]
                    Test ended at 2025-03-20 11:45:02

            CURRENT_TEST: spider/bugfix.mdev_30649
            --- /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.result 2025-02-19 10:33:44.017063336 +1100
            +++ /home/ycp/source/mariadb-server/10.5/src/storage/spider/mysql-test/spider/bugfix/r/mdev_30649.reject 2025-03-20 11:45:01.817285708 +1100
            @@ -19,11 +19,9 @@
             COMMENT='table "src dst", srv "s_2_1 s_1"';
             SELECT spider_copy_tables('t', '0', '1');
             spider_copy_tables('t', '0', '1')
            -1
            +0
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             connection child2_1;
             DROP TABLE src;
            @@ -32,8 +30,6 @@
             DROP TABLE t;
             SELECT * FROM dst;
             c d
            -42 2024-08-27
            -73 2024-07-12
             555 1999-12-12
             DROP TABLE dst;
             DROP DATABASE auto_test_local;
            {code}
            When run with --view-protocol, these tests

            {noformat}
            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
            {noformat}

            fail with

            {noformat}
            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');
            {noformat}

            If we remove the corresponding check:

            {code:diff}
            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);
            {code}

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

            If we remove both checks:

            {code:diff}
            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);
            {code}

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

            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.