]> granicus.if.org Git - postgresql/blobdiff - src/backend/access/transam/clog.c
Fix initialization of fake LSN for unlogged relations
[postgresql] / src / backend / access / transam / clog.c
index 8b7ff5b0c24b8a8d0139bbe60044204d94ac66d4..595c860aaaf9d070572fb3998c05dbfd9116fdc9 100644 (file)
@@ -23,7 +23,7 @@
  * for aborts (whether sync or async), since the post-crash assumption would
  * be that such transactions failed anyway.
  *
- * Portions Copyright (c) 1996-2018, PostgreSQL Global Development Group
+ * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
  * Portions Copyright (c) 1994, Regents of the University of California
  *
  * src/backend/access/transam/clog.c
@@ -92,20 +92,20 @@ static int  ZeroCLOGPage(int pageno, bool writeXlog);
 static bool CLOGPagePrecedes(int page1, int page2);
 static void WriteZeroPageXlogRec(int pageno);
 static void WriteTruncateXlogRec(int pageno, TransactionId oldestXact,
-                                        Oid oldestXidDb);
+                                                                Oid oldestXactDb);
 static void TransactionIdSetPageStatus(TransactionId xid, int nsubxids,
-                                                  TransactionId *subxids, XidStatus status,
-                                                  XLogRecPtr lsn, int pageno,
-                                                  bool all_xact_same_page);
+                                                                          TransactionId *subxids, XidStatus status,
+                                                                          XLogRecPtr lsn, int pageno,
+                                                                          bool all_xact_same_page);
 static void TransactionIdSetStatusBit(TransactionId xid, XidStatus status,
-                                                 XLogRecPtr lsn, int slotno);
+                                                                         XLogRecPtr lsn, int slotno);
 static void set_status_by_pages(int nsubxids, TransactionId *subxids,
-                                       XidStatus status, XLogRecPtr lsn);
+                                                               XidStatus status, XLogRecPtr lsn);
 static bool TransactionGroupUpdateXidStatus(TransactionId xid,
-                                                               XidStatus status, XLogRecPtr lsn, int pageno);
+                                                                                       XidStatus status, XLogRecPtr lsn, int pageno);
 static void TransactionIdSetPageStatusInternal(TransactionId xid, int nsubxids,
-                                                                  TransactionId *subxids, XidStatus status,
-                                                                  XLogRecPtr lsn, int pageno);
+                                                                                          TransactionId *subxids, XidStatus status,
+                                                                                          XLogRecPtr lsn, int pageno);
 
 
 /*
@@ -155,7 +155,7 @@ static void TransactionIdSetPageStatusInternal(TransactionId xid, int nsubxids,
  * NB: this is a low-level routine and is NOT the preferred entry point
  * for most uses; functions in transam.c are the intended callers.
  *
- * XXX Think about issuing FADVISE_WILLNEED on pages that we will need,
+ * XXX Think about issuing POSIX_FADV_WILLNEED on pages that we will need,
  * but aren't yet in cache, as well as hinting pages not to fall out of
  * cache yet.
  */
@@ -749,12 +749,12 @@ ZeroCLOGPage(int pageno, bool writeXlog)
 
 /*
  * This must be called ONCE during postmaster or standalone-backend startup,
- * after StartupXLOG has initialized ShmemVariableCache->nextXid.
+ * after StartupXLOG has initialized ShmemVariableCache->nextFullXid.
  */
 void
 StartupCLOG(void)
 {
-       TransactionId xid = ShmemVariableCache->nextXid;
+       TransactionId xid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid);
        int                     pageno = TransactionIdToPage(xid);
 
        LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
@@ -773,7 +773,7 @@ StartupCLOG(void)
 void
 TrimCLOG(void)
 {
-       TransactionId xid = ShmemVariableCache->nextXid;
+       TransactionId xid = XidFromFullTransactionId(ShmemVariableCache->nextFullXid);
        int                     pageno = TransactionIdToPage(xid);
 
        LWLockAcquire(CLogControlLock, LW_EXCLUSIVE);
@@ -792,7 +792,7 @@ TrimCLOG(void)
         * 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
+        * nextFullXid 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)
@@ -891,7 +891,7 @@ ExtendCLOG(TransactionId newestXact)
  * Remove all CLOG segments before the one holding the passed transaction ID
  *
  * Before removing any CLOG data, we must flush XLOG to disk, to ensure
- * that any recently-emitted HEAP_FREEZE records have reached disk; otherwise
+ * that any recently-emitted FREEZE_PAGE records have reached disk; otherwise
  * a crash and restart might leave us with some unfrozen tuples referencing
  * removed CLOG data.  We choose to emit a special TRUNCATE XLOG record too.
  * Replaying the deletion from XLOG is not critical, since the files could