summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavan Deolasee2017-05-18 04:52:31 +0000
committerPavan Deolasee2017-05-18 04:52:31 +0000
commit9b12e275cd0b42c2cc4f65b8f6dd771d394bbba7 (patch)
tree9f8ed2a2fb63bc6fb6107533acd5eea3be9f7ce5
parent802721867a8d3862eb2ebdb64db1faac013354b8 (diff)
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.
-rw-r--r--src/backend/access/transam/parallel.c5
1 files changed, 5 insertions, 0 deletions
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.