Skip to content

Commit e72f15e

Browse files
Truncate subtrans after each restartpoint.
Issue reported by Harald Kolb, patch by Fujii Masao, review by me.
1 parent e24d1dc commit e72f15e

File tree

1 file changed

+8
-4
lines changed
  • src/backend/access/transam

1 file changed

+8
-4
lines changed

src/backend/access/transam/xlog.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.432 2010/08/26 19:23:41 alvherre Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.433 2010/08/30 14:22:05 sriggs Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -7706,10 +7706,14 @@ CreateRestartPoint(int flags)
77067706
}
77077707

77087708
/*
7709-
* Currently, there is no need to truncate pg_subtrans during recovery. If
7710-
* we did do that, we will need to have called StartupSUBTRANS() already
7711-
* and then TruncateSUBTRANS() would go here.
7709+
* Truncate pg_subtrans if possible. We can throw away all data before
7710+
* the oldest XMIN of any running transaction. No future transaction will
7711+
* attempt to reference any pg_subtrans entry older than that (see Asserts
7712+
* in subtrans.c). When hot standby is disabled, though, we mustn't do
7713+
* this because StartupSUBTRANS hasn't been called yet.
77127714
*/
7715+
if (EnableHotStandby)
7716+
TruncateSUBTRANS(GetOldestXmin(true, false));
77137717

77147718
/* All real work is done, but log before releasing lock. */
77157719
if (log_checkpoints)

0 commit comments

Comments
 (0)