[MDEV-22348] main.default_storage_engine test uses common install.db datadir for startup Created: 2020-04-23  Updated: 2020-04-23  Resolved: 2020-04-23

Status: Closed
Project: MariaDB Server
Component/s: Tests
Affects Version/s: 5.5, 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.4.13, 10.5.3

Type: Bug Priority: Major
Reporter: Elena Stepanova Assignee: Michael Widenius
Resolution: Fixed Votes: 0
Labels: None


 Description   

The test runs the MTR bootstrap command (MYSQLD_BOOTSTRAP_CMD) without changing the datadir. The command is supposed to fail, but not right away – the server will attempt to start up, so it can conflict with other tests or logic which use the same datadir in parallel (as it is common for all parallel workers). In a worse scenario, if the test doesn't work as expected, it may damage install.db datadir which is important to keep clean and healthy for resetting the environment for tests.

The test should be using its own unique datadir.

--- /data/src/10.4/mysql-test/main/default_storage_engine.test	2019-04-21 01:03:31.152431465 +0300
+++ main/default_storage_engine.test	2020-04-23 04:15:50.501231748 +0300
@@ -9,8 +9,12 @@
 # Now it *must* fail, because if InnoDB is compiled in, it is used as a default
 # storage engine. but $cmd includes --skip-innodb
 #
+
+--mkdir $MYSQL_TMP_DIR/default_storage_engine_data
+
 error 1;
-exec $cmd;
+exec $cmd --datadir=$MYSQL_TMP_DIR/default_storage_engine_data;
 
-echo "all ok"; # to not have zero-length result file
+--rmdir $MYSQL_TMP_DIR/default_storage_engine_data
 
+echo "all ok"; # to not have zero-length result file



 Comments   
Comment by Marko Mäkelä [ 2020-04-23 ]

Here is a demonstration of the problem on a cmake -DCMAKE_BUILD_TYPE=Debug build:

./mtr --no-reorder innodb.innodb-system-table-view,4k main.default_storage_engine

10.4 88cf6f1c7ff5d56138c8b53a5adaca4c61752f86

innodb.innodb-system-table-view '4k,innodb' [ pass ]    277
main.default_storage_engine              [ fail ]
        Test ended at 2020-04-23 13:24:05
 
CURRENT_TEST: main.default_storage_engine
2020-04-23 13:23:33 0 [Note] /dev/shm/10.4g/sql/mysqld (mysqld 10.4.13-MariaDB-debug) starting as process 317055 ...
2020-04-23 13:23:33 0 [Warning] Could not increase number of max_open_files to more than 1024 (request: 32222)
2020-04-23 13:23:33 0 [Warning] Changed limits: max_open_files: 1024  max_connections: 151 (was 151)  table_cache: 421 (was 2000)
2020-04-23 13:23:33 0 [ERROR] mysqld: Can't lock aria control file '/dev/shm/10.4g/mysql-test/var/mysqld.1/data/aria_log_control' for exclusive use, error: 11. Will retry for 30 seconds
2020-04-23 13:24:04 0 [ERROR] mysqld: Got error 'Could not get an exclusive lock; file is probably in use by another process' when trying to use aria control file '/dev/shm/10.4g/mysql-test/var/mysqld.1/data/aria_log_control'
2020-04-23 13:24:04 0 [ERROR] Plugin 'Aria' init function returned error.
2020-04-23 13:24:04 0 [ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
2020-04-23 13:24:04 0 [Note] Plugin 'partition' is disabled.
2020-04-23 13:24:04 0 [Note] Plugin 'INNODB_SYS_SEMAPHORE_WAITS' is disabled.
2020-04-23 13:24:04 0 [Note] Plugin 'unix_socket' is disabled.
2020-04-23 13:24:04 0 [ERROR] Failed to initialize plugins.
2020-04-23 13:24:04 0 [ERROR] Aborting
mysqld: /mariadb/10.4/sql/mysqld.cc:1941: void mysqld_exit(int): Assertion `global_status_var.global_memory_used == 0' failed.

If I replace the assertion with a message, it will report 520 "leaked" bytes. But cmake -DWITH_ASAN does not report any leaks.

Comment by Michael Widenius [ 2020-04-23 ]

The propose fix, fixes the issue but it's the wrong way to do it.

All other similar tests works by stopping the server, run mysqld and then restarting it.
I have already pushed a fix for 10.4 that fixes it this way.

After talking with Elena I got to know that the problem is that MYSQLD_BOOTSTRAP_CMD has the wrong parameters because of previous tests.
However, even in this case it's good practice to stop and start the server around any execute of mysqld server

Comment by Elena Stepanova [ 2020-04-23 ]

Monty pushed his own patch, in 10.4+:
https://github.com/MariaDB/server/commit/d1c3342d07dbf56dc355b9e61efc3938807bcb3a

FWIW, I don't think it will fix anything, because MDEV-22349 will fix the MTR problem and will keep MYSQLD_BOOTSTRAP_CMD original, so the test will always be using install.db, and can pollute it or conflict with other parallel tests, as this directory is global. But I suppose we'll have to worry about it when it actually happens.
The patch only adds an extra server restart.

Comment by Marko Mäkelä [ 2020-04-23 ]

The (safemalloc-but-not-ASAN-reported) leak on failed Aria startup was fixed in 10.4.

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