HBASE-22376 master can fail to start w/NPE if lastflushedseqids file is empty

Signed-off-by: Peter Somogyi <psomogyi@apache.org>
This commit is contained in:
Sergey Shelukhin 2019-05-10 15:36:07 -07:00
parent 420fbba6ae
commit 3641e7a97d
2 changed files with 5 additions and 1 deletions

View File

@ -1007,7 +1007,7 @@ public class HMaster extends HRegionServer implements MasterServices {
try { try {
this.serverManager.loadLastFlushedSequenceIds(); this.serverManager.loadLastFlushedSequenceIds();
} catch (IOException e) { } 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); + " from file system", e);
} }
// Set ourselves as active Master now our claim has succeeded up in zk. // Set ourselves as active Master now our claim has succeeded up in zk.

View File

@ -1126,6 +1126,10 @@ public class ServerManager {
try { try {
FlushedSequenceId flushedSequenceId = FlushedSequenceId flushedSequenceId =
FlushedSequenceId.parseDelimitedFrom(in); FlushedSequenceId.parseDelimitedFrom(in);
if (flushedSequenceId == null) {
LOG.info(".lastflushedseqids found at {} is empty", lastFlushedSeqIdPath);
return;
}
for (FlushedRegionSequenceId flushedRegionSequenceId : flushedSequenceId for (FlushedRegionSequenceId flushedRegionSequenceId : flushedSequenceId
.getRegionSequenceIdList()) { .getRegionSequenceIdList()) {
byte[] encodedRegionName = flushedRegionSequenceId byte[] encodedRegionName = flushedRegionSequenceId