From 6de6d96d971c76c8d7bd3b31e6f182906137f913 Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Fri, 16 Oct 2015 11:31:23 -0400 Subject: [PATCH] Invalidate caches after cranking up a parallel worker transaction. Starting a parallel worker transaction changes our notion of which XIDs are in-progress or committed, and our notion of the current command counter ID. Therefore, our view of these caches prior to starting this transaction may no longer valid. Defend against that by clearing them. This fixes a bug in commit 924bcf4f16d54c55310b28f77686608684734f42. --- src/backend/access/transam/parallel.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c index 0b94c0f87e..e09bdb20b0 100644 --- a/src/backend/access/transam/parallel.c +++ b/src/backend/access/transam/parallel.c @@ -28,6 +28,7 @@ #include "tcop/tcopprot.h" #include "utils/combocid.h" #include "utils/guc.h" +#include "utils/inval.h" #include "utils/memutils.h" #include "utils/resowner.h" #include "utils/snapmgr.h" @@ -928,6 +929,12 @@ ParallelWorkerMain(Datum main_arg) Assert(asnapspace != NULL); PushActiveSnapshot(RestoreSnapshot(asnapspace)); + /* + * We've changed which tuples we can see, and must therefore invalidate + * system caches. + */ + InvalidateSystemCaches(); + /* Restore user ID and security context. */ SetUserIdAndSecContext(fps->current_user_id, fps->sec_context); -- 2.40.0