This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch branch-2.5
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-2.5 by this push:
     new b955b89d3a2 HBASE-28109 NPE for the region state: Failed to become 
active master (HMaster) (#5432)
b955b89d3a2 is described below

commit b955b89d3a2a8f3d5aed313ba461efd17d5d4680
Author: Ke Han <38852697+hanke...@users.noreply.github.com>
AuthorDate: Sat Oct 7 02:50:24 2023 -0400

    HBASE-28109 NPE for the region state: Failed to become active master 
(HMaster) (#5432)
    
    The RegionState for meta region could be null for a fresh new cluster, we 
should also wait a bit to let it finish the initialization.
    
    Signed-off-by: Duo Zhang <zhang...@apache.org>
    (cherry picked from commit 865a59547b3058100c834a28b29ea3e10839f8e3)
---
 hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java 
b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
index f8a64908783..c3e44cc65b9 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java
@@ -1336,7 +1336,7 @@ public class HMaster extends HRegionServer implements 
MasterServices {
     RetryCounter rc = null;
     while (!isStopped()) {
       RegionState rs = 
this.assignmentManager.getRegionStates().getRegionState(ri);
-      if (rs.isOpened()) {
+      if (rs != null && rs.isOpened()) {
         if (this.getServerManager().isServerOnline(rs.getServerName())) {
           return true;
         }

Reply via email to