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.
Attachments
Issue Links
relates to
MDEV-6268SPIDER table with no COMMENT clause causes queries to wait forever
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.
Yuchen Pei
added a comment - - edited 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
Yuchen Pei
added a comment - - edited 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
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
--error 12719
--connection master_1
--disable_query_log
--disable_result_log
--source ../t/test_deinit.inc
--enable_query_log