mirror of
https://github.com/postgres/postgres.git
synced 2025-08-18 12:22:09 +03:00
pgindent run for 9.4
This includes removing tabs after periods in C comments, which was applied to back branches, so this change should not effect backpatching.
This commit is contained in:
@@ -15,7 +15,7 @@
|
||||
* this module.
|
||||
*
|
||||
* To allow reusing existing combo cids, we also keep a hash table that
|
||||
* maps cmin,cmax pairs to combo cids. This keeps the data structure size
|
||||
* maps cmin,cmax pairs to combo cids. This keeps the data structure size
|
||||
* reasonable in most cases, since the number of unique pairs used by any
|
||||
* one transaction is likely to be small.
|
||||
*
|
||||
@@ -148,8 +148,8 @@ HeapTupleHeaderAdjustCmax(HeapTupleHeader tup,
|
||||
/*
|
||||
* If we're marking a tuple deleted that was inserted by (any
|
||||
* subtransaction of) our transaction, we need to use a combo command id.
|
||||
* Test for HeapTupleHeaderXminCommitted() first, because it's cheaper than a
|
||||
* TransactionIdIsCurrentTransactionId call.
|
||||
* Test for HeapTupleHeaderXminCommitted() first, because it's cheaper
|
||||
* than a TransactionIdIsCurrentTransactionId call.
|
||||
*/
|
||||
if (!HeapTupleHeaderXminCommitted(tup) &&
|
||||
TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetRawXmin(tup)))
|
||||
|
@@ -11,7 +11,7 @@
|
||||
* regd_count and count it in RegisteredSnapshots, but this reference is not
|
||||
* tracked by a resource owner. We used to use the TopTransactionResourceOwner
|
||||
* to track this snapshot reference, but that introduces logical circularity
|
||||
* and thus makes it impossible to clean up in a sane fashion. It's better to
|
||||
* and thus makes it impossible to clean up in a sane fashion. It's better to
|
||||
* handle this reference as an internally-tracked registration, so that this
|
||||
* module is entirely lower-level than ResourceOwners.
|
||||
*
|
||||
@@ -24,9 +24,9 @@
|
||||
* transaction).
|
||||
*
|
||||
* These arrangements let us reset MyPgXact->xmin when there are no snapshots
|
||||
* referenced by this transaction. (One possible improvement would be to be
|
||||
* referenced by this transaction. (One possible improvement would be to be
|
||||
* able to advance Xmin when the snapshot with the earliest Xmin is no longer
|
||||
* referenced. That's a bit harder though, it requires more locking, and
|
||||
* referenced. That's a bit harder though, it requires more locking, and
|
||||
* anyway it should be rather uncommon to keep temporary snapshots referenced
|
||||
* for too long.)
|
||||
*
|
||||
@@ -63,7 +63,7 @@
|
||||
* CurrentSnapshot points to the only snapshot taken in transaction-snapshot
|
||||
* mode, and to the latest one taken in a read-committed transaction.
|
||||
* SecondarySnapshot is a snapshot that's always up-to-date as of the current
|
||||
* instant, even in transaction-snapshot mode. It should only be used for
|
||||
* instant, even in transaction-snapshot mode. It should only be used for
|
||||
* special-purpose code (say, RI checking.) CatalogSnapshot points to an
|
||||
* MVCC snapshot intended to be used for catalog scans; we must refresh it
|
||||
* whenever a system catalog change occurs.
|
||||
@@ -135,7 +135,7 @@ static int RegisteredSnapshots = 0;
|
||||
bool FirstSnapshotSet = false;
|
||||
|
||||
/*
|
||||
* Remember the serializable transaction snapshot, if any. We cannot trust
|
||||
* Remember the serializable transaction snapshot, if any. We cannot trust
|
||||
* FirstSnapshotSet in combination with IsolationUsesXactSnapshot(), because
|
||||
* GUC may be reset before us, changing the value of IsolationUsesXactSnapshot.
|
||||
*/
|
||||
@@ -169,9 +169,9 @@ Snapshot
|
||||
GetTransactionSnapshot(void)
|
||||
{
|
||||
/*
|
||||
* Return historic snapshot if doing logical decoding. We'll never
|
||||
* need a non-historic transaction snapshot in this (sub-)transaction, so
|
||||
* there's no need to be careful to set one up for later calls to
|
||||
* Return historic snapshot if doing logical decoding. We'll never need a
|
||||
* non-historic transaction snapshot in this (sub-)transaction, so there's
|
||||
* no need to be careful to set one up for later calls to
|
||||
* GetTransactionSnapshot().
|
||||
*/
|
||||
if (HistoricSnapshotActive())
|
||||
@@ -238,8 +238,7 @@ GetLatestSnapshot(void)
|
||||
{
|
||||
/*
|
||||
* So far there are no cases requiring support for GetLatestSnapshot()
|
||||
* during logical decoding, but it wouldn't be hard to add if
|
||||
* required.
|
||||
* during logical decoding, but it wouldn't be hard to add if required.
|
||||
*/
|
||||
Assert(!HistoricSnapshotActive());
|
||||
|
||||
@@ -283,12 +282,11 @@ Snapshot
|
||||
GetNonHistoricCatalogSnapshot(Oid relid)
|
||||
{
|
||||
/*
|
||||
* If the caller is trying to scan a relation that has no syscache,
|
||||
* no catcache invalidations will be sent when it is updated. For a
|
||||
* a few key relations, snapshot invalidations are sent instead. If
|
||||
* we're trying to scan a relation for which neither catcache nor
|
||||
* snapshot invalidations are sent, we must refresh the snapshot every
|
||||
* time.
|
||||
* If the caller is trying to scan a relation that has no syscache, no
|
||||
* catcache invalidations will be sent when it is updated. For a a few
|
||||
* key relations, snapshot invalidations are sent instead. If we're
|
||||
* trying to scan a relation for which neither catcache nor snapshot
|
||||
* invalidations are sent, we must refresh the snapshot every time.
|
||||
*/
|
||||
if (!CatalogSnapshotStale && !RelationInvalidatesSnapshotsOnly(relid) &&
|
||||
!RelationHasSysCache(relid))
|
||||
@@ -403,7 +401,7 @@ SetTransactionSnapshot(Snapshot sourcesnap, TransactionId sourcexid)
|
||||
|
||||
/*
|
||||
* In transaction-snapshot mode, the first snapshot must live until end of
|
||||
* xact, so we must make a copy of it. Furthermore, if we're running in
|
||||
* xact, so we must make a copy of it. Furthermore, if we're running in
|
||||
* serializable mode, predicate.c needs to do its own processing.
|
||||
*/
|
||||
if (IsolationUsesXactSnapshot())
|
||||
@@ -499,7 +497,7 @@ FreeSnapshot(Snapshot snapshot)
|
||||
*
|
||||
* If the passed snapshot is a statically-allocated one, or it is possibly
|
||||
* subject to a future command counter update, create a new long-lived copy
|
||||
* with active refcount=1. Otherwise, only increment the refcount.
|
||||
* with active refcount=1. Otherwise, only increment the refcount.
|
||||
*/
|
||||
void
|
||||
PushActiveSnapshot(Snapshot snap)
|
||||
@@ -868,7 +866,7 @@ ExportSnapshot(Snapshot snapshot)
|
||||
* However, we haven't got enough information to do that, since we don't
|
||||
* know if we're at top level or not. For example, we could be inside a
|
||||
* plpgsql function that is going to fire off other transactions via
|
||||
* dblink. Rather than disallow perfectly legitimate usages, don't make a
|
||||
* dblink. Rather than disallow perfectly legitimate usages, don't make a
|
||||
* check.
|
||||
*
|
||||
* Also note that we don't make any restriction on the transaction's
|
||||
@@ -1081,7 +1079,7 @@ parseXidFromText(const char *prefix, char **s, const char *filename)
|
||||
|
||||
/*
|
||||
* ImportSnapshot
|
||||
* Import a previously exported snapshot. The argument should be a
|
||||
* Import a previously exported snapshot. The argument should be a
|
||||
* filename in SNAPSHOT_EXPORT_DIR. Load the snapshot from that file.
|
||||
* This is called by "SET TRANSACTION SNAPSHOT 'foo'".
|
||||
*/
|
||||
|
@@ -20,7 +20,7 @@
|
||||
* TransactionIdDidCommit will both return true. If we check only
|
||||
* TransactionIdDidCommit, we could consider a tuple committed when a
|
||||
* later GetSnapshotData call will still think the originating transaction
|
||||
* is in progress, which leads to application-level inconsistency. The
|
||||
* is in progress, which leads to application-level inconsistency. The
|
||||
* upshot is that we gotta check TransactionIdIsInProgress first in all
|
||||
* code paths, except for a few cases where we are looking at
|
||||
* subtransactions of our own main transaction and so there can't be any
|
||||
@@ -89,13 +89,13 @@ static bool XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot);
|
||||
* just refrain from setting the hint bit until some future re-examination
|
||||
* of the tuple.
|
||||
*
|
||||
* We can always set hint bits when marking a transaction aborted. (Some
|
||||
* We can always set hint bits when marking a transaction aborted. (Some
|
||||
* code in heapam.c relies on that!)
|
||||
*
|
||||
* Also, if we are cleaning up HEAP_MOVED_IN or HEAP_MOVED_OFF entries, then
|
||||
* we can always set the hint bits, since pre-9.0 VACUUM FULL always used
|
||||
* synchronous commits and didn't move tuples that weren't previously
|
||||
* hinted. (This is not known by this subroutine, but is applied by its
|
||||
* hinted. (This is not known by this subroutine, but is applied by its
|
||||
* callers.) Note: old-style VACUUM FULL is gone, but we have to keep this
|
||||
* module's support for MOVED_OFF/MOVED_IN flag bits for as long as we
|
||||
* support in-place update from pre-9.0 databases.
|
||||
@@ -165,6 +165,7 @@ bool
|
||||
HeapTupleSatisfiesSelf(HeapTuple htup, Snapshot snapshot, Buffer buffer)
|
||||
{
|
||||
HeapTupleHeader tuple = htup->t_data;
|
||||
|
||||
Assert(ItemPointerIsValid(&htup->t_self));
|
||||
Assert(htup->t_tableOid != InvalidOid);
|
||||
|
||||
@@ -343,7 +344,7 @@ HeapTupleSatisfiesAny(HeapTuple htup, Snapshot snapshot, Buffer buffer)
|
||||
* This is a simplified version that only checks for VACUUM moving conditions.
|
||||
* It's appropriate for TOAST usage because TOAST really doesn't want to do
|
||||
* its own time qual checks; if you can see the main table row that contains
|
||||
* a TOAST reference, you should be able to see the TOASTed value. However,
|
||||
* a TOAST reference, you should be able to see the TOASTed value. However,
|
||||
* vacuuming a TOAST table is independent of the main table, and in case such
|
||||
* a vacuum fails partway through, we'd better do this much checking.
|
||||
*
|
||||
@@ -355,6 +356,7 @@ HeapTupleSatisfiesToast(HeapTuple htup, Snapshot snapshot,
|
||||
Buffer buffer)
|
||||
{
|
||||
HeapTupleHeader tuple = htup->t_data;
|
||||
|
||||
Assert(ItemPointerIsValid(&htup->t_self));
|
||||
Assert(htup->t_tableOid != InvalidOid);
|
||||
|
||||
@@ -440,6 +442,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
|
||||
Buffer buffer)
|
||||
{
|
||||
HeapTupleHeader tuple = htup->t_data;
|
||||
|
||||
Assert(ItemPointerIsValid(&htup->t_self));
|
||||
Assert(htup->t_tableOid != InvalidOid);
|
||||
|
||||
@@ -497,7 +500,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
|
||||
|
||||
if (HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask))
|
||||
{
|
||||
TransactionId xmax;
|
||||
TransactionId xmax;
|
||||
|
||||
xmax = HeapTupleHeaderGetRawXmax(tuple);
|
||||
|
||||
@@ -600,7 +603,7 @@ HeapTupleSatisfiesUpdate(HeapTuple htup, CommandId curcid,
|
||||
{
|
||||
/*
|
||||
* If it's only locked but neither EXCL_LOCK nor KEYSHR_LOCK is
|
||||
* set, it cannot possibly be running. Otherwise need to check.
|
||||
* set, it cannot possibly be running. Otherwise need to check.
|
||||
*/
|
||||
if ((tuple->t_infomask & (HEAP_XMAX_EXCL_LOCK |
|
||||
HEAP_XMAX_KEYSHR_LOCK)) &&
|
||||
@@ -712,6 +715,7 @@ HeapTupleSatisfiesDirty(HeapTuple htup, Snapshot snapshot,
|
||||
Buffer buffer)
|
||||
{
|
||||
HeapTupleHeader tuple = htup->t_data;
|
||||
|
||||
Assert(ItemPointerIsValid(&htup->t_self));
|
||||
Assert(htup->t_tableOid != InvalidOid);
|
||||
|
||||
@@ -908,6 +912,7 @@ HeapTupleSatisfiesMVCC(HeapTuple htup, Snapshot snapshot,
|
||||
Buffer buffer)
|
||||
{
|
||||
HeapTupleHeader tuple = htup->t_data;
|
||||
|
||||
Assert(ItemPointerIsValid(&htup->t_self));
|
||||
Assert(htup->t_tableOid != InvalidOid);
|
||||
|
||||
@@ -1100,7 +1105,7 @@ HeapTupleSatisfiesMVCC(HeapTuple htup, Snapshot snapshot,
|
||||
* we mainly want to know is if a tuple is potentially visible to *any*
|
||||
* running transaction. If so, it can't be removed yet by VACUUM.
|
||||
*
|
||||
* OldestXmin is a cutoff XID (obtained from GetOldestXmin()). Tuples
|
||||
* OldestXmin is a cutoff XID (obtained from GetOldestXmin()). Tuples
|
||||
* deleted by XIDs >= OldestXmin are deemed "recently dead"; they might
|
||||
* still be visible to some open transaction, so we can't remove them,
|
||||
* even if we see that the deleting transaction has committed.
|
||||
@@ -1110,6 +1115,7 @@ HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin,
|
||||
Buffer buffer)
|
||||
{
|
||||
HeapTupleHeader tuple = htup->t_data;
|
||||
|
||||
Assert(ItemPointerIsValid(&htup->t_self));
|
||||
Assert(htup->t_tableOid != InvalidOid);
|
||||
|
||||
@@ -1192,7 +1198,7 @@ HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin,
|
||||
}
|
||||
|
||||
/*
|
||||
* Okay, the inserter committed, so it was good at some point. Now what
|
||||
* Okay, the inserter committed, so it was good at some point. Now what
|
||||
* about the deleting transaction?
|
||||
*/
|
||||
if (tuple->t_infomask & HEAP_XMAX_INVALID)
|
||||
@@ -1332,7 +1338,7 @@ HeapTupleSatisfiesVacuum(HeapTuple htup, TransactionId OldestXmin,
|
||||
* in lieu of HeapTupleSatisifesVacuum when the tuple has just been
|
||||
* tested by HeapTupleSatisfiesMVCC and, therefore, any hint bits that
|
||||
* can be set should already be set. We assume that if no hint bits
|
||||
* either for xmin or xmax, the transaction is still running. This is
|
||||
* either for xmin or xmax, the transaction is still running. This is
|
||||
* therefore faster than HeapTupleSatisfiesVacuum, because we don't
|
||||
* consult CLOG (and also because we don't need to give an exact answer,
|
||||
* just whether or not the tuple is surely dead).
|
||||
@@ -1341,6 +1347,7 @@ bool
|
||||
HeapTupleIsSurelyDead(HeapTuple htup, TransactionId OldestXmin)
|
||||
{
|
||||
HeapTupleHeader tuple = htup->t_data;
|
||||
|
||||
Assert(ItemPointerIsValid(&htup->t_self));
|
||||
Assert(htup->t_tableOid != InvalidOid);
|
||||
|
||||
@@ -1397,7 +1404,7 @@ XidInMVCCSnapshot(TransactionId xid, Snapshot snapshot)
|
||||
|
||||
/*
|
||||
* Make a quick range check to eliminate most XIDs without looking at the
|
||||
* xip arrays. Note that this is OK even if we convert a subxact XID to
|
||||
* xip arrays. Note that this is OK even if we convert a subxact XID to
|
||||
* its parent below, because a subxact with XID < xmin has surely also got
|
||||
* a parent with XID < xmin, while one with XID >= xmax must belong to a
|
||||
* parent that was not yet committed at the time of this snapshot.
|
||||
@@ -1574,7 +1581,7 @@ TransactionIdInArray(TransactionId xid, TransactionId *xip, Size num)
|
||||
*/
|
||||
bool
|
||||
HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
|
||||
Buffer buffer)
|
||||
Buffer buffer)
|
||||
{
|
||||
HeapTupleHeader tuple = htup->t_data;
|
||||
TransactionId xmin = HeapTupleHeaderGetXmin(tuple);
|
||||
@@ -1598,8 +1605,8 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
|
||||
|
||||
/*
|
||||
* another transaction might have (tried to) delete this tuple or
|
||||
* cmin/cmax was stored in a combocid. So we need to lookup the
|
||||
* actual values externally.
|
||||
* cmin/cmax was stored in a combocid. So we need to lookup the actual
|
||||
* values externally.
|
||||
*/
|
||||
resolved = ResolveCminCmaxDuringDecoding(HistoricSnapshotGetTupleCids(), snapshot,
|
||||
htup, buffer,
|
||||
@@ -1611,7 +1618,7 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
|
||||
Assert(cmin != InvalidCommandId);
|
||||
|
||||
if (cmin >= snapshot->curcid)
|
||||
return false; /* inserted after scan started */
|
||||
return false; /* inserted after scan started */
|
||||
/* fall through */
|
||||
}
|
||||
/* committed before our xmin horizon. Do a normal visibility check. */
|
||||
@@ -1632,13 +1639,14 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
|
||||
return false;
|
||||
}
|
||||
/* check if it's a committed transaction in [xmin, xmax) */
|
||||
else if(TransactionIdInArray(xmin, snapshot->xip, snapshot->xcnt))
|
||||
else if (TransactionIdInArray(xmin, snapshot->xip, snapshot->xcnt))
|
||||
{
|
||||
/* fall through */
|
||||
}
|
||||
|
||||
/*
|
||||
* none of the above, i.e. between [xmin, xmax) but hasn't
|
||||
* committed. I.e. invisible.
|
||||
* none of the above, i.e. between [xmin, xmax) but hasn't committed. I.e.
|
||||
* invisible.
|
||||
*/
|
||||
else
|
||||
{
|
||||
@@ -1653,9 +1661,10 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
|
||||
/* locked tuples are always visible */
|
||||
else if (HEAP_XMAX_IS_LOCKED_ONLY(tuple->t_infomask))
|
||||
return true;
|
||||
|
||||
/*
|
||||
* We can see multis here if we're looking at user tables or if
|
||||
* somebody SELECT ... FOR SHARE/UPDATE a system table.
|
||||
* We can see multis here if we're looking at user tables or if somebody
|
||||
* SELECT ... FOR SHARE/UPDATE a system table.
|
||||
*/
|
||||
else if (tuple->t_infomask & HEAP_XMAX_IS_MULTI)
|
||||
{
|
||||
@@ -1665,9 +1674,9 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
|
||||
/* check if it's one of our txids, toplevel is also in there */
|
||||
if (TransactionIdInArray(xmax, snapshot->subxip, snapshot->subxcnt))
|
||||
{
|
||||
bool resolved;
|
||||
CommandId cmin;
|
||||
CommandId cmax = HeapTupleHeaderGetRawCommandId(tuple);
|
||||
bool resolved;
|
||||
CommandId cmin;
|
||||
CommandId cmax = HeapTupleHeaderGetRawCommandId(tuple);
|
||||
|
||||
/* Lookup actual cmin/cmax values */
|
||||
resolved = ResolveCminCmaxDuringDecoding(HistoricSnapshotGetTupleCids(), snapshot,
|
||||
@@ -1680,9 +1689,9 @@ HeapTupleSatisfiesHistoricMVCC(HeapTuple htup, Snapshot snapshot,
|
||||
Assert(cmax != InvalidCommandId);
|
||||
|
||||
if (cmax >= snapshot->curcid)
|
||||
return true; /* deleted after scan started */
|
||||
return true; /* deleted after scan started */
|
||||
else
|
||||
return false; /* deleted before scan started */
|
||||
return false; /* deleted before scan started */
|
||||
}
|
||||
/* below xmin horizon, normal transaction state is valid */
|
||||
else if (TransactionIdPrecedes(xmax, snapshot->xmin))
|
||||
|
Reference in New Issue
Block a user