-
Notifications
You must be signed in to change notification settings - Fork 491
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
safekeeper: fix atomicity of WAL truncation (#9685)
If WAL truncation fails in the middle it might leave some data on disk above the write/flush LSN. In theory, concatenated with previous records it might form bogus WAL (though very unlikely in practice because CRC would protect from that). To protect from that, set pending_wal_truncation flag: means before any WAL writes truncation must be retried until it succeeds. We already did that in case of safekeeper restart, now extend this mechanism for failures without restart. Also, importantly, reset LSNs in the beginning of the operation, not in the end, because once on disk deletion starts previous pointers are wrong. All this most likely haven't created any problems in practice because CRC protects from the consequences. Tests for this are hard; simulation infrastructure might be useful here in the future, but not yet.
- Loading branch information
Showing
1 changed file
with
47 additions
and
19 deletions.
There are no files selected for viewing
This file contains 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
d06bf4b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5491 tests run: 5253 passed, 1 failed, 237 skipped (full report)
Failures on Postgres 16
test_sharded_ingest[github-actions-selfhosted-1]
: release-x86-64Flaky tests (2)
Postgres 17
test_location_conf_churn[3]
: release-arm64Postgres 16
test_create_churn_during_restart
: release-x86-64Code coverage* (full report)
functions
:31.8% (7889 of 24837 functions)
lines
:49.4% (62454 of 126324 lines)
* collected from Rust tests only
d06bf4b at 2024-11-14T11:56:19.490Z :recycle: