Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 640178c

Browse files
author
Amit Kapila
committed
Rename the conflict types for the origin differ cases.
The conflict types 'update_differ' and 'delete_differ' indicate that a row to be modified was previously altered by another origin. Rename those to 'update_origin_differs' and 'delete_origin_differs' to clarify their meaning. Author: Hou Zhijie Reviewed-by: Shveta Malik, Peter Smith Discussion: https://postgr.es/m/CAA4eK1+HEKwG_UYt4Zvwh5o_HoCKCjEGesRjJX38xAH3OxuuYA@mail.gmail.com
1 parent 9d90e2b commit 640178c

File tree

6 files changed

+17
-17
lines changed

6 files changed

+17
-17
lines changed

doc/src/sgml/logical-replication.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1599,7 +1599,7 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
15991599
</listitem>
16001600
</varlistentry>
16011601
<varlistentry>
1602-
<term><literal>update_differ</literal></term>
1602+
<term><literal>update_origin_differs</literal></term>
16031603
<listitem>
16041604
<para>
16051605
Updating a row that was previously modified by another origin.
@@ -1637,7 +1637,7 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
16371637
</listitem>
16381638
</varlistentry>
16391639
<varlistentry>
1640-
<term><literal>delete_differ</literal></term>
1640+
<term><literal>delete_origin_differs</literal></term>
16411641
<listitem>
16421642
<para>
16431643
Deleting a row that was previously modified by another origin. Note that
@@ -1723,7 +1723,7 @@ DETAIL: <replaceable class="parameter">detailed_explanation</replaceable>.
17231723
<para>
17241724
The <literal>existing local tuple</literal> section includes the local
17251725
tuple if its origin differs from the remote tuple for
1726-
<literal>update_differ</literal> or <literal>delete_differ</literal>
1726+
<literal>update_origin_differs</literal> or <literal>delete_origin_differs</literal>
17271727
conflicts, or if the key value conflicts with the remote tuple for
17281728
<literal>insert_exists</literal> or <literal>update_exists</literal>
17291729
conflicts.

src/backend/replication/logical/conflict.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424

2525
static const char *const ConflictTypeNames[] = {
2626
[CT_INSERT_EXISTS] = "insert_exists",
27-
[CT_UPDATE_DIFFER] = "update_differ",
27+
[CT_UPDATE_ORIGIN_DIFFERS] = "update_origin_differs",
2828
[CT_UPDATE_EXISTS] = "update_exists",
2929
[CT_UPDATE_MISSING] = "update_missing",
30-
[CT_DELETE_DIFFER] = "delete_differ",
30+
[CT_DELETE_ORIGIN_DIFFERS] = "delete_origin_differs",
3131
[CT_DELETE_MISSING] = "delete_missing"
3232
};
3333

@@ -167,9 +167,9 @@ errcode_apply_conflict(ConflictType type)
167167
case CT_INSERT_EXISTS:
168168
case CT_UPDATE_EXISTS:
169169
return errcode(ERRCODE_UNIQUE_VIOLATION);
170-
case CT_UPDATE_DIFFER:
170+
case CT_UPDATE_ORIGIN_DIFFERS:
171171
case CT_UPDATE_MISSING:
172-
case CT_DELETE_DIFFER:
172+
case CT_DELETE_ORIGIN_DIFFERS:
173173
case CT_DELETE_MISSING:
174174
return errcode(ERRCODE_T_R_SERIALIZATION_FAILURE);
175175
}
@@ -237,7 +237,7 @@ errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo,
237237

238238
break;
239239

240-
case CT_UPDATE_DIFFER:
240+
case CT_UPDATE_ORIGIN_DIFFERS:
241241
if (localorigin == InvalidRepOriginId)
242242
appendStringInfo(&err_detail, _("Updating the row that was modified locally in transaction %u at %s."),
243243
localxmin, timestamptz_to_str(localts));
@@ -256,7 +256,7 @@ errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo,
256256
appendStringInfo(&err_detail, _("Could not find the row to be updated."));
257257
break;
258258

259-
case CT_DELETE_DIFFER:
259+
case CT_DELETE_ORIGIN_DIFFERS:
260260
if (localorigin == InvalidRepOriginId)
261261
appendStringInfo(&err_detail, _("Deleting the row that was modified locally in transaction %u at %s."),
262262
localxmin, timestamptz_to_str(localts));

