@@ -7426,14 +7426,10 @@ struct ParallelizableFinder final
7426
7426
: public WalkerWorker<ExecutionNode, WalkerUniqueness::NonUnique> {
7427
7427
bool const _parallelizeWrites;
7428
7428
bool _isParallelizable;
7429
- bool _seenDistribute;
7430
- uint32_t _numRemotes;
7431
7429
7432
7430
explicit ParallelizableFinder (bool parallelizeWrites)
7433
7431
: _parallelizeWrites(parallelizeWrites),
7434
- _isParallelizable(true ),
7435
- _seenDistribute(false ),
7436
- _numRemotes(0 ) {}
7432
+ _isParallelizable(true ) {}
7437
7433
7438
7434
~ParallelizableFinder () = default ;
7439
7435
@@ -7443,38 +7439,11 @@ struct ParallelizableFinder final
7443
7439
7444
7440
bool before (ExecutionNode* node) override final {
7445
7441
if (node->getType () == ExecutionNode::SCATTER ||
7446
- node->getType () == ExecutionNode::GATHER) {
7442
+ node->getType () == ExecutionNode::GATHER ||
7443
+ node->getType () == ExecutionNode::DISTRIBUTE) {
7447
7444
_isParallelizable = false ;
7448
7445
return true ; // true to abort the whole walking process
7449
7446
}
7450
- if (node->getType () == ExecutionNode::DISTRIBUTE) {
7451
- if (_seenDistribute) {
7452
- // if we find 2 DISTRIBUTE nodes in the plan, or a DISTRIBUTE
7453
- // at an unexpected place, we give up
7454
- _isParallelizable = false ;
7455
- return true ;
7456
- }
7457
- // note that we have seen a DISTRIBUTE node.
7458
- // note that a single DISTRIBUTE node should be safe if it
7459
- // itself does not reach out to other snippets.
7460
- // The reason it should be safe is that the DISTRIBUTE will
7461
- // be executed under the snippet's mutex, so any real parallelism
7462
- // on the same DISTRIBUTE node is prevented. if multiple
7463
- // DB ervers are queuing for the same DISTRIBUTE node, this may
7464
- // lead to some contention, but should work eventually.
7465
- _seenDistribute = true ;
7466
- }
7467
- if (node->getType () == ExecutionNode::REMOTE) {
7468
- // plan walking starts at a GATHER node, so we expect to see
7469
- // at least one REMOTE node.
7470
- // if we find another one, it is ok if that REMOTE node refers
7471
- // to a DISTRIBUTE node (checked above). if it refers to another
7472
- // GATHER node somewhere, we also abort above.
7473
- if (++_numRemotes > 2 || _seenDistribute) {
7474
- _isParallelizable = false ;
7475
- return true ;
7476
- }
7477
- }
7478
7447
7479
7448
if (node->getType () == ExecutionNode::TRAVERSAL ||
7480
7449
node->getType () == ExecutionNode::SHORTEST_PATH ||
@@ -7493,7 +7462,6 @@ struct ParallelizableFinder final
7493
7462
(!_parallelizeWrites ||
7494
7463
(node->getType () != ExecutionNode::REMOVE &&
7495
7464
node->getType () != ExecutionNode::REPLACE &&
7496
- node->getType () != ExecutionNode::INSERT &&
7497
7465
node->getType () != ExecutionNode::UPDATE))) {
7498
7466
_isParallelizable = false ;
7499
7467
return true ; // true to abort the whole walking process
@@ -7838,10 +7806,10 @@ void arangodb::aql::parallelizeGatherRule(Optimizer* opt,
7838
7806
::arangodb::containers::SmallVector<ExecutionNode*> nodes{a};
7839
7807
plan->findNodesOfType (nodes, EN::GATHER, true );
7840
7808
7841
- if (nodes.size () == 1 && !plan->contains (EN::SCATTER)) {
7842
- GatherNode* gn = ExecutionNode::castTo<GatherNode*>(nodes[0 ]);
7809
+ if (nodes.size () == 1 && !plan->contains (EN::DISTRIBUTE) && !plan->contains (EN::SCATTER)) {
7843
7810
TRI_vocbase_t& vocbase = plan->getAst ()->query ().vocbase ();
7844
7811
bool parallelizeWrites = vocbase.server ().getFeature <OptimizerRulesFeature>().parallelizeGatherWrites ();
7812
+ GatherNode* gn = ExecutionNode::castTo<GatherNode*>(nodes[0 ]);
7845
7813
7846
7814
if (!gn->isInSubquery () && isParallelizable (gn, parallelizeWrites)) {
7847
7815
// find all graph nodes and make sure that they all are using satellite
0 commit comments