Apache Solr open-source search software
SOLR-8837: Fix duplicate election node detection
Alan Woodward04bd5860710c
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex ce804f52435..3c49ba9e0ca 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -20,6 +20,7 @@ See the Quick Start guide at http://lucene.apache.org/solr/quickstart.html(No Changes)================== 6.1.0 ==================+Detailed Change List----------------------* SOLR-8782: Add asynchronous sugar methods to the SolrJ Collections API. You@@ -30,13 +31,13 @@ Detailed Change List* SOLR-8765: Enforce required parameters at query construction time in the SolrJCollections API, add static factory methods, and deprecate old setter methods.(Alan Woodward, Jason Gerlowski)-* SOLR-8842: authorization APIs do not use name as an identifier for a permission- for update, delete commands and 'before' attribute (noble)++* SOLR-8842: authorization APIs do not use name as an identifier for a permission+ for update, delete commands and 'before' attribute (noble)New Features-----------------------* SOLR-8814: Support GeoJSON response writer and general spatial formatting. Adding&wt=geojson&geojson.field=<your geometry field>Will return a FeatureCollection for each SolrDocumentList and a Feature with the@@ -282,8 +283,9 @@ Bug Fixes* SOLR-8656: PeerSync should use same nUpdates everywhere. (Ramsey Haddad via Mark Miller)-* SOLR-8697: Scope ZK election nodes by session to prevent elections from interfering with each other- and other small LeaderElector improvements. (Scott Blum via Mark Miller)+* SOLR-8697, SOLR-8837: Scope ZK election nodes by session to prevent elections from interfering with each other+ and other small LeaderElector improvements. (Scott Blum via Mark Miller, Alan+ Woodward)* SOLR-8599: After a failed connection during construction of SolrZkClient attempt to retry until a connectioncan be made. (Keith Laban, Dennis Gove)diff --git a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.javaindex c0eb3958333..e71ddf09b9b 100644--- a/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java+++ b/solr/core/src/java/org/apache/solr/cloud/LeaderElector.java@@ -18,16 +18,13 @@ package org.apache.solr.cloud;import java.io.IOException;import java.lang.invoke.MethodHandles;-import java.util.ArrayList;import java.util.Collections;-import java.util.Comparator;import java.util.Iterator;import java.util.List;import java.util.Map;import java.util.regex.Matcher;import java.util.regex.Pattern;-import org.apache.commons.lang.StringUtils;import org.apache.solr.cloud.ZkController.ContextKey;import org.apache.solr.common.SolrException;import org.apache.solr.common.cloud.SolrZkClient;@@ -116,7 +113,7 @@ public class LeaderElector {// If any double-registrations exist for me, remove all but this latest one!// TODO: can we even get into this state?- String prefix = zkClient.getSolrZooKeeper().getSessionId() + "-" + context.id;+ String prefix = zkClient.getSolrZooKeeper().getSessionId() + "-" + context.id + "-";Iterator<String> it = seqs.iterator();while (it.hasNext()) {String elec = it.next();