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 924bcf4f16.
This commit is contained in:
Robert Haas 2015-10-16 11:31:23 -04:00
parent d07fea542f
commit 6de6d96d97
1 changed files with 7 additions and 0 deletions

View File

@ -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);