Skip to content

Commit f444daf

Browse files
committed
Can't truncate pg_subtrans during a recovery checkpoint --- subtrans
module isn't fully initialized yet.
1 parent 7ff1c9d commit f444daf

File tree

1 file changed

+5
-3
lines changed
  • src/backend/access/transam

1 file changed

+5
-3
lines changed

src/backend/access/transam/xlog.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2003, 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.163 2004/08/23 23:22:44 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/access/transam/xlog.c,v 1.164 2004/08/28 18:18:03 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -4922,9 +4922,11 @@ CreateCheckPoint(bool shutdown, bool force)
49224922
* Truncate pg_subtrans if possible. We can throw away all data before
49234923
* the oldest XMIN of any running transaction. No future transaction will
49244924
* attempt to reference any pg_subtrans entry older than that (see Asserts
4925-
* in subtrans.c).
4925+
* in subtrans.c). During recovery, though, we mustn't do this because
4926+
* StartupSUBTRANS hasn't been called yet.
49264927
*/
4927-
TruncateSUBTRANS(GetOldestXmin(true));
4928+
if (!InRecovery)
4929+
TruncateSUBTRANS(GetOldestXmin(true));
49284930

49294931
LWLockRelease(CheckpointLock);
49304932
}

0 commit comments

Comments
 (0)