Re: SyncRepWaitForLSN waits for XLogFlush?

Поиск
Список
Период
Сортировка
От Andres Freund
Тема Re: SyncRepWaitForLSN waits for XLogFlush?
Дата
Msg-id 20230524213310.b2j7nnvcrt7a7wxx@awork3.anarazel.de
обсуждение исходный текст
Ответ на SyncRepWaitForLSN waits for XLogFlush?  (Tejasvi Kashi <mail@tejasvi.dev>)
Ответы Re: SyncRepWaitForLSN waits for XLogFlush?  (Tejasvi Kashi <mail@tejasvi.dev>)
Список pgsql-hackers
Hi,

On 2023-05-24 10:53:51 -0400, Tejasvi Kashi wrote:
> I was wondering if waiting for an LSN in SyncRepWaitForLSN ensures that the
> XLOG has been flushed locally up to that location before the record is
> shipped off to standbys?

No, SyncRepWaitForLSN() doesn't directly ensure that. The callers have to (and
do) call XLogFlush() separately. See e.g. the XLogFlush() call in
RecordTransactionCommit().

Note that calling SyncRepWaitForLSN() for an LSN that is not yet flushed would
not lead for data to be prematurely sent out - walsender won't send data that
hasn't yet been flushed. So a backend with such a spurious SyncRepWaitForLSN()
would just wait until the LSN is actually flushed and *then* replicated.

Any specific reason for that question?

Greetings,

Andres Freund



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Wrong results due to missing quals
Следующее
От: Tom Lane
Дата:
Сообщение: Re: testing dist tarballs