git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: c3928b4)
Avoid unnecessary shared invalidations in ROLLBACK PREPARED
2021年8月12日 11:12:47 +0000 (20:12 +0900)
2021年8月12日 11:12:47 +0000 (20:12 +0900)
The performance gain is minimal, but this makes the logic more
consistent with AtEOXact_Inval(). No other invalidation is needed in
this case as PREPARE takes already care of sending any local ones.

Author: Liu Huailing
Reviewed-by: Tom Lane, Michael Paquier
Discussion: https://postgr.es/m/OSZPR01MB6215AA84D71EF2B3D354CF86BE139@OSZPR01MB6215.jpnprd01.prod.outlook.com


diff --git a/src/backend/access/transam/twophase.c b/src/backend/access/transam/twophase.c
index 6d3efb49a40a0dfcb63df224eef3f956c6b75ee0..2156de187c37fc99804078d8431405b0c0861e86 100644 (file)
--- a/src/backend/access/transam/twophase.c
+++ b/src/backend/access/transam/twophase.c
@@ -1520,13 +1520,17 @@ FinishPreparedTransaction(const char *gid, bool isCommit)
* Handle cache invalidation messages.
*
* Relcache init file invalidation requires processing both before and
- * after we send the SI messages. See AtEOXact_Inval()
+ * after we send the SI messages, only when committing. 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
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /