mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
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
This commit is contained in:
@ -1599,7 +1599,7 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><literal>update_differ</literal></term>
|
<term><literal>update_origin_differs</literal></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Updating a row that was previously modified by another origin.
|
Updating a row that was previously modified by another origin.
|
||||||
@ -1637,7 +1637,7 @@ test_sub=# SELECT * FROM t1 ORDER BY id;
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><literal>delete_differ</literal></term>
|
<term><literal>delete_origin_differs</literal></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Deleting a row that was previously modified by another origin. Note that
|
Deleting a row that was previously modified by another origin. Note that
|
||||||
@ -1723,7 +1723,7 @@ DETAIL: <replaceable class="parameter">detailed_explanation</replaceable>.
|
|||||||
<para>
|
<para>
|
||||||
The <literal>existing local tuple</literal> section includes the local
|
The <literal>existing local tuple</literal> section includes the local
|
||||||
tuple if its origin differs from the remote tuple for
|
tuple if its origin differs from the remote tuple for
|
||||||
<literal>update_differ</literal> or <literal>delete_differ</literal>
|
<literal>update_origin_differs</literal> or <literal>delete_origin_differs</literal>
|
||||||
conflicts, or if the key value conflicts with the remote tuple for
|
conflicts, or if the key value conflicts with the remote tuple for
|
||||||
<literal>insert_exists</literal> or <literal>update_exists</literal>
|
<literal>insert_exists</literal> or <literal>update_exists</literal>
|
||||||
conflicts.
|
conflicts.
|
||||||
|
@ -24,10 +24,10 @@
|
|||||||
|
|
||||||
static const char *const ConflictTypeNames[] = {
|
static const char *const ConflictTypeNames[] = {
|
||||||
[CT_INSERT_EXISTS] = "insert_exists",
|
[CT_INSERT_EXISTS] = "insert_exists",
|
||||||
[CT_UPDATE_DIFFER] = "update_differ",
|
[CT_UPDATE_ORIGIN_DIFFERS] = "update_origin_differs",
|
||||||
[CT_UPDATE_EXISTS] = "update_exists",
|
[CT_UPDATE_EXISTS] = "update_exists",
|
||||||
[CT_UPDATE_MISSING] = "update_missing",
|
[CT_UPDATE_MISSING] = "update_missing",
|
||||||
[CT_DELETE_DIFFER] = "delete_differ",
|
[CT_DELETE_ORIGIN_DIFFERS] = "delete_origin_differs",
|
||||||
[CT_DELETE_MISSING] = "delete_missing"
|
[CT_DELETE_MISSING] = "delete_missing"
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -167,9 +167,9 @@ errcode_apply_conflict(ConflictType type)
|
|||||||
case CT_INSERT_EXISTS:
|
case CT_INSERT_EXISTS:
|
||||||
case CT_UPDATE_EXISTS:
|
case CT_UPDATE_EXISTS:
|
||||||
return errcode(ERRCODE_UNIQUE_VIOLATION);
|
return errcode(ERRCODE_UNIQUE_VIOLATION);
|
||||||
case CT_UPDATE_DIFFER:
|
case CT_UPDATE_ORIGIN_DIFFERS:
|
||||||
case CT_UPDATE_MISSING:
|
case CT_UPDATE_MISSING:
|
||||||
case CT_DELETE_DIFFER:
|
case CT_DELETE_ORIGIN_DIFFERS:
|
||||||
case CT_DELETE_MISSING:
|
case CT_DELETE_MISSING:
|
||||||
return errcode(ERRCODE_T_R_SERIALIZATION_FAILURE);
|
return errcode(ERRCODE_T_R_SERIALIZATION_FAILURE);
|
||||||
}
|
}
|
||||||
@ -237,7 +237,7 @@ errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo,
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_UPDATE_DIFFER:
|
case CT_UPDATE_ORIGIN_DIFFERS:
|
||||||
if (localorigin == InvalidRepOriginId)
|
if (localorigin == InvalidRepOriginId)
|
||||||
appendStringInfo(&err_detail, _("Updating the row that was modified locally in transaction %u at %s."),
|
appendStringInfo(&err_detail, _("Updating the row that was modified locally in transaction %u at %s."),
|
||||||
localxmin, timestamptz_to_str(localts));
|
localxmin, timestamptz_to_str(localts));
|
||||||
@ -256,7 +256,7 @@ errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo,
|
|||||||
appendStringInfo(&err_detail, _("Could not find the row to be updated."));
|
appendStringInfo(&err_detail, _("Could not find the row to be updated."));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CT_DELETE_DIFFER:
|
case CT_DELETE_ORIGIN_DIFFERS:
|
||||||
if (localorigin == InvalidRepOriginId)
|
if (localorigin == InvalidRepOriginId)
|
||||||
appendStringInfo(&err_detail, _("Deleting the row that was modified locally in transaction %u at %s."),
|
appendStringInfo(&err_detail, _("Deleting the row that was modified locally in transaction %u at %s."),
|
||||||
localxmin, timestamptz_to_str(localts));
|
localxmin, timestamptz_to_str(localts));
|
||||||
|
@ -2702,7 +2702,7 @@ apply_handle_update_internal(ApplyExecutionData *edata,
|
|||||||
newslot = table_slot_create(localrel, &estate->es_tupleTable);
|
newslot = table_slot_create(localrel, &estate->es_tupleTable);
|
||||||
slot_store_data(newslot, relmapentry, newtup);
|
slot_store_data(newslot, relmapentry, newtup);
|
||||||
|
|
||||||
ReportApplyConflict(estate, relinfo, LOG, CT_UPDATE_DIFFER,
|
ReportApplyConflict(estate, relinfo, LOG, CT_UPDATE_ORIGIN_DIFFERS,
|
||||||
remoteslot, localslot, newslot,
|
remoteslot, localslot, newslot,
|
||||||
InvalidOid, localxmin, localorigin, localts);
|
InvalidOid, localxmin, localorigin, localts);
|
||||||
}
|
}
|
||||||
@ -2868,7 +2868,7 @@ apply_handle_delete_internal(ApplyExecutionData *edata,
|
|||||||
*/
|
*/
|
||||||
if (GetTupleTransactionInfo(localslot, &localxmin, &localorigin, &localts) &&
|
if (GetTupleTransactionInfo(localslot, &localxmin, &localorigin, &localts) &&
|
||||||
localorigin != replorigin_session_origin)
|
localorigin != replorigin_session_origin)
|
||||||
ReportApplyConflict(estate, relinfo, LOG, CT_DELETE_DIFFER,
|
ReportApplyConflict(estate, relinfo, LOG, CT_DELETE_ORIGIN_DIFFERS,
|
||||||
remoteslot, localslot, NULL,
|
remoteslot, localslot, NULL,
|
||||||
InvalidOid, localxmin, localorigin, localts);
|
InvalidOid, localxmin, localorigin, localts);
|
||||||
|
|
||||||
@ -3097,7 +3097,7 @@ apply_handle_tuple_routing(ApplyExecutionData *edata,
|
|||||||
newslot = table_slot_create(partrel, &estate->es_tupleTable);
|
newslot = table_slot_create(partrel, &estate->es_tupleTable);
|
||||||
slot_store_data(newslot, part_entry, newtup);
|
slot_store_data(newslot, part_entry, newtup);
|
||||||
|
|
||||||
ReportApplyConflict(estate, partrelinfo, LOG, CT_UPDATE_DIFFER,
|
ReportApplyConflict(estate, partrelinfo, LOG, CT_UPDATE_ORIGIN_DIFFERS,
|
||||||
remoteslot_part, localslot, newslot,
|
remoteslot_part, localslot, newslot,
|
||||||
InvalidOid, localxmin, localorigin,
|
InvalidOid, localxmin, localorigin,
|
||||||
localts);
|
localts);
|
||||||
|
@ -21,7 +21,7 @@ typedef enum
|
|||||||
CT_INSERT_EXISTS,
|
CT_INSERT_EXISTS,
|
||||||
|
|
||||||
/* The row to be updated was modified by a different origin */
|
/* The row to be updated was modified by a different origin */
|
||||||
CT_UPDATE_DIFFER,
|
CT_UPDATE_ORIGIN_DIFFERS,
|
||||||
|
|
||||||
/* The updated row value violates unique constraint */
|
/* The updated row value violates unique constraint */
|
||||||
CT_UPDATE_EXISTS,
|
CT_UPDATE_EXISTS,
|
||||||
@ -30,7 +30,7 @@ typedef enum
|
|||||||
CT_UPDATE_MISSING,
|
CT_UPDATE_MISSING,
|
||||||
|
|
||||||
/* The row to be deleted was modified by a different origin */
|
/* The row to be deleted was modified by a different origin */
|
||||||
CT_DELETE_DIFFER,
|
CT_DELETE_ORIGIN_DIFFERS,
|
||||||
|
|
||||||
/* The row to be deleted is missing */
|
/* The row to be deleted is missing */
|
||||||
CT_DELETE_MISSING,
|
CT_DELETE_MISSING,
|
||||||
|
@ -799,7 +799,7 @@ $node_publisher->wait_for_catchup('sub_viaroot');
|
|||||||
|
|
||||||
$logfile = slurp_file($node_subscriber1->logfile(), $log_location);
|
$logfile = slurp_file($node_subscriber1->logfile(), $log_location);
|
||||||
ok( $logfile =~
|
ok( $logfile =~
|
||||||
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\)/,
|
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\)/,
|
||||||
'updating a tuple that was modified by a different origin');
|
'updating a tuple that was modified by a different origin');
|
||||||
|
|
||||||
# The remaining tests no longer test conflict detection.
|
# The remaining tests no longer test conflict detection.
|
||||||
|
@ -163,7 +163,7 @@ is($result, qq(32), 'The node_A data replicated to node_B');
|
|||||||
$node_C->safe_psql('postgres', "UPDATE tab SET a = 33 WHERE a = 32;");
|
$node_C->safe_psql('postgres', "UPDATE tab SET a = 33 WHERE a = 32;");
|
||||||
|
|
||||||
$node_B->wait_for_log(
|
$node_B->wait_for_log(
|
||||||
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\)/
|
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\)/
|
||||||
);
|
);
|
||||||
|
|
||||||
$node_B->safe_psql('postgres', "DELETE FROM tab;");
|
$node_B->safe_psql('postgres', "DELETE FROM tab;");
|
||||||
@ -179,7 +179,7 @@ is($result, qq(33), 'The node_A data replicated to node_B');
|
|||||||
$node_C->safe_psql('postgres', "DELETE FROM tab WHERE a = 33;");
|
$node_C->safe_psql('postgres', "DELETE FROM tab WHERE a = 33;");
|
||||||
|
|
||||||
$node_B->wait_for_log(
|
$node_B->wait_for_log(
|
||||||
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\)/
|
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\)/
|
||||||
);
|
);
|
||||||
|
|
||||||
# The remaining tests no longer test conflict detection.
|
# The remaining tests no longer test conflict detection.
|
||||||
|
Reference in New Issue
Block a user