Use SYNC_REPLICATION_MODE, NUM_SYNC_REPLICAS, SYNC_COMMIT_LEVEL in sync scripts (v9–v18)#61
Open
souravbiswassanto wants to merge 2 commits into
Open
Use SYNC_REPLICATION_MODE, NUM_SYNC_REPLICAS, SYNC_COMMIT_LEVEL in sync scripts (v9–v18)#61souravbiswassanto wants to merge 2 commits into
souravbiswassanto wants to merge 2 commits into
Conversation
Replace hardcoded ANY 1 and remote_write with env vars in synchronous_standby_names and synchronous_commit configuration across all version scripts (v9-v18). Shell defaults preserve existing behavior when env vars are absent: - SYNC_REPLICATION_MODE defaults to ANY - NUM_SYNC_REPLICAS defaults to 1 - SYNC_COMMIT_LEVEL defaults to remote_write Signed-off-by: saurov@appscode.com Signed-off-by: souravbiswassanto <sourav.cse4.bu@gmail.com>
When SYNC_STANDBY_NAMES is set (comma-separated pod names), use that list directly instead of auto-generating from pod indices. This enables FIRST mode with custom priority ordering and selective exclusion of specific standbys (e.g., cross-region replicas) from the sync quorum. Falls back to auto-generation when SYNC_STANDBY_NAMES is absent, preserving existing behaviour. Signed-off-by: saurov@appscode.com Signed-off-by: souravbiswassanto <sourav.cse4.bu@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends the synchronous replication block in all 40 role scripts (v9–v18) to use
SYNC_STANDBY_NAMESwhen set, falling back to the existing auto-generation loop when not.Logic (all scripts: primary/start.sh, standby/run.sh, standby/warm_stanby.sh, standby/ha_backup_job.sh)
What this unlocks
mode: First):FIRST 1 ("postgres-2","postgres-0")— explicit preferenceWhat is NOT changed
remote-replica.shfiles — those use'*'(all standbys), unrelated to this feature.Backwards compatibility
Shell
:-defaults on all three env vars mean scripts behave identically when running against an older operator that doesn't set these vars.Dependency
https://github.com/kubedb/postgres/pull/904 (operator) / kubedb/apimachinery#1782 (API)
Test plan
SYNC_STANDBY_NAMES=postgres-2,postgres-0 SYNC_REPLICATION_MODE=FIRST NUM_SYNC_REPLICAS=1— verifysynchronous_standby_names = 'FIRST 1 ("postgres-2","postgres-0")'remote-replica.shfiles touched🤖 Generated with Claude Code