makosten commented on a change in pull request #288: URL: https://github.com/apache/solr/pull/288#discussion_r743107726
########## File path: solr/core/src/java/org/apache/solr/update/processor/DistributedZkUpdateProcessor.java ########## @@ -316,6 +317,41 @@ public void processDelete(DeleteUpdateCommand cmd) throws IOException { protected void doDeleteById(DeleteUpdateCommand cmd) throws IOException { setupRequest(cmd); + if (broadcastDeleteById && DistribPhase.parseParam(req.getParams().get(DISTRIB_UPDATE_PARAM)) == DistribPhase.NONE ) { + + log.debug("The deleteById command is missing the required route, broadcasting to leaders of other shards"); + + ModifiableSolrParams outParams = new ModifiableSolrParams(filterParams(req.getParams())); + outParams.set(DISTRIB_UPDATE_PARAM, DistribPhase.TOLEADER.toString()); + outParams.set(DISTRIB_FROM, ZkCoreNodeProps.getCoreUrl( + zkController.getBaseUrl(), req.getCore().getName())); + + SolrParams params = req.getParams(); + String route = params.get(ShardParams._ROUTE_); + DocCollection coll = clusterState.getCollection(collection); + Collection<Slice> slices = coll.getRouter().getSearchSlices(route, params, coll); + + // if just one slice, we can skip this + if (slices.size() > 1) { + List<SolrCmdDistributor.Node> leaders = new ArrayList<>(slices.size() - 1); + for (Slice slice : slices) { + String sliceName = slice.getName(); + if (!sliceName.equals(cloudDesc.getShardId())) { + Replica leader; + try { + leader = zkController.getZkStateReader().getLeaderRetry(collection, sliceName); + } catch (InterruptedException e) { + throw new SolrException(SolrException.ErrorCode.SERVICE_UNAVAILABLE, "Exception finding leader for shard " + sliceName, e); + } + ZkCoreNodeProps coreLeaderProps = new ZkCoreNodeProps(leader); + leaders.add(new SolrCmdDistributor.ForwardNode(coreLeaderProps, zkController.getZkStateReader(), collection, sliceName, maxRetriesOnForward)); + } + } + outParams.remove("commit"); // this will be distributed from the local commit + cmdDistrib.distribDelete(cmd, leaders, outParams, false, rollupReplicationTracker, null); + } + } + // check if client has requested minimum replication factor information. will set replicationTracker to null if // we aren't the leader or subShardLeader checkReplicationTracker(cmd); Review comment: I added creating the rollup replication tracker before forwarding the delete-by-id to the other shard leaders and saw no behavior difference. The handleReplicationFactor method didn't receive responses from other shard leaders. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org