HBASE-27068 NPE occurs when the active master has not yet been elected (#4474)

Signed-off-by: Pankaj Kumar <pankajkumar@apache.org>
Signed-off-by: Viraj Jasani<virajjasani@apache.org
This commit is contained in:
litao 2022-06-01 02:49:49 +08:00 committed by GitHub
parent 88d9c4bef4
commit d532135a26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -24,12 +24,13 @@ java.util.*;
org.apache.hadoop.hbase.ServerName;
org.apache.hadoop.hbase.ClusterMetrics;
org.apache.hadoop.hbase.master.HMaster;
org.apache.hbase.thirdparty.com.google.common.base.Preconditions;
</%import>
<%if (!master.isActiveMaster()) %>
<%java>
ServerName active_master = master.getActiveMaster().orElse(null);
assert active_master != null : "Failed to retrieve active master's ServerName!";
int activeInfoPort = active_master == null ? 0 : master.getActiveMasterInfoPort();
Preconditions.checkState(active_master != null, "Failed to retrieve active master's ServerName!");
int activeInfoPort = master.getActiveMasterInfoPort();
</%java>
<div class="row inner_header">
<div class="page-header">