Hi Ajin, v15 applies to master (eb983d0a94), builds warning-free, make check 245/245, pg_upgrade TAP 148/148. I also ran a real pg_upgrade with one origin in each of the three states -- never advanced, advanced to 0/0, advanced to a real LSN -- and all three keep their tracking state:
origin old cluster new cluster
o_never untracked untracked
o_tracked_zero 0/00000000 0/00000000
o_tracked_real 0/12345678 0/12345678
A test gap, a doc paragraph the pre-17 change left behind, and three small
things.
1. 004_subscription.pl covers the first and third rows -- regress_user_origin
is never advanced, the subscription origins have a non-zero remote_lsn -- but
not the second, and the second is the only row where !PG_ARGISNULL(2) gets it
right and a plain remote_lsn check would get it wrong. The suite cannot tell
the two apart: with !XLogRecPtrIsInvalid(remote_lsn) swapped in as a
deliberately wrong version, the file still passes 24/24, and the same upgrade
as above becomes
o_tracked_zero 0/00000000 untracked
Attached adds an origin advanced to 0/0 next to the never-advanced one -- two
statements and one assertion. It passes on v15 as posted (25/25), and under
the substitution the one failure is
Failed test 'origin 'regress_zero_origin' advanced to 0/0 is still tracked
after upgrade'
2. Since v8, per the discussion upthread, origins migrate from pre-17 old
clusters too. I tested that on a real upgrade -- a PG16 old cluster
with one subscription (connect = false) and one user origin, upgraded to
master+v15:
roident roname old (PG16) new cluster
1 pg_16384 untracked untracked
2 user_origin_16 0/12345678 0/12345678
with pg_subscription.oid preserved as well. But "Prepare for Subscriber
Upgrades" in logical-replication.sgml still says:
pg_upgrade attempts to migrate subscription dependencies which includes
the subscription's table information present in pg_subscription_rel
system catalog and also the subscription's replication origin. [...]
Migration of subscription dependencies is only supported when the old
cluster is version 17.0 or later. Subscription dependencies on clusters
before version 17.0 will silently be ignored.
The origin half of that is no longer true. The origin should come out of
the "17.0 or later" claim: origins and their remote_lsn now migrate from any
old version, while the pg_subscription_rel state still does not.
3. Small things:
- Nothing reads the origin_status join in getSubscriptions() any more --
suboriginremotelsn was its last consumer. The block at pg_dump.c:5248-5251
can go:
"LEFT JOIN pg_catalog.pg_replication_origin_status o \n"
" ON o.external_id = 'pg_' || s.oid::text \n"
- origin.c:308, in the new comment: "We cannot distinglish only by the
remote_lsn" -> distinguish.
- pg_dumpall.c:1841 has a trailing space after "Origins" that the other
headers in the file don't:
fprintf(OPF, "--\n-- Replication Origins \n--\n\n");
Regards,
Rui
0001-Cover-the-origin-that-was-advanced-to-exactly-0-0.patch
Description: Binary data
