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

rsgroup cleanup unassign code

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • None
    • 1.4.0, 2.0.0
    • rsgroup
    • None
    • Reviewed

    Description

      While walking through rsgroup code, I found that variable misplacedRegions has never been added any element into. This makes the unassign region code is not functional. And according to my test, it is actually unnecessary to do that.

      RSGroupBasedLoadBalancer.java

      private Map<ServerName, List<HRegionInfo>> correctAssignments(
             Map<ServerName, List<HRegionInfo>> existingAssignments)
        throws HBaseIOException{
          Map<ServerName, List<HRegionInfo>> correctAssignments = new TreeMap<>();
          List<HRegionInfo> misplacedRegions = new LinkedList<>();
          correctAssignments.put(LoadBalancer.BOGUS_SERVER_NAME, new LinkedList<>());
          for (Map.Entry<ServerName, List<HRegionInfo>> assignments : existingAssignments.entrySet()){
            ServerName sName = assignments.getKey();
            correctAssignments.put(sName, new LinkedList<>());
            List<HRegionInfo> regions = assignments.getValue();
            for (HRegionInfo region : regions) {
              RSGroupInfo info = null;
              try {
                info = rsGroupInfoManager.getRSGroup(
                    rsGroupInfoManager.getRSGroupOfTable(region.getTable()));
              } catch (IOException exp) {
                LOG.debug("RSGroup information null for region of table " + region.getTable(),
                    exp);
              }
              if ((info == null) || (!info.containsServer(sName.getAddress()))) {
                correctAssignments.get(LoadBalancer.BOGUS_SERVER_NAME).add(region);
              } else {
                correctAssignments.get(sName).add(region);
              }
            }
          }
      
          //TODO bulk unassign?
          //unassign misplaced regions, so that they are assigned to correct groups.
          for(HRegionInfo info: misplacedRegions) {
            try {
              this.masterServices.getAssignmentManager().unassign(info);
            } catch (IOException e) {
              throw new HBaseIOException(e);
            }
          }
          return correctAssignments;
        }
      

      Attachments

        1. HBASE-18602-master-v4.patch
          3 kB
          Wang, Xinglong
        2. HBASE-18602-master-v3.patch
          1 kB
          Chia-Ping Tsai
        3. HBASE-18602-master-v3.patch
          1 kB
          Chia-Ping Tsai
        4. HBASE-18602-master-v3.patch
          1 kB
          Wang, Xinglong
        5. HBASE-18602-master-v2.patch
          1 kB
          Wang, Xinglong
        6. HBASE-18602-master-v1.patch
          1 kB
          Wang, Xinglong

        Issue Links

          Activity

            People

              suxingfate Wang, Xinglong
              suxingfate Wang, Xinglong
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: