Repository: hbase Updated Branches: refs/heads/branch-2.0 9a9ccf984 -> da630c25e
HBASE-21425 2.1.1 fails to start over 1.x data; namespace not assigned Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/da630c25 Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/da630c25 Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/da630c25 Branch: refs/heads/branch-2.0 Commit: da630c25ea40115ed17de591bd18ab8df44986fb Parents: 9a9ccf9 Author: Michael Stack <[email protected]> Authored: Thu Nov 1 12:58:15 2018 -0700 Committer: Michael Stack <[email protected]> Committed: Sat Nov 3 09:45:09 2018 -0700 ---------------------------------------------------------------------- .../org/apache/hadoop/hbase/master/HMaster.java | 6 ++++++ .../hadoop/hbase/master/TableStateManager.java | 2 +- .../master/assignment/AssignmentManager.java | 22 +++++++++++--------- 3 files changed, 19 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/da630c25/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index 8824bb3..5bab8cc 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -965,6 +965,12 @@ public class HMaster extends HRegionServer implements MasterServices { this.assignmentManager.joinCluster(); // The below depends on hbase:meta being online. this.tableStateManager.start(); + // Below has to happen after tablestatemanager has started in the case where this hbase-2.x + // is being started over an hbase-1.x dataset. tablestatemanager runs a migration as part + // of its 'start' moving table state from zookeeper to hbase:meta. This migration needs to + // complete before we do this next step processing offline regions else it fails reading + // table states messing up master launch (namespace table, etc., are not assigned). + this.assignmentManager.processOfflineRegions(); // Initialize after meta is up as below scans meta if (favoredNodesManager != null && !maintenanceMode) { SnapshotOfRegionAssignmentFromMeta snapshotOfRegionAssignment = http://git-wip-us.apache.org/repos/asf/hbase/blob/da630c25/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableStateManager.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableStateManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableStateManager.java index 6e34618..580e726 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableStateManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/TableStateManager.java @@ -273,7 +273,7 @@ public class TableStateManager { throws IOException { Map<String, TableDescriptor> allDescriptors = tableDescriptors.getAll(); Map<String, TableState> states = new HashMap<>(); - // NOTE: Ful hbase:meta table scan! + // NOTE: Full hbase:meta table scan! MetaTableAccessor.fullScanTables(connection, new MetaTableAccessor.Visitor() { @Override public boolean visit(Result r) throws IOException { http://git-wip-us.apache.org/repos/asf/hbase/blob/da630c25/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java index 1e1ec6f..de8281b 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/AssignmentManager.java @@ -1198,8 +1198,6 @@ public class AssignmentManager implements ServerListener { } LOG.info("Number of RegionServers={}", master.getServerManager().countOfRegionServers()); - processOfflineRegions(); - // Start the RIT chore master.getMasterProcedureExecutor().addChore(this.ritChore); @@ -1207,14 +1205,18 @@ public class AssignmentManager implements ServerListener { LOG.info("Joined the cluster in {}", StringUtils.humanTimeDiff(costMs)); } - // Create assign procedure for offline regions. - // Just follow the old processofflineServersWithOnlineRegions method. Since now we do not need to - // deal with dead server any more, we only deal with the regions in OFFLINE state in this method. - // And this is a bit strange, that for new regions, we will add it in CLOSED state instead of - // OFFLINE state, and usually there will be a procedure to track them. The - // processofflineServersWithOnlineRegions is a legacy from long ago, as things are going really - // different now, maybe we do not need this method any more. Need to revisit later. - private void processOfflineRegions() { + /** + * Create assign procedure for offline regions. + * Just follow the old processofflineServersWithOnlineRegions method. Since now we do not need to + * deal with dead server any more, we only deal with the regions in OFFLINE state in this method. + * And this is a bit strange, that for new regions, we will add it in CLOSED state instead of + * OFFLINE state, and usually there will be a procedure to track them. The + * processofflineServersWithOnlineRegions is a legacy from long ago, as things are going really + * different now, maybe we do not need this method any more. Need to revisit later. + */ + // Public so can be run by the Master as part of the startup. Needs hbase:meta to be online. + // Needs to be done after the table state manager has been started. + public void processOfflineRegions() { List<RegionInfo> offlineRegions = regionStates.getRegionStates().stream() .filter(RegionState::isOffline).filter(s -> isTableEnabled(s.getRegion().getTable())) .map(RegionState::getRegion).collect(Collectors.toList());
