[ https://issues.apache.org/jira/browse/SOLR-14326?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17319550#comment-17319550 ]
John Wooden commented on SOLR-14326: ------------------------------------ The changes merged as part of SOLR-13608 implements the bug fix proposed in this ticket. [https://gitbox.apache.org/repos/asf?p=lucene-solr.git;h=33d16b5] [https://github.com/apache/solr/blame/963a81de14535139a637d901875c25760d14da8a/solr/core/src/java/org/apache/solr/cloud/api/collections/RestoreCmd.java#L498] > 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 > Components: Backup/Restore > Affects Versions: 7.7.2, 8.0 > Reporter: John Wooden > Priority: Minor > Time Spent: 20m > Remaining Estimate: 0h > > 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...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org