src/backend/replication/logical/worker.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2702,7 +2702,7 @@ apply_handle_update_internal(ApplyExecutionData *edata,
27022702
newslot = table_slot_create(localrel, &estate->es_tupleTable);
27032703
slot_store_data(newslot, relmapentry, newtup);
27042704

2705-
ReportApplyConflict(estate, relinfo, LOG, CT_UPDATE_DIFFER,
2705+
ReportApplyConflict(estate, relinfo, LOG, CT_UPDATE_ORIGIN_DIFFERS,
27062706
remoteslot, localslot, newslot,
27072707
InvalidOid, localxmin, localorigin, localts);
27082708
}
@@ -2868,7 +2868,7 @@ apply_handle_delete_internal(ApplyExecutionData *edata,
28682868
*/
28692869
if (GetTupleTransactionInfo(localslot, &localxmin, &localorigin, &localts) &&
28702870
localorigin != replorigin_session_origin)
2871-
ReportApplyConflict(estate, relinfo, LOG, CT_DELETE_DIFFER,
2871+
ReportApplyConflict(estate, relinfo, LOG, CT_DELETE_ORIGIN_DIFFERS,
28722872
remoteslot, localslot, NULL,
28732873
InvalidOid, localxmin, localorigin, localts);
28742874

@@ -3097,7 +3097,7 @@ apply_handle_tuple_routing(ApplyExecutionData *edata,
30973097
newslot = table_slot_create(partrel, &estate->es_tupleTable);
30983098
slot_store_data(newslot, part_entry, newtup);
30993099

3100-
ReportApplyConflict(estate, partrelinfo, LOG, CT_UPDATE_DIFFER,
3100+
ReportApplyConflict(estate, partrelinfo, LOG, CT_UPDATE_ORIGIN_DIFFERS,
31013101
remoteslot_part, localslot, newslot,
31023102
InvalidOid, localxmin, localorigin,
31033103
localts);

src/include/replication/conflict.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ typedef enum
2121
CT_INSERT_EXISTS,
2222

2323
/* The row to be updated was modified by a different origin */
24-
CT_UPDATE_DIFFER,
24+
CT_UPDATE_ORIGIN_DIFFERS,
2525

2626
/* The updated row value violates unique constraint */
2727
CT_UPDATE_EXISTS,
@@ -30,7 +30,7 @@ typedef enum
3030
CT_UPDATE_MISSING,
3131

3232
/* The row to be deleted was modified by a different origin */
33-
CT_DELETE_DIFFER,
33+
CT_DELETE_ORIGIN_DIFFERS,
3434

3535
/* The row to be deleted is missing */
3636
CT_DELETE_MISSING,

src/test/subscription/t/013_partition.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -799,7 +799,7 @@ BEGIN
799799

800800
$logfile = slurp_file($node_subscriber1->logfile(), $log_location);
801801
ok( $logfile =~
802-
qr/conflict detected on relation "public.tab2_1": conflict=update_differ.*\n.*DETAIL:.* Updating the row that was modified locally in transaction [0-9]+ at .*\n.*Existing local tuple \(yyy, null, 3\); remote tuple \(pub_tab2, quux, 3\); replica identity \(a\)=\(3\)/,
802+
qr/conflict detected on relation "public.tab2_1": conflict=update_origin_differs.*\n.*DETAIL:.* Updating the row that was modified locally in transaction [0-9]+ at .*\n.*Existing local tuple \(yyy, null, 3\); remote tuple \(pub_tab2, quux, 3\); replica identity \(a\)=\(3\)/,
803803
'updating a tuple that was modified by a different origin');
804804

805805
# The remaining tests no longer test conflict detection.

src/test/subscription/t/030_origin.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@
163163
$node_C->safe_psql('postgres', "UPDATE tab SET a = 33 WHERE a = 32;");
164164

165165
$node_B->wait_for_log(
166-
qr/conflict detected on relation "public.tab": conflict=update_differ.*\n.*DETAIL:.* Updating the row that was modified by a different origin ".*" in transaction [0-9]+ at .*\n.*Existing local tuple \(32\); remote tuple \(33\); replica identity \(a\)=\(32\)/
166+
qr/conflict detected on relation "public.tab": conflict=update_origin_differs.*\n.*DETAIL:.* Updating the row that was modified by a different origin ".*" in transaction [0-9]+ at .*\n.*Existing local tuple \(32\); remote tuple \(33\); replica identity \(a\)=\(32\)/
167167
);
168168

169169
$node_B->safe_psql('postgres', "DELETE FROM tab;");
@@ -179,7 +179,7 @@
179179
$node_C->safe_psql('postgres', "DELETE FROM tab WHERE a = 33;");
180180

181181
$node_B->wait_for_log(
182-
qr/conflict detected on relation "public.tab": conflict=delete_differ.*\n.*DETAIL:.* Deleting the row that was modified by a different origin ".*" in transaction [0-9]+ at .*\n.*Existing local tuple \(33\); replica identity \(a\)=\(33\)/
182+
qr/conflict detected on relation "public.tab": conflict=delete_origin_differs.*\n.*DETAIL:.* Deleting the row that was modified by a different origin ".*" in transaction [0-9]+ at .*\n.*Existing local tuple \(33\); replica identity \(a\)=\(33\)/
183183
);
184184

185185
# The remaining tests no longer test conflict detection.

0 commit comments

Comments
 (0)