Skip to content

Commit

Permalink
HBASE-24518 : waitForNamespaceOnline() should return false if any reg…
Browse files Browse the repository at this point in the history
…ion is offline (#1869)

Signed-off-by: ramkrish86 <[email protected]>
  • Loading branch information
virajjasani authored Jun 17, 2020
1 parent b17ba7b commit 192dade
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1226,15 +1226,15 @@ private void finishActiveMasterInitialization(MonitoredTask status) throws IOExc
* and we will hold here until operator intervention.
*/
@VisibleForTesting
public boolean waitForMetaOnline() throws InterruptedException {
public boolean waitForMetaOnline() {
return isRegionOnline(RegionInfoBuilder.FIRST_META_REGIONINFO);
}

/**
* @return True if region is online and scannable else false if an error or shutdown (Otherwise
* we just block in here holding up all forward-progess).
*/
private boolean isRegionOnline(RegionInfo ri) throws InterruptedException {
private boolean isRegionOnline(RegionInfo ri) {
RetryCounter rc = null;
while (!isStopped()) {
RegionState rs = this.assignmentManager.getRegionStates().getRegionState(ri);
Expand Down Expand Up @@ -1265,16 +1265,16 @@ private boolean isRegionOnline(RegionInfo ri) throws InterruptedException {
* Check hbase:namespace table is assigned. If not, startup will hang looking for the ns table
* <p/>
* This is for rolling upgrading, later we will migrate the data in ns table to the ns family of
* meta table. And if this is a new clsuter, this method will return immediately as there will be
* meta table. And if this is a new cluster, this method will return immediately as there will be
* no namespace table/region.
* @return True if namespace table is up/online.
*/
private boolean waitForNamespaceOnline() throws InterruptedException, IOException {
private boolean waitForNamespaceOnline() throws IOException {
TableState nsTableState =
MetaTableAccessor.getTableState(getConnection(), TableName.NAMESPACE_TABLE_NAME);
if (nsTableState == null || nsTableState.isDisabled()) {
// this means we have already migrated the data and disabled or deleted the namespace table,
// or this is a new depliy which does not have a namespace table from the beginning.
// or this is a new deploy which does not have a namespace table from the beginning.
return true;
}
List<RegionInfo> ris =
Expand All @@ -1285,7 +1285,9 @@ private boolean waitForNamespaceOnline() throws InterruptedException, IOExceptio
}
// Else there are namespace regions up in meta. Ensure they are assigned before we go on.
for (RegionInfo ri : ris) {
isRegionOnline(ri);
if (!isRegionOnline(ri)) {
return false;
}
}
return true;
}
Expand Down

0 comments on commit 192dade

Please sign in to comment.