Summary:
It was observed that currently test_decoding adds the field `old-key` to every UPDATE output message (if the replica identity is not FULL, this field is left empty). This is a deviation from PG, where the UPDATE output messages contain `old-key` field only in case of replica identity FULL.
In test_decoding code, we check if the old-tuple is not null and add the field `old-key` to the output string. The values to this field are added by iterating over attributes of the old tuple. However, in YB the old-tuple is always not null. If the replica identity is not FULL, then the attributes of the old tuple are NULL. This results in the above mentioned behaviour. In other words the issue arises because the old-tuple being sent for UPDATES is not NULL for replica identities having no before image.
To fix this, in `YBDecodeUpdate()` function we populate the old tuple only if the replica identity is FULL. Otherwise a NULL old tuple is sent out.
Jira: DB-12279
Test Plan:
Jenkins: test regex: .*ReplicationSlot.*
./yb_build.sh --java-test 'org.yb.pgsql.TestPgReplicationSlot#testWithTestDecodingPlugin'
Reviewers: asrinivasan, stiwary
Reviewed By: stiwary
Subscribers: skumar, yql, ycdcxcluster
Tags: #jenkins-ready
Differential Revision: https://phorge.dev.yugabyte.com/D36971