Commit e72f15ed authored by Simon Riggs's avatar Simon Riggs

Truncate subtrans after each restartpoint.

Issue reported by Harald Kolb, patch by Fujii Masao, review by me.
parent e24d1dc0
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California * 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) ...@@ -7706,10 +7706,14 @@ CreateRestartPoint(int flags)
} }
/* /*
* Currently, there is no need to truncate pg_subtrans during recovery. If * Truncate pg_subtrans if possible. We can throw away all data before
* we did do that, we will need to have called StartupSUBTRANS() already * the oldest XMIN of any running transaction. No future transaction will
* and then TruncateSUBTRANS() would go here. * 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. */ /* All real work is done, but log before releasing lock. */
if (log_checkpoints) if (log_checkpoints)
......
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