]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Extend xlogwait infrastructure with write and flush wait types
authorAlexander Korotkov <akorotkov@postgresql.org>
Mon, 5 Jan 2026 17:40:31 +0000 (19:40 +0200)
committerAlexander Korotkov <akorotkov@postgresql.org>
Mon, 5 Jan 2026 17:56:19 +0000 (19:56 +0200)
commit7a39f43d885b44a78f366aa50535944c4e38bdbb
tree0ae140ea1c19d923ef4df8b457f25aaa037bbb7a
parentd51a5d8e56922a4343af8e31abef4a3faf95352f
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 parameter.

Key changes are following.
- Add WAIT_LSN_TYPE_STANDBY_WRITE and WAIT_LSN_TYPE_STANDBY_FLUSH to
  WaitLSNType.
- Add GetCurrentLSNForWaitType() to retrieve the 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.

Discussion: https://postgr.es/m/CABPTF7UiArgW-sXj9CNwRzUhYOQrevLzkYcgBydmX5oDes1sjg%40mail.gmail.com
Author: Xuneng Zhou <xunengzhou@gmail.com>
Reviewed-by: Alexander Korotkov <aekorotkov@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Alvaro Herrera <alvherre@kurilemu.de>
src/backend/access/transam/xlog.c
src/backend/access/transam/xlogrecovery.c
src/backend/access/transam/xlogwait.c
src/backend/commands/wait.c
src/backend/utils/activity/wait_event_names.txt
src/include/access/xlogwait.h