You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by no...@apache.org on 2022/11/11 00:42:37 UTC

[solr] branch main updated: SOLR-16456: more cleanup

This is an automated email from the ASF dual-hosted git repository.

noble pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/solr.git


The following commit(s) were added to refs/heads/main by this push:
     new c37713fced6 SOLR-16456: more cleanup
c37713fced6 is described below

commit c37713fced652d78e3082c787ff3a0b047fc8447
Author: Noble Paul <no...@gmail.com>
AuthorDate: Fri Nov 11 11:41:51 2022 +1100

    SOLR-16456: more cleanup
---
 .../apache/solr/cloud/ShardLeaderElectionContext.java   | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
index 27ce0012da7..4edf6f78773 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContext.java
@@ -22,6 +22,7 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import org.apache.lucene.search.MatchAllDocsQuery;
 import org.apache.solr.cloud.overseer.OverseerAction;
+import org.apache.solr.common.MapWriter;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.SolrException.ErrorCode;
 import org.apache.solr.common.cloud.ClusterState;
@@ -127,19 +128,15 @@ final class ShardLeaderElectionContext extends ShardLeaderElectionContextBase {
           > 1) {
         // Clear the leader in clusterstate. We only need to worry about this if there is actually
         // more than one replica.
-        ZkNodeProps m =
-            new ZkNodeProps(
-                Overseer.QUEUE_OPERATION,
-                OverseerAction.LEADER.toLower(),
-                ZkStateReader.SHARD_ID_PROP,
-                shardId,
-                ZkStateReader.COLLECTION_PROP,
-                collection);
-
+        MapWriter m =
+            ew ->
+                ew.put(Overseer.QUEUE_OPERATION, OverseerAction.LEADER.toLower())
+                    .put(ZkStateReader.SHARD_ID_PROP, shardId)
+                    .put(ZkStateReader.COLLECTION_PROP, collection);
         if (distributedClusterStateUpdater.isDistributedStateUpdate()) {
           distributedClusterStateUpdater.doSingleStateUpdate(
               DistributedClusterStateUpdater.MutatingCommand.SliceSetShardLeader,
-              m,
+              new ZkNodeProps(m),
               zkController.getSolrCloudManager(),
               zkStateReader);
         } else {