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.
This commit is contained in:
Robert Haas 2010-08-13 15:42:21 +00:00
parent e4155c8483
commit 95ef7cd40d

View file

@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.296 2010/08/12 23:24:53 rhaas Exp $ * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.297 2010/08/13 15:42:21 rhaas Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -915,15 +915,16 @@ RecordTransactionCommit(void)
bool haveNonTemp; bool haveNonTemp;
int nchildren; int nchildren;
TransactionId *children; TransactionId *children;
int nmsgs; int nmsgs = 0;
SharedInvalidationMessage *invalMessages = NULL; SharedInvalidationMessage *invalMessages = NULL;
bool RelcacheInitFileInval; bool RelcacheInitFileInval = false;
/* Get data needed for commit record */ /* Get data needed for commit record */
nrels = smgrGetPendingDeletes(true, &rels, &haveNonTemp); nrels = smgrGetPendingDeletes(true, &rels, &haveNonTemp);
nchildren = xactGetCommittedChildren(&children); nchildren = xactGetCommittedChildren(&children);
nmsgs = xactGetCommittedInvalidationMessages(&invalMessages, if (XLogStandbyInfoActive())
&RelcacheInitFileInval); nmsgs = xactGetCommittedInvalidationMessages(&invalMessages,
&RelcacheInitFileInval);
/* /*
* If we haven't been assigned an XID yet, we neither can, nor do we want * If we haven't been assigned an XID yet, we neither can, nor do we want