HBASE-21425 2.1.1 fails to start over 1.x data; namespace not assigned
This commit is contained in:
parent
62fe365934
commit
d08990c962
|
@ -1081,6 +1081,12 @@ public class HMaster extends HRegionServer implements MasterServices {
|
||||||
this.assignmentManager.joinCluster();
|
this.assignmentManager.joinCluster();
|
||||||
// The below depends on hbase:meta being online.
|
// The below depends on hbase:meta being online.
|
||||||
this.tableStateManager.start();
|
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
|
// Initialize after meta is up as below scans meta
|
||||||
if (favoredNodesManager != null && !maintenanceMode) {
|
if (favoredNodesManager != null && !maintenanceMode) {
|
||||||
SnapshotOfRegionAssignmentFromMeta snapshotOfRegionAssignment =
|
SnapshotOfRegionAssignmentFromMeta snapshotOfRegionAssignment =
|
||||||
|
|
|
@ -273,7 +273,7 @@ public class TableStateManager {
|
||||||
throws IOException {
|
throws IOException {
|
||||||
Map<String, TableDescriptor> allDescriptors = tableDescriptors.getAll();
|
Map<String, TableDescriptor> allDescriptors = tableDescriptors.getAll();
|
||||||
Map<String, TableState> states = new HashMap<>();
|
Map<String, TableState> states = new HashMap<>();
|
||||||
// NOTE: Ful hbase:meta table scan!
|
// NOTE: Full hbase:meta table scan!
|
||||||
MetaTableAccessor.fullScanTables(connection, new MetaTableAccessor.Visitor() {
|
MetaTableAccessor.fullScanTables(connection, new MetaTableAccessor.Visitor() {
|
||||||
@Override
|
@Override
|
||||||
public boolean visit(Result r) throws IOException {
|
public boolean visit(Result r) throws IOException {
|
||||||
|
|
|
@ -1264,8 +1264,6 @@ public class AssignmentManager implements ServerListener {
|
||||||
}
|
}
|
||||||
LOG.info("Number of RegionServers={}", master.getServerManager().countOfRegionServers());
|
LOG.info("Number of RegionServers={}", master.getServerManager().countOfRegionServers());
|
||||||
|
|
||||||
processOfflineRegions();
|
|
||||||
|
|
||||||
// Start the RIT chore
|
// Start the RIT chore
|
||||||
master.getMasterProcedureExecutor().addChore(this.ritChore);
|
master.getMasterProcedureExecutor().addChore(this.ritChore);
|
||||||
|
|
||||||
|
@ -1273,14 +1271,18 @@ public class AssignmentManager implements ServerListener {
|
||||||
LOG.info("Joined the cluster in {}", StringUtils.humanTimeDiff(costMs));
|
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
|
* Create assign procedure for offline regions.
|
||||||
// deal with dead server any more, we only deal with the regions in OFFLINE state in this method.
|
* Just follow the old processofflineServersWithOnlineRegions method. Since now we do not need to
|
||||||
// And this is a bit strange, that for new regions, we will add it in CLOSED state instead of
|
* deal with dead server any more, we only deal with the regions in OFFLINE state in this method.
|
||||||
// OFFLINE state, and usually there will be a procedure to track them. The
|
* And this is a bit strange, that for new regions, we will add it in CLOSED state instead of
|
||||||
// processofflineServersWithOnlineRegions is a legacy from long ago, as things are going really
|
* OFFLINE state, and usually there will be a procedure to track them. The
|
||||||
// different now, maybe we do not need this method any more. Need to revisit later.
|
* processofflineServersWithOnlineRegions is a legacy from long ago, as things are going really
|
||||||
private void processOfflineRegions() {
|
* 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()
|
List<RegionInfo> offlineRegions = regionStates.getRegionStates().stream()
|
||||||
.filter(RegionState::isOffline).filter(s -> isTableEnabled(s.getRegion().getTable()))
|
.filter(RegionState::isOffline).filter(s -> isTableEnabled(s.getRegion().getTable()))
|
||||||
.map(RegionState::getRegion).collect(Collectors.toList());
|
.map(RegionState::getRegion).collect(Collectors.toList());
|
||||||
|
|
Loading…
Reference in New Issue