| From: | Peter Smith <smithpb2250(at)gmail(dot)com> |
|---|---|
| To: | Hüseyin Demir <huseyin(dot)d3r(at)gmail(dot)com> |
| Cc: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: [PATCH] Report changes discarded for relations not in the subscription |
| Date: | 2026-12-01 05:47:06 |
| Message-ID: | CAHut+Pta_R5LB0hkrS8=aHy-HaPRejkrPP565z2hNYuZt=suxg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi. Here are some review comments for v4 tests.
======
src/test/subscription/t/024_add_drop_pub.pl
1.
+$node_publisher->safe_psql('postgres', "INSERT INTO tab_4 VALUES (1)");
+$node_subscriber->wait_for_log(
+ qr/LOG: ( [A-Z0-9]+:)? skipping changes for relation "public\.tab_4"/,
+ $offset);
+
+ok( $node_subscriber->log_contains(
+ qr/DETAIL: ( [A-Z0-9]+:)? The published relation is not included in
subscription "tap_sub"\./,
+ $offset),
+ 'relation not in the subscription is reported with the relation name');
It seemed odd to me to for tests of LOG and DETAIL to be separated
when really they belong to the same ereport.
IMO those can be combined. For example, what I tried below seems
commonly used in other *.pl and it worked. Search other *.pl tests in
case there is another better way.
$node_publisher->safe_psql('postgres', "INSERT INTO tab_4 VALUES (1)");
ok(
$node_subscriber->wait_for_log(
qr/LOG: ( [A-Z0-9]+:)? skipping changes for relation
"public\.tab_4".*\n.*DETAIL: ( [A-Z0-9]+:)? The published relation is
not included in subscription "tap_sub"\./,
$offset),
'relation not in the subscription is reported with the relation name');
~~~
2.
# Remove the relation from the subscription but keep it published. Changes
# were applied in between, so skipping them again must be reported again
Not sure about that "in between" sentence. I didn't think it's
"between" anything.
How about:
Subsequent changes will be skipped again, so must be reported again.
======
src/test/subscription/t/015_stream.pl
3.
+foreach my $i (1 .. 3)
+{
+ $node_publisher->safe_psql('postgres',
+ "INSERT INTO test_tab_3 SELECT i FROM generate_series(1, 5000) s(i)");
+}
I wonder if it's more readable to not have that loop, and simply do:
$node_publisher->safe_psql('postgres', qq(
INSERT INTO test_tab_3 SELECT * FROM generate_series(1, 5000);
INSERT INTO test_tab_3 SELECT * FROM generate_series(1, 5000);
INSERT INTO test_tab_3 SELECT * FROM generate_series(1, 5000);
));
~~~
4.
+# Verify that a parallel apply worker reports changes it does not apply.
+#
+# test_tab_3 still has no pg_subscription_rel row. GetSubscriptionRelations()
+# only returns rows that exist, so such a table is invisible to
+# AllTablesyncsReady(), pa_can_start() still hands the streamed transaction to
+# a parallel apply worker, and that worker discards every change for the table.
Something seems strange with the comma in this part:
"AllTablesyncsReady(), pa_can_start()".
My LLM interpreted that as below. Is it what was meant?
# Verify that a parallel apply worker reports changes it does not apply.
#
# test_tab_3 still has no pg_subscription_rel row. GetSubscriptionRelations()
# only returns rows that exist, so such a table is invisible to
# AllTablesyncsReady(). As a result, pa_can_start() still hands the streamed
# transaction to a parallel apply worker, which then discards every change
# for the table.
~~~
5.
+$node_subscriber->wait_for_log(
+ qr/logical replication parallel worker\[\d+\] LOG: ( [A-Z0-9]+:)?
skipping changes for relation "public\.test_tab_3"/,
+ $pa_offset);
+
+ok( $node_subscriber->log_contains(
+ qr/DETAIL: ( [A-Z0-9]+:)? The published relation is not included in
subscription "tap_sub"\./,
+ $pa_offset),
+ 'parallel apply worker names the relation it is not applying changes for'
+);
(Here is similar to earlier review comment. IMO i might be better to
combine these since both are emitted by the same ereport)
I experimented locally like this, which worked for me:
ok(
$node_subscriber->wait_for_log(
qr/logical replication parallel worker\[\d+\] LOG: (
[A-Z0-9]+:)? skipping changes for relation
"public\.test_tab_3".*\n.*DETAIL: ( [A-Z0-9]+:)? The published
relation is not included in subscription "tap_sub"\./,
$pa_offset),
'parallel apply worker names the relation it is not applying changes for');
======
Kind Regards,
Peter Smith.
Fujitsu Australia
| From | Date | Subject | |
|---|---|---|---|
| Next Message | shveta malik | 2026-12-01 05:49:55 | Re: Preserve conflict log table during upgrade |
| Previous Message | Zhijie Hou | 2026-12-01 05:41:15 | Re: update_deleted lookup assumes heap tuple slots |