ramkrishna.s.vasudevan created HBASE-19017:
----------------------------------------------

             Summary: EnableTableProcedure is not retaining the assignments
                 Key: HBASE-19017
                 URL: https://issues.apache.org/jira/browse/HBASE-19017
             Project: HBase
          Issue Type: Bug
          Components: Region Assignment
    Affects Versions: 2.0.0-alpha-3
            Reporter: ramkrishna.s.vasudevan
            Assignee: ramkrishna.s.vasudevan
             Fix For: 2.0.0-beta-1


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 'lastNode' 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 'lastNode' and we go ahead with new assignment.
On region CLOSE while disable table
{code}
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);
    }
{code}

In AssignProcedure
{code}
    ServerName lastRegionLocation = regionNode.offline();
{code}
{code}
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;
    }
{code}
So further code in AssignProcedure
{code}
 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);
        }
      }
    }
{code}
Tries to do retainAssignment but fails because lastRegionLocation is always 
null.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to