summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/dispatch/LoadBalancer.java
diff options
context:
space:
mode:
authorOlli Virtanen <olli.virtanen@oath.com>2018-10-12 15:56:04 +0200
committerOlli Virtanen <olli.virtanen@oath.com>2018-10-12 15:56:04 +0200
commit18bb6854530466f66c574349861748b3bba13d33 (patch)
tree76bad6f306c35717f15091612007c72ea6db57dd /container-search/src/main/java/com/yahoo/search/dispatch/LoadBalancer.java
parentee6f2a8fb5756d9b13ce89789a0dc6f9b28a1c33 (diff)
Remove group affinity - conflicts with profiles
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/dispatch/LoadBalancer.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/dispatch/LoadBalancer.java32
1 files changed, 4 insertions, 28 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/dispatch/LoadBalancer.java b/container-search/src/main/java/com/yahoo/search/dispatch/LoadBalancer.java
index 455696c16b1..9eac9b9b63d 100644
--- a/container-search/src/main/java/com/yahoo/search/dispatch/LoadBalancer.java
+++ b/container-search/src/main/java/com/yahoo/search/dispatch/LoadBalancer.java
@@ -1,7 +1,6 @@
// Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.dispatch;
-import com.yahoo.processing.request.CompoundName;
import com.yahoo.search.Query;
import com.yahoo.search.dispatch.SearchCluster.Group;
@@ -24,8 +23,6 @@ public class LoadBalancer {
private static final Logger log = Logger.getLogger(LoadBalancer.class.getName());
- private static final CompoundName QUERY_NODE_GROUP_AFFINITY = new CompoundName("dispatch.group.affinity");
-
private final List<GroupSchedule> scoreboard;
private int needle = 0;
@@ -54,16 +51,7 @@ public class LoadBalancer {
return Optional.empty();
}
- Integer groupAffinity = query.properties().getInteger(QUERY_NODE_GROUP_AFFINITY);
- if (groupAffinity != null) {
- Optional<Group> previouslyChosen = allocateFromGroup(groupAffinity);
- if (previouslyChosen.isPresent()) {
- return previouslyChosen;
- }
- }
- Optional<Group> allocatedGroup = allocateNextGroup();
- allocatedGroup.ifPresent(group -> query.properties().set(QUERY_NODE_GROUP_AFFINITY, group.id()));
- return allocatedGroup;
+ return allocateNextGroup();
}
/**
@@ -83,18 +71,6 @@ public class LoadBalancer {
}
}
- private Optional<Group> allocateFromGroup(int groupId) {
- synchronized (this) {
- for (GroupSchedule schedule : scoreboard) {
- if (schedule.group.id() == groupId) {
- schedule.adjustScore(1);
- return Optional.of(schedule.group);
- }
- }
- }
- return Optional.empty();
- }
-
private Optional<Group> allocateNextGroup() {
synchronized (this) {
GroupSchedule bestSchedule = null;
@@ -139,12 +115,12 @@ public class LoadBalancer {
}
public boolean isPreferredOver(GroupSchedule other) {
- if (! group.hasSufficientCoverage()) {
- return false;
- }
if (other == null) {
return true;
}
+ if (! group.hasSufficientCoverage()) {
+ return false;
+ }
return this.score < other.score;
}