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

[AMv2] EnableTableProcedure is not retaining the assignments

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.0.0-alpha-3
    • Fix Version/s: 2.0.0-beta-1, 2.0.0
    • Component/s: Region Assignment
    • Labels:
      None
    • Hadoop Flags:
      Reviewed

      Description

      Found this while working on HBASE-18946. In branch-1.4 when ever we do enable table we try retain assignment.
      But in branch-2 and trunk the EnableTableProcedure tries to get the location from the existing regionNode. It always returns null because while doing region CLOSE while disabling a table, the regionNode's 'regionLocation' is made NULL but the 'lastHost' is actually having the servername where the region was hosted. But on trying assignment again we try to see what was the last RegionLocation and not the 'lastHost' and we go ahead with new assignment.
      On region CLOSE while disable table

      public void markRegionAsClosed(final RegionStateNode regionNode) throws IOException {
          final RegionInfo hri = regionNode.getRegionInfo();
          synchronized (regionNode) {
            State state = regionNode.transitionState(State.CLOSED, RegionStates.STATES_EXPECTED_ON_CLOSE);
            regionStates.removeRegionFromServer(regionNode.getRegionLocation(), regionNode);
            regionNode.setLastHost(regionNode.getRegionLocation());
            regionNode.setRegionLocation(null);
            regionStateStore.updateRegionLocation(regionNode.getRegionInfo(), state,
              regionNode.getRegionLocation()/*null*/, regionNode.getLastHost(),
              HConstants.NO_SEQNUM, regionNode.getProcedure().getProcId());
            sendRegionClosedNotification(hri);
          }
      

      In AssignProcedure

          ServerName lastRegionLocation = regionNode.offline();
      
      public ServerName setRegionLocation(final ServerName serverName) {
            ServerName lastRegionLocation = this.regionLocation;
            if (LOG.isTraceEnabled() && serverName == null) {
              LOG.trace("Tracking when we are set to null " + this, new Throwable("TRACE"));
            }
            this.regionLocation = serverName;
            this.lastUpdate = EnvironmentEdgeManager.currentTime();
            return lastRegionLocation;
          }
      

      So further code in AssignProcedure

       boolean retain = false;
          if (!forceNewPlan) {
            if (this.targetServer != null) {
              retain = targetServer.equals(lastRegionLocation);
              regionNode.setRegionLocation(targetServer);
            } else {
              if (lastRegionLocation != null) {
                // Try and keep the location we had before we offlined.
                retain = true;
                regionNode.setRegionLocation(lastRegionLocation);
              }
            }
          }
      

      Tries to do retainAssignment but fails because lastRegionLocation is always null.

        Attachments

        1. HBASE-19017.patch
          9 kB
          ramkrishna.s.vasudevan

          Activity

            People

            • Assignee:
              ram_krish ramkrishna.s.vasudevan
              Reporter:
              ram_krish ramkrishna.s.vasudevan
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: