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 (apache#1869)

Signed-off-by: ramkrish86 <[email protected]>
  • Loading branch information
virajjasani authored and clarax committed Nov 15, 2020
1 parent 89f3fbc commit 587be80
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1200,15 +1200,15 @@ private void finishActiveMasterInitialization(MonitoredTask status)
* 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 @@ -1241,7 +1241,7 @@ private boolean isRegionOnline(RegionInfo ri) throws InterruptedException {
* @return True if namespace table is up/online.
*/
@VisibleForTesting
public boolean waitForNamespaceOnline() throws InterruptedException {
public boolean waitForNamespaceOnline() {
List<RegionInfo> ris = this.assignmentManager.getRegionStates().
getRegionsOfTable(TableName.NAMESPACE_TABLE_NAME);
if (ris.isEmpty()) {
Expand All @@ -1251,7 +1251,9 @@ public boolean waitForNamespaceOnline() throws InterruptedException {
}
// 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 587be80

Please sign in to comment.