[ 
https://issues.apache.org/jira/browse/SOLR-11724?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16436609#comment-16436609
 ] 

Varun Thacker commented on SOLR-11724:
--------------------------------------

Hi Amrit,

Thanks for working on the patch! I like the solution here , seems like the 
right way to solve the problem.

Here's some feedback on the patch:
 # In CdcrReplicatorManager#sendRequestRecoveryToFollowers , the following line 
looks dangerous ( 
[https://docs.oracle.com/javase/7/docs/api/java/util/Map.html#values()] )
 ## 
{code:java}
replicas.remove(slice.getLeader());{code}

 ## Maybe we could add something like this in the inner for loop instead?
{code:java}
if (slice.getLeader().getCoreName().equals(replica.getCoreName())) {
  continue;
}{code}

 ## Do we really need a separate test for this? Maybe in one of the existing 
tests we could increase the target replicationFactor ?
 ## To assert doc counts , we have CdcrTestsUtil#waitForCoresToSync . How about 
something like this instead?
{code:java}
protected static boolean assertShardInSync(String collection, String shard, 
CloudSolrClient client) throws IOException, SolrServerException {
  TimeOut waitTimeOut = new TimeOut(30, TimeUnit.SECONDS, TimeSource.NANO_TIME);
  DocCollection docCollection = 
client.getZkStateReader().getClusterState().getCollection(collection);
  Slice correctSlice = null;
  for (Slice slice : docCollection.getSlices()) {
    if (shard.equals(slice.getName())) {
      correctSlice = slice;
      break;
    }
  }
  assertNotNull(correctSlice);

  long leaderDocCount;
  try (HttpSolrClient leaderClient = new 
HttpSolrClient.Builder(correctSlice.getLeader().getCoreUrl()).withHttpClient(client.getHttpClient()).build())
 {
    leaderDocCount = leaderClient.query(new 
SolrQuery("*:*").setParam("distrib", "false")).getResults().getNumFound();
  }

  while (!waitTimeOut.hasTimedOut()) {
    int replicasInSync = 0;
    for (Replica replica : correctSlice.getReplicas()) {
      try (HttpSolrClient leaderClient = new 
HttpSolrClient.Builder(replica.getCoreUrl()).withHttpClient(client.getHttpClient()).build())
 {
        long replicaDocCount = leaderClient.query(new 
SolrQuery("*:*").setParam("distrib", "false")).getResults().getNumFound();
        if (replicaDocCount == leaderDocCount) replicasInSync++;
      }
    }
    if (replicasInSync == correctSlice.getReplicas().size()) {
      return true;
    }
  }
  return false;
}{code}

> Cdcr Bootstrapping does not cause "index copying" to follower nodes on Target
> -----------------------------------------------------------------------------
>
>                 Key: SOLR-11724
>                 URL: https://issues.apache.org/jira/browse/SOLR-11724
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: CDCR
>    Affects Versions: 7.1
>            Reporter: Amrit Sarkar
>            Assignee: Varun Thacker
>            Priority: Major
>         Attachments: SOLR-11724.patch, SOLR-11724.patch, SOLR-11724.patch, 
> SOLR-11724.patch, SOLR-11724.patch
>
>
> Please find the discussion on:
> http://lucene.472066.n3.nabble.com/Issue-with-CDCR-bootstrapping-in-Solr-7-1-td4365258.html
> If we index significant documents in to Source, stop indexing and then start 
> CDCR; bootstrapping only copies the index to leader node of shards of the 
> collection, and followers never receive the documents / index until and 
> unless atleast one document is inserted again on source; which propels to 
> target and target collection trigger index replication to followers.
> This behavior needs to be addressed in proper manner, either at target 
> collection or while bootstrapping.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

Reply via email to