PostgreSQL Source Code: src/include/replication/conflict.h File Reference (original) (raw)
Go to the source code of this file.
Functions | |
---|---|
bool | GetTupleTransactionInfo (TupleTableSlot *localslot, TransactionId *xmin, RepOriginId *localorigin, TimestampTz *localts) |
void | ReportApplyConflict (EState *estate, ResultRelInfo *relinfo, int elevel, ConflictType type, TupleTableSlot *searchslot, TupleTableSlot *remoteslot, List *conflicttuples) |
void | InitConflictIndexes (ResultRelInfo *relInfo) |
◆ CONFLICT_NUM_TYPES
◆ ConflictTupleInfo
◆ ConflictType
Enumerator |
---|
CT_INSERT_EXISTS |
CT_UPDATE_ORIGIN_DIFFERS |
CT_UPDATE_EXISTS |
CT_UPDATE_MISSING |
CT_DELETE_ORIGIN_DIFFERS |
CT_DELETE_MISSING |
CT_MULTIPLE_UNIQUE_CONFLICTS |
Definition at line 24 of file conflict.h.
25{
26
28
29
31
32
34
35
37
38
40
41
43
44
46
47
48
49
50
51
@ CT_MULTIPLE_UNIQUE_CONFLICTS
@ CT_UPDATE_ORIGIN_DIFFERS
@ CT_DELETE_ORIGIN_DIFFERS
◆ GetTupleTransactionInfo()
Definition at line 62 of file conflict.c.
64{
66 bool isnull;
67
69 &isnull);
72
73
74
75
76
78 {
80 *localts = 0;
81 return false;
82 }
83
85}
bool track_commit_timestamp
bool TransactionIdGetCommitTsData(TransactionId xid, TimestampTz *ts, RepOriginId *nodeid)
Assert(PointerIsAligned(start, uint64))
#define InvalidRepOriginId
static TransactionId DatumGetTransactionId(Datum X)
#define MinTransactionIdAttributeNumber
static Datum slot_getsysattr(TupleTableSlot *slot, int attnum, bool *isnull)
References Assert(), DatumGetTransactionId(), InvalidRepOriginId, MinTransactionIdAttributeNumber, slot_getsysattr(), track_commit_timestamp, and TransactionIdGetCommitTsData().
Referenced by apply_handle_delete_internal(), apply_handle_tuple_routing(), apply_handle_update_internal(), and CheckAndReportConflict().
◆ InitConflictIndexes()
Definition at line 138 of file conflict.c.
139{
140 List *uniqueIndexes = NIL;
141
143 {
145
146 if (indexRelation == NULL)
147 continue;
148
149
151 continue;
152
153
154 if (!indexRelation->rd_index->indimmediate)
155 continue;
156
157 uniqueIndexes = lappend_oid(uniqueIndexes,
159 }
160
162}
List * lappend_oid(List *list, Oid datum)
#define RelationGetRelid(relation)
List * ri_onConflictArbiterIndexes
RelationPtr ri_IndexRelationDescs
IndexInfo ** ri_IndexRelationInfo
References i, IndexInfo::ii_Unique, lappend_oid(), NIL, RelationData::rd_index, RelationGetRelid, ResultRelInfo::ri_IndexRelationDescs, ResultRelInfo::ri_IndexRelationInfo, ResultRelInfo::ri_NumIndices, and ResultRelInfo::ri_onConflictArbiterIndexes.
Referenced by apply_handle_insert_internal(), apply_handle_tuple_routing(), and apply_handle_update_internal().
◆ ReportApplyConflict()
Definition at line 103 of file conflict.c.
106{
109
111
112
115 conflicttuple->slot, remoteslot,
116 conflicttuple->indexoid,
117 conflicttuple->xmin,
118 conflicttuple->origin,
119 conflicttuple->ts,
120 &err_detail);
121
123
126 errmsg("conflict detected on relation \"%s.%s\": conflict=%s",
131}
Subscription * MySubscription
static void errdetail_apply_conflict(EState *estate, ResultRelInfo *relinfo, ConflictType type, TupleTableSlot *searchslot, TupleTableSlot *localslot, TupleTableSlot *remoteslot, Oid indexoid, TransactionId localxmin, RepOriginId localorigin, TimestampTz localts, StringInfo err_msg)
static const char *const ConflictTypeNames[]
static int errcode_apply_conflict(ConflictType type)
int errdetail_internal(const char *fmt,...)
int errmsg(const char *fmt,...)
#define ereport(elevel,...)
char * get_namespace_name(Oid nspid)
#define foreach_ptr(type, var, lst)
void pgstat_report_subscription_conflict(Oid subid, ConflictType type)
#define RelationGetRelationName(relation)
#define RelationGetNamespace(relation)
void initStringInfo(StringInfo str)
References ConflictTypeNames, StringInfoData::data, ereport, errcode_apply_conflict(), errdetail_apply_conflict(), errdetail_internal(), errmsg(), foreach_ptr, get_namespace_name(), initStringInfo(), MySubscription, Subscription::oid, pgstat_report_subscription_conflict(), RelationGetNamespace, RelationGetRelationName, ResultRelInfo::ri_RelationDesc, and type.
Referenced by apply_handle_delete_internal(), apply_handle_tuple_routing(), apply_handle_update_internal(), and CheckAndReportConflict().