feat(pgbackrest): scale WAL drop + spool ceilings by volume size#76
Merged
Conversation
Both archive-failure thresholds were absolute constants (500 MiB pg_wal drop, 5 GiB archive-push-queue-max), tuned for mid-size volumes. On a 1 GiB Hobby volume the 5 GiB spool was unreachable and 500 MiB of pg_wal was half the disk. On a 1 TB volume both were needlessly tight. Scale them DOWN proportionally — never above the existing 500 MiB / 5 GiB caps: - wal-drop: min(500 MiB, ~10% of volume), floor 64 MiB - queue-max: min(5 GiB, ~50% of volume), floor 128 MiB The 10x spread between the two budgets is preserved across volume sizes — hard failures still bail fast, transient stalls still absorb generously. On volumes >=25 GiB both ceilings hold (= today's behavior). wrapper.sh computes thresholds at boot, exports WAL_DROP_THRESHOLD_MB (if not operator-set) so the archive_command wrapper inherits it, and threads the queue-max value into the rendered pgbackrest.conf. Operator overrides keep working: WAL_DROP_THRESHOLD_MB is respected when pre-set, and pgBackRest env-var precedence (env > config) means PGBACKREST_ARCHIVE_PUSH_QUEUE_MAX still wins over the rendered conf value.
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
Both archive-failure thresholds were absolute constants —
WAL_DROP_THRESHOLD_MB=500forpg_wal/hard-failure drops,archive-push-queue-max=5GiBfor the async spool. Tuned for mid-size volumes. On a 1 GiB Hobby volume the 5 GiB spool was unreachable and 500 MiB ofpg_wal/was half the disk. Scale them DOWN proportionally — never above the existing 500 MiB / 5 GiB caps:min(500 MiB, ~10% of volume), floor 64 MiBmin(5 GiB, ~50% of volume), floor 128 MiBThe 10× spread between the two budgets is preserved across volume sizes — hard failures still bail fast, transient stalls still absorb generously. On volumes ≥25 GiB both ceilings hold (= today's behavior).
wrapper.shcomputes thresholds at boot viadf -Pk $RAILWAY_VOLUME_MOUNT_PATH, exportsWAL_DROP_THRESHOLD_MB(only if not operator-set) so the archive_command wrapper inherits it, and threads the queue-max value into the renderedpgbackrest.conf.Compatibility
WAL_DROP_THRESHOLD_MBis respected (env var pre-existing wins over the computed default).PGBACKREST_ARCHIVE_PUSH_QUEUE_MAXis respected via pgBackRest's env-var > config precedence.t_s3_unreachable_pg_stays_up,t_queue_max_5gib_trips) both rely on these override paths and continue to work.Test plan
wal-drop=500 MiB queue-max=5120 MiB, behaves identically to current mainwal-drop=102 MiB queue-max=512 MiB, conf hasarchive-push-queue-max=512MiB