Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()

Поиск
Список
Период
Сортировка
От Amul Sul
Тема Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()
Дата
Msg-id CAAJ_b94YfK6Z-dVnEZq4yHxUKCbBCAgRzD7qAunj_QX6frbODw@mail.gmail.com
обсуждение исходный текст
Ответ на Simplify standby state machine a bit in WaitForWALToBecomeAvailable()  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Ответы Re: Simplify standby state machine a bit in WaitForWALToBecomeAvailable()
Список pgsql-hackers
On Tue, Oct 18, 2022 at 12:01 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> Hi,
>
> In standby mode, the state machine in WaitForWALToBecomeAvailable()
> reads WAL from pg_wal after failing to read from the archive. This is
> currently implemented in XLogFileReadAnyTLI() by calling
> XLogFileRead() with source XLOG_FROM_PG_WAL after it fails with source
> XLOG_FROM_PG_ARCHIVE and the current source isn't changed at all.
> Also, passing the source to XLogFileReadAnyTLI() in
> WaitForWALToBecomeAvailable() isn't straight i.e. it's not necessary
> to pass in XLOG_FROM_ANY at all. These things make the state machine a
> bit complicated and hard to understand.
>
> The attached patch attempts to simplify the code a bit by changing the
> current source to XLOG_FROM_PG_WAL after failing in
> XLOG_FROM_PG_ARCHIVE so that the state machine can move smoothly to
> read from pg_wal. And we can just pass the current source to
> XLogFileReadAnyTLI(). It also enables us to reduce a bit of extra
> XLogFileRead() code in XLogFileReadAnyTLI().
>
> Thoughts?

+1

Regards,
Amul



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

Предыдущее
От: "Drouvot, Bertrand"
Дата:
Сообщение: Re: Patch proposal: make use of regular expressions for the username in pg_hba.conf
Следующее
От: Masahiko Sawada
Дата:
Сообщение: Re: TRAP: FailedAssertion("prev_first_lsn < cur_txn->first_lsn", File: "reorderbuffer.c", Line: 927, PID: 568639)