Temporarily disable making leadership elections fair
Change-Id: Ic7208cc118ab4a7da80f72a6cf216cc58d194191
diff --git a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java
index 865ec43..5afa954 100644
--- a/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java
+++ b/core/store/primitives/src/main/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorService.java
@@ -428,7 +428,11 @@
this.elections = elections;
}
+ private boolean useRegistrationSorting = false;
private void sortRegistrations(String topic, List<Registration> registrations) {
+ if (!useRegistrationSorting) {
+ return;
+ }
registrations.sort((a, b) -> ComparisonChain.start()
.compare(countLeaders(topic, a), countLeaders(topic, b))
.compare(a.sessionId, b.sessionId)
diff --git a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorTest.java b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorTest.java
index 3eda617..a42748b 100644
--- a/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorTest.java
+++ b/core/store/primitives/src/test/java/org/onosproject/store/primitives/resources/impl/AtomixLeaderElectorTest.java
@@ -22,6 +22,7 @@
import io.atomix.protocols.raft.proxy.RaftProxy;
import io.atomix.protocols.raft.service.RaftService;
+import org.junit.Ignore;
import org.junit.Test;
import org.onosproject.cluster.Leadership;
import org.onosproject.cluster.NodeId;
@@ -50,6 +51,7 @@
return new AtomixLeaderElector(proxy);
}
+ @Ignore("leader elector balancing is currently disabled")
@Test
public void testRun() throws Throwable {
leaderElectorRunTests();
@@ -267,6 +269,7 @@
}).join();
}
+ @Ignore("leader elector balancing is currently disabled")
@Test
public void testLeaderBalance() throws Throwable {
AtomixLeaderElector elector1 = newPrimitive("test-elector-leader-session-close");