Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-30542

Update the spider self_reference test to include a case of circular referencing of length > 0

Details

    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.

      Attachments

        Issue Links

          Activity

            ycp 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
            

            ycp 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
            ycp 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

            ycp 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
            ycp Yuchen Pei added a comment - Hi holyfoot , PTAL thanks https://github.com/MariaDB/server/commit/fadb119fed8

            looks ok to push.

            holyfoot Alexey Botchkov added a comment - looks ok to push.
            ycp Yuchen Pei added a comment -

            Thanks for the review, pushed to 10.5

            ycp Yuchen Pei added a comment - Thanks for the review, pushed to 10.5
            ycp Yuchen Pei added a comment - Pushed a trivial fixup https://github.com/MariaDB/server/commit/24faa5de16c

            People

              ycp Yuchen Pei
              ycp Yuchen Pei
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.