From 7ae950510626a1a19757ffb3bc0ee6cdab5c31a2 Mon Sep 17 00:00:00 2001 From: Tuukka Pasanen Date: Mon, 6 May 2024 12:30:29 +0300 Subject: [PATCH] MDEV-33750: Rework MyISAM recovery script Make small adjustment to MyISAM recovery function SQL statement and how to handle it. --- debian/additions/debian-start.inc.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/debian/additions/debian-start.inc.sh b/debian/additions/debian-start.inc.sh index 5455f268b9f..486acc15ff6 100755 --- a/debian/additions/debian-start.inc.sh +++ b/debian/additions/debian-start.inc.sh @@ -3,7 +3,7 @@ # This file is included by /etc/mysql/debian-start # -## Check MyISAM and Aria unclosed tables. +## Is there MyISAM or Aria unclosed tables. # - Requires the server to be up. # - Is supposed to run silently in background. function check_for_crashed_tables() { @@ -31,14 +31,13 @@ function check_for_crashed_tables() { # Note that inside single quotes must be quoted with '\'' (to be outside of single quotes). set +e # The $MARIADB is intentionally used to expand into a command and arguments - # shellcheck disable=SC2086 - LC_ALL=C echo ' + echo ' SELECT CONCAT("select count(*) into @discard from '\''", TABLE_SCHEMA, "'\''.'\''", TABLE_NAME, "'\''") FROM information_schema.TABLES WHERE TABLE_SCHEMA<>"INFORMATION_SCHEMA" AND TABLE_SCHEMA<>"PERFORMANCE_SCHEMA" AND (ENGINE="MyISAM" OR ENGINE="Aria") ' | \ - $MARIADB --skip-column-names --batch | \ - xargs -i $MARIADB --skip-column-names --silent --batch --force -e "{}" &> "${tempfile}" + LC_ALL=C "$MARIADB" --skip-column-names --batch | \ + xargs --no-run-if-empty -i "$MARIADB" --skip-column-names --silent --batch --force -e "{}" &> "${tempfile}" set -e if [ -s "$tempfile" ]