diff --git a/upgrade-entrypoint.sh b/upgrade-entrypoint.sh index dd9f70f..f5354ff 100644 --- a/upgrade-entrypoint.sh +++ b/upgrade-entrypoint.sh @@ -26,13 +26,24 @@ if [ -f "$OLD_VERSION_FILE" ]; then # Run pg_upgrade # --link is used to avoid copying files (fast, but requires a backup!) - pg_upgrade \ + if ! pg_upgrade \ -d $DATA_DIR/old_data \ -D $DATA_DIR/new_data \ -b "$OLD_BIN" \ -B "$NEW_BIN" \ -s /tmp \ - --link + --link; then + + echo "========================================" + echo "pg_upgrade FAILED! Here is the actual reason why the old server crashed:" + echo "========================================" + + # Print the contents of the server log + cat "$DATA_DIR/new_data/pg_upgrade_output.d/*/log/pg_upgrade_server.log" + + # Exit to prevent the script from continuing + exit 1 + fi # Clean-up echo "Upgrade complete. Cleaning up..."