Re: [BUG]Update Toast data failure in logical replication
Dilip Kumar <dilipbalaut@gmail.com>
From: Dilip Kumar <dilipbalaut@gmail.com>
To: Amit Kapila <amit.kapila16@gmail.com>
Cc: Alvaro Herrera <alvherre@alvh.no-ip.org>,
Petr Jelinek <petr.jelinek@enterprisedb.com>, Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Tomas Vondra <tomas.vondra@enterprisedb.com>,
Andres Freund <andres@anarazel.de>, Kuntal Ghosh <kuntalghosh.2007@gmail.com>, "tanghy.fnst@fujitsu.com" <tanghy.fnst@fujitsu.com>,
pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2021-08-11T12:44:55Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
WAL log unchanged toasted replica identity key attributes.
- 5e01001ffb38 15.0 landed
- b5e060473273 10.21 landed
- 1cd5802ac69a 11.16 landed
- ce349cf176e2 12.11 landed
- caa231be97df 13.7 landed
- 04645bbcae72 14.3 landed
-
Add new wal_level, logical, sufficient for logical decoding.
- e55704d8b2fe 9.4.0 cited
-
Add the notion of REPLICA IDENTITY for a table.
- 07cacba983ef 9.4.0 cited
Attachments
- v4-0001-Extract-unchanged-external-replica-identity-key.patch (application/x-patch) patch v4-0001
On Wed, Aug 11, 2021 at 10:30 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > On Tue, Aug 10, 2021 at 8:08 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote: > > > > On 2021-Jul-30, Amit Kapila wrote: > > > > Reading Dilip's last posted patch that day, I had some reservations > > about the API of ExtractReplicaIdentity. The new argument makes for a > > very strange to explain behavior "return the key values if they are > > unchanged, *or* if they are toasted" ... ??? > > > > I think we can say it as "Return the key values if they are changed > *or* if they are toasted". Currently, we have an exception for Deletes > where the caller always passed key_changed as true, so maybe we can > have a similar exception when the tuple has toasted values. Can we > think of changing the flag to "key_required" instead of "key_changed" > and let the caller identify and set its value? For Deletes, it will > work the same but for Updates, the caller needs to compute it by > checking if any of the key columns are modified or has a toast value. > We can try to see if the caller can identify it cheaply along with > determining the modified_attrs as at that time we will anyway check > replica key attrs. Right > > Currently, in proposed patch first, we check that the tuple has any > toast values and then it deforms and forms the new key tuple. After > that, it checks if the key has any toast values and then only decides > to return the tuple. If as described in the previous paragraph, we can > cheaply identify whether the key has toasted values, then we can avoid > deform/form cost in some cases. Also, I think we need to change the > Replica Identity description in the docs[1]. Yeah we can avoid that by detecting any toasted replica identity key in HeapDetermineModifiedColumns, check the attached patch. -- Regards, Dilip Kumar EnterpriseDB: http://www.enterprisedb.com