-
Notifications
You must be signed in to change notification settings - Fork 2
Comparing changes
Open a pull request
base repository: postgresql-cfbot/postgresql
base: cf/6265~1
head repository: postgresql-cfbot/postgresql
compare: cf/6265
- 5 commits
- 11 files changed
- 2 contributors
Commits on Dec 26, 2025
-
Extend xlogwait infrastructure with write and flush wait types
Add support for waiting on WAL write and flush LSNs in addition to the existing replay LSN wait type. This provides the foundation for extending the WAIT FOR command with MODE option. Key changes: - Add WAIT_LSN_TYPE_STANDBY_WRITE and WAIT_LSN_TYPE_STANDBY_FLUSH to WaitLSNType - Add GetCurrentLSNForWaitType() to retrieve current LSN for each wait type - Add new wait events WAIT_EVENT_WAIT_FOR_WAL_WRITE and WAIT_EVENT_WAIT_FOR_WAL_FLUSH for pg_stat_activity visibility - Update WaitForLSN() to use GetCurrentLSNForWaitType() internally
Configuration menu - View commit details
-
Copy full SHA for 4e9097d - Browse repository at this point
Copy the full SHA 4e9097dView commit details -
Add MODE option to WAIT FOR LSN command
Extend the WAIT FOR LSN command with an optional MODE option in the WITH clause that specifies which LSN type to wait for: WAIT FOR LSN '<lsn>' [WITH (MODE '<mode>', ...)] where mode can be: - 'standby_replay' (default): Wait for WAL to be replayed to the specified LSN - 'standby_write': Wait for WAL to be written (received) to the specified LSN - 'standby_flush': Wait for WAL to be flushed to disk at the specified LSN - 'primary_flush': Wait for WAL to be flushed to disk on the primary server The default mode is 'standby_replay', matching the original behavior when MODE is not specified. This follows the pattern used by COPY and EXPLAIN commands where options are specified as string values in the WITH clause. Modes are explicitly named to distinguish between primary and standby operations: - Standby modes ('standby_replay', 'standby_write', 'standby_flush') can only be used during recovery (on a standby server) - Primary mode ('primary_flush') can only be used on a primary server The 'standby_write' and 'standby_flush' modes are useful for scenarios where applications need to ensure WAL has been received or persisted on the standby without necessarily waiting for replay to complete. The 'primary_flush' mode allows waiting for WAL to be flushed on the primary server. Also includes: - Documentation updates for the new syntax and mode descriptions - Test coverage for all four modes including error cases and concurrent waiters - Wakeup logic in walreceiver for standby write/flush waiters - Wakeup logic in WAL writer for primary flush waitersConfiguration menu - View commit details
-
Copy full SHA for d9d68dc - Browse repository at this point
Copy the full SHA d9d68dcView commit details -
Add tab completion for WAIT FOR LSN MODE option
Update psql tab completion to support the optional MODE option in WAIT FOR LSN command. After specifying an LSN value, completion now offers both MODE and WITH keywords. The MODE option controls whether the wait is evaluated from the standby or primary perspective. When MODE is specified, completion suggests the valid mode values: standby_replay, standby_write, standby_flush, and primary_flush.
Configuration menu - View commit details
-
Copy full SHA for 5861122 - Browse repository at this point
Copy the full SHA 5861122View commit details -
Use WAIT FOR LSN in PostgreSQL::Test::Cluster::wait_for_catchup()
When the standby is passed as a PostgreSQL::Test::Cluster instance, use the WAIT FOR LSN command on the standby server to implement wait_for_catchup() for replay, write, and flush modes. This is more efficient than polling pg_stat_replication on the upstream, as the WAIT FOR LSN command uses a latch-based wakeup mechanism. The optimization applies when: - The standby is passed as a Cluster object (not just a name string) - The mode is 'replay', 'write', or 'flush' (not 'sent') - The standby is in recovery For 'sent' mode, when the standby is passed as a string (e.g., a subscription name for logical replication), or when the standby has been promoted, the function falls back to the original polling-based approach using pg_stat_replication on the upstream.
Configuration menu - View commit details
-
Copy full SHA for 9d0e9bd - Browse repository at this point
Copy the full SHA 9d0e9bdView commit details -
[CF 6265] v8 - Add MODE parameter to WAIT FOR LSN command
This branch was automatically generated by a robot using patches from an email thread registered at: https://commitfest.postgresql.org/patch/6265 The branch will be overwritten each time a new patch version is posted to the thread, and also periodically to check for bitrot caused by changes on the master branch. Patch(es): https://www.postgresql.org/message-id/CABPTF7WDzTs2EEB6c5QmsV-svF4rKSTLOS1pWM+7ydUN6tnFOQ@mail.gmail.com Author(s): Xuneng Zhou
Commitfest Bot committedDec 26, 2025 Configuration menu - View commit details
-
Copy full SHA for 203ecb4 - Browse repository at this point
Copy the full SHA 203ecb4View commit details
This comparison is taking too long to generate.
Unfortunately it looks like we can’t render this comparison for you right now. It might be too big, or there might be something weird with your repository.
You can try running this command locally to see the comparison on your machine:
git diff cf/6265~1...cf/6265