From commits-return-120444-archive-asf-public=cust-asf.ponee.io@lucene.apache.org Thu Jan 14 12:11:30 2021 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mxout1-ec2-va.apache.org (mxout1-ec2-va.apache.org [3.227.148.255]) by mx-eu-01.ponee.io (Postfix) with ESMTPS id F3636180663 for ; Thu, 14 Jan 2021 13:11:29 +0100 (CET) Received: from mail.apache.org (mailroute1-lw-us.apache.org [207.244.88.153]) by mxout1-ec2-va.apache.org (ASF Mail Server at mxout1-ec2-va.apache.org) with SMTP id 3908045E13 for ; Thu, 14 Jan 2021 12:11:29 +0000 (UTC) Received: (qmail 45207 invoked by uid 500); 14 Jan 2021 12:11:28 -0000 Mailing-List: contact commits-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@lucene.apache.org Delivered-To: mailing list commits@lucene.apache.org Received: (qmail 45198 invoked by uid 99); 14 Jan 2021 12:11:28 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jan 2021 12:11:28 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id A1318820F7; Thu, 14 Jan 2021 12:11:28 +0000 (UTC) Date: Thu, 14 Jan 2021 12:11:27 +0000 To: "commits@lucene.apache.org" Subject: [lucene-solr] branch jira/solr-15055-2 updated: SOLR-15055: Fix the replica count verification. MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <161062628710.6577.8001995261840656850@gitbox.apache.org> From: ab@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: lucene-solr X-Git-Refname: refs/heads/jira/solr-15055-2 X-Git-Reftype: branch X-Git-Oldrev: 7b8baefda09bdceceb3c68a2075b8cd10a69140f X-Git-Newrev: e296eb020d48f3e1cc84d75d72d420bb15e61057 X-Git-Rev: e296eb020d48f3e1cc84d75d72d420bb15e61057 X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. ab pushed a commit to branch jira/solr-15055-2 in repository https://gitbox.apache.org/repos/asf/lucene-solr.git The following commit(s) were added to refs/heads/jira/solr-15055-2 by this push: new e296eb0 SOLR-15055: Fix the replica count verification. e296eb0 is described below commit e296eb020d48f3e1cc84d75d72d420bb15e61057 Author: Andrzej Bialecki AuthorDate: Thu Jan 14 13:10:50 2021 +0100 SOLR-15055: Fix the replica count verification. --- .../plugins/AffinityPlacementFactory.java | 29 +++++++++++++--------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/solr/core/src/java/org/apache/solr/cluster/placement/plugins/AffinityPlacementFactory.java b/solr/core/src/java/org/apache/solr/cluster/placement/plugins/AffinityPlacementFactory.java index 799562e..ad75053 100644 --- a/solr/core/src/java/org/apache/solr/cluster/placement/plugins/AffinityPlacementFactory.java +++ b/solr/core/src/java/org/apache/solr/cluster/placement/plugins/AffinityPlacementFactory.java @@ -30,6 +30,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.lang.invoke.MethodHandles; import java.util.*; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; @@ -265,6 +266,14 @@ public class AffinityPlacementFactory implements PlacementPluginFactory> secondaryNodeShardReplicas = new HashMap<>(); + secondaryCollection.shards().forEach(shard -> + shard.replicas().forEach(replica -> { + secondaryNodeShardReplicas.computeIfAbsent(replica.getNode(), n -> new HashMap<>()) + .computeIfAbsent(replica.getShard().getShardName(), s -> new AtomicInteger()) + .incrementAndGet(); + })); + // find the colocated-with collections Cluster cluster = placementContext.getCluster(); Set colocatedCollections = new HashSet<>(); @@ -301,18 +310,14 @@ public class AffinityPlacementFactory implements PlacementPluginFactory 1) { + // we can delete it - record the deletion + secondaryCount.decrementAndGet(); + continue; } // fail - this replica cannot be removed if (exception == null) {