|
PostgreSQL Source Code git master
|
#include "postgres.h"#include "access/clog.h"#include "access/slru.h"#include "access/transam.h"#include "access/xlog.h"#include "access/xloginsert.h"#include "access/xlogutils.h"#include "miscadmin.h"#include "pg_trace.h"#include "pgstat.h"#include "storage/proc.h"#include "storage/subsystems.h"#include "storage/sync.h"#include "utils/guc_hooks.h"#include "utils/wait_event.h"
Go to the source code of this file.
Macros | |
| #define | CLOG_BITS_PER_XACT 2 |
| #define | CLOG_XACTS_PER_BYTE 4 |
| #define | CLOG_XACTS_PER_PAGE (BLCKSZ * CLOG_XACTS_PER_BYTE) |
| #define | CLOG_XACT_BITMASK ((1 << CLOG_BITS_PER_XACT) - 1) |
| #define | CLOG_MAX_ALLOWED_BUFFERS |
| #define | TransactionIdToPgIndex(xid) ((xid) % (TransactionId) CLOG_XACTS_PER_PAGE) |
| #define | TransactionIdToByte(xid) (TransactionIdToPgIndex(xid) / CLOG_XACTS_PER_BYTE) |
| #define | TransactionIdToBIndex(xid) ((xid) % (TransactionId) CLOG_XACTS_PER_BYTE) |
| #define | CLOG_XACTS_PER_LSN_GROUP 32 /* keep this a power of 2 */ |
| #define | CLOG_LSNS_PER_PAGE (CLOG_XACTS_PER_PAGE / CLOG_XACTS_PER_LSN_GROUP) |
| #define | GetLSNIndex(slotno, xid) |
| #define | THRESHOLD_SUBTRANS_CLOG_OPT 5 |
| #define | XactCtl (&XactSlruDesc) |
Variables | |
| const ShmemCallbacks | CLOGShmemCallbacks |
| static SlruDesc | XactSlruDesc |
| #define CLOG_LSNS_PER_PAGE (CLOG_XACTS_PER_PAGE / CLOG_XACTS_PER_LSN_GROUP) |
| #define CLOG_MAX_ALLOWED_BUFFERS |
Definition at line 74 of file clog.c.
| #define CLOG_XACT_BITMASK ((1 << CLOG_BITS_PER_XACT) - 1) |
| #define CLOG_XACTS_PER_PAGE (BLCKSZ * CLOG_XACTS_PER_BYTE) |
| #define TransactionIdToBIndex | ( | xid | ) | ((xid) % (TransactionId) CLOG_XACTS_PER_BYTE) |
| #define TransactionIdToByte | ( | xid | ) | (TransactionIdToPgIndex(xid) / CLOG_XACTS_PER_BYTE) |
| #define TransactionIdToPgIndex | ( | xid | ) | ((xid) % (TransactionId) CLOG_XACTS_PER_PAGE) |
| #define XactCtl (&XactSlruDesc) |
Definition at line 850 of file clog.c.
References SimpleLruZeroAndWritePage(), and XactCtl.
Referenced by BootStrapXLOG().
Definition at line 838 of file clog.c.
References check_slru_buffers(), and newval.
Definition at line 921 of file clog.c.
References fb(), SimpleLruWriteAll(), and XactCtl.
Referenced by CheckPointGuts().
Definition at line 1055 of file clog.c.
References errdetail(), and fb().
Referenced by CLOGShmemRequest().
| void clog_redo | ( | XLogReaderState * | record | ) |
Definition at line 1089 of file clog.c.
References AdvanceOldestClogXid(), Assert, CLOG_TRUNCATE, CLOG_ZEROPAGE, elog, fb(), memcpy(), PANIC, SimpleLruTruncate(), SimpleLruZeroAndWritePage(), XactCtl, XLogRecGetData, XLogRecGetInfo, and XLogRecHasAnyBlockRefs.
Definition at line 1040 of file clog.c.
References CLOG_XACTS_PER_PAGE, fb(), FirstNormalTransactionId, and TransactionIdPrecedes().
Referenced by CLOGShmemRequest().
Definition at line 776 of file clog.c.
References CLOG_MAX_ALLOWED_BUFFERS, Max, Min, SimpleLruAutotuneBuffers(), and transaction_buffers.
Referenced by CLOGShmemRequest().
Definition at line 829 of file clog.c.
References CLOG_XACTS_PER_PAGE, SlruPagePrecedesUnitTests, and XactCtl.
Definition at line 789 of file clog.c.
References Assert, buf, clog_errdetail_for_io_error(), CLOG_LSNS_PER_PAGE, CLOGPagePrecedes(), CLOGShmemBuffers(), fb(), name, PGC_POSTMASTER, PGC_S_DYNAMIC_DEFAULT, PGC_S_OVERRIDE, SetConfigOption(), SimpleLruRequest, snprintf, SYNC_HANDLER_CLOG, transaction_buffers, and XactSlruDesc.
Definition at line 1121 of file clog.c.
References SlruSyncFileTag(), and XactCtl.
| void ExtendCLOG | ( | TransactionId | newestXact | ) |
Definition at line 943 of file clog.c.
References CLOG_ZEROPAGE, fb(), FirstNormalTransactionId, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SimpleLruGetBankLock(), SimpleLruZeroPage(), TransactionIdEquals, TransactionIdToPage(), TransactionIdToPgIndex, XactCtl, and XLogSimpleInsertInt64().
Referenced by GetNewTransactionId().
|
static |
Definition at line 266 of file clog.c.
References Assert, fb(), i, InvalidTransactionId, TransactionIdSetPageStatus(), and TransactionIdToPage().
Referenced by TransactionIdSetTreeStatus().
Definition at line 861 of file clog.c.
References TransamVariablesData::nextXid, pg_atomic_write_u64(), TransactionIdToPage(), TransamVariables, XactCtl, and XidFromFullTransactionId.
Referenced by StartupXLOG().
|
static |
Definition at line 450 of file clog.c.
References Assert, PROC_HDR::clogGroupFirst, PGPROC::clogGroupMember, PGPROC::clogGroupMemberLsn, PGPROC::clogGroupMemberPage, PGPROC::clogGroupMemberXid, PGPROC::clogGroupMemberXidStatus, PGPROC::clogGroupNext, fb(), GetPGProcByNumber, INVALID_PROC_NUMBER, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MyProc, MyProcNumber, pg_atomic_compare_exchange_u32(), pg_atomic_exchange_u32(), pg_atomic_read_u32(), pg_atomic_write_u32(), pg_write_barrier, PGSemaphoreLock(), PGSemaphoreUnlock(), pgstat_report_wait_end(), pgstat_report_wait_start(), ProcGlobal, PGPROC::sem, SimpleLruGetBankLock(), THRESHOLD_SUBTRANS_CLOG_OPT, TransactionIdIsValid, TransactionIdSetPageStatusInternal(), and XactCtl.
Referenced by TransactionIdSetPageStatus().
| XidStatus TransactionIdGetStatus | ( | TransactionId | xid, |
| XLogRecPtr * | lsn | ||
| ) |
Definition at line 743 of file clog.c.
References CLOG_BITS_PER_XACT, CLOG_XACT_BITMASK, fb(), GetLSNIndex, LWLockRelease(), SimpleLruGetBankLock(), SimpleLruReadPage_ReadOnly(), TransactionIdToBIndex, TransactionIdToByte, TransactionIdToPage(), and XactCtl.
Referenced by TransactionIdGetCommitLSN(), and TransactionLogFetch().
|
static |
Definition at line 302 of file clog.c.
References XidCacheStatus::count, fb(), LW_EXCLUSIVE, LWLockAcquire(), LWLockConditionalAcquire(), LWLockRelease(), MyProc, PGPROC_MAX_CACHED_SUBXIDS, SimpleLruGetBankLock(), StaticAssertDecl, PGPROC::subxids, PGPROC::subxidStatus, THRESHOLD_SUBTRANS_CLOG_OPT, TransactionGroupUpdateXidStatus(), TransactionIdSetPageStatusInternal(), XactCtl, PGPROC::xid, and XidCache::xids.
Referenced by set_status_by_pages(), and TransactionIdSetTreeStatus().
|
static |
Definition at line 373 of file clog.c.
References Assert, fb(), i, LW_EXCLUSIVE, LWLockHeldByMeInMode(), SimpleLruGetBankLock(), SimpleLruReadPage(), TRANSACTION_STATUS_ABORTED, TRANSACTION_STATUS_COMMITTED, TRANSACTION_STATUS_SUB_COMMITTED, TransactionIdIsValid, TransactionIdSetStatusBit(), TransactionIdToPage(), XactCtl, and XLogRecPtrIsValid.
Referenced by TransactionGroupUpdateXidStatus(), and TransactionIdSetPageStatus().
|
static |
Definition at line 669 of file clog.c.
References Assert, CLOG_BITS_PER_XACT, CLOG_XACT_BITMASK, fb(), GetLSNIndex, InRecovery, LW_EXCLUSIVE, LWLockHeldByMeInMode(), SimpleLruGetBankLock(), TRANSACTION_STATUS_COMMITTED, TRANSACTION_STATUS_IN_PROGRESS, TRANSACTION_STATUS_SUB_COMMITTED, TransactionIdToBIndex, TransactionIdToByte, TransactionIdToPage(), XactCtl, and XLogRecPtrIsValid.
Referenced by TransactionIdSetPageStatusInternal().
| void TransactionIdSetTreeStatus | ( | TransactionId | xid, |
| int | nsubxids, | ||
| TransactionId * | subxids, | ||
| XidStatus | status, | ||
| XLogRecPtr | lsn | ||
| ) |
Definition at line 192 of file clog.c.
References Assert, fb(), i, set_status_by_pages(), TRANSACTION_STATUS_ABORTED, TRANSACTION_STATUS_COMMITTED, TRANSACTION_STATUS_SUB_COMMITTED, TransactionIdSetPageStatus(), and TransactionIdToPage().
Referenced by TransactionIdAbortTree(), TransactionIdAsyncCommitTree(), and TransactionIdCommitTree().
|
inlinestatic |
Definition at line 84 of file clog.c.
References CLOG_XACTS_PER_PAGE.
Referenced by ExtendCLOG(), set_status_by_pages(), StartupCLOG(), TransactionIdGetStatus(), TransactionIdSetPageStatusInternal(), TransactionIdSetStatusBit(), TransactionIdSetTreeStatus(), TrimCLOG(), and TruncateCLOG().
Definition at line 876 of file clog.c.
References CLOG_BITS_PER_XACT, fb(), LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MemSet, TransamVariablesData::nextXid, SimpleLruGetBankLock(), SimpleLruReadPage(), TransactionIdToBIndex, TransactionIdToByte, TransactionIdToPage(), TransactionIdToPgIndex, TransamVariables, XactCtl, and XidFromFullTransactionId.
Referenced by StartupXLOG().
| void TruncateCLOG | ( | TransactionId | oldestXact, |
| Oid | oldestxid_datoid | ||
| ) |
Definition at line 985 of file clog.c.
References AdvanceOldestClogXid(), fb(), SimpleLruTruncate(), SlruScanDirCbReportPresence(), SlruScanDirectory(), TransactionIdToPage(), WriteTruncateXlogRec(), and XactCtl.
Referenced by vac_truncate_clog().
|
static |
Definition at line 1070 of file clog.c.
References CLOG_TRUNCATE, fb(), xl_clog_truncate::pageno, XLogBeginInsert(), XLogFlush(), XLogInsert(), and XLogRegisterData().
Referenced by TruncateCLOG().
| const ShmemCallbacks CLOGShmemCallbacks |
|
static |
Definition at line 120 of file clog.c.
Referenced by CLOGShmemRequest().