pgsql: Implement pg_wal_replay_wait() stored procedure
От | Alexander Korotkov |
---|---|
Тема | pgsql: Implement pg_wal_replay_wait() stored procedure |
Дата | |
Msg-id | E1rrkGl-000AiC-L5@gemulon.postgresql.org обсуждение исходный текст |
Ответы |
Re: pgsql: Implement pg_wal_replay_wait() stored procedure
Re: pgsql: Implement pg_wal_replay_wait() stored procedure |
Список | pgsql-committers |
Implement pg_wal_replay_wait() stored procedure pg_wal_replay_wait() is to be used on standby and specifies waiting for the specific WAL location to be replayed before starting the transaction. This option is useful when the user makes some data changes on primary and needs a guarantee to see these changes on standby. The queue of waiters is stored in the shared memory array sorted by LSN. During replay of WAL waiters whose LSNs are already replayed are deleted from the shared memory array and woken up by setting of their latches. pg_wal_replay_wait() needs to wait without any snapshot held. Otherwise, the snapshot could prevent the replay of WAL records implying a kind of self-deadlock. This is why it is only possible to implement pg_wal_replay_wait() as a procedure working in a non-atomic context, not a function. Catversion is bumped. Discussion: https://postgr.es/m/eb12f9b03851bb2583adab5df9579b4b%40postgrespro.ru Author: Kartyshov Ivan, Alexander Korotkov Reviewed-by: Michael Paquier, Peter Eisentraut, Dilip Kumar, Amit Kapila Reviewed-by: Alexander Lakhin, Bharath Rupireddy, Euler Taveira Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/06c418e163e913966e17cb2d3fb1c5f8a8d58308 Modified Files -------------- doc/src/sgml/func.sgml | 113 ++++++++ src/backend/access/transam/xlog.c | 7 + src/backend/access/transam/xlogrecovery.c | 11 + src/backend/catalog/system_functions.sql | 3 + src/backend/commands/Makefile | 3 +- src/backend/commands/meson.build | 1 + src/backend/commands/waitlsn.c | 348 ++++++++++++++++++++++++ src/backend/storage/ipc/ipci.c | 7 + src/backend/storage/lmgr/proc.c | 6 + src/backend/utils/activity/wait_event_names.txt | 1 + src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_proc.dat | 5 + src/include/commands/waitlsn.h | 43 +++ src/test/recovery/meson.build | 1 + src/test/recovery/t/043_wal_replay_wait.pl | 97 +++++++ src/tools/pgindent/typedefs.list | 2 + 16 files changed, 648 insertions(+), 2 deletions(-)
В списке pgsql-committers по дате отправления: