You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@solr.apache.org by kr...@apache.org on 2023/01/10 20:48:11 UTC
[solr] branch main updated: SOLR-13243: Correct initial capacity of ops (#1232)
This is an automated email from the ASF dual-hosted git repository.
krisden 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 1a9a8dc336e SOLR-13243: Correct initial capacity of ops (#1232)
1a9a8dc336e is described below
commit 1a9a8dc336e7d578ee4aa650cd7cfe578f8d48b6
Author: Haythem <ha...@yahoo.fr>
AuthorDate: Tue Jan 10 21:48:05 2023 +0100
SOLR-13243: Correct initial capacity of ops (#1232)
---
solr/CHANGES.txt | 2 ++
.../solr/cloud/ShardLeaderElectionContextBase.java | 19 +++++++++----------
2 files changed, 11 insertions(+), 10 deletions(-)
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 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 Fixes
diff --git a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java
index 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);