Apache Solr open-source search software
SOLR-13243: Correct initial capacity of ops (#1232)
Haythem1a9a8dc336e7
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txtindex 0acbdd43308..a3268c3acd7 100644--- a/solr/CHANGES.txt+++ b/solr/CHANGES.txt@@ -216,6 +216,8 @@ Other Changes* SOLR-16534: Jaegertracer-Configurator is now deprecated. From v10.0 we'll only support OpenTelemetry (janhoy)+* SOLR-13243: Correct the initial capacity of the ZK operations to run in ShardLeaderElectionContextBase#runLeaderProcess (Haythem Khiri)+================== 9.1.1 ==================Bug Fixesdiff --git a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.javaindex a8ef1070979..c38521bf35c 100644--- a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java+++ b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java@@ -145,21 +145,20 @@ class ShardLeaderElectionContextBase extends ElectionContext {"Creating leader registration node {} after winning as {}",leaderPath,leaderSeqPath);- List<Op> ops = new ArrayList<>(2);// We use a multi operation to get the parent nodes version, which will// be used to make sure we only remove our own leader registration node.// The setData call used to get the parent version is also the trigger to// increment the version. We also do a sanity check that our leaderSeqPath exists.-- ops.add(Op.check(leaderSeqPath, -1));- ops.add(- Op.create(- leaderPath,- Utils.toJSON(leaderProps),- zkClient.getZkACLProvider().getACLsToAdd(leaderPath),- CreateMode.EPHEMERAL));- ops.add(Op.setData(parent, null, -1));+ List<Op> ops =+ List.of(+ Op.check(leaderSeqPath, -1),+ Op.create(+ leaderPath,+ Utils.toJSON(leaderProps),+ zkClient.getZkACLProvider().getACLsToAdd(leaderPath),+ CreateMode.EPHEMERAL),+ Op.setData(parent, null, -1));List<OpResult> results;results = zkClient.multi(ops, true);