From 3641e7a97d1d6f460a8264fb989c821caf70bad5 Mon Sep 17 00:00:00 2001 From: Sergey Shelukhin Date: Fri, 10 May 2019 15:36:07 -0700 Subject: [PATCH] HBASE-22376 master can fail to start w/NPE if lastflushedseqids file is empty Signed-off-by: Peter Somogyi --- .../src/main/java/org/apache/hadoop/hbase/master/HMaster.java | 2 +- .../java/org/apache/hadoop/hbase/master/ServerManager.java | 4 ++++ 2 files changed, 5 insertions(+), 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 faa5c7dd560..8eb8a481dab 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 @@ -1007,7 +1007,7 @@ public class HMaster extends HRegionServer implements MasterServices { try { this.serverManager.loadLastFlushedSequenceIds(); } catch (IOException e) { - LOG.debug("Failed to load last flushed sequence id of regions" + LOG.info("Failed to load last flushed sequence id of regions" + " from file system", e); } // Set ourselves as active Master now our claim has succeeded up in zk. diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java index 0fb1551792e..88edb79d794 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/ServerManager.java @@ -1126,6 +1126,10 @@ public class ServerManager { try { FlushedSequenceId flushedSequenceId = FlushedSequenceId.parseDelimitedFrom(in); + if (flushedSequenceId == null) { + LOG.info(".lastflushedseqids found at {} is empty", lastFlushedSeqIdPath); + return; + } for (FlushedRegionSequenceId flushedRegionSequenceId : flushedSequenceId .getRegionSequenceIdList()) { byte[] encodedRegionName = flushedRegionSequenceId