Skip to content

Commit

Permalink
MDEV-24788: mariadbd --help Can't lock aria control file
Browse files Browse the repository at this point in the history
... '/var/lib/mysql/aria_log_control' for exclusive use, error: 11

As such don't lock under aria_readonly (which is set by opt_help in the handler
initialization.

Fixes: 8eba777
  • Loading branch information
grooverdan committed Dec 15, 2021
1 parent 03678bc commit 2776635
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
4 changes: 0 additions & 4 deletions mysql-test/main/mysqld--help-aria.result
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
[ERROR] mariadbd: Can't lock aria aria_log_control for exclusive use, error: #. Will retry for 0 seconds
[ERROR] Plugin 'Aria' init function returned error.
[ERROR] Plugin 'Aria' registration as a STORAGE ENGINE failed.
[Warning] Could not open mysql.plugin table: "Unknown storage engine 'Aria'". Some options may be missing from the help text
#
# Check that we don't write any data to wrong or not existing datadir
#
Expand Down
7 changes: 1 addition & 6 deletions mysql-test/main/mysqld--help-aria.test
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@
# Check errors from mysqld--help when providing different datadir
#

# We can't run this test on windows as windows doesn't provide file locking
# which the first exec requires.

--source include/not_windows.inc

--let $args=--table-cache=5 --max-connections=10 --log-warnings=1 --silent-startup --lower-case-table-names=1 --help --verbose

--exec $MYSQLD_CMD $args > $MYSQL_TMP_DIR/mysqld--help2.txt 2> $MYSQL_TMP_DIR/mysqld--help2.err
--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* // /control file '.*aria_log_control'/aria_log_control/ /error: \d+/error: #/
--replace_regex /mysqld/mariadbd/ /\d\d\d\d-\d*-\d* *\d*:\d*:\d* \d* //
--cat_file $MYSQL_TMP_DIR/mysqld--help2.err

--echo #
Expand Down
4 changes: 2 additions & 2 deletions storage/maria/ma_control_file.c
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
errmsg= "Can't create file";
goto err;
}
if (lock_control_file(name, wait_for_lock))
if (!aria_readonly && lock_control_file(name, wait_for_lock))
{
error= CONTROL_FILE_LOCKED;
errmsg= lock_failed_errmsg;
Expand All @@ -332,7 +332,7 @@ CONTROL_FILE_ERROR ma_control_file_open(my_bool create_if_missing,
}

/* lock it before reading content */
if (lock_control_file(name, wait_for_lock))
if (!aria_readonly && lock_control_file(name, wait_for_lock))
{
error= CONTROL_FILE_LOCKED;
errmsg= lock_failed_errmsg;
Expand Down

0 comments on commit 2776635

Please sign in to comment.