RE: Disabled logical replication origin session causes primary key errors

From: "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>
To: 'vignesh C' <vignesh21(at)gmail(dot)com>
Cc: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Shawn McCoy <shawn(dot)the(dot)mccoy(at)gmail(dot)com>, "pgsql-bugs(at)lists(dot)postgresql(dot)org" <pgsql-bugs(at)lists(dot)postgresql(dot)org>, "drewwcallahan(at)gmail(dot)com" <drewwcallahan(at)gmail(dot)com>, "scott(at)meads(dot)us" <scott(at)meads(dot)us>
Subject: RE: Disabled logical replication origin session causes primary key errors
Date: 2025-04-22 11:00:51
Message-ID: OSCPR01MB14966C633C0C7CDB7CC7D844BF5BB2@OSCPR01MB14966.jpnprd01.prod.outlook.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Dear Vignesh,

> Couple of minor suggestions in the test:
> 1) I felt this is not required for this test as it has been verified many times:
> +
> +# Insert tuples and confirms replication works well
> +$node_publisher->safe_psql('postgres', "INSERT INTO t1 VALUES (1);");
> +
> +$node_publisher->wait_for_catchup('regress_sub');

I added it to ensure remote_lsn to the valid value, but yes it is not mandatory.

> 2) How about we change:
> +# Confirms the origin can be advanced
> +ok( $node_subscriber->poll_query_until(
> + 'postgres',
> + "SELECT remote_lsn > '$remote_lsn' FROM
> pg_catalog.pg_replication_origin_status os, pg_catalog.pg_subscription
> s WHERE os.external_id = 'pg_' || s.oid AND s.subname =
> 'regress_sub'",
> + 't')
> + or die "Timed out while waiting for replication origin to be
> updated");
>
> to:
> $node_publisher->wait_for_catchup('regress_sub');
>
> # Confirms the origin can be advanced
> $result = $node_subscriber->safe_psql('postgres',
> "SELECT remote_lsn > '$remote_lsn' FROM
> pg_catalog.pg_replication_origin_status os, pg_catalog.pg_subscription
> s WHERE os.external_id = 'pg_' || s.oid AND s.subname = 'regress_sub'"
> );
> is($result, 't',
> 'remote_lsn has advanced for apply worker raising an exception');
>
> In that way, we need not wait on poll_query_until.

I intentionally used poll_query_until(), but I have no strong opinions.
Modified.

PSA new patches.

Best regards,
Hayato Kuroda
FUJITSU LIMITED

Attachment Content-Type Size
v5-PG16-PG17-0001-Fix-oversight-3f28b2f.patch application/octet-stream 5.2 KB
v5-HEAD-0001-Fix-oversight-3f28b2f.patch application/octet-stream 6.4 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Manika Singhal 2025-04-22 11:30:24 Re: PostgreSQL v15.12 fails to perform PG_UPGRADE from v13 and v9 on Windows
Previous Message Avi Uziel 2025-04-22 10:58:06 Re: PostgreSQL v15.12 fails to perform PG_UPGRADE from v13 and v9 on Windows