From 71a086f283303f8f2e40d0ab3e7dc0e27f98cbd7 Mon Sep 17 00:00:00 2001 From: liuhl Date: Tue, 3 Aug 2021 17:04:55 +0800 Subject: [PATCH] Disallow sending SI messages when excuting ROLLBACK PREPARED command --- src/backend/access/transam/twophase.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c index 6d3efb4..4c6e2be 100644 --- a/src/backend/access/transam/twophase.c +++ b/src/backend/access/transam/twophase.c @@ -1522,11 +1522,15 @@ FinishPreparedTransaction(const char *gid, bool isCommit) * Relcache init file invalidation requires processing both before and * after we send the SI messages. See AtEOXact_Inval() */ - if (hdr->initfileinval) - RelationCacheInitFilePreInvalidate(); - SendSharedInvalidMessages(invalmsgs, hdr->ninvalmsgs); - if (hdr->initfileinval) - RelationCacheInitFilePostInvalidate(); + if (isCommit) + { + if (hdr->initfileinval) + RelationCacheInitFilePreInvalidate(); + SendSharedInvalidMessages(invalmsgs, hdr->ninvalmsgs); + if (hdr->initfileinval) + RelationCacheInitFilePostInvalidate(); + } + /* * Acquire the two-phase lock. We want to work on the two-phase callbacks -- 2.7.2.windows.1