Add PostgreSQL promotion database gate
This commit is contained in:
@@ -29,6 +29,11 @@ mc_pg_promote_database_shadow()
|
||||
if [ "${rc}" -ne 0 ]; then
|
||||
ocf_log warn \
|
||||
"managed-containerd promote.database shadow unavailable rc=${rc}"
|
||||
|
||||
if [ "${MC_PROMOTE_DATABASE_GATE:-false}" = true ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -50,10 +55,12 @@ if (
|
||||
else
|
||||
ocf_log err \
|
||||
"managed-containerd promote.database shadow MISMATCH response=${response}"
|
||||
|
||||
if [ "${MC_PROMOTE_DATABASE_GATE:-false}" = true ]; then
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Shadow-only milestone: daemon disagreement must not alter the
|
||||
# authoritative native promotion result yet.
|
||||
return 0
|
||||
}
|
||||
|
||||
@@ -117,9 +124,13 @@ managed_promote()
|
||||
"Promoting PostgreSQL standby inside ${CONTAINER_NAME}"
|
||||
|
||||
# Independent managed-containerd promotion preflight.
|
||||
# Shadow-only for now: disagreement is logged but does not block
|
||||
# the authoritative native PostgreSQL promotion.
|
||||
mc_pg_promote_database_shadow
|
||||
# Shadow-only by default; when promote_database_gate=true,
|
||||
# daemon disagreement or transport failure denies native promotion.
|
||||
if ! mc_pg_promote_database_shadow; then
|
||||
ocf_exit_reason \
|
||||
"Promotion database gate rejected native PostgreSQL promotion"
|
||||
return "${OCF_ERR_GENERIC}"
|
||||
fi
|
||||
|
||||
if ! pg_command '
|
||||
BINDIR="$(pg_config --bindir)" || exit 1
|
||||
|
||||
Reference in New Issue
Block a user