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.
About this change - What it does
Includes necessary changes for supporting PostgreSQL 17.
This PR updates the behavior of pg_walfile_name based on changes introduced in PostgreSQL 17 (PG17). Instead of calling `(pg_current_lsn), the function now uses the LSN obtained from the result of pg_backup_stop.
Why this way
For versions earlier than PG17, pg_walfile_name returns the previous WAL file name in certain edge cases, such as when the backup’s ending LSN falls on a segment boundary. This issue was resolved in PG17, making the get_backup_end_segment_and_time function largely obsolete for newer versions. As a result, for PG17 and later, backup end segments now rely directly on the pg_backup_stop result.
Note on Testing
While an edge case test was considered (where the backup’s ending LSN falls on a boundary), it was ultimately not included. This test requires a fresh PostgreSQL service to reliably reproduce the scenario. However, in shared pipeline environments, where other tests may have already committed transactions, reproducing the issue is highly inconsistent. Therefore, the test was deemed impractical for inclusion.
Resolves: #BF-2568
UPDATE:
Decided to remove changes in
get_backup_end_segment_and_time
for considering changes inpg_walfile_name
for PG17, was discussed offline and we agreed to keep old behavior rather than having two different ways for getting the end segment.