Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion role_scripts/10/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi
# ref: https://superuser.com/a/246841/985093
cat /tmp/postgresql.conf $PGDATA/postgresql.conf >"/tmp/postgresql.conf.tmp" && mv "/tmp/postgresql.conf.tmp" "$PGDATA/postgresql.conf"
9 changes: 8 additions & 1 deletion role_scripts/10/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi
if [[ "${SSL:-0}" == "ON" ]]; then
echo "ssl = on" >>/tmp/postgresql.conf
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/10/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi
if [[ "${SSL:-0}" == "ON" ]]; then
echo "ssl = on" >>/tmp/postgresql.conf
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/10/standby/warm_stanby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi
if [[ "${SSL:-0}" == "ON" ]]; then
echo "ssl = on" >>/tmp/postgresql.conf
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/11/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi
# ref: https://superuser.com/a/246841/985093
cat /tmp/postgresql.conf $PGDATA/postgresql.conf >"/tmp/postgresql.conf.tmp" && mv "/tmp/postgresql.conf.tmp" "$PGDATA/postgresql.conf"
9 changes: 8 additions & 1 deletion role_scripts/11/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

if [[ "${SSL:-0}" == "ON" ]]; then
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/11/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi
if [[ "${SSL:-0}" == "ON" ]]; then
echo "ssl = on" >>/tmp/postgresql.conf
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/11/standby/warm_stanby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

if [[ "${SSL:-0}" == "ON" ]]; then
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/12/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

# ref: https://superuser.com/a/246841/985093
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/12/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

if [[ "${SSL:-0}" == "ON" ]]; then
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/12/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi
if [[ "${SSL:-0}" == "ON" ]]; then
echo "ssl = on" >>/tmp/postgresql.conf
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/12/standby/warm_stanby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi
if [[ "${SSL:-0}" == "ON" ]]; then
echo "ssl = on" >>/tmp/postgresql.conf
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/13/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

# ref: https://superuser.com/a/246841/985093
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/13/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi
if [[ "${SSL:-0}" == "ON" ]]; then
echo "ssl = on" >>/tmp/postgresql.conf
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/13/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

if [[ "${SSL:-0}" == "ON" ]]; then
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/13/standby/warm_stanby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

if [[ "${SSL:-0}" == "ON" ]]; then
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/14/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

# ref: https://superuser.com/a/246841/985093
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/14/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi
if [[ "${SSL:-0}" == "ON" ]]; then
echo "ssl = on" >>/tmp/postgresql.conf
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/14/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

if [[ "${SSL:-0}" == "ON" ]]; then
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/14/standby/warm_stanby.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

if [[ "${SSL:-0}" == "ON" ]]; then
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/15/primary/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

# ref: https://superuser.com/a/246841/985093
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/15/standby/ha_backup_job.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi
if [[ "${SSL:-0}" == "ON" ]]; then
echo "ssl = on" >>/tmp/postgresql.conf
Expand Down
9 changes: 8 additions & 1 deletion role_scripts/15/standby/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,14 @@ if [[ "$STREAMING" == "synchronous" ]]; then
done
names=${names%,}
fi
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
# An empty list is a syntax error, not "no sync standbys" -- postgres refuses to start on
# 'FIRST 2 ()'. $names is empty whenever this pod is the only member it can see, e.g. a
# PITR restore at one replica. Empty means "wait for local flush only", so this is safe.
if [[ -z "${names:-}" ]]; then
echo "synchronous_standby_names = ''" >>/tmp/postgresql.conf
else
echo "synchronous_standby_names = '${SYNC_REPLICATION_MODE:-ANY} ${NUM_SYNC_REPLICAS:-1} ("$names")'" >>/tmp/postgresql.conf
fi
fi

if [[ "${SSL:-0}" == "ON" ]]; then
Expand Down
Loading
Loading