MDEV-36335 MDEV-35452 Disable view protocol when calling spider_copy_tables in tests

Spider needs to lock the spider table when executing the udf, but the
server layer would have already locked tables in view protocol because
it transforms the query:

select spider_copy_table('t', 0, 1)

to two queries

create or replace view mysqltest_tmp_v as select
spider_copy_table('t', 0, 1);
select * from mysqltest_tmp_v;

So spider justifiably errors out in this case by checking on
thd->derived_tables and thd->locks in spider_copy_tables_body()
This commit is contained in:
Yuchen Pei 2025-04-02 14:47:53 +11:00
parent 0f7c9146cf
commit dabd51c391
No known key found for this signature in database
GPG Key ID: 3DD1B35105743563
8 changed files with 18 additions and 0 deletions

View File

@ -395,7 +395,9 @@ if ($USE_CHILD_GROUP3)
--connection master_1
eval $MASTER_1_SET_RECOVERY_STATUS_2_1;
eval $MASTER_1_CHECK_LINK_STATUS;
--disable_view_protocol
eval $MASTER_1_COPY_TABLES_2_1;
--enable_view_protocol
if ($USE_CHILD_GROUP3)
{
if (!$OUTPUT_CHILD_GROUP3)

View File

@ -460,7 +460,9 @@ if ($HAVE_PARTITION)
--connection master_1
eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1;
eval $MASTER_1_CHECK_LINK_STATUS;
--disable_view_protocol
eval $MASTER_1_COPY_TABLES_P_2_1;
--enable_view_protocol
if ($USE_CHILD_GROUP3)
{
if (!$OUTPUT_CHILD_GROUP3)

View File

@ -25,7 +25,9 @@ INSERT INTO dst VALUES (555, '1999-12-12');
# possibly a bug, e.g. an unnecessary requirement.
evalp CREATE TABLE t (c INT, d DATE, PRIMARY KEY(c)) ENGINE=SPIDER
COMMENT='table "src dst", srv "s_2_1 s_1"';
--disable_view_protocol
SELECT spider_copy_tables('t', '0', '1');
--enable_view_protocol
SELECT * FROM dst;

View File

@ -7,8 +7,10 @@ CREATE FUNCTION spider_bg_direct_sql RETURNS INT SONAME 'ha_spider.so';
SELECT spider_bg_direct_sql ('SELECT * FROM s','a','srv "b"');
CREATE FUNCTION spider_copy_tables RETURNS INT SONAME 'ha_spider.so';
--disable_view_protocol
--error ER_CANT_INITIALIZE_UDF
SELECT spider_copy_tables ('t', '0', '0');
--enable_view_protocol
# spider_flush_table_mon_cache does not require spider init to function
CREATE FUNCTION spider_flush_table_mon_cache RETURNS INT SONAME 'ha_spider.so';
@ -21,8 +23,10 @@ install soname 'ha_spider';
SELECT spider_direct_sql ('SELECT * FROM s','a','srv "b"');
call mtr.add_suppression(".*\\[Error\\] (mysqld|mariadbd): Can't find record in 'spider_tables'");
--disable_view_protocol
--error ER_KEY_NOT_FOUND
SELECT spider_copy_tables ('t', '0', '0');
--enable_view_protocol
SELECT spider_flush_table_mon_cache ();

View File

@ -395,7 +395,9 @@ if ($USE_CHILD_GROUP3)
--connection master_1
eval $MASTER_1_SET_RECOVERY_STATUS_2_1;
eval $MASTER_1_CHECK_LINK_STATUS;
--disable_view_protocol
eval $MASTER_1_COPY_TABLES_2_1;
--enable_view_protocol
if ($USE_CHILD_GROUP3)
{
if (!$OUTPUT_CHILD_GROUP3)

View File

@ -460,7 +460,9 @@ if ($HAVE_PARTITION)
--connection master_1
eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1;
eval $MASTER_1_CHECK_LINK_STATUS;
--disable_view_protocol
eval $MASTER_1_COPY_TABLES_P_2_1;
--enable_view_protocol
if ($USE_CHILD_GROUP3)
{
if (!$OUTPUT_CHILD_GROUP3)

View File

@ -395,7 +395,9 @@ if ($USE_CHILD_GROUP3)
--connection master_1
eval $MASTER_1_SET_RECOVERY_STATUS_2_1;
eval $MASTER_1_CHECK_LINK_STATUS;
--disable_view_protocol
eval $MASTER_1_COPY_TABLES_2_1;
--enable_view_protocol
if ($USE_CHILD_GROUP3)
{
if (!$OUTPUT_CHILD_GROUP3)

View File

@ -460,7 +460,9 @@ if ($HAVE_PARTITION)
--connection master_1
eval $MASTER_1_SET_RECOVERY_STATUS_P_2_1;
eval $MASTER_1_CHECK_LINK_STATUS;
--disable_view_protocol
eval $MASTER_1_COPY_TABLES_P_2_1;
--enable_view_protocol
if ($USE_CHILD_GROUP3)
{
if (!$OUTPUT_CHILD_GROUP3)