[MDEV-27134] Test main.cte_nonrecursive on sporadic failures Created: 2021-11-28  Updated: 2021-11-29  Resolved: 2021-11-29

Status: Closed
Project: MariaDB Server
Component/s: Tests
Affects Version/s: None
Fix Version/s: 10.3.33, 10.4.23, 10.5.14, 10.6.6, 10.7.2

Type: Bug Priority: Major
Reporter: Otto Kekäläinen Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: None


 Description   

I've noticed several times failures of the main.cte_nonrecursive test. They usually don't repeat when restarting the test, so they seem sporadic.

Example:

main.cte_nonrecursive                    w3 [ fail ]
        Test ended at 2021-11-27 23:03:54
 
CURRENT_TEST: main.cte_nonrecursive
mysqltest: At line 1220: query 'drop database test' failed: ER_DB_DROP_RMDIR (1010): Error dropping database (can't rmdir './test', errno: 39 "Directory not empty")
 
The result from queries just before the failure was:
< snip >
# MDEV-18460: Server crashed in strmake / tdc_create_key /
# THD::create_tmp_table_def_key
#
connect con1,localhost,root,,;
CREATE TEMPORARY TABLE test.t (a INT);
WITH cte AS (SELECT 1) SELECT * FROM cte;
1
1
WITH t AS (SELECT 1) SELECT * FROM t;
1
1
WITH cte AS (SELECT 1) SELECT * FROM t;
ERROR 3D000: No database selected
DROP TABLE test.t;
connection default;
disconnect con1;
#
# MDEV-22781: create view with CTE without default database
#
drop database test;
 
More results from queries before failure can be found in /tmp/tmp.SRpydvPo6F/var/3/log/cte_nonrecursive.log
 
 - saving '/tmp/tmp.SRpydvPo6F/var/3/log/main.cte_nonrecursive/' to '/tmp/tmp.SRpydvPo6F/var/log/main.cte_nonrecursive/'

Occurences:

I've seen this failure on MariaDB 10.4 a couple of times too, so I don't think it is specific for 10.6.



 Comments   
Comment by Marko Mäkelä [ 2021-11-29 ]

otto, I see that the test is executing several DROP DATABASE. The problematic one in your report is

drop database test;

I remember that monty has stated earlier (related to versioning tests) that the test database should never be dropped or re-created. That is, this failure could be worked around by slightly changing the test.

It would be helpful to know which files existed in the directory when it was not empty, so that we would know which earlier test might have left some garbage files behind in that directory. In 10.6, the culprit should not be InnoDB (MDEV-21283).

I made a quick attempt based on https://salsa.debian.org/mariadb-team/mariadb-server/-/jobs/2225231/raw as follows:

  • compiled CMAKE_BUILD_TYPE=RelWithDebInfo of mariadb-10.6.5
  • extracted the names of all 172 tests that were run on w3 up to the failure
  • invoked ./mtr --no-reorder main.ipv6 main.sp_trans_log … main.create_utf8 main.cte_nonrecursive

Unfortunately, the test main.cte_nonrecursive always passed on my system. I attempted it 3 times.

Comment by Marko Mäkelä [ 2021-11-29 ]

otto, would the following change to the test fix the failure?

diff --git a/mysql-test/main/cte_nonrecursive.result b/mysql-test/main/cte_nonrecursive.result
index 17c73f74a49..3d56754b2a8 100644
--- a/mysql-test/main/cte_nonrecursive.result
+++ b/mysql-test/main/cte_nonrecursive.result
@@ -1693,7 +1693,9 @@ disconnect con1;
 #
 # MDEV-22781: create view with CTE without default database
 #
-drop database test;
+create database db;
+use db;
+drop database db;
 create database db1;
 create table db1.t1 (a int);
 insert into db1.t1 values (3),(7),(1);
@@ -1723,7 +1725,6 @@ a
 drop view db1.v1;
 drop table db1.t1;
 drop database db1;
-create database test;
 use test;
 #
 # MDEV-24597: CTE with union used multiple times in query
diff --git a/mysql-test/main/cte_nonrecursive.test b/mysql-test/main/cte_nonrecursive.test
index 8ab3bddc410..82afcdb9b8e 100644
--- a/mysql-test/main/cte_nonrecursive.test
+++ b/mysql-test/main/cte_nonrecursive.test
@@ -1217,7 +1217,9 @@ DROP TABLE test.t;
 --echo # MDEV-22781: create view with CTE without default database
 --echo #
 
-drop database test;
+create database db;
+use db;
+drop database db;
 create database db1;
 create table db1.t1 (a int);
 insert into db1.t1 values (3),(7),(1);
@@ -1239,7 +1241,6 @@ drop view db1.v1;
 drop table db1.t1;
 drop database db1;
 
-create database test;
 use test;
 
 --echo #

Comment by Marko Mäkelä [ 2021-11-29 ]

I pushed the test case cleanup to 10.3 and merged to all later-vesion branches.

Generated at Thu Feb 08 09:50:36 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.