diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 511aba2..503c722 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -915,15 +915,16 @@ RecordTransactionCommit(void) bool haveNonTemp; int nchildren; TransactionId *children; - int nmsgs; + int nmsgs = 0; SharedInvalidationMessage *invalMessages = NULL; - bool RelcacheInitFileInval; + bool RelcacheInitFileInval = false; /* Get data needed for commit record */ nrels = smgrGetPendingDeletes(true, &rels, &haveNonTemp); nchildren = xactGetCommittedChildren(&children); - nmsgs = xactGetCommittedInvalidationMessages(&invalMessages, - &RelcacheInitFileInval); + if (XLogStandbyInfoActive()) + nmsgs = xactGetCommittedInvalidationMessages(&invalMessages, + &RelcacheInitFileInval); /* * If we haven't been assigned an XID yet, we neither can, nor do we want