Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.5
-
None
-
None
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
- is part of
-
MDEV-35452 Always failing spider tests on Debug Last-N builder with --view-protocol
-
- Open
-
Activity
Field | Original Value | New Value |
---|---|---|
Link | This issue is part of MDEV-35452 [ MDEV-35452 ] |
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 |
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 |
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} |
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} |
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} |
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 |
Upon further analysis, I think the error reporting makes sense and we should disable view protocol for calls to this udf in spider tests.
More specifically, consider the statement SELECT spider_copy_tables('t', '0', '1').
Without view protocol, the query is simply SELECT spider_copy_tables('t', '0', '1'), and lock_tables() in the initial open-and-lock is a no-op because there are no tables involved (the server layer has no idea the string 't' refers to a table).
// lock_tables:
DBUG_RETURN(0);
With view protocol, the query is SELECT * FROM mysqltest_tmp_v, where mysqltest_tmp_v is a view created using the actual SELECT of the udf. So the initial lock_tables does lock tables:
// lock_tables:
flags)))
DBUG_RETURN(TRUE);
With or without view protocol, during the execution of the udf, to copy from one table at the data node to another, spider needs to open the spider table t to access its fields so that it can construct queries to select from the source table and insert into the destination table.
// spider_copy_tables_body:
insert_ct->append_insert_str(SPIDER_DB_INSERT_IGNORE) ||
insert_ct->append_into_str() ||
insert_ct->append_table_name(0) ||
insert_ct->append_open_paren_str() ||
insert_ct->append_table_columns(table_share) ||
insert_ct->append_values_str()
) {
my_error(ER_OUT_OF_RESOURCES, MYF(0), HA_ERR_OUT_OF_MEM);
}
With view protocol, the attempt to lock t trips at an assertion failure:
// lock_tables:
{
BTW this is not a problem with other spider udfs such as spider_direct_sql, which simply passes the query to the data node without the need to lock any tables at the spider node.