mirror of
https://github.com/postgres/postgres.git
synced 2025-11-16 15:02:33 +03:00
pgindent run for 8.2.
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/ipci.c,v 1.87 2006/08/01 19:03:11 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/ipci.c,v 1.88 2006/10/04 00:29:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -95,8 +95,8 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
|
||||
size = add_size(size, 8192 - (size % 8192));
|
||||
|
||||
/*
|
||||
* The shared memory for add-ins is treated as a separate
|
||||
* segment, but in reality it is not.
|
||||
* The shared memory for add-ins is treated as a separate segment, but
|
||||
* in reality it is not.
|
||||
*/
|
||||
size_b4addins = size;
|
||||
size = add_size(size, AddinShmemSize());
|
||||
@@ -115,8 +115,8 @@ CreateSharedMemoryAndSemaphores(bool makePrivate, int port)
|
||||
* Modify hdr to show segment size before add-ins
|
||||
*/
|
||||
seghdr->totalsize = size_b4addins;
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* Set up segment header sections in each Addin context
|
||||
*/
|
||||
InitAddinContexts((void *) ((char *) seghdr + size_b4addins));
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.17 2006/09/03 15:59:38 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/procarray.c,v 1.18 2006/10/04 00:29:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -393,7 +393,7 @@ TransactionIdIsActive(TransactionId xid)
|
||||
* This is used by VACUUM to decide which deleted tuples must be preserved
|
||||
* in a table. allDbs = TRUE is needed for shared relations, but allDbs =
|
||||
* FALSE is sufficient for non-shared relations, since only backends in my
|
||||
* own database could ever see the tuples in them. Also, we can ignore
|
||||
* own database could ever see the tuples in them. Also, we can ignore
|
||||
* concurrently running lazy VACUUMs because (a) they must be working on other
|
||||
* tables, and (b) they don't need to do snapshot-based lookups.
|
||||
*
|
||||
@@ -545,13 +545,13 @@ GetSnapshotData(Snapshot snapshot, bool serializable)
|
||||
globalxmin = xmin = GetTopTransactionId();
|
||||
|
||||
/*
|
||||
* It is sufficient to get shared lock on ProcArrayLock, even if we
|
||||
* are computing a serializable snapshot and therefore will be setting
|
||||
* It is sufficient to get shared lock on ProcArrayLock, even if we are
|
||||
* computing a serializable snapshot and therefore will be setting
|
||||
* MyProc->xmin. This is because any two backends that have overlapping
|
||||
* shared holds on ProcArrayLock will certainly compute the same xmin
|
||||
* (since no xact, in particular not the oldest, can exit the set of
|
||||
* running transactions while we hold ProcArrayLock --- see further
|
||||
* discussion just below). So it doesn't matter whether another backend
|
||||
* discussion just below). So it doesn't matter whether another backend
|
||||
* concurrently doing GetSnapshotData or GetOldestXmin sees our xmin as
|
||||
* set or not; he'd compute the same xmin for himself either way.
|
||||
*/
|
||||
@@ -595,8 +595,8 @@ GetSnapshotData(Snapshot snapshot, bool serializable)
|
||||
|
||||
/*
|
||||
* Ignore my own proc (dealt with my xid above), procs not running a
|
||||
* transaction, xacts started since we read the next transaction
|
||||
* ID, and xacts executing LAZY VACUUM. There's no need to store XIDs
|
||||
* transaction, xacts started since we read the next transaction ID,
|
||||
* and xacts executing LAZY VACUUM. There's no need to store XIDs
|
||||
* above what we got from ReadNewTransactionId, since we'll treat them
|
||||
* as running anyway. We also assume that such xacts can't compute an
|
||||
* xmin older than ours, so they needn't be considered in computing
|
||||
@@ -625,18 +625,17 @@ GetSnapshotData(Snapshot snapshot, bool serializable)
|
||||
* their parent, so no need to check them against xmin.
|
||||
*
|
||||
* The other backend can add more subxids concurrently, but cannot
|
||||
* remove any. Hence it's important to fetch nxids just once.
|
||||
* Should be safe to use memcpy, though. (We needn't worry about
|
||||
* missing any xids added concurrently, because they must postdate
|
||||
* xmax.)
|
||||
* remove any. Hence it's important to fetch nxids just once. Should
|
||||
* be safe to use memcpy, though. (We needn't worry about missing any
|
||||
* xids added concurrently, because they must postdate xmax.)
|
||||
*/
|
||||
if (subcount >= 0)
|
||||
{
|
||||
if (proc->subxids.overflowed)
|
||||
subcount = -1; /* overflowed */
|
||||
subcount = -1; /* overflowed */
|
||||
else
|
||||
{
|
||||
int nxids = proc->subxids.nxids;
|
||||
int nxids = proc->subxids.nxids;
|
||||
|
||||
if (nxids > 0)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.96 2006/09/27 18:40:09 tgl Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/storage/ipc/shmem.c,v 1.97 2006/10/04 00:29:57 momjian Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -62,14 +62,14 @@
|
||||
* hash bucket garbage collector if need be. Right now, it seems
|
||||
* unnecessary.
|
||||
*
|
||||
* (e) Add-ins can request their own logical shared memory segments
|
||||
* by calling RegisterAddinContext() from the preload-libraries hook.
|
||||
* Each call establishes a uniquely named add-in shared memopry
|
||||
* context which will be set up as part of postgres intialisation.
|
||||
* Memory can be allocated from these contexts using
|
||||
* ShmemAllocFromContext(), and can be reset to its initial condition
|
||||
* using ShmemResetContext(). Also, RegisterAddinLWLock(LWLockid *lock_ptr)
|
||||
* can be used to request that a LWLock be allocated, placed into *lock_ptr.
|
||||
* (e) Add-ins can request their own logical shared memory segments
|
||||
* by calling RegisterAddinContext() from the preload-libraries hook.
|
||||
* Each call establishes a uniquely named add-in shared memopry
|
||||
* context which will be set up as part of postgres intialisation.
|
||||
* Memory can be allocated from these contexts using
|
||||
* ShmemAllocFromContext(), and can be reset to its initial condition
|
||||
* using ShmemResetContext(). Also, RegisterAddinLWLock(LWLockid *lock_ptr)
|
||||
* can be used to request that a LWLock be allocated, placed into *lock_ptr.
|
||||
*/
|
||||
|
||||
#include "postgres.h"
|
||||
@@ -98,9 +98,9 @@ static HTAB *ShmemIndex = NULL; /* primary index hashtable for shmem */
|
||||
/* Structures and globals for managing add-in shared memory contexts */
|
||||
typedef struct context
|
||||
{
|
||||
char *name;
|
||||
Size size;
|
||||
PGShmemHeader *seg_hdr;
|
||||
char *name;
|
||||
Size size;
|
||||
PGShmemHeader *seg_hdr;
|
||||
struct context *next;
|
||||
} ContextNode;
|
||||
|
||||
@@ -138,9 +138,9 @@ InitShmemAllocation(void)
|
||||
Assert(shmhdr != NULL);
|
||||
|
||||
/*
|
||||
* Initialize the spinlock used by ShmemAlloc. We have to do the
|
||||
* space allocation the hard way, since obviously ShmemAlloc can't
|
||||
* be called yet.
|
||||
* Initialize the spinlock used by ShmemAlloc. We have to do the space
|
||||
* allocation the hard way, since obviously ShmemAlloc can't be called
|
||||
* yet.
|
||||
*/
|
||||
ShmemLock = (slock_t *) (((char *) shmhdr) + shmhdr->freeoffset);
|
||||
shmhdr->freeoffset += MAXALIGN(sizeof(slock_t));
|
||||
@@ -153,22 +153,22 @@ InitShmemAllocation(void)
|
||||
ShmemIndex = (HTAB *) NULL;
|
||||
|
||||
/*
|
||||
* Initialize ShmemVariableCache for transaction manager.
|
||||
* (This doesn't really belong here, but not worth moving.)
|
||||
* Initialize ShmemVariableCache for transaction manager. (This doesn't
|
||||
* really belong here, but not worth moving.)
|
||||
*/
|
||||
ShmemVariableCache = (VariableCache)
|
||||
ShmemAlloc(sizeof(*ShmemVariableCache));
|
||||
ShmemAlloc(sizeof(*ShmemVariableCache));
|
||||
memset(ShmemVariableCache, 0, sizeof(*ShmemVariableCache));
|
||||
}
|
||||
|
||||
/*
|
||||
* RegisterAddinContext -- Register the requirement for a named shared
|
||||
* memory context.
|
||||
* memory context.
|
||||
*/
|
||||
void
|
||||
RegisterAddinContext(const char *name, Size size)
|
||||
{
|
||||
char *newstr = malloc(strlen(name) + 1);
|
||||
char *newstr = malloc(strlen(name) + 1);
|
||||
ContextNode *node = malloc(sizeof(ContextNode));
|
||||
|
||||
strcpy(newstr, name);
|
||||
@@ -185,7 +185,7 @@ RegisterAddinContext(const char *name, Size size)
|
||||
|
||||
/*
|
||||
* ContextFromName -- Return the ContextNode for the given named
|
||||
* context, or NULL if not found.
|
||||
* context, or NULL if not found.
|
||||
*/
|
||||
static ContextNode *
|
||||
ContextFromName(const char *name)
|
||||
@@ -203,7 +203,7 @@ ContextFromName(const char *name)
|
||||
|
||||
/*
|
||||
* InitAddinContexts -- Initialise the registered addin shared memory
|
||||
* contexts.
|
||||
* contexts.
|
||||
*/
|
||||
void
|
||||
InitAddinContexts(void *start)
|
||||
@@ -218,7 +218,7 @@ InitAddinContexts(void *start)
|
||||
next_segment->totalsize = context->size;
|
||||
next_segment->freeoffset = MAXALIGN(sizeof(PGShmemHeader));
|
||||
|
||||
next_segment = (PGShmemHeader *)
|
||||
next_segment = (PGShmemHeader *)
|
||||
((char *) next_segment + context->size);
|
||||
context = context->next;
|
||||
}
|
||||
@@ -245,7 +245,7 @@ ShmemResetContext(const char *name)
|
||||
|
||||
/*
|
||||
* AddinShmemSize -- Report how much shared memory has been registered
|
||||
* for add-ins.
|
||||
* for add-ins.
|
||||
*/
|
||||
Size
|
||||
AddinShmemSize(void)
|
||||
@@ -265,15 +265,15 @@ AddinShmemSize(void)
|
||||
void *
|
||||
ShmemAllocFromContext(Size size, const char *context_name)
|
||||
{
|
||||
Size newStart;
|
||||
Size newFree;
|
||||
void *newSpace;
|
||||
ContextNode *context;
|
||||
Size newStart;
|
||||
Size newFree;
|
||||
void *newSpace;
|
||||
ContextNode *context;
|
||||
|
||||
/* use volatile pointer to prevent code rearrangement */
|
||||
volatile PGShmemHeader *shmemseghdr = ShmemSegHdr;
|
||||
|
||||
/*
|
||||
/*
|
||||
* if context_name is provided, allocate from the named context
|
||||
*/
|
||||
if (context_name)
|
||||
@@ -480,8 +480,8 @@ ShmemInitStruct(const char *name, Size size, bool *foundPtr)
|
||||
* be trying to init the shmem index itself.
|
||||
*
|
||||
* Notice that the ShmemIndexLock is released before the shmem
|
||||
* index has been initialized. This should be OK because no
|
||||
* other process can be accessing shared memory yet.
|
||||
* index has been initialized. This should be OK because no other
|
||||
* process can be accessing shared memory yet.
|
||||
*/
|
||||
Assert(shmemseghdr->indexoffset == 0);
|
||||
structPtr = ShmemAlloc(size);
|
||||
|
||||
Reference in New Issue
Block a user