Re: [HACKERS] make async slave to wait for lsn to be replayed
От | Alexey Kondratov |
---|---|
Тема | Re: [HACKERS] make async slave to wait for lsn to be replayed |
Дата | |
Msg-id | a8bff0350a27e0a87a6eaf0905d6737f@postgrespro.ru обсуждение исходный текст |
Ответ на | Re: [HACKERS] make async slave to wait for lsn to be replayed (Tom Lane <tgl@sss.pgh.pa.us>) |
Ответы |
Re: [HACKERS] make async slave to wait for lsn to be replayed
|
Список | pgsql-hackers |
On 2020-04-09 16:33, Tom Lane wrote: > Fujii Masao <masao.fujii@oss.nttdata.com> writes: >> On 2020/04/09 16:11, Kyotaro Horiguchi wrote: >>> At Wed, 08 Apr 2020 16:35:46 -0400, Tom Lane <tgl@sss.pgh.pa.us> >>> wrote in >>>> Why is this getting grafted onto BEGIN/START TRANSACTION in the >>>> first place? > >>> The rationale for not being a fmgr function is stated in the >>> following >>> comments. [...] > >> This issue happens because the function is executed after BEGIN? If >> yes, >> what about executing the function (i.e., as separate transaction) >> before BEGIN? >> If so, the snapshot taken in the function doesn't affect the >> subsequent >> transaction whatever its isolation level is. > > I wonder whether making it a procedure, rather than a plain function, > would help any. > Just another idea in case if one will still decide to go with a separate statement + BEGIN integration instead of a function. We could use parenthesized options list here. This is already implemented for VACUUM, REINDEX, etc. There was an idea to allow CONCURRENTLY in REINDEX there [1] and recently this was proposed again for new options [2], since it is much more extensible from the grammar perspective. That way, the whole feature may look like: WAIT (LSN '16/B374D848', TIMEOUT 100); and/or BEGIN WAIT (LSN '16/B374D848', WHATEVER_OPTION_YOU_WANT); ... COMMIT; It requires only one reserved keyword 'WAIT'. The advantage of this approach is that it can be extended to support xid, timestamp, csn or anything else, that may be invented in the future, without affecting the grammar. What do you think? Personally, I find this syntax to be more convenient and human-readable compared with function call: SELECT pg_wait_for_lsn('16/B374D848'); BEGIN; [1] https://www.postgresql.org/message-id/aad2ec49-5142-7356-ffb2-a9b2649cdd1f%402ndquadrant.com [2] https://www.postgresql.org/message-id/20200401060334.GB142683%40paquier.xyz Regards -- Alexey Kondratov Postgres Professional https://www.postgrespro.com Russian Postgres Company
В списке pgsql-hackers по дате отправления: