Skip to content

Commit 6de6d96

Browse files
committed
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 924bcf4.
1 parent d07fea5 commit 6de6d96

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/backend/access/transam/parallel.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include "tcop/tcopprot.h"
2929
#include "utils/combocid.h"
3030
#include "utils/guc.h"
31+
#include "utils/inval.h"
3132
#include "utils/memutils.h"
3233
#include "utils/resowner.h"
3334
#include "utils/snapmgr.h"
@@ -928,6 +929,12 @@ ParallelWorkerMain(Datum main_arg)
928929
Assert(asnapspace != NULL);
929930
PushActiveSnapshot(RestoreSnapshot(asnapspace));
930931

932+
/*
933+
* We've changed which tuples we can see, and must therefore invalidate
934+
* system caches.
935+
*/
936+
InvalidateSystemCaches();
937+
931938
/* Restore user ID and security context. */
932939
SetUserIdAndSecContext(fps->current_user_id, fps->sec_context);
933940

0 commit comments

Comments
 (0)