Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3f14d8d

Browse files
committed
Avoid incorrectly indicating exclusion constraint wait
INSERT ... ON CONFLICT's precheck may have to wait on the outcome ofanother insertion, which may or may not itself be a speculativeinsertion. This wait is not necessarily associated with an exclusionconstraint, but was always reported that way in log messages if the waithappened to involve a tuple that had no speculative token.Initially discovered through use of ON CONFLICT DO NOTHING, wherespurious references to exclusion constraints in log messages were morelikely.Patch by Peter Geoghegan.Reviewed by Julien Rouhaud.Back-patch to 9.5 where INSERT ... ON CONFLICT was added.
1 parent755ebfa commit3f14d8d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

‎src/backend/executor/execIndexing.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -725,6 +725,7 @@ check_exclusion_or_unique_constraint(Relation heap, Relation index,
725725
{
726726
TransactionIdxwait;
727727
ItemPointerDatactid_wait;
728+
XLTW_Operreason_wait;
728729
Datumexisting_values[INDEX_MAX_KEYS];
729730
boolexisting_isnull[INDEX_MAX_KEYS];
730731
char*error_new;
@@ -783,13 +784,14 @@ check_exclusion_or_unique_constraint(Relation heap, Relation index,
783784
TransactionIdPrecedes(GetCurrentTransactionId(),xwait))))
784785
{
785786
ctid_wait=tup->t_data->t_ctid;
787+
reason_wait=indexInfo->ii_ExclusionOps ?
788+
XLTW_RecheckExclusionConstr :XLTW_InsertIndex;
786789
index_endscan(index_scan);
787790
if (DirtySnapshot.speculativeToken)
788791
SpeculativeInsertionWait(DirtySnapshot.xmin,
789792
DirtySnapshot.speculativeToken);
790793
else
791-
XactLockTableWait(xwait,heap,&ctid_wait,
792-
XLTW_RecheckExclusionConstr);
794+
XactLockTableWait(xwait,heap,&ctid_wait,reason_wait);
793795
gotoretry;
794796
}
795797

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp