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

Commita31ff70

Browse files
committed
Make ascii-art in comments pgindent-safe, and some other formatting changes.
Kevin Grittner
1 parentfc1286d commita31ff70

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

‎src/backend/storage/lmgr/predicate.c

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3814,7 +3814,7 @@ FlagRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer)
38143814
SetRWConflict(reader,writer);
38153815
}
38163816

3817-
/*
3817+
/*----------------------------------------------------------------------------
38183818
* We are about to add a RW-edge to the dependency graph - check that we don't
38193819
* introduce a dangerous structure by doing so, and abort one of the
38203820
* transactions if so.
@@ -3823,13 +3823,14 @@ FlagRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer)
38233823
* in the dependency graph:
38243824
*
38253825
*Tin ------> Tpivot ------> Tout
3826-
* rw rw
3826+
* rw rw
38273827
*
38283828
* Furthermore, Tout must commit first.
38293829
*
38303830
* One more optimization is that if Tin is declared READ ONLY (or commits
38313831
* without writing), we can only have a problem if Tout committed before Tin
38323832
* acquired its snapshot.
3833+
*----------------------------------------------------------------------------
38333834
*/
38343835
staticvoid
38353836
OnConflict_CheckForSerializationFailure(constSERIALIZABLEXACT*reader,
@@ -3842,32 +3843,34 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
38423843

38433844
failure= false;
38443845

3845-
/*
3846+
/*------------------------------------------------------------------------
38463847
* Check for already-committed writer with rw-conflict out flagged
38473848
* (conflict-flag on W means that T2 committed before W):
38483849
*
38493850
*R ------> W ------> T2
3850-
*rw rw
3851+
*rw rw
38513852
*
38523853
* That is a dangerous structure, so we must abort. (Since the writer
38533854
* has already committed, we must be the reader)
3855+
*------------------------------------------------------------------------
38543856
*/
38553857
if (SxactIsCommitted(writer)
38563858
&& (SxactHasConflictOut(writer)||SxactHasSummaryConflictOut(writer)))
38573859
failure= true;
38583860

3859-
/*
3861+
/*------------------------------------------------------------------------
38603862
* Check whether the writer has become a pivot with an out-conflict
38613863
* committed transaction (T2), and T2 committed first:
38623864
*
38633865
*R ------> W ------> T2
3864-
*rw rw
3866+
*rw rw
38653867
*
38663868
* Because T2 must've committed first, there is no anomaly if:
38673869
* - the reader committed before T2
38683870
* - the writer committed before T2
38693871
* - the reader is a READ ONLY transaction and the reader was concurrent
38703872
* with T2 (= reader acquired its snapshot before T2 committed)
3873+
*------------------------------------------------------------------------
38713874
*/
38723875
if (!failure)
38733876
{
@@ -3891,7 +3894,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
38913894
&& (!SxactIsCommitted(writer)
38923895
||t2->commitSeqNo <=writer->commitSeqNo)
38933896
&& (!SxactIsReadOnly(reader)
3894-
||t2->commitSeqNo <=reader->SeqNo.lastCommitBeforeSnapshot))
3897+
||t2->commitSeqNo <=reader->SeqNo.lastCommitBeforeSnapshot))
38953898
{
38963899
failure= true;
38973900
break;
@@ -3903,16 +3906,17 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
39033906
}
39043907
}
39053908

3906-
/*
3909+
/*------------------------------------------------------------------------
39073910
* Check whether the reader has become a pivot with a committed writer:
39083911
*
39093912
*T0 ------> R ------> W
3910-
* rw rw
3913+
* rw rw
39113914
*
39123915
* Because W must've committed first for an anomaly to occur, there is no
39133916
* anomaly if:
39143917
* - T0 committed before the writer
39153918
* - T0 is READ ONLY, and overlaps the writer
3919+
*------------------------------------------------------------------------
39163920
*/
39173921
if (!failure&&SxactIsCommitted(writer)&& !SxactIsReadOnly(reader))
39183922
{
@@ -3934,7 +3938,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
39343938
&& (!SxactIsCommitted(t0)
39353939
||t0->commitSeqNo >=writer->commitSeqNo)
39363940
&& (!SxactIsReadOnly(t0)
3937-
||t0->SeqNo.lastCommitBeforeSnapshot >=writer->commitSeqNo))
3941+
||t0->SeqNo.lastCommitBeforeSnapshot >=writer->commitSeqNo))
39383942
{
39393943
failure= true;
39403944
break;
@@ -3950,8 +3954,8 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
39503954
{
39513955
/*
39523956
* We have to kill a transaction to avoid a possible anomaly from
3953-
* occurring. If the writer is us, we can just ereport() to cause
3954-
*atransaction abort. Otherwise we flag the writer for termination,
3957+
* occurring. If the writer is us, we can just ereport() to cause a
3958+
* transaction abort. Otherwise we flag the writer for termination,
39553959
* causing it to abort when it tries to commit. However, if the writer
39563960
* is a prepared transaction, already prepared, we can't abort it
39573961
* anymore, so we have to kill the reader instead.
@@ -3962,7 +3966,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
39623966
ereport(ERROR,
39633967
(errcode(ERRCODE_T_R_SERIALIZATION_FAILURE),
39643968
errmsg("could not serialize access due to read/write dependencies among transactions"),
3965-
errdetail("Cancelled on identification as a pivot, during write."),
3969+
errdetail("Cancelled on identification as a pivot, during write."),
39663970
errhint("The transaction might succeed if retried.")));
39673971
}
39683972
elseif (SxactIsPrepared(writer))

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp