Uploaded image for project: 'HBase'
  1. HBase
  2. HBASE-12762

Region with no hfiles will have the highest locality cost in LocalityCostFunction

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 0.99.2
    • 1.0.0, 0.98.10, 1.1.0
    • Balancer
    • None
    • Reviewed

    Description

      The locality cost of region will be computed in LocalityCostFunction.cost as:

      double cost() {
              ...
              int index = -1;
              for (int j = 0; j < regionLocations.length; j++) {
                if (regionLocations[j] >= 0 && regionLocations[j] == serverIndex) {
                  index = j;
                  break;
                }
              }
      
              if (index < 0) {
                cost += 1;  // ==> region with no hfiles will have the highest cost
              } else {
                cost += (double) index / (double) regionLocations.length;
              }
              ...
          }
      

      The region with no hfiles(such as empty region) will have the highest cost which represents the worst case that region located in the server with no locality for hfiles. However, this might be the best case because there are no hlogs for the region. Although the absolute cost value won't affect the balance process, will it be more reasonable to have zero cost for such regions? such as:

         ...
              if (index < 0) {
                if (regionLocation.length > 0) { //  ==> only consider regions with hfiles
                    cost += 1;
                }
              } else {
                cost += (double) index / (double) regionLocations.length;
              }
         ...
      

      Attachments

        1. HBASE-12762-trunk.patch
          0.7 kB
          Jianwei Cui

        Activity

          People

            cuijianwei Jianwei Cui
            cuijianwei Jianwei Cui
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: