mariadbdebian

mariadb debian-start script giving errors: ERROR 1146 (42S02) at line 1: Table '_cdfd7a1251c20c3e.tabError' doesn't exist


I'm getting a number of these errors printed in the systemd journal when i restart mariadb:

Nov 07 17:56:05 p2 /etc/mysql/debian-start[8427]: --------------
Nov 07 17:56:05 p2 /etc/mysql/debian-start[8427]: select count(*) into @discard from _cdfd7a1251c20c3e.tabError Log
Nov 07 17:56:05 p2 /etc/mysql/debian-start[8427]: --------------
Nov 07 17:56:05 p2 /etc/mysql/debian-start[8427]: 
Nov 07 17:56:05 p2 /etc/mysql/debian-start[8427]: ERROR 1146 (42S02) at line 1: Table '_cdfd7a1251c20c3e.tabError' doesn't exist

It appears to be cause by the check_for_crashed_tables shell call in debian-start I have found that function in /usr/share/mariadb/debian-start.inc.sh:

  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")
    ' | \
    LC_ALL=C $MARIADB --skip-column-names --batch | \
    xargs --no-run-if-empty -i $MARIADB --skip-column-names --silent --batch --force -e "{}" &> "${tempfile}"

It looks to me like the table.table_name is not properly surrounded by quotes, so when a table name with spaces occurs, the command is failing.

However looking at the shell script they have gone to quite a bit of trouble to add the correct quotes in the SELECT CONCAT( statement.

Can anyone provide some insight? I have reported to the debian bug tracker (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1120329).


Solution

  • I wondered about using backticks instead, which worked. Change the SELECT statement to:

    SELECT CONCAT("select count(*) into @discard from `", TABLE_SCHEMA, "`.`", TABLE_NAME, "`")