Re: Logical replication 'invalid memory alloc request size 1585837200' after upgrading to 17.5
От | Masahiko Sawada |
---|---|
Тема | Re: Logical replication 'invalid memory alloc request size 1585837200' after upgrading to 17.5 |
Дата | |
Msg-id | CAD21AoCjpj-DoASrhKCiEKuxh=0q3rC1RnAeugEwEJ=xwk=n6g@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: Logical replication 'invalid memory alloc request size 1585837200' after upgrading to 17.5 (Amit Kapila <amit.kapila16@gmail.com>) |
Список | pgsql-bugs |
On Wed, May 21, 2025 at 4:12 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Wed, May 21, 2025 at 11:18 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > > > On Mon, May 19, 2025 at 8:08 PM Duncan Sands > > <duncan.sands@deepbluecap.com> wrote: > > > > > > While it is long, it doesn't seem to merit allocating anything like 1GB of > > > memory. So I'm guessing that postgres is miscalculating the required size somehow. > > > > > > > We fixed a bug in commit 4909b38af0 to distribute invalidation at the > > transaction end to avoid data loss in certain cases, which could cause > > such a problem. I am wondering that even prior to that commit, we > > would eventually end up allocating the required memory for a > > transaction for all the invalidations because of repalloc in > > ReorderBufferAddInvalidations, so why it matter with this commit? One > > possibility is that we need allocations for multiple in-progress > > transactions now. > > > > I think the problem here is that when we are distributing > invalidations to a concurrent transaction, in addition to queuing the > invalidations as a change, we also copy the distributed invalidations > along with the original transaction's invalidations via repalloc in > ReorderBufferAddInvalidations. So, when there are many in-progress > transactions, each would try to copy all its accumulated invalidations > to the remaining in-progress transactions. This could lead to such an > increase in allocation request size. I agree with this analysis. > However, after queuing the > change, we don't need to copy it along with the original transaction's > invalidations. This is because the copy is only required when we don't > process any changes in cases like ReorderBufferForget(). It seems that we use the accumulated invalidation message also after replaying or concurrently aborting a transaction via ReorderBufferExecuteInvalidations(). Do we need to consider such cases too? Regards, -- Masahiko Sawada Amazon Web Services: https://aws.amazon.com
В списке pgsql-bugs по дате отправления: