#include "postgres.h"#include "access/clog.h"#include "access/slru.h"#include "access/transam.h"#include "miscadmin.h"#include "pg_trace.h"
Go to the source code of this file.
Defines | |
| #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 | TransactionIdToPage(xid) ((xid) / (TransactionId) CLOG_XACTS_PER_PAGE) |
| #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 |
| #define | CLOG_LSNS_PER_PAGE (CLOG_XACTS_PER_PAGE / CLOG_XACTS_PER_LSN_GROUP) |
| #define | GetLSNIndex(slotno, xid) |
| #define | ClogCtl (&ClogCtlData) |
Functions | |
| static int | ZeroCLOGPage (int pageno, bool writeXlog) |
| static bool | CLOGPagePrecedes (int page1, int page2) |
| static void | WriteZeroPageXlogRec (int pageno) |
| static void | WriteTruncateXlogRec (int pageno) |
| static void | TransactionIdSetPageStatus (TransactionId xid, int nsubxids, TransactionId *subxids, XidStatus status, XLogRecPtr lsn, int pageno) |
| static void | TransactionIdSetStatusBit (TransactionId xid, XidStatus status, XLogRecPtr lsn, int slotno) |
| static void | set_status_by_pages (int nsubxids, TransactionId *subxids, XidStatus status, XLogRecPtr lsn) |
| void | TransactionIdSetTreeStatus (TransactionId xid, int nsubxids, TransactionId *subxids, XidStatus status, XLogRecPtr lsn) |
| XidStatus | TransactionIdGetStatus (TransactionId xid, XLogRecPtr *lsn) |
| Size | CLOGShmemBuffers (void) |
| Size | CLOGShmemSize (void) |
| void | CLOGShmemInit (void) |
| void | BootStrapCLOG (void) |
| void | StartupCLOG (void) |
| void | TrimCLOG (void) |
| void | ShutdownCLOG (void) |
| void | CheckPointCLOG (void) |
| void | ExtendCLOG (TransactionId newestXact) |
| void | TruncateCLOG (TransactionId oldestXact) |
| void | clog_redo (XLogRecPtr lsn, XLogRecord *record) |
Variables | |
| static SlruCtlData | ClogCtlData |
| #define CLOG_LSNS_PER_PAGE (CLOG_XACTS_PER_PAGE / CLOG_XACTS_PER_LSN_GROUP) |
Definition at line 66 of file clog.c.
Referenced by CLOGShmemInit(), and CLOGShmemSize().
| #define CLOG_XACT_BITMASK ((1 << CLOG_BITS_PER_XACT) - 1) |
Definition at line 57 of file clog.c.
Referenced by TransactionIdGetStatus(), and TransactionIdSetStatusBit().
| #define ClogCtl (&ClogCtlData) |
Definition at line 77 of file clog.c.
Referenced by BootStrapCLOG(), CheckPointCLOG(), clog_redo(), CLOGShmemInit(), ShutdownCLOG(), StartupCLOG(), TransactionIdGetStatus(), TransactionIdSetPageStatus(), TransactionIdSetStatusBit(), TrimCLOG(), TruncateCLOG(), and ZeroCLOGPage().
| #define GetLSNIndex | ( | slotno, | ||
| xid | ||||
| ) |
((slotno) * CLOG_LSNS_PER_PAGE + \ ((xid) % (TransactionId) CLOG_XACTS_PER_PAGE) / CLOG_XACTS_PER_LSN_GROUP)
Definition at line 68 of file clog.c.
Referenced by TransactionIdGetStatus(), and TransactionIdSetStatusBit().
| #define TransactionIdToBIndex | ( | xid | ) | ((xid) % (TransactionId) CLOG_XACTS_PER_BYTE) |
Definition at line 62 of file clog.c.
Referenced by TransactionIdGetStatus(), TransactionIdSetStatusBit(), and TrimCLOG().
| #define TransactionIdToByte | ( | xid | ) | (TransactionIdToPgIndex(xid) / CLOG_XACTS_PER_BYTE) |
Definition at line 61 of file clog.c.
Referenced by TransactionIdGetStatus(), TransactionIdSetStatusBit(), and TrimCLOG().
| #define TransactionIdToPage | ( | xid | ) | ((xid) / (TransactionId) CLOG_XACTS_PER_PAGE) |
Definition at line 59 of file clog.c.
Referenced by ExtendCLOG(), set_status_by_pages(), StartupCLOG(), TransactionIdGetStatus(), TransactionIdSetPageStatus(), TransactionIdSetTreeStatus(), TrimCLOG(), and TruncateCLOG().
| #define TransactionIdToPgIndex | ( | xid | ) | ((xid) % (TransactionId) CLOG_XACTS_PER_PAGE) |
Definition at line 60 of file clog.c.
Referenced by ExtendCLOG(), and TrimCLOG().
| void BootStrapCLOG | ( | void | ) |
Definition at line 467 of file clog.c.
References Assert, CLogControlLock, ClogCtl, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SimpleLruWritePage(), and ZeroCLOGPage().
Referenced by BootStrapXLOG().
{
int slotno;
LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
/* Create and zero the first page of the commit log */
slotno = ZeroCLOGPage(0, false);
/* Make sure it's written out */
SimpleLruWritePage(ClogCtl, slotno);
Assert(!ClogCtl->shared->page_dirty[slotno]);
LWLockRelease(CLogControlLock);
}
| void CheckPointCLOG | ( | void | ) |
Definition at line 590 of file clog.c.
References ClogCtl, and SimpleLruFlush().
Referenced by CheckPointGuts().
{
/* Flush dirty CLOG pages to disk */
TRACE_POSTGRESQL_CLOG_CHECKPOINT_START(true);
SimpleLruFlush(ClogCtl, true);
TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE(true);
}
| void clog_redo | ( | XLogRecPtr | lsn, | |
| XLogRecord * | record | |||
| ) |
Definition at line 732 of file clog.c.
References Assert, CLOG_TRUNCATE, CLOG_ZEROPAGE, CLogControlLock, ClogCtl, elog, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), PANIC, SimpleLruTruncate(), SimpleLruWritePage(), XLogRecord::xl_info, XLogRecGetData, XLR_BKP_BLOCK_MASK, and ZeroCLOGPage().
{
uint8 info = record->xl_info & ~XLR_INFO_MASK;
/* Backup blocks are not used in clog records */
Assert(!(record->xl_info & XLR_BKP_BLOCK_MASK));
if (info == CLOG_ZEROPAGE)
{
int pageno;
int slotno;
memcpy(&pageno, XLogRecGetData(record), sizeof(int));
LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
slotno = ZeroCLOGPage(pageno, false);
SimpleLruWritePage(ClogCtl, slotno);
Assert(!ClogCtl->shared->page_dirty[slotno]);
LWLockRelease(CLogControlLock);
}
else if (info == CLOG_TRUNCATE)
{
int pageno;
memcpy(&pageno, XLogRecGetData(record), sizeof(int));
/*
* During XLOG replay, latest_page_number isn't set up yet; insert a
* suitable value to bypass the sanity test in SimpleLruTruncate.
*/
ClogCtl->shared->latest_page_number = pageno;
SimpleLruTruncate(ClogCtl, pageno);
}
else
elog(PANIC, "clog_redo: unknown op code %u", info);
}
| static bool CLOGPagePrecedes | ( | int | page1, | |
| int | page2 | |||
| ) | [static] |
Definition at line 679 of file clog.c.
References TransactionIdPrecedes().
{
TransactionId xid1;
TransactionId xid2;
xid1 = ((TransactionId) page1) * CLOG_XACTS_PER_PAGE;
xid1 += FirstNormalTransactionId;
xid2 = ((TransactionId) page2) * CLOG_XACTS_PER_PAGE;
xid2 += FirstNormalTransactionId;
return TransactionIdPrecedes(xid1, xid2);
}
| Size CLOGShmemBuffers | ( | void | ) |
Definition at line 438 of file clog.c.
References Max, Min, and NBuffers.
Referenced by CLOGShmemInit(), CLOGShmemSize(), and NumLWLocks().
| void CLOGShmemInit | ( | void | ) |
Definition at line 453 of file clog.c.
References CLOG_LSNS_PER_PAGE, CLogControlLock, ClogCtl, CLOGShmemBuffers(), and SimpleLruInit().
Referenced by CreateSharedMemoryAndSemaphores().
{
ClogCtl->PagePrecedes = CLOGPagePrecedes;
SimpleLruInit(ClogCtl, "CLOG Ctl", CLOGShmemBuffers(), CLOG_LSNS_PER_PAGE,
CLogControlLock, "pg_clog");
}
| Size CLOGShmemSize | ( | void | ) |
Definition at line 447 of file clog.c.
References CLOG_LSNS_PER_PAGE, CLOGShmemBuffers(), and SimpleLruShmemSize().
Referenced by CreateSharedMemoryAndSemaphores().
{
return SimpleLruShmemSize(CLOGShmemBuffers(), CLOG_LSNS_PER_PAGE);
}
| void ExtendCLOG | ( | TransactionId | newestXact | ) |
Definition at line 608 of file clog.c.
References CLogControlLock, FirstNormalTransactionId, InRecovery, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), TransactionIdEquals, TransactionIdToPage, TransactionIdToPgIndex, and ZeroCLOGPage().
Referenced by GetNewTransactionId(), and RecordKnownAssignedTransactionIds().
{
int pageno;
/*
* No work except at first XID of a page. But beware: just after
* wraparound, the first XID of page zero is FirstNormalTransactionId.
*/
if (TransactionIdToPgIndex(newestXact) != 0 &&
!TransactionIdEquals(newestXact, FirstNormalTransactionId))
return;
pageno = TransactionIdToPage(newestXact);
LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
/* Zero the page and make an XLOG entry about it */
ZeroCLOGPage(pageno, !InRecovery);
LWLockRelease(CLogControlLock);
}
| static void set_status_by_pages | ( | int | nsubxids, | |
| TransactionId * | subxids, | |||
| XidStatus | status, | |||
| XLogRecPtr | lsn | |||
| ) | [static] |
Definition at line 219 of file clog.c.
References i, InvalidTransactionId, TransactionIdSetPageStatus(), and TransactionIdToPage.
Referenced by TransactionIdSetTreeStatus().
{
int pageno = TransactionIdToPage(subxids[0]);
int offset = 0;
int i = 0;
while (i < nsubxids)
{
int num_on_page = 0;
while (TransactionIdToPage(subxids[i]) == pageno && i < nsubxids)
{
num_on_page++;
i++;
}
TransactionIdSetPageStatus(InvalidTransactionId,
num_on_page, subxids + offset,
status, lsn, pageno);
offset = i;
pageno = TransactionIdToPage(subxids[offset]);
}
}
| void ShutdownCLOG | ( | void | ) |
Definition at line 578 of file clog.c.
References ClogCtl, and SimpleLruFlush().
Referenced by ShutdownXLOG().
{
/* Flush dirty CLOG pages to disk */
TRACE_POSTGRESQL_CLOG_CHECKPOINT_START(false);
SimpleLruFlush(ClogCtl, false);
TRACE_POSTGRESQL_CLOG_CHECKPOINT_DONE(false);
}
| void StartupCLOG | ( | void | ) |
Definition at line 510 of file clog.c.
References CLogControlLock, ClogCtl, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), VariableCacheData::nextXid, ShmemVariableCache, and TransactionIdToPage.
Referenced by StartupXLOG().
{
TransactionId xid = ShmemVariableCache->nextXid;
int pageno = TransactionIdToPage(xid);
LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
/*
* Initialize our idea of the latest page number.
*/
ClogCtl->shared->latest_page_number = pageno;
LWLockRelease(CLogControlLock);
}
| XidStatus TransactionIdGetStatus | ( | TransactionId | xid, | |
| XLogRecPtr * | lsn | |||
| ) |
Definition at line 389 of file clog.c.
References CLOG_XACT_BITMASK, CLogControlLock, ClogCtl, GetLSNIndex, LWLockRelease(), SimpleLruReadPage_ReadOnly(), TransactionIdToBIndex, TransactionIdToByte, and TransactionIdToPage.
Referenced by TransactionIdGetCommitLSN(), and TransactionLogFetch().
{
int pageno = TransactionIdToPage(xid);
int byteno = TransactionIdToByte(xid);
int bshift = TransactionIdToBIndex(xid) * CLOG_BITS_PER_XACT;
int slotno;
int lsnindex;
char *byteptr;
XidStatus status;
/* lock is acquired by SimpleLruReadPage_ReadOnly */
slotno = SimpleLruReadPage_ReadOnly(ClogCtl, pageno, xid);
byteptr = ClogCtl->shared->page_buffer[slotno] + byteno;
status = (*byteptr >> bshift) & CLOG_XACT_BITMASK;
lsnindex = GetLSNIndex(slotno, xid);
*lsn = ClogCtl->shared->group_lsn[lsnindex];
LWLockRelease(CLogControlLock);
return status;
}
| static void TransactionIdSetPageStatus | ( | TransactionId | xid, | |
| int | nsubxids, | |||
| TransactionId * | subxids, | |||
| XidStatus | status, | |||
| XLogRecPtr | lsn, | |||
| int | pageno | |||
| ) | [static] |
Definition at line 251 of file clog.c.
References Assert, CLogControlLock, ClogCtl, i, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), SimpleLruReadPage(), TRANSACTION_STATUS_ABORTED, TRANSACTION_STATUS_COMMITTED, TRANSACTION_STATUS_SUB_COMMITTED, TransactionIdIsValid, TransactionIdSetStatusBit(), TransactionIdToPage, and XLogRecPtrIsInvalid.
Referenced by set_status_by_pages(), and TransactionIdSetTreeStatus().
{
int slotno;
int i;
Assert(status == TRANSACTION_STATUS_COMMITTED ||
status == TRANSACTION_STATUS_ABORTED ||
(status == TRANSACTION_STATUS_SUB_COMMITTED && !TransactionIdIsValid(xid)));
LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
/*
* If we're doing an async commit (ie, lsn is valid), then we must wait
* for any active write on the page slot to complete. Otherwise our
* update could reach disk in that write, which will not do since we
* mustn't let it reach disk until we've done the appropriate WAL flush.
* But when lsn is invalid, it's OK to scribble on a page while it is
* write-busy, since we don't care if the update reaches disk sooner than
* we think.
*/
slotno = SimpleLruReadPage(ClogCtl, pageno, XLogRecPtrIsInvalid(lsn), xid);
/*
* Set the main transaction id, if any.
*
* If we update more than one xid on this page while it is being written
* out, we might find that some of the bits go to disk and others don't.
* If we are updating commits on the page with the top-level xid that
* could break atomicity, so we subcommit the subxids first before we mark
* the top-level commit.
*/
if (TransactionIdIsValid(xid))
{
/* Subtransactions first, if needed ... */
if (status == TRANSACTION_STATUS_COMMITTED)
{
for (i = 0; i < nsubxids; i++)
{
Assert(ClogCtl->shared->page_number[slotno] == TransactionIdToPage(subxids[i]));
TransactionIdSetStatusBit(subxids[i],
TRANSACTION_STATUS_SUB_COMMITTED,
lsn, slotno);
}
}
/* ... then the main transaction */
TransactionIdSetStatusBit(xid, status, lsn, slotno);
}
/* Set the subtransactions */
for (i = 0; i < nsubxids; i++)
{
Assert(ClogCtl->shared->page_number[slotno] == TransactionIdToPage(subxids[i]));
TransactionIdSetStatusBit(subxids[i], status, lsn, slotno);
}
ClogCtl->shared->page_dirty[slotno] = true;
LWLockRelease(CLogControlLock);
}
| static void TransactionIdSetStatusBit | ( | TransactionId | xid, | |
| XidStatus | status, | |||
| XLogRecPtr | lsn, | |||
| int | slotno | |||
| ) | [static] |
Definition at line 320 of file clog.c.
References Assert, CLOG_XACT_BITMASK, ClogCtl, GetLSNIndex, InRecovery, TRANSACTION_STATUS_COMMITTED, TRANSACTION_STATUS_IN_PROGRESS, TRANSACTION_STATUS_SUB_COMMITTED, TransactionIdToBIndex, TransactionIdToByte, and XLogRecPtrIsInvalid.
Referenced by TransactionIdSetPageStatus().
{
int byteno = TransactionIdToByte(xid);
int bshift = TransactionIdToBIndex(xid) * CLOG_BITS_PER_XACT;
char *byteptr;
char byteval;
char curval;
byteptr = ClogCtl->shared->page_buffer[slotno] + byteno;
curval = (*byteptr >> bshift) & CLOG_XACT_BITMASK;
/*
* When replaying transactions during recovery we still need to perform
* the two phases of subcommit and then commit. However, some transactions
* are already correctly marked, so we just treat those as a no-op which
* allows us to keep the following Assert as restrictive as possible.
*/
if (InRecovery && status == TRANSACTION_STATUS_SUB_COMMITTED &&
curval == TRANSACTION_STATUS_COMMITTED)
return;
/*
* Current state change should be from 0 or subcommitted to target state
* or we should already be there when replaying changes during recovery.
*/
Assert(curval == 0 ||
(curval == TRANSACTION_STATUS_SUB_COMMITTED &&
status != TRANSACTION_STATUS_IN_PROGRESS) ||
curval == status);
/* note this assumes exclusive access to the clog page */
byteval = *byteptr;
byteval &= ~(((1 << CLOG_BITS_PER_XACT) - 1) << bshift);
byteval |= (status << bshift);
*byteptr = byteval;
/*
* Update the group LSN if the transaction completion LSN is higher.
*
* Note: lsn will be invalid when supplied during InRecovery processing,
* so we don't need to do anything special to avoid LSN updates during
* recovery. After recovery completes the next clog change will set the
* LSN correctly.
*/
if (!XLogRecPtrIsInvalid(lsn))
{
int lsnindex = GetLSNIndex(slotno, xid);
if (ClogCtl->shared->group_lsn[lsnindex] < lsn)
ClogCtl->shared->group_lsn[lsnindex] = lsn;
}
}
| void TransactionIdSetTreeStatus | ( | TransactionId | xid, | |
| int | nsubxids, | |||
| TransactionId * | subxids, | |||
| XidStatus | status, | |||
| XLogRecPtr | lsn | |||
| ) |
Definition at line 145 of file clog.c.
References Assert, i, set_status_by_pages(), TRANSACTION_STATUS_ABORTED, TRANSACTION_STATUS_COMMITTED, TRANSACTION_STATUS_SUB_COMMITTED, TransactionIdSetPageStatus(), and TransactionIdToPage.
Referenced by TransactionIdAbortTree(), TransactionIdAsyncCommitTree(), and TransactionIdCommitTree().
{
int pageno = TransactionIdToPage(xid); /* get page of parent */
int i;
Assert(status == TRANSACTION_STATUS_COMMITTED ||
status == TRANSACTION_STATUS_ABORTED);
/*
* See how many subxids, if any, are on the same page as the parent, if
* any.
*/
for (i = 0; i < nsubxids; i++)
{
if (TransactionIdToPage(subxids[i]) != pageno)
break;
}
/*
* Do all items fit on a single page?
*/
if (i == nsubxids)
{
/*
* Set the parent and all subtransactions in a single call
*/
TransactionIdSetPageStatus(xid, nsubxids, subxids, status, lsn,
pageno);
}
else
{
int nsubxids_on_first_page = i;
/*
* If this is a commit then we care about doing this correctly (i.e.
* using the subcommitted intermediate status). By here, we know
* we're updating more than one page of clog, so we must mark entries
* that are *not* on the first page so that they show as subcommitted
* before we then return to update the status to fully committed.
*
* To avoid touching the first page twice, skip marking subcommitted
* for the subxids on that first page.
*/
if (status == TRANSACTION_STATUS_COMMITTED)
set_status_by_pages(nsubxids - nsubxids_on_first_page,
subxids + nsubxids_on_first_page,
TRANSACTION_STATUS_SUB_COMMITTED, lsn);
/*
* Now set the parent and subtransactions on same page as the parent,
* if any
*/
pageno = TransactionIdToPage(xid);
TransactionIdSetPageStatus(xid, nsubxids_on_first_page, subxids, status,
lsn, pageno);
/*
* Now work through the rest of the subxids one clog page at a time,
* starting from the second page onwards, like we did above.
*/
set_status_by_pages(nsubxids - nsubxids_on_first_page,
subxids + nsubxids_on_first_page,
status, lsn);
}
}
| void TrimCLOG | ( | void | ) |
Definition at line 529 of file clog.c.
References CLogControlLock, ClogCtl, LW_EXCLUSIVE, LWLockAcquire(), LWLockRelease(), MemSet, VariableCacheData::nextXid, ShmemVariableCache, SimpleLruReadPage(), TransactionIdToBIndex, TransactionIdToByte, TransactionIdToPage, and TransactionIdToPgIndex.
Referenced by StartupXLOG().
{
TransactionId xid = ShmemVariableCache->nextXid;
int pageno = TransactionIdToPage(xid);
LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
/*
* Re-Initialize our idea of the latest page number.
*/
ClogCtl->shared->latest_page_number = pageno;
/*
* Zero out the remainder of the current clog page. Under normal
* circumstances it should be zeroes already, but it seems at least
* theoretically possible that XLOG replay will have settled on a nextXID
* value that is less than the last XID actually used and marked by the
* previous database lifecycle (since subtransaction commit writes clog
* but makes no WAL entry). Let's just be safe. (We need not worry about
* pages beyond the current one, since those will be zeroed when first
* used. For the same reason, there is no need to do anything when
* nextXid is exactly at a page boundary; and it's likely that the
* "current" page doesn't exist yet in that case.)
*/
if (TransactionIdToPgIndex(xid) != 0)
{
int byteno = TransactionIdToByte(xid);
int bshift = TransactionIdToBIndex(xid) * CLOG_BITS_PER_XACT;
int slotno;
char *byteptr;
slotno = SimpleLruReadPage(ClogCtl, pageno, false, xid);
byteptr = ClogCtl->shared->page_buffer[slotno] + byteno;
/* Zero so-far-unused positions in the current byte */
*byteptr &= (1 << bshift) - 1;
/* Zero the rest of the page */
MemSet(byteptr + 1, 0, BLCKSZ - byteno - 1);
ClogCtl->shared->page_dirty[slotno] = true;
}
LWLockRelease(CLogControlLock);
}
| void TruncateCLOG | ( | TransactionId | oldestXact | ) |
Definition at line 647 of file clog.c.
References ClogCtl, SimpleLruTruncate(), SlruScanDirCbReportPresence(), SlruScanDirectory(), TransactionIdToPage, and WriteTruncateXlogRec().
Referenced by vac_truncate_clog().
{
int cutoffPage;
/*
* The cutoff point is the start of the segment containing oldestXact. We
* pass the *page* containing oldestXact to SimpleLruTruncate.
*/
cutoffPage = TransactionIdToPage(oldestXact);
/* Check to see if there's any files that could be removed */
if (!SlruScanDirectory(ClogCtl, SlruScanDirCbReportPresence, &cutoffPage))
return; /* nothing to remove */
/* Write XLOG record and flush XLOG to disk */
WriteTruncateXlogRec(cutoffPage);
/* Now we can remove the old CLOG segment(s) */
SimpleLruTruncate(ClogCtl, cutoffPage);
}
| static void WriteTruncateXlogRec | ( | int | pageno | ) | [static] |
Definition at line 715 of file clog.c.
References XLogRecData::buffer, CLOG_TRUNCATE, XLogRecData::data, XLogRecData::len, XLogRecData::next, XLogFlush(), and XLogInsert().
Referenced by TruncateCLOG().
{
XLogRecData rdata;
XLogRecPtr recptr;
rdata.data = (char *) (&pageno);
rdata.len = sizeof(int);
rdata.buffer = InvalidBuffer;
rdata.next = NULL;
recptr = XLogInsert(RM_CLOG_ID, CLOG_TRUNCATE, &rdata);
XLogFlush(recptr);
}
| static void WriteZeroPageXlogRec | ( | int | pageno | ) | [static] |
Definition at line 697 of file clog.c.
References XLogRecData::buffer, CLOG_ZEROPAGE, XLogRecData::data, XLogRecData::len, XLogRecData::next, and XLogInsert().
Referenced by ZeroCLOGPage().
{
XLogRecData rdata;
rdata.data = (char *) (&pageno);
rdata.len = sizeof(int);
rdata.buffer = InvalidBuffer;
rdata.next = NULL;
(void) XLogInsert(RM_CLOG_ID, CLOG_ZEROPAGE, &rdata);
}
| static int ZeroCLOGPage | ( | int | pageno, | |
| bool | writeXlog | |||
| ) | [static] |
Definition at line 493 of file clog.c.
References ClogCtl, SimpleLruZeroPage(), and WriteZeroPageXlogRec().
Referenced by BootStrapCLOG(), clog_redo(), and ExtendCLOG().
{
int slotno;
slotno = SimpleLruZeroPage(ClogCtl, pageno);
if (writeXlog)
WriteZeroPageXlogRec(pageno);
return slotno;
}
SlruCtlData ClogCtlData [static] |
1.7.1