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:51:57 UTC
[solr] branch branch_9x 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 branch_9x
in repository https://gitbox.apache.org/repos/asf/solr.git
The following commit(s) were added to refs/heads/branch_9x by this push:
new 953ac3531fa SOLR-13243: Correct initial capacity of ops (#1232)
953ac3531fa is described below
commit 953ac3531fadd5a8af76e074b9b35e4bf22c276e
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 a1244b2b650..cc1547e22b8 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -190,6 +190,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 6288a6e39d5..c8a868bcb26 100644
--- a/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java
+++ b/solr/core/src/java/org/apache/solr/cloud/ShardLeaderElectionContextBase.java
@@ -146,21 +146,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);