Обсуждение: pgsql: Extend xlogwait infrastructure with write and flush wait types
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> Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/7a39f43d885b44a78f366aa50535944c4e38bdbb Modified Files -------------- src/backend/access/transam/xlog.c | 2 +- src/backend/access/transam/xlogrecovery.c | 4 +- src/backend/access/transam/xlogwait.c | 96 ++++++++++++++++++++----- src/backend/commands/wait.c | 2 +- src/backend/utils/activity/wait_event_names.txt | 3 +- src/include/access/xlogwait.h | 14 ++-- 6 files changed, 93 insertions(+), 28 deletions(-)