[Patch] Fix check_pub_rdt bypass when origin is set in same ALTER SUBSCRIPTION

Started by SATYANARAYANA NARLAPURAM6 months ago4 messageshackers
Jump to latest
#1SATYANARAYANA NARLAPURAM
satyanarlapuram@gmail.com

HI hackers,

When ALTER SUBSCRIPTION SET (retain_dead_tuples = true, origin = 'none')
is used, the publisher version/recovery check was bypassed because the
origin handling unconditionally overwrote check_pub_rdt to false.

Fix by using |= instead of = so that the flag set by retain_dead_tuples
cannot be cleared by a subsequent origin assignment in the same command.

Attached two patches where 0001 is the code fix and 0002 is a tap fix test
to reproduce
the problem. I didn't fully polish the test, intended only for the
reviewers to reproduce the
problem with a standby setup. Let me know if you would like to include the
test.

Thanks,
Satya

Attachments:

0001-Fix-check_pub_rdt-bypass-when-origin-is-set-in-same-.patchapplication/octet-stream; name=0001-Fix-check_pub_rdt-bypass-when-origin-is-set-in-same-.patchDownload+4-3
0002-Add-TAP-test-for-check_pub_rdt-bypass-fix.patchapplication/octet-stream; name=0002-Add-TAP-test-for-check_pub_rdt-bypass-fix.patchDownload+148-5
#2Amit Kapila
amit.kapila16@gmail.com
In reply to: SATYANARAYANA NARLAPURAM (#1)
Re: [Patch] Fix check_pub_rdt bypass when origin is set in same ALTER SUBSCRIPTION

On Tue, May 26, 2026 at 3:50 PM SATYANARAYANA NARLAPURAM
<satyanarlapuram@gmail.com> wrote:

HI hackers,

When ALTER SUBSCRIPTION SET (retain_dead_tuples = true, origin = 'none')
is used, the publisher version/recovery check was bypassed because the
origin handling unconditionally overwrote check_pub_rdt to false.

Fix by using |= instead of = so that the flag set by retain_dead_tuples
cannot be cleared by a subsequent origin assignment in the same command.

Thanks for catching this. Your fix LGTM. I won't be able to commit
today as I have to travel. In the meantime, let's see if Hou-San or
others have any comments.

--
With Regards,
Amit Kapila.

#3Zhijie Hou (Fujitsu)
houzj.fnst@fujitsu.com
In reply to: Amit Kapila (#2)
RE: [Patch] Fix check_pub_rdt bypass when origin is set in same ALTER SUBSCRIPTION

On Saturday, May 30, 2026 6:19 AM Amit Kapila <amit.kapila16@gmail.com> wrote:

On Tue, May 26, 2026 at 3:50 PM SATYANARAYANA NARLAPURAM
<satyanarlapuram@gmail.com> wrote:

HI hackers,

When ALTER SUBSCRIPTION SET (retain_dead_tuples = true, origin =
'none') is used, the publisher version/recovery check was bypassed
because the origin handling unconditionally overwrote check_pub_rdt to

false.

Fix by using |= instead of = so that the flag set by
retain_dead_tuples cannot be cleared by a subsequent origin assignment in

the same command.

Thanks for reporting ! I agree this needs to be fixed.

Thanks for catching this. Your fix LGTM. I won't be able to commit today as I
have to travel. In the meantime, let's see if Hou-San or others have any
comments.

The fix looks good to me as well.

Best Regards,
Hou zj

#4Amit Kapila
amit.kapila16@gmail.com
In reply to: Zhijie Hou (Fujitsu) (#3)
Re: [Patch] Fix check_pub_rdt bypass when origin is set in same ALTER SUBSCRIPTION

On Tue, Jun 2, 2026 at 7:44 AM Zhijie Hou (Fujitsu)
<houzj.fnst@fujitsu.com> wrote:

On Saturday, May 30, 2026 6:19 AM Amit Kapila <amit.kapila16@gmail.com> wrote:

On Tue, May 26, 2026 at 3:50 PM SATYANARAYANA NARLAPURAM
<satyanarlapuram@gmail.com> wrote:

HI hackers,

When ALTER SUBSCRIPTION SET (retain_dead_tuples = true, origin =
'none') is used, the publisher version/recovery check was bypassed
because the origin handling unconditionally overwrote check_pub_rdt to

false.

Fix by using |= instead of = so that the flag set by
retain_dead_tuples cannot be cleared by a subsequent origin assignment in

the same command.

Thanks for reporting ! I agree this needs to be fixed.

Thanks for catching this. Your fix LGTM. I won't be able to commit today as I
have to travel. In the meantime, let's see if Hou-San or others have any
comments.

The fix looks good to me as well.

Thanks for the verification. I've pushed the fix.

--
With Regards,
Amit Kapila.