Commit 61b22d3a authored by Tom Lane's avatar Tom Lane

btree page recycling can be done as soon as page's next-xact label is

older than current Xmin; we don't have to wait till it's older than
GlobalXmin.
parent 3bbd6af3
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.62 2003/02/23 22:43:08 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.63 2003/02/23 23:20:52 tgl Exp $
* *
* NOTES * NOTES
* Postgres btree pages look like ordinary relation pages. The opaque * Postgres btree pages look like ordinary relation pages. The opaque
...@@ -544,7 +544,7 @@ _bt_page_recyclable(Page page) ...@@ -544,7 +544,7 @@ _bt_page_recyclable(Page page)
*/ */
opaque = (BTPageOpaque) PageGetSpecialPointer(page); opaque = (BTPageOpaque) PageGetSpecialPointer(page);
if (P_ISDELETED(opaque) && if (P_ISDELETED(opaque) &&
TransactionIdPrecedesOrEquals(opaque->btpo.xact, RecentGlobalXmin)) TransactionIdPrecedesOrEquals(opaque->btpo.xact, RecentXmin))
return true; return true;
return false; return false;
} }
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.53 2002/11/21 06:36:08 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.54 2003/02/23 23:20:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -298,9 +298,10 @@ GetOldestXmin(bool allDbs) ...@@ -298,9 +298,10 @@ GetOldestXmin(bool allDbs)
* This ensures that the set of transactions seen as "running" by the * This ensures that the set of transactions seen as "running" by the
* current xact will not change after it takes the snapshot. * current xact will not change after it takes the snapshot.
* *
* Also, we compute the current global xmin (oldest xmin across all running * We also compute the current global xmin (oldest xmin across all running
* transactions) and save it in RecentGlobalXmin. This is the same * transactions) and save it in RecentGlobalXmin. This is the same
* computation done by GetOldestXmin(TRUE). * computation done by GetOldestXmin(TRUE). The xmin value is also stored
* into RecentXmin.
*---------- *----------
*/ */
Snapshot Snapshot
...@@ -419,7 +420,9 @@ GetSnapshotData(bool serializable) ...@@ -419,7 +420,9 @@ GetSnapshotData(bool serializable)
if (TransactionIdPrecedes(xmin, globalxmin)) if (TransactionIdPrecedes(xmin, globalxmin))
globalxmin = xmin; globalxmin = xmin;
/* Update globals for use by VACUUM */
RecentGlobalXmin = globalxmin; RecentGlobalXmin = globalxmin;
RecentXmin = xmin;
snapshot->xmin = xmin; snapshot->xmin = xmin;
snapshot->xmax = xmax; snapshot->xmax = xmax;
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.61 2002/10/08 17:17:19 tgl Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.62 2003/02/23 23:20:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -33,7 +33,8 @@ Snapshot SnapshotDirty = &SnapshotDirtyData; ...@@ -33,7 +33,8 @@ Snapshot SnapshotDirty = &SnapshotDirtyData;
Snapshot QuerySnapshot = NULL; Snapshot QuerySnapshot = NULL;
Snapshot SerializableSnapshot = NULL; Snapshot SerializableSnapshot = NULL;
/* This is updated by GetSnapshotData: */ /* These are updated by GetSnapshotData: */
TransactionId RecentXmin = InvalidTransactionId;
TransactionId RecentGlobalXmin = InvalidTransactionId; TransactionId RecentGlobalXmin = InvalidTransactionId;
bool ReferentialIntegritySnapshotOverride = false; bool ReferentialIntegritySnapshotOverride = false;
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * Portions Copyright (c) 1994, Regents of the University of California
* *
* $Id: tqual.h,v 1.43 2002/09/04 20:31:46 momjian Exp $ * $Id: tqual.h,v 1.44 2003/02/23 23:20:52 tgl Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -41,6 +41,7 @@ extern DLLIMPORT Snapshot SnapshotDirty; ...@@ -41,6 +41,7 @@ extern DLLIMPORT Snapshot SnapshotDirty;
extern DLLIMPORT Snapshot QuerySnapshot; extern DLLIMPORT Snapshot QuerySnapshot;
extern DLLIMPORT Snapshot SerializableSnapshot; extern DLLIMPORT Snapshot SerializableSnapshot;
extern TransactionId RecentXmin;
extern TransactionId RecentGlobalXmin; extern TransactionId RecentGlobalXmin;
extern bool ReferentialIntegritySnapshotOverride; extern bool ReferentialIntegritySnapshotOverride;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment