Re: Atomic GetFreeIndexPage()?
От | Peter Geoghegan |
---|---|
Тема | Re: Atomic GetFreeIndexPage()? |
Дата | |
Msg-id | CAH2-Wzk1_VYtC8hfKTHFRuP5=zTgMzrgLZmZUT-zsXx00ASk-A@mail.gmail.com обсуждение исходный текст |
Ответ на | Atomic GetFreeIndexPage()? (Chris Cleveland <ccleveland@dieselpoint.com>) |
Список | pgsql-hackers |
On Wed, May 4, 2022 at 12:16 PM Chris Cleveland <ccleveland@dieselpoint.com> wrote: > Similar code is repeated in a bunch of places. Each access method has to explicitly write something into a freed page thatidentifies it as ok to use. I wouldn't say that that's what this code is doing, though I do see what you mean. The reason why the ultimate consumer of the free page writes to it is because....well, it wouldn't have asked for a page if it didn't have something to write. Code like GinPageIsRecyclable() is generally concerned with something called recycle safety, typically using something called the drain technique. That's what this code is primarily concerned about. The definition of recycle safety is documented in the nbtree README. > Otherwise, you could have two processes get the same page, then one locks it, writes it, and unlocks it, then the secondone does the same clobbering the first. But you could have that anyway, since the FSM isn't crash safe. It's inherently not completely trustworthy for that reason. Actually, the FSM shouldn't really contain a page that is ! GinPageIsRecyclable() to begin with, but that is still possible for a variety of reasons. All of which boil down to "the current FSM design cannot be totally trusted, so we verify redundantly". -- Peter Geoghegan
В списке pgsql-hackers по дате отправления: