John Wooden created SOLR-14326:
----------------------------------

             Summary: Number of tlog replicas off by one when restoring 
collections
                 Key: SOLR-14326
                 URL: https://issues.apache.org/jira/browse/SOLR-14326
             Project: Solr
          Issue Type: Bug
      Security Level: Public (Default Security Level. Issues are Public)
          Components: Backup/Restore
    Affects Versions: 8.0, 7.7.2
            Reporter: John Wooden


When making a request to restore a collection, the quantity of tlog replicas 
will always be off by one when restoring a collection that doesn't contain nrt 
replicas or when specifying the quantity of replicas in the request itself.
{quote}/admin/collections?action=RESTORE&name=<NAME>&location=<PATH>&collection=<COLLECTION>&tlogReplicas=1&pullReplicas=1
{quote}
Despite the backup AND/OR the request specifying 1 Tlog & 1 Pull replica, this 
request will create 2 Tlog replicas. On a 2-node cluster with 
maxShardsPerNode=1, the 1 pull replica is never created due to the excess tlog 
replica meeting the maxShardsPerNode limit.

 

This is due to a flawed comparison where an int meant to be an iterator for 
tlog replicas is checked if it is greater than zero, however, since that 
variable was initialized as 0 just prior it will never be greater than zero. 
The fix is to compare the _desired_ number of tlog replicas (like nrt) rather 
than the iterator.

 
{quote}int createdNrtReplicas = 0, {color:#de350b}createdTlogReplicas = 
0{color}, createdPullReplicas = 0;

// We already created either a NRT or an TLOG replica as leader
 if (numNrtReplicas > 0) {
 createdNrtReplicas++;
 } else if ({color:#de350b}createdTlogReplicas > 0{color}) {
 createdTlogReplicas++;
 }
{quote}
 

 

 

 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to