Skip to content

Commit f2614fa

Browse files
committed
Update replication script
1 parent 7976938 commit f2614fa

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

images/replication-job/start.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,16 @@ function enable_osmdbt_replication() {
100100

101101
# Use osmdbt-enable-replication to set up replication properly
102102
echo "$(date +%F_%H:%M:%S): Running osmdbt-enable-replication..."
103-
if /osmdbt/build/src/osmdbt-enable-replication -c "$osmdbtConfig" 2>&1 | tee -a "${logDirectory}/osmdbt-enable-replication.log"; then
103+
local log_file="${logDirectory}/osmdbt-enable-replication.log"
104+
if /osmdbt/build/src/osmdbt-enable-replication -c "$osmdbtConfig" 2>&1 | tee -a "$log_file"; then
104105
echo "$(date +%F_%H:%M:%S): Successfully enabled osmdbt replication."
105106
return 0
106107
else
108+
# Check if error is "already exists" - this is acceptable
109+
if grep -qi "already exists" "$log_file" 2>/dev/null; then
110+
echo "$(date +%F_%H:%M:%S): Replication slot '$REPLICATION_SLOT' already exists. Replication should be enabled."
111+
return 0
112+
fi
107113
local error_msg="ERROR: Failed to enable osmdbt replication. Check PostgreSQL configuration (wal_level=logical, max_replication_slots >= 1, user with REPLICATION attribute)."
108114
echo "$(date +%F_%H:%M:%S): $error_msg"
109115
send_slack_message "🚨 ${ENVIROMENT:-production}: $error_msg"

0 commit comments

Comments
 (0)