Skip to content

Commit 95ef7cd

Browse files
committed
Make RecordTransactionCommit() respect wal_level.
Since the only purpose of WAL-loggin SharedInvalidationMessages is to support Hot Standby operation, they needn't be included when wal_level < hot_standby. Back-patch to 9.0. Review by Heikki Linnakanagas and Fujii Masao.
1 parent e4155c8 commit 95ef7cd

File tree

1 file changed

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

1 file changed

+6
-5
lines changed

src/backend/access/transam/xact.c

+6-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.296 2010/08/12 23:24:53 rhaas Exp $
13+
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.297 2010/08/13 15:42:21 rhaas Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -915,15 +915,16 @@ RecordTransactionCommit(void)
915915
bool haveNonTemp;
916916
int nchildren;
917917
TransactionId *children;
918-
int nmsgs;
918+
int nmsgs = 0;
919919
SharedInvalidationMessage *invalMessages = NULL;
920-
bool RelcacheInitFileInval;
920+
bool RelcacheInitFileInval = false;
921921

922922
/* Get data needed for commit record */
923923
nrels = smgrGetPendingDeletes(true, &rels, &haveNonTemp);
924924
nchildren = xactGetCommittedChildren(&children);
925-
nmsgs = xactGetCommittedInvalidationMessages(&invalMessages,
926-
&RelcacheInitFileInval);
925+
if (XLogStandbyInfoActive())
926+
nmsgs = xactGetCommittedInvalidationMessages(&invalMessages,
927+
&RelcacheInitFileInval);
927928

928929
/*
929930
* If we haven't been assigned an XID yet, we neither can, nor do we want

0 commit comments

Comments
 (0)