| From: | "Hayato Kuroda (Fujitsu)" <kuroda(dot)hayato(at)fujitsu(dot)com> |
|---|---|
| To: | 'Zsolt Parragi' <zsolt(dot)parragi(at)percona(dot)com> |
| Cc: | "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Ajin Cherian <itsajin(at)gmail(dot)com>, Sergey <ls7777(at)yandex(dot)ru>, "orlovmg(at)gmail(dot)com" <orlovmg(at)gmail(dot)com>, "amit(dot)kapila16(at)gmail(dot)com" <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
| Subject: | RE: Patch for migration of the pg_commit_ts directory |
| Date: | 2026-11-16 05:53:13 |
| Message-ID: | OS7PR01MB183175E897C8E3581BD73E364F57C2@OS7PR01MB18317.jpnprd01.prod.outlook.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hey Zsolt,
Thanks for paying attention the thread! PSA new version.
> Without the origin preservation patch Sawada-san's scenario upthread
> still reproduces:
>
> -- On the old subscriber (track_commit_timestamp=on):
> CREATE TABLE test (id int primary key, t text);
> CREATE SUBSCRIPTION mysub CONNECTION '...' PUBLICATION pub;
> CREATE SUBSCRIPTION a_dummy CONNECTION '...' PUBLICATION pub WITH
> (connect = false, enabled = false);
> -- wait for mysub's table sync to reach 'r', then on the publisher:
> INSERT INTO test VALUES (1, 'pub-insert');
> -- subscriber: pg_xact_commit_timestamp_origin(xmin).roident = 1 (mysub)
> ALTER SUBSCRIPTION mysub DISABLE;
>
> Then pg_upgrade --preserve-commit-timestamps into a new cluster with
> track_commit_timestamp=on, enable mysub, and run UPDATE test SET t =
> 'pub-update' WHERE id = 1 on the publisher. Origins are recreated in
> subscription name order, so a_dummy gets roident 1 and mysub gets 2,
> but the copied commit_ts entry still says 1:
>
> LOG: conflict detected on relation "public.test":
> conflict=update_origin_differs
> DETAIL: Updating the row that was modified by a different origin
> "pg_16408" in transaction 672 ...: local row (1, pub-insert), remote
> row (1, pub-update), replica identity (id)=(1).
> CONTEXT: processing remote data for replication origin "pg_16409"
> during message type "UPDATE" ...
>
> Even as an opt-in feature, this doesn't seem right if this gets
> committed first.
To clarify, we're not intended that this patch can be pushed alone, a patch which
preserves replication origins [1] is a prerequisite. I'm not motivated to add
additional guard in the patch, the commit message was updated for it.
> And there's another corner case issue: the commit_ts window is read
> before the old server is started, and it isn't re-read later.
Good catch. I don't think it's like to happen but should be fixed.
My fix idea is to check the GUC parameter for the target (old) instance and
migrate commit_ts only if it's true. New version implemented the same.
> Shouldn't this also mention that preserve-commit-timestamps is opt-in?
I'm not excited to update docs around here because it's entangled with another
thread, but added an one line.
BTW, while updating the doc, I found that all entries in the same variablelist
must have id attributes if we want to refer one of them. It's not directly
related with the code but done in 0001.
[1]: https://commitfest.postgresql.org/patch/6743/
Best regards,
Hayato Kuroda
FUJITSU LIMITED
| Attachment | Content-Type | Size |
|---|---|---|
| v18-0001-Doc-add-IDs-to-pgupgrade.sgml-s-varlistentry.patch | application/octet-stream | 8.6 KB |
| v18-0002-pg_upgrade-Preserve-commit-timestamps-across-upg.patch | application/octet-stream | 12.5 KB |
| v18-0003-pg_upgrade-Add-option-to-preserve-commit-timesta.patch | application/octet-stream | 5.9 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Joao Rito | 2026-11-16 06:07:00 | Re: [PATCH] contrib/fuzzystrmatch: improve test coverage |
| Previous Message | Raja Sai pranav | 2026-11-16 05:40:30 | Re: Re: Re: Assertion failure in WAL summarizer |