Andres Freund <[email protected]> writes:
> On 2026-01-24 16:11:47 -0500, Tom Lane wrote:
>> In the case at hand I think it is probably driven by two recursion levels
>> trying to acquire free space out of the same buffer. SPGist is expecting
>> the lower level to fail to get the lock and then go find some free space
>> elsewhere. Yeah, we could probably re-code it to get that outcome in
>> another way, but why?
> Regardless of the assertion, it still feels like there may be something off
> here. Why is the page marked as empty in the FSM, despite actually not being
> empty?
Who said anything about its being empty? There's X amount of space
used on the page now, the outer level is preparing to add a tuple
of size Y, the inner level is looking for a place to put a tuple
of size Z. As long as X+Y+Z <= 8K, there's no free-space-related
reason the page wouldn't work for this. We could actually try to
make it work, but that seems fragile to me: the outer level would
have to be prepared for the possibility that the page changes
under it despite holding exclusive lock. I think it's reasonable
on complexity grounds to insist that the inner recursion level
go play someplace else.
regards, tom lane