Skip to content

Commit

Permalink
Correct mariadb upgrade script for support ib_logfile0 re-do log error
Browse files Browse the repository at this point in the history
  • Loading branch information
jimyhuang committed Oct 4, 2023
1 parent afcd9b1 commit 44e26f8
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions container/mysql/mysql-init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@ mariadb_error() {

mariadb_do_upgrade() {
mariadb_note "[Perform Mariadb System Table Upgrade]"
mariadb_note "Delete exists innodb redo log due to block of upgrade"
if [ -f /var/lib/mysql/ib_logfile0 ]; then
mv /var/lib/mysql/ib_logfile0 /var/lib/mysql/ib_logfile0.old
fi
if [ -f /var/lib/mysql/ib_logfile1 ]; then
mv /var/lib/mysql/ib_logfile1 /var/lib/mysql/ib_logfile1.old
fi
mariadb_note "Waiting temporary process start up ..."
mysqld \
--skip-networking \
Expand All @@ -44,6 +51,12 @@ mariadb_do_upgrade() {
mariadb_note "Upgrading system tables ..."
mysql_upgrade -uroot -p$INIT_PASSWD --upgrade-system-tables
mariadb_note "Upgrading completed."
if [ -f /var/lib/mysql/ib_logfile0.old ]; then
rm /var/lib/mysql/ib_logfile0.old
fi
if [ -f /var/lib/mysql/ib_logfile1.old ]; then
rm /var/lib/mysql/ib_logfile1.old
fi
kill "$MARIADB_PID"
wait "$MARIADB_PID"
}
Expand Down

0 comments on commit 44e26f8

Please sign in to comment.