Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-14326

Number of tlog replicas off by one when restoring collections

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 7.7.2, 8.0
    • 9.0, 8.9
    • Backup/Restore
    • None

    Description

      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.

      /admin/collections?action=RESTORE&name=<NAME>&location=<PATH>&collection=<COLLECTION>&tlogReplicas=1&pullReplicas=1

      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.

       

      int createdNrtReplicas = 0, createdTlogReplicas = 0, createdPullReplicas = 0;

      // We already created either a NRT or an TLOG replica as leader
      if (numNrtReplicas > 0)

      Unknown macro: { createdNrtReplicas++; }

      else if (createdTlogReplicas > 0)

      Unknown macro: { createdTlogReplicas++; }

       

       

       

       

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              jwooden271 John Wooden
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h