PostgreSQL Source Code
git master
|
Go to the source code of this file.
Data Structures | |
struct | SlruSharedData |
struct | SlruCtlData |
Macros | |
#define | SLRU_MAX_ALLOWED_BUFFERS ((1024 * 1024 * 1024) / BLCKSZ) |
#define | SLRU_PAGES_PER_SEGMENT 32 |
#define | SlruPagePrecedesUnitTests(ctl, per_page) do {} while (0) |
Typedefs | |
typedef struct SlruSharedData | SlruSharedData |
typedef SlruSharedData * | SlruShared |
typedef struct SlruCtlData | SlruCtlData |
typedef SlruCtlData * | SlruCtl |
typedef bool(* | SlruScanCallback) (SlruCtl ctl, char *filename, int64 segpage, void *data) |
Enumerations | |
enum | SlruPageStatus { SLRU_PAGE_EMPTY , SLRU_PAGE_READ_IN_PROGRESS , SLRU_PAGE_VALID , SLRU_PAGE_WRITE_IN_PROGRESS } |
#define SLRU_MAX_ALLOWED_BUFFERS ((1024 * 1024 * 1024) / BLCKSZ) |
typedef SlruCtlData* SlruCtl |
typedef struct SlruCtlData SlruCtlData |
typedef SlruSharedData* SlruShared |
typedef struct SlruSharedData SlruSharedData |
enum SlruPageStatus |
bool check_slru_buffers | ( | const char * | name, |
int * | newval | ||
) |
Definition at line 355 of file slru.c.
References GUC_check_errdetail, name, newval, and SLRU_BANK_SIZE.
Referenced by check_commit_ts_buffers(), check_multixact_member_buffers(), check_multixact_offset_buffers(), check_notify_buffers(), check_serial_buffers(), check_subtrans_buffers(), and check_transaction_buffers().
int SimpleLruAutotuneBuffers | ( | int | divisor, |
int | max | ||
) |
Definition at line 232 of file slru.c.
References Max, Min, NBuffers, and SLRU_BANK_SIZE.
Referenced by CLOGShmemBuffers(), CommitTsShmemBuffers(), and SUBTRANSShmemBuffers().
Definition at line 746 of file slru.c.
References CloseTransientFile(), ctl, endpos, fd(), MAXPGPATH, OpenTransientFile(), PG_BINARY, pgstat_count_slru_page_exists(), SlruWriteAllData::segno, SLRU_CLOSE_FAILED, slru_errcause, slru_errno, SLRU_OPEN_FAILED, SLRU_PAGES_PER_SEGMENT, SLRU_SEEK_FAILED, SlruFileName(), and SlruReportIOError().
Referenced by ActivateCommitTs(), find_multixact_start(), MaybeExtendOffsetSlru(), and test_slru_page_exists().
Definition at line 178 of file slru.h.
References ctl.
Referenced by ActivateCommitTs(), asyncQueueAddEntries(), asyncQueueReadAllNotifications(), BootStrapCLOG(), BootStrapMultiXact(), BootStrapSUBTRANS(), clog_redo(), commit_ts_redo(), ExtendCLOG(), ExtendCommitTs(), ExtendMultiXactMember(), ExtendMultiXactOffset(), ExtendSUBTRANS(), find_multixact_start(), GetMultiXactIdMembers(), MaybeExtendOffsetSlru(), multixact_redo(), RecordNewMultiXact(), SerialAdd(), SerialGetMinConflictCommitSeqNo(), SetXidCommitTsInPage(), SimpleLruReadPage(), SimpleLruReadPage_ReadOnly(), SimpleLruZeroPage(), SlruInternalWritePage(), SlruSelectLRUPage(), StartupSUBTRANS(), SubTransGetParent(), SubTransSetParent(), test_slru_page_exists(), test_slru_page_read(), test_slru_page_readonly(), test_slru_page_write(), TransactionGroupUpdateXidStatus(), TransactionIdGetCommitTsData(), TransactionIdGetStatus(), TransactionIdSetPageStatus(), TransactionIdSetPageStatusInternal(), TransactionIdSetStatusBit(), TrimCLOG(), and TrimMultiXact().
void SimpleLruInit | ( | SlruCtl | ctl, |
const char * | name, | ||
int | nslots, | ||
int | nlsns, | ||
const char * | subdir, | ||
int | buffer_tranche_id, | ||
int | bank_tranche_id, | ||
SyncRequestHandler | sync_handler, | ||
bool | long_segment_names | ||
) |
Definition at line 252 of file slru.c.
References Assert, SlruSharedData::bank_cur_lru_count, SlruSharedData::bank_locks, SlruSharedData::buffer_locks, BUFFERALIGN, ctl, SlruSharedData::group_lsn, IsUnderPostmaster, SlruSharedData::latest_page_number, LWLockPadded::lock, SlruSharedData::lsn_groups_per_page, LWLockInitialize(), MAXALIGN, name, SlruSharedData::num_slots, SlruSharedData::page_buffer, SlruSharedData::page_dirty, SlruSharedData::page_lru_count, SlruSharedData::page_number, SlruSharedData::page_status, pg_atomic_init_u64(), pgstat_get_slru_index(), ShmemInitStruct(), SimpleLruShmemSize(), SLRU_BANK_SIZE, SLRU_MAX_ALLOWED_BUFFERS, SLRU_PAGE_EMPTY, SlruSharedData::slru_stats_idx, and strlcpy().
Referenced by AsyncShmemInit(), CLOGShmemInit(), CommitTsShmemInit(), MultiXactShmemInit(), SerialInit(), SUBTRANSShmemInit(), and test_slru_shmem_startup().
int SimpleLruReadPage | ( | SlruCtl | ctl, |
int64 | pageno, | ||
bool | write_ok, | ||
TransactionId | xid | ||
) |
Definition at line 502 of file slru.c.
References Assert, SlruSharedData::buffer_locks, ctl, LWLockPadded::lock, LW_EXCLUSIVE, LWLockAcquire(), LWLockHeldByMeInMode(), LWLockRelease(), SlruSharedData::page_dirty, SlruSharedData::page_number, SlruSharedData::page_status, pgstat_count_slru_page_hit(), pgstat_count_slru_page_read(), SimpleLruGetBankLock(), SimpleLruWaitIO(), SimpleLruZeroLSNs(), SLRU_PAGE_EMPTY, SLRU_PAGE_READ_IN_PROGRESS, SLRU_PAGE_VALID, SLRU_PAGE_WRITE_IN_PROGRESS, SlruSharedData::slru_stats_idx, SlruPhysicalReadPage(), SlruRecentlyUsed(), SlruReportIOError(), and SlruSelectLRUPage().
Referenced by asyncQueueAddEntries(), GetMultiXactIdMembers(), RecordNewMultiXact(), SerialAdd(), SetXidCommitTsInPage(), SimpleLruReadPage_ReadOnly(), SubTransSetParent(), test_slru_page_read(), TransactionIdSetPageStatusInternal(), TrimCLOG(), and TrimMultiXact().
int SimpleLruReadPage_ReadOnly | ( | SlruCtl | ctl, |
int64 | pageno, | ||
TransactionId | xid | ||
) |
Definition at line 605 of file slru.c.
References ctl, LW_EXCLUSIVE, LW_SHARED, LWLockAcquire(), LWLockRelease(), SlruSharedData::page_number, SlruSharedData::page_status, pgstat_count_slru_page_hit(), SimpleLruGetBankLock(), SimpleLruReadPage(), SLRU_BANK_SIZE, SLRU_PAGE_EMPTY, SLRU_PAGE_READ_IN_PROGRESS, SlruSharedData::slru_stats_idx, and SlruRecentlyUsed().
Referenced by asyncQueueReadAllNotifications(), find_multixact_start(), SerialGetMinConflictCommitSeqNo(), SubTransGetParent(), test_slru_page_readonly(), TransactionIdGetCommitTsData(), and TransactionIdGetStatus().
Size SimpleLruShmemSize | ( | int | nslots, |
int | nlsns | ||
) |
Definition at line 199 of file slru.c.
References Assert, BUFFERALIGN, MAXALIGN, SLRU_BANK_SIZE, and SLRU_MAX_ALLOWED_BUFFERS.
Referenced by AsyncShmemSize(), CLOGShmemSize(), CommitTsShmemSize(), MultiXactShmemSize(), PredicateLockShmemSize(), SimpleLruInit(), SUBTRANSShmemSize(), and test_slru_shmem_request().
void SimpleLruTruncate | ( | SlruCtl | ctl, |
int64 | cutoffPage | ||
) |
Definition at line 1408 of file slru.c.
References SlruSharedData::bank_locks, ctl, ereport, errmsg(), SlruSharedData::latest_page_number, LWLockPadded::lock, LOG, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SlruSharedData::num_slots, SlruSharedData::page_dirty, SlruSharedData::page_number, SlruSharedData::page_status, pg_atomic_read_u64(), pgstat_count_slru_truncate(), SimpleLruWaitIO(), SlotGetBankNumber, SLRU_PAGE_EMPTY, SLRU_PAGE_VALID, SlruSharedData::slru_stats_idx, SlruInternalWritePage(), SlruScanDirCbDeleteCutoff(), and SlruScanDirectory().
Referenced by asyncQueueAdvanceTail(), CheckPointPredicate(), clog_redo(), commit_ts_redo(), PerformOffsetsTruncation(), test_slru_page_truncate(), TruncateCLOG(), TruncateCommitTs(), and TruncateSUBTRANS().
Definition at line 1322 of file slru.c.
References Assert, SlruSharedData::bank_locks, CloseTransientFile(), ctl, SlruWriteAllData::fd, fsync_fname(), i, InvalidTransactionId, LWLockPadded::lock, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SlruWriteAllData::num_files, SlruSharedData::num_slots, SlruSharedData::page_dirty, SlruSharedData::page_status, pgstat_count_slru_flush(), SlruWriteAllData::segno, SlotGetBankNumber, SLRU_CLOSE_FAILED, slru_errcause, slru_errno, SLRU_PAGE_EMPTY, SLRU_PAGE_VALID, SLRU_PAGES_PER_SEGMENT, SlruSharedData::slru_stats_idx, SlruInternalWritePage(), SlruReportIOError(), and SYNC_HANDLER_NONE.
Referenced by CheckPointCLOG(), CheckPointCommitTs(), CheckPointMultiXact(), CheckPointPredicate(), CheckPointSUBTRANS(), find_multixact_start(), and test_slru_page_writeall().
void SimpleLruWritePage | ( | SlruCtl | ctl, |
int | slotno | ||
) |
Definition at line 732 of file slru.c.
References Assert, ctl, SLRU_PAGE_EMPTY, and SlruInternalWritePage().
Referenced by ActivateCommitTs(), BootStrapCLOG(), BootStrapMultiXact(), BootStrapSUBTRANS(), clog_redo(), commit_ts_redo(), MaybeExtendOffsetSlru(), multixact_redo(), and test_slru_page_write().
int SimpleLruZeroPage | ( | SlruCtl | ctl, |
int64 | pageno | ||
) |
Definition at line 375 of file slru.c.
References Assert, ctl, SlruSharedData::latest_page_number, LW_EXCLUSIVE, LWLockHeldByMeInMode(), MemSet, SlruSharedData::page_buffer, SlruSharedData::page_dirty, SlruSharedData::page_number, SlruSharedData::page_status, pg_atomic_write_u64(), pgstat_count_slru_page_zeroed(), SimpleLruGetBankLock(), SimpleLruZeroLSNs(), SLRU_PAGE_EMPTY, SLRU_PAGE_VALID, SlruSharedData::slru_stats_idx, SlruRecentlyUsed(), and SlruSelectLRUPage().
Referenced by asyncQueueAddEntries(), SerialAdd(), test_slru_page_write(), ZeroCLOGPage(), ZeroCommitTsPage(), ZeroMultiXactMemberPage(), ZeroMultiXactOffsetPage(), and ZeroSUBTRANSPage().
void SlruDeleteSegment | ( | SlruCtl | ctl, |
int64 | segno | ||
) |
Definition at line 1526 of file slru.c.
References SlruSharedData::bank_locks, ctl, LWLockPadded::lock, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SlruSharedData::num_slots, SlruSharedData::page_dirty, SlruSharedData::page_number, SlruSharedData::page_status, SlruWriteAllData::segno, SimpleLruWaitIO(), SlotGetBankNumber, SLRU_PAGE_EMPTY, SLRU_PAGE_VALID, SLRU_PAGES_PER_SEGMENT, SlruInternalDeleteSegment(), and SlruInternalWritePage().
Referenced by PerformMembersTruncation(), and test_slru_page_delete().
Definition at line 1744 of file slru.c.
References ctl, SLRU_PAGES_PER_SEGMENT, and SlruInternalDeleteSegment().
Referenced by AsyncShmemInit(), DeactivateCommitTs(), and test_slru_scan_cb().
Definition at line 1712 of file slru.c.
References ctl, data, and SlruMayDeleteSegment().
Referenced by TruncateCLOG(), and TruncateCommitTs().
bool SlruScanDirectory | ( | SlruCtl | ctl, |
SlruScanCallback | callback, | ||
void * | data | ||
) |
Definition at line 1791 of file slru.c.
References AllocateDir(), callback(), ctl, dirent::d_name, data, DEBUG2, elog, FreeDir(), len, ReadDir(), SLRU_PAGES_PER_SEGMENT, SlruCorrectSegmentFilenameLength(), and strtoi64.
Referenced by AsyncShmemInit(), DeactivateCommitTs(), SimpleLruTruncate(), test_slru_delete_all(), TruncateCLOG(), TruncateCommitTs(), and TruncateMultiXact().
Definition at line 1831 of file slru.c.
References CloseTransientFile(), ctl, fd(), OpenTransientFile(), PG_BINARY, pg_fsync(), pgstat_report_wait_end(), pgstat_report_wait_start(), FileTag::segno, and SlruFileName().
Referenced by clogsyncfiletag(), committssyncfiletag(), multixactmemberssyncfiletag(), multixactoffsetssyncfiletag(), and test_slru_page_sync().