Re: base backup vs. concurrent truncation

Поиск
Список
Период
Сортировка
От Robert Haas
Тема Re: base backup vs. concurrent truncation
Дата
Msg-id CA+TgmoZ-TrTQkv6aESEwbgpw1Lo3w1DLTK27tkHjf9u7v_+hVg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: base backup vs. concurrent truncation  (Aleksander Alekseev <aleksander@timescale.com>)
Список pgsql-hackers
On Fri, Apr 21, 2023 at 5:19 PM Aleksander Alekseev
<aleksander@timescale.com> wrote:
> Naturally the database is consistent too. So it looks like the
> recovery protocol worked as expected after all, at least in the
> upcoming PG16 and this specific scenario.
>
> Did I miss anything? If not, perhaps we should just update the comments a bit?

I was confused about what was happening here but after trying to
reproduce I think I figured it out. In my test, I saw the .1 file grow
to a full 1GB and then the truncate happened afterward.
Unsurprisingly, that works. I believe that what's happening here is
that the DELETE statement triggers FPIs for all of the blocks it
touches. Therefore, when the DELETE records are replayed, those blocks
get written back to the relation, extending it. That gets it up to the
required 1GB size after which the .2 file is visible to the smgr
again, so the truncate works fine. I think that to reproduce the
scenario, you want the truncate to happen in its own checkpoint cycle.

I also found out from Andres that he's complained about pretty much
the same problem just a couple of months ago:

https://www.postgresql.org/message-id/20230223010147.32oir7sb66slqnjk@awork3.anarazel.de

--
Robert Haas
EDB: http://www.enterprisedb.com



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

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: Missing update of all_hasnulls in BRIN opclasses
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Missing update of all_hasnulls in BRIN opclasses