HBASE-21425 2.1.1 fails to start over 1.x data; namespace not assigned
This commit is contained in:
parent
46eb8f1d0d
commit
8df5878932
|
@ -1001,6 +1001,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 =
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -1215,8 +1215,6 @@ public class AssignmentManager implements ServerListener {
|
|||
}
|
||||
LOG.info("Number of RegionServers={}", master.getServerManager().countOfRegionServers());
|
||||
|
||||
processOfflineRegions();
|
||||
|
||||
// Start the RIT chore
|
||||
master.getMasterProcedureExecutor().addChore(this.ritChore);
|
||||
|
||||
|
@ -1224,14 +1222,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());
|
||||
|
|
Loading…
Reference in New Issue