From 9b12e275cd0b42c2cc4f65b8f6dd771d394bbba7 Mon Sep 17 00:00:00 2001 From: Pavan Deolasee Date: Thu, 18 May 2017 10:22:31 +0530 Subject: Ensure that multi-node executor is initialised correctly. Since parallel background worker threads may need to communicate with remote nodes, we should initialise multi-node executor when the parallel worker starts it work. This was discovered while running queries with force_parallel_mode set to on. --- src/backend/access/transam/parallel.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/backend/access/transam/parallel.c b/src/backend/access/transam/parallel.c index a47eba647b..3c0da2e1e0 100644 --- a/src/backend/access/transam/parallel.c +++ b/src/backend/access/transam/parallel.c @@ -1008,6 +1008,11 @@ ParallelWorkerMain(Datum main_arg) BackgroundWorkerInitializeConnectionByOid(fps->database_id, fps->authenticated_user_id); + StartTransactionCommand(); + /* Initialize XL executor. This must be done inside a transaction block. */ + InitMultinodeExecutor(false); + CommitTransactionCommand(); + /* * Set the client encoding to the database encoding, since that is what * the leader will expect. -- cgit v1.2.3