Re: using an end-of-recovery record in all cases
От | Amul Sul |
---|---|
Тема | Re: using an end-of-recovery record in all cases |
Дата | |
Msg-id | CAAJ_b94sVCrGKL6pBKTr6_ADL4ehASe3s0P=85JBB=V5zCV6ng@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: using an end-of-recovery record in all cases (Kyotaro Horiguchi <horikyota.ntt@gmail.com>) |
Ответы |
Re: using an end-of-recovery record in all cases
|
Список | pgsql-hackers |
I was trying to understand the v1 patch and found that at the end RequestCheckpoint() is called unconditionally, I think that should have been called if REDO had performed, here is the snip from the v1 patch: /* - * If this was a promotion, request an (online) checkpoint now. This isn't - * required for consistency, but the last restartpoint might be far back, - * and in case of a crash, recovering from it might take a longer than is - * appropriate now that we're not in standby mode anymore. + * Request an (online) checkpoint now. Note that, until this is complete, + * a crash would start replay from the same WAL location we did, or from + * the last restartpoint that completed. We don't want to let that + * situation persist for longer than necessary, since users don't like + * long recovery times. On the other hand, they also want to be able to + * start doing useful work again as quickly as possible. Therfore, we + * don't pass CHECKPOINT_IMMEDIATE to avoid bogging down the system. + * + * Note that the consequence of requesting a checkpoint here only after + * we've allowed WAL writes is that a single checkpoint cycle can span + * multiple server lifetimes. So for example if you want to something to + * happen at least once per checkpoint cycle or at most once per + * checkpoint cycle, you have to consider what happens if the server + * is restarted someplace in the middle. */ - if (promoted) - RequestCheckpoint(CHECKPOINT_FORCE); + RequestCheckpoint(CHECKPOINT_FORCE); When I try to call that conditionally like attached, I don't see any regression failure, correct me if I am missing something here. Regards, Amul
Вложения
В списке pgsql-hackers по дате отправления: