- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit3b4e53a
committed
Add infrastructure for efficient LSN waiting
Implement a new facility that allows processes to wait for WAL to reachspecific LSNs, both on primary (waiting for flush) and standby (waitingfor replay) servers.The implementation uses shared memory with per-backend informationorganized into pairing heaps, allowing O(1) access to the minimumwaited LSN. This enables fast-path checks: after replaying or flushingWAL, the startup process or WAL writer can quickly determine if anywaiters need to be awakened.Key components:- New xlogwait.c/h module with WaitForLSNReplay() and WaitForLSNFlush()- Separate pairing heaps for replay and flush waiters- WaitLSN lightweight lock for coordinating shared state- Wait events WAIT_FOR_WAL_REPLAY and WAIT_FOR_WAL_FLUSH for monitoringThis infrastructure can be used by features that need to wait for WALoperations to complete.Discussion:https://www.postgresql.org/message-id/flat/CAPpHfdsjtZLVzxjGT8rJHCYbM0D5dwkO+BBjcirozJ6nYbOW8Q@mail.gmail.comDiscussion:https://www.postgresql.org/message-id/flat/CABPTF7UNft368x-RgOXkfj475OwEbp%2BVVO-wEXz7StgjD_%3D6sw%40mail.gmail.comAuthor: Kartyshov Ivan <i.kartyshov@postgrespro.ru>Author: Alexander Korotkov <aekorotkov@gmail.com>Author: Xuneng Zhou <xunengzhou@gmail.com>Reviewed-by: Michael Paquier <michael@paquier.xyz>Reviewed-by: Peter Eisentraut <peter.eisentraut@enterprisedb.com>Reviewed-by: Dilip Kumar <dilipbalaut@gmail.com>Reviewed-by: Amit Kapila <amit.kapila16@gmail.com>Reviewed-by: Alexander Lakhin <exclusion@gmail.com>Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>Reviewed-by: Euler Taveira <euler@eulerto.com>Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>Reviewed-by: Kyotaro Horiguchi <horikyota.ntt@gmail.com>Reviewed-by: Xuneng Zhou <xunengzhou@gmail.com>1 parent8af3ae0 commit3b4e53a
File tree
8 files changed
+521
-1
lines changed- src
- backend
- access/transam
- storage/ipc
- utils/activity
- include
- access
- storage
- tools/pgindent
8 files changed
+521
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| 40 | + | |
40 | 41 | | |
41 | 42 | | |
42 | 43 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
27 | 28 | | |
28 | 29 | | |
29 | 30 | | |
| |||
0 commit comments
Comments
(0)