Early warning sytem for postgres' transaction ID wraparound #12
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.
Based on this blog post from AWS, it implements a warning system to avoid transaction ID wraparound.
If this alarm is triggered, you should check your AUTOVACUUM progress. More info about this in AWS blog "Understanding autovacuum in Amazon RDS for PostgreSQL environments"
New resources:
aws_cloudwatch_metric_alarm.maximum_used_transaction_ids_too_high
New inputs:
var.engine
- by default it is set to an empty string. If that is configured to be eitherpostgres
oraurora-postgresql
(same values that are used for aws_db_instance), then this new alarm is created.var.maximum_used_transaction_ids_too_high_threshold
- set to 1,000,000,000 (1 billion), as recommended by AWS blog post mentioned above.New outputs:
alarm_maximum_used_transaction_ids_too_high
All resources, inputs and outputs are following the same naming and style convention as existing code. Only real difference is the conditional creation in case it is a postgres engine.
Tested and already in daily use in prod. Backwards compatible, does not affect existing setups.