| From: | Peter Smith <smithpb2250(at)gmail(dot)com> |
|---|---|
| To: | Zhijie Hou <houzhijie22(at)gmail(dot)com> |
| Cc: | vignesh C <vignesh21(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, shveta malik <shveta(dot)malik(at)gmail(dot)com>, shihao zhong <zhong950419(at)gmail(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, saurabh singh <saurabh(dot)singh214(at)gmail(dot)com>, Robert Haas <robertmhaas(at)gmail(dot)com>, Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, shveta malik <shvetamalik(at)gmail(dot)com> |
| Subject: | Re: Proposal: Conflict log history table for Logical Replication |
| Date: | 2026-11-24 01:31:56 |
| Message-ID: | CAHut+Pse5SS48mzXCZx5bJpPL2Ss0opLQVEq0XTrAKtesnUFDg@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Some review comments for docs in patch v96-0001.
======
doc/src/sgml/logical-replication.sgml
1
+ <literal>delete_missing</literal>). In these cases, local data may diverge
+ or be overwritten, making a queryable audit log valuable for DBAs to
+ understand why a row changed or was skipped.
It is rare to say "DBAs" in the docs. Mostly PostgreSQL docs refer to
"database administrators".
~~~
2.
+ <para>
+ Every value in <literal>replica_identity</literal> is written as a
+ <acronym>JSON</acronym> string. For most columns, this is the same text a
+ <command>SELECT</command> of that column would show. Values are quoted
+ whatever the column's type, so numbers, booleans and <type>jsonb</type>
+ documents all appear as strings:
It seems redundant to say "Values are quoted..."?
The first sentence already said, "Every value in
<literal>replica_identity</literal> is written as a
<acronym>JSON</acronym> string".
~~~
3.
+ Large values are dropped rather than shortened, because a shortened value
+ would still look like a real one and would give wrong answers when
+ compared or joined against the table.
IMO, slightly different wording would be better:
- "are omitted" instead of "are dropped".
- "truncated" instead of "shortened"
~~~
4.
+ <para>
+ Some limit is needed because <literal>replica_identity</literal> is a
+ <type>json</type> value, which cannot exceed 1GB, and the text of a value
+ can be much longer than the value itself. However, the 64kB limit is
+ applied only after a key value's text representation has been produced,
+ so it limits how much text is kept in the conflict log table but does not
+ stop that text from exceeding 1GB in the first place. Normally this
+ cannot happen, because the publisher had to produce the same text, within
+ the same 1GB limit, in order to send the value. That does not hold when,
+ for example, the key column has a different data type on the subscriber,
+ the subscription uses
+ <link linkend="sql-createsubscription-params-with-binary"><literal>binary</literal></link>
+ mode so the value is not sent as text, or the subscriber's
+ <xref linkend="guc-bytea-output"/> or
+ <xref linkend="guc-quote-all-identifiers"/> setting differs from the
+ publisher's. In such cases the text can exceed 1GB, and the apply worker
+ fails with an error when it tries to log the conflict.
+ </para>
The opening "Some limit is needed" is strange because it's not
immediately obvious that it refers to the earlier-mentioned 64kB.
SUGGESTION
<para>
Key values are limited to 64kB because <literal>replica_identity</literal>
is a <type>json</type> value, which cannot exceed 1GB, and the text form of
a value can be longer than the value itself.
</para>
<para>
The limit is applied only after a key value's text representation has
been produced, so it bounds how much text is stored in the conflict log
table but not how large that text becomes while it is being built.
Normally this is not a problem, because the publisher had to produce the
same text, within the same 1GB limit, in order to send the value.
This does not hold in some cases, for example when the key column has a
different data type on the subscriber, when the subscription uses
<link linkend="sql-createsubscription-params-with-binary"><literal>binary</literal></link>
mode so the value is not sent as text, or when the subscriber's
<xref linkend="guc-bytea-output"/> or
<xref linkend="guc-quote-all-identifiers"/> setting differs from the
publisher's. Then the text can exceed 1GB, and the apply worker fails with
an error when it tries to log the conflict.
</para>
======
doc/src/sgml/ref/create_subscription.sgml
5.
<caution>
<para>
The conflict log table is strictly tied to the lifecycle of the
subscription or the
<literal>conflict_log_destination</literal> setting. If
the subscription is dropped, or if the destination is changed to
- <literal>log</literal>, the table is
<emphasis>dropped</emphasis>.
+ <literal>log</literal>, the table and all its recorded
conflict data are
+ <emphasis>permanently deleted</emphasis>.
</para>
</caution>
In the docs, typically tables are "dropped", not "deleted".
SUGGESTION
... the table is <emphasis>permanently dropped</emphasis>, along with
all the conflict data recorded in it.
======
Kind Regards,
Peter Smith.
Fujitsu Australia
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Masahiko Sawada | 2026-11-24 01:39:25 | Re: Make COPY format extendable: Extract COPY TO format implementations |
| Previous Message | David Rowley | 2026-11-24 01:23:32 | Re: Hash aggregation shows only the last execution's stats for parallel workers |