Re: Deduplicate code updating ControleFile's DBState.

Поиск
Список
Период
Сортировка
От Amul Sul
Тема Re: Deduplicate code updating ControleFile's DBState.
Дата
Msg-id CAAJ_b94bQa_PZeaKd+0NnBxhq=omPzw2+HYrX1MQD-SKB6w0zg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Deduplicate code updating ControleFile's DBState.  (Michael Paquier <michael@paquier.xyz>)
Список pgsql-hackers
On Thu, Sep 16, 2021 at 5:17 AM Michael Paquier <michael@paquier.xyz> wrote:
>
> On Wed, Sep 15, 2021 at 10:49:39PM +0000, Bossart, Nathan wrote:
> > Ah, I was missing this context.  Perhaps this should be included in
> > the patch set for the other thread, especially if it will need to be
> > exported.
>
> This part of the patch is mentioned at the top of the thread:
> -   LWLockAcquire(ControlFileLock, LW_EXCLUSIVE);
> -   ControlFile->state = DB_IN_PRODUCTION;
> -   ControlFile->time = (pg_time_t) time(NULL);
> -
> +   SetControlFileDBState(DB_IN_PRODUCTION);
>     SpinLockAcquire(&XLogCtl->info_lck);
>     XLogCtl->SharedRecoveryState = RECOVERY_STATE_DONE;
>     SpinLockRelease(&XLogCtl->info_lck);
>
> There is an assumption in this code to update SharedRecoveryState
> *while* holding ControlFileLock.  For example, see the following
> comment in xlog.c, ReadRecord():
> /*
>  * We update SharedRecoveryState while holding the lock on
>  * ControlFileLock so both states are consistent in shared
>  * memory.
>  */

Ok, understood, let's do that update with ControlFileLock, thanks.

Regards,
Amul



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

Предыдущее
От: Kevin Burke
Дата:
Сообщение: Coding guidelines for braces + spaces - link 404's
Следующее
От: Antonin Houska
Дата:
Сообщение: Re: POC: Cleaning up orphaned files using undo logs