Skip to content

Commit 61b22d3

Browse files
committed
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.
1 parent 3bbd6af commit 61b22d3

File tree

4 files changed

+13
-8
lines changed

4 files changed

+13
-8
lines changed

src/backend/access/nbtree/nbtpage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.62 2003/02/23 22:43:08 tgl Exp $
12+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtpage.c,v 1.63 2003/02/23 23:20:52 tgl Exp $
1313
*
1414
* NOTES
1515
* Postgres btree pages look like ordinary relation pages. The opaque
@@ -544,7 +544,7 @@ _bt_page_recyclable(Page page)
544544
*/
545545
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
546546
if (P_ISDELETED(opaque) &&
547-
TransactionIdPrecedesOrEquals(opaque->btpo.xact, RecentGlobalXmin))
547+
TransactionIdPrecedesOrEquals(opaque->btpo.xact, RecentXmin))
548548
return true;
549549
return false;
550550
}

src/backend/storage/ipc/sinval.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.53 2002/11/21 06:36:08 tgl Exp $
11+
* $Header: /cvsroot/pgsql/src/backend/storage/ipc/sinval.c,v 1.54 2003/02/23 23:20:52 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -298,9 +298,10 @@ GetOldestXmin(bool allDbs)
298298
* This ensures that the set of transactions seen as "running" by the
299299
* current xact will not change after it takes the snapshot.
300300
*
301-
* Also, we compute the current global xmin (oldest xmin across all running
301+
* We also compute the current global xmin (oldest xmin across all running
302302
* transactions) and save it in RecentGlobalXmin. This is the same
303-
* computation done by GetOldestXmin(TRUE).
303+
* computation done by GetOldestXmin(TRUE). The xmin value is also stored
304+
* into RecentXmin.
304305
*----------
305306
*/
306307
Snapshot
@@ -419,7 +420,9 @@ GetSnapshotData(bool serializable)
419420
if (TransactionIdPrecedes(xmin, globalxmin))
420421
globalxmin = xmin;
421422

423+
/* Update globals for use by VACUUM */
422424
RecentGlobalXmin = globalxmin;
425+
RecentXmin = xmin;
423426

424427
snapshot->xmin = xmin;
425428
snapshot->xmax = xmax;

src/backend/utils/time/tqual.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* Portions Copyright (c) 1994, Regents of the University of California
1717
*
1818
* IDENTIFICATION
19-
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.61 2002/10/08 17:17:19 tgl Exp $
19+
* $Header: /cvsroot/pgsql/src/backend/utils/time/tqual.c,v 1.62 2003/02/23 23:20:52 tgl Exp $
2020
*
2121
*-------------------------------------------------------------------------
2222
*/
@@ -33,7 +33,8 @@ Snapshot SnapshotDirty = &SnapshotDirtyData;
3333
Snapshot QuerySnapshot = NULL;
3434
Snapshot SerializableSnapshot = NULL;
3535

36-
/* This is updated by GetSnapshotData: */
36+
/* These are updated by GetSnapshotData: */
37+
TransactionId RecentXmin = InvalidTransactionId;
3738
TransactionId RecentGlobalXmin = InvalidTransactionId;
3839

3940
bool ReferentialIntegritySnapshotOverride = false;

src/include/utils/tqual.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group
99
* Portions Copyright (c) 1994, Regents of the University of California
1010
*
11-
* $Id: tqual.h,v 1.43 2002/09/04 20:31:46 momjian Exp $
11+
* $Id: tqual.h,v 1.44 2003/02/23 23:20:52 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -41,6 +41,7 @@ extern DLLIMPORT Snapshot SnapshotDirty;
4141
extern DLLIMPORT Snapshot QuerySnapshot;
4242
extern DLLIMPORT Snapshot SerializableSnapshot;
4343

44+
extern TransactionId RecentXmin;
4445
extern TransactionId RecentGlobalXmin;
4546

4647
extern bool ReferentialIntegritySnapshotOverride;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy