mirror of
https://github.com/postgres/postgres.git
synced 2025-08-06 18:42:54 +03:00
Make ascii-art in comments pgindent-safe, and some other formatting changes.
Kevin Grittner
This commit is contained in:
@@ -3814,7 +3814,7 @@ FlagRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer)
|
|||||||
SetRWConflict(reader, writer);
|
SetRWConflict(reader, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*----------------------------------------------------------------------------
|
||||||
* We are about to add a RW-edge to the dependency graph - check that we don't
|
* We are about to add a RW-edge to the dependency graph - check that we don't
|
||||||
* introduce a dangerous structure by doing so, and abort one of the
|
* introduce a dangerous structure by doing so, and abort one of the
|
||||||
* transactions if so.
|
* transactions if so.
|
||||||
@@ -3830,6 +3830,7 @@ FlagRWConflict(SERIALIZABLEXACT *reader, SERIALIZABLEXACT *writer)
|
|||||||
* One more optimization is that if Tin is declared READ ONLY (or commits
|
* One more optimization is that if Tin is declared READ ONLY (or commits
|
||||||
* without writing), we can only have a problem if Tout committed before Tin
|
* without writing), we can only have a problem if Tout committed before Tin
|
||||||
* acquired its snapshot.
|
* acquired its snapshot.
|
||||||
|
*----------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
|
OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
|
||||||
@@ -3842,7 +3843,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
|
|||||||
|
|
||||||
failure = false;
|
failure = false;
|
||||||
|
|
||||||
/*
|
/*------------------------------------------------------------------------
|
||||||
* Check for already-committed writer with rw-conflict out flagged
|
* Check for already-committed writer with rw-conflict out flagged
|
||||||
* (conflict-flag on W means that T2 committed before W):
|
* (conflict-flag on W means that T2 committed before W):
|
||||||
*
|
*
|
||||||
@@ -3851,12 +3852,13 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
|
|||||||
*
|
*
|
||||||
* That is a dangerous structure, so we must abort. (Since the writer
|
* That is a dangerous structure, so we must abort. (Since the writer
|
||||||
* has already committed, we must be the reader)
|
* has already committed, we must be the reader)
|
||||||
|
*------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
if (SxactIsCommitted(writer)
|
if (SxactIsCommitted(writer)
|
||||||
&& (SxactHasConflictOut(writer) || SxactHasSummaryConflictOut(writer)))
|
&& (SxactHasConflictOut(writer) || SxactHasSummaryConflictOut(writer)))
|
||||||
failure = true;
|
failure = true;
|
||||||
|
|
||||||
/*
|
/*------------------------------------------------------------------------
|
||||||
* Check whether the writer has become a pivot with an out-conflict
|
* Check whether the writer has become a pivot with an out-conflict
|
||||||
* committed transaction (T2), and T2 committed first:
|
* committed transaction (T2), and T2 committed first:
|
||||||
*
|
*
|
||||||
@@ -3868,6 +3870,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
|
|||||||
* - the writer committed before T2
|
* - the writer committed before T2
|
||||||
* - the reader is a READ ONLY transaction and the reader was concurrent
|
* - the reader is a READ ONLY transaction and the reader was concurrent
|
||||||
* with T2 (= reader acquired its snapshot before T2 committed)
|
* with T2 (= reader acquired its snapshot before T2 committed)
|
||||||
|
*------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
if (!failure)
|
if (!failure)
|
||||||
{
|
{
|
||||||
@@ -3903,7 +3906,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*------------------------------------------------------------------------
|
||||||
* Check whether the reader has become a pivot with a committed writer:
|
* Check whether the reader has become a pivot with a committed writer:
|
||||||
*
|
*
|
||||||
* T0 ------> R ------> W
|
* T0 ------> R ------> W
|
||||||
@@ -3913,6 +3916,7 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
|
|||||||
* anomaly if:
|
* anomaly if:
|
||||||
* - T0 committed before the writer
|
* - T0 committed before the writer
|
||||||
* - T0 is READ ONLY, and overlaps the writer
|
* - T0 is READ ONLY, and overlaps the writer
|
||||||
|
*------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
if (!failure && SxactIsCommitted(writer) && !SxactIsReadOnly(reader))
|
if (!failure && SxactIsCommitted(writer) && !SxactIsReadOnly(reader))
|
||||||
{
|
{
|
||||||
@@ -3950,8 +3954,8 @@ OnConflict_CheckForSerializationFailure(const SERIALIZABLEXACT *reader,
|
|||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* We have to kill a transaction to avoid a possible anomaly from
|
* We have to kill a transaction to avoid a possible anomaly from
|
||||||
* occurring. If the writer is us, we can just ereport() to cause
|
* occurring. If the writer is us, we can just ereport() to cause a
|
||||||
* a transaction abort. Otherwise we flag the writer for termination,
|
* transaction abort. Otherwise we flag the writer for termination,
|
||||||
* causing it to abort when it tries to commit. However, if the writer
|
* causing it to abort when it tries to commit. However, if the writer
|
||||||
* is a prepared transaction, already prepared, we can't abort it
|
* is a prepared transaction, already prepared, we can't abort it
|
||||||
* anymore, so we have to kill the reader instead.
|
* anymore, so we have to kill the reader instead.
|
||||||
|
Reference in New Issue
Block a user