Repository navigation
Conversation
ecleon26
self-requested a review
December 1, 2026 06:33
ecleon26
requested changes
Dec 1, 2026
ecleon26
left a comment
Collaborator
There was a problem hiding this comment.
@Shgit29 The fix in wf_retention.c looks ok.
Don't #include a .c file in the test suite, and don't #define time. Either drop test_retention_calendar.c, or expose what you need through a proper function in a header.
Rebase, and squash
Comment on lines
+50
to
+55
| /* Exercise the private marker with a controlled clock without adding a public | ||
| * API or interposing time() for other tests or the shared library. */ | ||
| #define time retention_test_time | ||
| #define pgmoneta_create_retention retention_test_create_workflow | ||
| #include "../../src/libpgmoneta/wf_retention.c" | ||
| #undef pgmoneta_create_retention |
Collaborator
There was a problem hiding this comment.
Remove. We don't include source files from src/ in the tests
Author
|
Alright, I am fixing it. |
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.
Fixes #1772.
Weekly retention promises Monday backups, but fixed 86400-second steps can cross local midnight when a daylight-saving offset changes. For US Eastern at 2025-03-10 00:30 with two retained weeks, the previous target becomes February 24 instead of March 3. This can leave the intended Monday backup eligible for deletion even after #1506's accumulated-offset fix.
Calendar normalization at noon avoids the midnight ambiguity, while
tm_isdst = -1lets libc determine the target date's offset. Only the resulting calendar date is matched; noon is not a backup-time cutoff. Daily retention and the latest-valid-backup safeguard remain unchanged.The tests include the private marker's source with a test-local clock and renamed workflow factory. This avoids adding a public API solely for testing or interposing the production clock.
Validation against upstream
9a83b075:These are isolated function-level tests using synthetic backup metadata and a controlled clock, not a full PostgreSQL integration run. The upstream baseline uses unchanged source with the test clock shim and the clean upstream library. No real backups were deleted. The changes have been personally understood and tested before submission.