mirror of
https://github.com/postgres/postgres.git
synced 2025-10-22 14:32:25 +03:00
Change pg_bsd_indent to follow upstream rules for placement of comments
to the right of code, and remove pgindent hack that caused comments
following #endif to not obey the general rule.
Commit e3860ffa4d
wasn't actually using
the published version of pg_bsd_indent, but a hacked-up version that
tried to minimize the amount of movement of comments to the right of
code. The situation of interest is where such a comment has to be
moved to the right of its default placement at column 33 because there's
code there. BSD indent has always moved right in units of tab stops
in such cases --- but in the previous incarnation, indent was working
in 8-space tab stops, while now it knows we use 4-space tabs. So the
net result is that in about half the cases, such comments are placed
one tab stop left of before. This is better all around: it leaves
more room on the line for comment text, and it means that in such
cases the comment uniformly starts at the next 4-space tab stop after
the code, rather than sometimes one and sometimes two tabs after.
Also, ensure that comments following #endif are indented the same
as comments following other preprocessor commands such as #else.
That inconsistency turns out to have been self-inflicted damage
from a poorly-thought-through post-indent "fixup" in pgindent.
This patch is much less interesting than the first round of indent
changes, but also bulkier, so I thought it best to separate the effects.
Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org
Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
161 lines
5.2 KiB
C
161 lines
5.2 KiB
C
/*
|
|
* multixact.h
|
|
*
|
|
* PostgreSQL multi-transaction-log manager
|
|
*
|
|
* Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/access/multixact.h
|
|
*/
|
|
#ifndef MULTIXACT_H
|
|
#define MULTIXACT_H
|
|
|
|
#include "access/xlogreader.h"
|
|
#include "lib/stringinfo.h"
|
|
|
|
|
|
/*
|
|
* The first two MultiXactId values are reserved to store the truncation Xid
|
|
* and epoch of the first segment, so we start assigning multixact values from
|
|
* 2.
|
|
*/
|
|
#define InvalidMultiXactId ((MultiXactId) 0)
|
|
#define FirstMultiXactId ((MultiXactId) 1)
|
|
#define MaxMultiXactId ((MultiXactId) 0xFFFFFFFF)
|
|
|
|
#define MultiXactIdIsValid(multi) ((multi) != InvalidMultiXactId)
|
|
|
|
#define MaxMultiXactOffset ((MultiXactOffset) 0xFFFFFFFF)
|
|
|
|
/* Number of SLRU buffers to use for multixact */
|
|
#define NUM_MXACTOFFSET_BUFFERS 8
|
|
#define NUM_MXACTMEMBER_BUFFERS 16
|
|
|
|
/*
|
|
* Possible multixact lock modes ("status"). The first four modes are for
|
|
* tuple locks (FOR KEY SHARE, FOR SHARE, FOR NO KEY UPDATE, FOR UPDATE); the
|
|
* next two are used for update and delete modes.
|
|
*/
|
|
typedef enum
|
|
{
|
|
MultiXactStatusForKeyShare = 0x00,
|
|
MultiXactStatusForShare = 0x01,
|
|
MultiXactStatusForNoKeyUpdate = 0x02,
|
|
MultiXactStatusForUpdate = 0x03,
|
|
/* an update that doesn't touch "key" columns */
|
|
MultiXactStatusNoKeyUpdate = 0x04,
|
|
/* other updates, and delete */
|
|
MultiXactStatusUpdate = 0x05
|
|
} MultiXactStatus;
|
|
|
|
#define MaxMultiXactStatus MultiXactStatusUpdate
|
|
|
|
/* does a status value correspond to a tuple update? */
|
|
#define ISUPDATE_from_mxstatus(status) \
|
|
((status) > MultiXactStatusForUpdate)
|
|
|
|
|
|
typedef struct MultiXactMember
|
|
{
|
|
TransactionId xid;
|
|
MultiXactStatus status;
|
|
} MultiXactMember;
|
|
|
|
|
|
/* ----------------
|
|
* multixact-related XLOG entries
|
|
* ----------------
|
|
*/
|
|
|
|
#define XLOG_MULTIXACT_ZERO_OFF_PAGE 0x00
|
|
#define XLOG_MULTIXACT_ZERO_MEM_PAGE 0x10
|
|
#define XLOG_MULTIXACT_CREATE_ID 0x20
|
|
#define XLOG_MULTIXACT_TRUNCATE_ID 0x30
|
|
|
|
typedef struct xl_multixact_create
|
|
{
|
|
MultiXactId mid; /* new MultiXact's ID */
|
|
MultiXactOffset moff; /* its starting offset in members file */
|
|
int32 nmembers; /* number of member XIDs */
|
|
MultiXactMember members[FLEXIBLE_ARRAY_MEMBER];
|
|
} xl_multixact_create;
|
|
|
|
#define SizeOfMultiXactCreate (offsetof(xl_multixact_create, members))
|
|
|
|
typedef struct xl_multixact_truncate
|
|
{
|
|
Oid oldestMultiDB;
|
|
|
|
/* to-be-truncated range of multixact offsets */
|
|
MultiXactId startTruncOff; /* just for completeness' sake */
|
|
MultiXactId endTruncOff;
|
|
|
|
/* to-be-truncated range of multixact members */
|
|
MultiXactOffset startTruncMemb;
|
|
MultiXactOffset endTruncMemb;
|
|
} xl_multixact_truncate;
|
|
|
|
#define SizeOfMultiXactTruncate (sizeof(xl_multixact_truncate))
|
|
|
|
|
|
extern MultiXactId MultiXactIdCreate(TransactionId xid1,
|
|
MultiXactStatus status1, TransactionId xid2,
|
|
MultiXactStatus status2);
|
|
extern MultiXactId MultiXactIdExpand(MultiXactId multi, TransactionId xid,
|
|
MultiXactStatus status);
|
|
extern MultiXactId MultiXactIdCreateFromMembers(int nmembers,
|
|
MultiXactMember *members);
|
|
|
|
extern MultiXactId ReadNextMultiXactId(void);
|
|
extern bool MultiXactIdIsRunning(MultiXactId multi, bool isLockOnly);
|
|
extern void MultiXactIdSetOldestMember(void);
|
|
extern int GetMultiXactIdMembers(MultiXactId multi, MultiXactMember **xids,
|
|
bool allow_old, bool isLockOnly);
|
|
extern bool MultiXactIdPrecedes(MultiXactId multi1, MultiXactId multi2);
|
|
extern bool MultiXactIdPrecedesOrEquals(MultiXactId multi1,
|
|
MultiXactId multi2);
|
|
|
|
extern void AtEOXact_MultiXact(void);
|
|
extern void AtPrepare_MultiXact(void);
|
|
extern void PostPrepare_MultiXact(TransactionId xid);
|
|
|
|
extern Size MultiXactShmemSize(void);
|
|
extern void MultiXactShmemInit(void);
|
|
extern void BootStrapMultiXact(void);
|
|
extern void StartupMultiXact(void);
|
|
extern void TrimMultiXact(void);
|
|
extern void ShutdownMultiXact(void);
|
|
extern void SetMultiXactIdLimit(MultiXactId oldest_datminmxid,
|
|
Oid oldest_datoid,
|
|
bool is_startup);
|
|
extern void MultiXactGetCheckptMulti(bool is_shutdown,
|
|
MultiXactId *nextMulti,
|
|
MultiXactOffset *nextMultiOffset,
|
|
MultiXactId *oldestMulti,
|
|
Oid *oldestMultiDB);
|
|
extern void CheckPointMultiXact(void);
|
|
extern MultiXactId GetOldestMultiXactId(void);
|
|
extern void TruncateMultiXact(MultiXactId oldestMulti, Oid oldestMultiDB);
|
|
extern void MultiXactSetNextMXact(MultiXactId nextMulti,
|
|
MultiXactOffset nextMultiOffset);
|
|
extern void MultiXactAdvanceNextMXact(MultiXactId minMulti,
|
|
MultiXactOffset minMultiOffset);
|
|
extern void MultiXactAdvanceOldest(MultiXactId oldestMulti, Oid oldestMultiDB);
|
|
extern int MultiXactMemberFreezeThreshold(void);
|
|
|
|
extern void multixact_twophase_recover(TransactionId xid, uint16 info,
|
|
void *recdata, uint32 len);
|
|
extern void multixact_twophase_postcommit(TransactionId xid, uint16 info,
|
|
void *recdata, uint32 len);
|
|
extern void multixact_twophase_postabort(TransactionId xid, uint16 info,
|
|
void *recdata, uint32 len);
|
|
|
|
extern void multixact_redo(XLogReaderState *record);
|
|
extern void multixact_desc(StringInfo buf, XLogReaderState *record);
|
|
extern const char *multixact_identify(uint8 info);
|
|
extern char *mxid_to_string(MultiXactId multi, int nmembers,
|
|
MultiXactMember *members);
|
|
|
|
#endif /* MULTIXACT_H */
|