RE: Logical replication 'invalid memory alloc request size 1585837200' after upgrading to 17.5
Hayato Kuroda (Fujitsu) <kuroda.hayato@fujitsu.com>
From: "Hayato Kuroda (Fujitsu)" <kuroda.hayato@fujitsu.com>
To: 'Masahiko Sawada' <sawada.mshk@gmail.com>, Amit Kapila <amit.kapila16@gmail.com>
Cc: Duncan Sands <duncan.sands@deepbluecap.com>, "pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2025-05-28T12:27:51Z
Lists: pgsql-bugs
Attachments
- v4-PG17-0001-Avoid-distributing-invalidation-messages-sev.patch (application/octet-stream) patch v4-0001
- v4-master-0001-Avoid-distributing-invalidation-messages-s.patch (application/octet-stream) patch v4-0001
Dear Sawada-san, Amit, > > It can impact the performance for large transactions with fewer > > invalidations, especially the ones which has spilled changes because > > it needs to traverse the entire list of changes again at the end. > > Agreed. > > > The > > other idea would be to add new member(s) in ReorderBufferTXN to > > receive distributed invalidations. For adding the new member in > > ReorderBufferTXN: (a) in HEAD, it should be okay, (b) for > > backbranches, we may be able to add at the end, but we should check if > > there are any extensions using sizeof(ReorderBufferTxn) and if they > > are using what we need to do. > > If we can make sure that that change won't break the existing > extensions, I think this would be the most reasonable solution. Based on the discussion, I created PoC for master/PG17. Please see attached. The basic idea is to introduce the new queue which only contains distributed inval messages. Contents are consumed at end of transactions. I feel some of codes can be re-used so that internal functions are introduced. At least, it could pass regression tests and workloads discussed here. Best regards, Hayato Kuroda FUJITSU LIMITED
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Fix cache-dependent test failures in logical decoding.
- 87819f766f37 13.22 landed
-
Fix re-distributing previously distributed invalidation messages during logical decoding.
- d87d07b7ad3b 18.0 landed
- 45c357e0e85d 17.6 landed
- b2ae077205e1 16.10 landed
- fc0fb77c550f 15.14 landed
- 983b3636259b 14.19 landed
- 1230be12f086 13.22 landed
-
Fix data loss in logical replication.
- 247ee94150b6 13.21 cited
- 4909b38af034 18.0 cited