Commit 6b2b5800 by Vincent Pelletier

stack/erp5: Improve clone startup script.

Always running SQL_CHANGE_MASTER breaks GTID setup (at least on 10.1.24)
as it resets MASTER_USE_GTID. So only run it when not using GTID.
Also, fold SQL_SET_GTID into the existing "if" bloc for simplicity.
1 parent 0d302559
......@@ -22,7 +22,7 @@ md5sum = 0c0d98a68230cd0ad36046bb25b35f4a
[mariadb-start-clone-from-backup]
filename = instance-mariadb-start-clone-from-backup.sh.in
md5sum = 1af531c51f575a1d1362f2ca2d61620d
md5sum = e405227118a70fbf949a6414469989db
[template-mariadb]
filename = instance-mariadb.cfg.in
......
......@@ -88,6 +88,7 @@ zcat "$BACKUP" | "$CLIENT" -u root
echo "Configuring server as slave..."
if [ "$MASTER_USE_GTID" -eq 1 ]; then
"$CLIENT" -u root -e "$SQL_SET_GTID"
MASTER_USE_GTID_SQL="current_pos"
else
MASTER_USE_GTID_SQL="NO"
......@@ -104,8 +105,14 @@ fi
MASTER_SSL_VERIFY_SERVER_CERT=1,
MASTER_USE_GTID=$MASTER_USE_GTID_SQL;
"
"$CLIENT" -u root -e "$SQL_CHANGE_MASTER"
test "$MASTER_USE_GTID" -eq 1 && "$CLIENT" -u root -e "$SQL_SET_GTID"
if [ "$MASTER_USE_GTID" -eq 0 ]; then
# No GTID, use binlog name & offset as provided by backup file.
# Example: CHANGE MASTER TO MASTER_LOG_FILE='binlog.003447', MASTER_LOG_POS=360;
# Notes:
# - Must happen after setting MASTER_HOST & MASTER_PORT.
# - Implicitly sets MASTER_USE_GTID=NO if it was set before.
"$CLIENT" -u root -e "$SQL_CHANGE_MASTER"
fi
"$CLIENT" -u root -e "START SLAVE;"
echo "Stopping mariadb..."
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!