aboutsummaryrefslogtreecommitdiff
path: root/src/backend/access/transam/xlog.c
diff options
context:
space:
mode:
authorSimon Riggs <simon@2ndQuadrant.com>2010-08-30 14:22:05 +0000
committerSimon Riggs <simon@2ndQuadrant.com>2010-08-30 14:22:05 +0000
commite72f15ed6064c89d1077a3757ebd9cd4eaad1c13 (patch)
treed5c18bb0f4e8615b27534ab3add841758edc5a19 /src/backend/access/transam/xlog.c
parente24d1dc069bd44b6311166f9ba23b39639f55968 (diff)
downloadpostgresql-e72f15ed6064c89d1077a3757ebd9cd4eaad1c13.tar.gz
postgresql-e72f15ed6064c89d1077a3757ebd9cd4eaad1c13.zip
Truncate subtrans after each restartpoint.
Issue reported by Harald Kolb, patch by Fujii Masao, review by me.
Diffstat (limited to 'src/backend/access/transam/xlog.c')
-rw-r--r--src/backend/access/transam/xlog.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 617895c147a..fd7f2054668 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.432 2010/08/26 19:23:41 alvherre Exp $
+ * $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.433 2010/08/30 14:22:05 sriggs Exp $
*
*-------------------------------------------------------------------------
*/
@@ -7706,10 +7706,14 @@ CreateRestartPoint(int flags)
}
/*
- * Currently, there is no need to truncate pg_subtrans during recovery. If
- * we did do that, we will need to have called StartupSUBTRANS() already
- * and then TruncateSUBTRANS() would go here.
+ * Truncate pg_subtrans if possible. We can throw away all data before
+ * the oldest XMIN of any running transaction. No future transaction will
+ * attempt to reference any pg_subtrans entry older than that (see Asserts
+ * in subtrans.c). When hot standby is disabled, though, we mustn't do
+ * this because StartupSUBTRANS hasn't been called yet.
*/
+ if (EnableHotStandby)
+ TruncateSUBTRANS(GetOldestXmin(true, false));
/* All real work is done, but log before releasing lock. */
if (log_checkpoints)