On 25/07/2022 09:54, Heikki Linnakangas wrote:
> In RecordTransactionCommit(), we enter a critical section, and then call
> TransactionIdCommitTree() to update the CLOG pages. That now involves a
> call to ReadBuffer_common(), which in turn calls
> ResourceOwnerEnlargeBuffers(). That can fail, because it might require
> allocating memory, which is forbidden in a critical section. I ran into
> an assertion about that with "make check" when I was playing around with
> a heavily modified version of this patch. Haven't seen it with your
> original one, but I believe that's just luck.
>
> Calling ResourceOwnerEnlargeBuffers() before entering the critical
> section would probably fix that, although I'm a bit worried about having
> the Enlarge call so far away from the point where it's needed.
Oh I just saw that you had a comment about that in the patch and had
hacked around it. Anyway, calling ResourceOwnerEnlargeBuffers() might be
a solution. Or switch to a separate "CriticalResourceOwner" that's
guaranteed to have enough pre-allocated space, before entering the
critical section.
- Heikki