Skip to content

Commit

Permalink
Bugfix in the ReactiveSchedulingStrategy.
Browse files Browse the repository at this point in the history
  • Loading branch information
thorsten-papenbrock committed Nov 7, 2018
1 parent 0c67462 commit 3ced2cc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/.settings
.metadata
/.metadata
.recommenders
*.releaseBackup
release.properties
.idea
Expand All @@ -15,3 +16,5 @@ bin/
target
datasets/
output/
copyOctopus2Thor.sh
copyAkkaTutorial2Thor.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ private class QueryTracker {
/**
* Assign a subquery of the tracked query to the worker. If a subquery was available, a {@link Worker.ValidationMessage} is send to the worker with master as sender.
*
* @return a new subquery or {@code null}
* @return {@code true}, if work was assigned and {@code false} otherwise
*/
boolean assignWork(ActorRef worker, ActorRef master) {

Expand Down Expand Up @@ -199,21 +199,24 @@ private void assignSubqueries() {
.map(Map.Entry::getKey)
.collect(Collectors.toList());

// Assign idle workers to subqueries as long as there is work to do
// Return if no query is present
if (this.queryId2tracker.isEmpty())
return;

// Assign idle workers to pending subqueries
Iterator<QueryTracker> queryTrackerIterator = this.queryId2tracker.values().iterator();
QueryTracker queryTracker = queryTrackerIterator.next();
for (ActorRef idleWorker : idleWorkers) {
QueryTracker queryTracker;

// Find a query tracker that can assign a subquery to this idle worker
do {
while (!queryTracker.assignWork(idleWorker, this.master)) {
// Check if there is any (further) on-going query
if (!queryTrackerIterator.hasNext())
return;

// Select the (next) query tracker
queryTracker = queryTrackerIterator.next();
}
while (!queryTracker.assignWork(idleWorker, this.master));

// Assign the subquery to the worker and keep track of the assignment
this.worker2tracker.put(idleWorker, queryTracker);
Expand Down

0 comments on commit 3ced2cc

Please # to comment.