[MDEV-30542] Update the spider self_reference test to include a case of circular referencing of length > 0 Created: 2023-02-02  Updated: 2023-07-26  Resolved: 2023-04-19

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Spider
Fix Version/s: 11.1.1, 10.11.3, 11.0.2, 10.5.20, 10.6.13, 10.8.8, 10.9.6, 10.10.4

Type: Task Priority: Major
Reporter: Yuchen Pei Assignee: Yuchen Pei
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-6268 SPIDER table with no COMMENT clause c... Closed

 Description   

The self_reference test added in commit 23c8adda749 for MDEV-6268 only contains a case of a table directly referencing itself (length 0) which is not very realistic. The loop detection feature added there is believed to be more powerful than that, and can detect arbitrary lengths. Update the testcase to cover this case.



 Comments   
Comment by Yuchen Pei [ 2023-02-02 ]

I thought it would be somewhat trivial to write a test case for this, at least when all tables are on the same server, but I'm getting mysqltest: At line 27: query 'SELECT a FROM tbl_a' failed: <Unknown> (12720): Host:localhost and Socket:/home/ycp/source/mariadb-server/mdev-30542/build/mysql-test/var/tmp/mysqld.1.1.sock aim self server. Please change spider_same_server_link parameter if this link is required. despite spider_same_server_link is on for the following case.

--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
 
--connection master_1
CREATE DATABASE auto_test_local;
USE auto_test_local;
SET spider_same_server_link= on;
eval CREATE TABLE tbl_a (
    a INT
) $MASTER_1_ENGINE COMMENT='table "tbl_b", srv "s_1"';
eval CREATE TABLE tbl_b (
    a INT
) $MASTER_1_ENGINE COMMENT='table "tbl_c", srv "s_1"';
eval CREATE TABLE tbl_c (
    a INT
) $MASTER_1_ENGINE COMMENT='table "tbl_a", srv "s_1"';
 
--error 12719
SELECT a FROM tbl_a;
 
--connection master_1
DROP DATABASE IF EXISTS auto_test_local;
 
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_query_log
--enable_result_log

Comment by Yuchen Pei [ 2023-04-03 ]

Here's a simple test that works - place it under storage/spider/mysql-test/spider/bugfix/t/. I came up with it while working on MDEV-29676.

--disable_query_log
--disable_result_log
--source ../../t/test_init.inc
--enable_result_log
--enable_query_log
 
eval CREATE SERVER srv FOREIGN DATA WRAPPER MYSQL OPTIONS (SOCKET "$MASTER_1_MYSOCK", DATABASE 'test',user 'root');
create table t2 (c int);
create table t1 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t2"';
create table t0 (c int) ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t1"';
alter table t2 ENGINE=Spider COMMENT='WRAPPER "mysql", srv "srv",TABLE "t0"';
--error 12719
select * from t0;
--error 12719
select * from t1;
--error 12719
select * from t2;
drop table t0, t1, t2;
--disable_query_log
--disable_result_log
--source ../../t/test_deinit.inc
--enable_result_log
--enable_query_log

Comment by Yuchen Pei [ 2023-04-14 ]

Hi holyfoot, PTAL thanks

https://github.com/MariaDB/server/commit/fadb119fed8

Comment by Alexey Botchkov [ 2023-04-18 ]

looks ok to push.

Comment by Yuchen Pei [ 2023-04-19 ]

Thanks for the review, pushed to 10.5

Comment by Yuchen Pei [ 2023-06-28 ]

Pushed a trivial fixup https://github.com/MariaDB/server/commit/24faa5de16c

Generated at Thu Feb 08 10:17:02 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.