You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by te...@apache.org on 2018/10/06 19:52:08 UTC
hbase git commit: HBASE-21219 Hbase incremental backup fails with
null pointer exception
Repository: hbase
Updated Branches:
refs/heads/master e42741e08 -> 5da0c2010
HBASE-21219 Hbase incremental backup fails with null pointer exception
Signed-off-by: tedyu <yu...@gmail.com>
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/5da0c201
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/5da0c201
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/5da0c201
Branch: refs/heads/master
Commit: 5da0c2010b39899faf84e20d9125a23823439875
Parents: e42741e
Author: Vladimir Rodionov <vr...@hortonworks.com>
Authored: Mon Sep 24 17:28:26 2018 -0700
Committer: tedyu <yu...@gmail.com>
Committed: Sat Oct 6 12:51:12 2018 -0700
----------------------------------------------------------------------
.../backup/impl/IncrementalBackupManager.java | 19 +++++++++++++++----
1 file changed, 15 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/5da0c201/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalBackupManager.java
----------------------------------------------------------------------
diff --git a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalBackupManager.java b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalBackupManager.java
index 3eebf42..853f458 100644
--- a/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalBackupManager.java
+++ b/hbase-backup/src/main/java/org/apache/hadoop/hbase/backup/impl/IncrementalBackupManager.java
@@ -296,9 +296,20 @@ public class IncrementalBackupManager extends BackupManager {
currentLogFile = log.getPath().toString();
resultLogFiles.add(currentLogFile);
currentLogTS = BackupUtils.getCreationTime(log.getPath());
- // newestTimestamps is up-to-date with the current list of hosts
- // so newestTimestamps.get(host) will not be null.
- if (currentLogTS > newestTimestamps.get(host)) {
+
+ // If newestTimestamps.get(host) is null, means that
+ // either RS (host) has been restarted recently with different port number
+ // or RS is down (was decommisioned). In any case, we treat this
+ // log file as eligible for inclusion into incremental backup log list
+ Long ts = newestTimestamps.get(host);
+ if (ts == null) {
+ LOG.warn("ORPHAN log found: " + log + " host=" + host);
+ LOG.debug("Known hosts (from newestTimestamps):");
+ for (String s: newestTimestamps.keySet()) {
+ LOG.debug(s);
+ }
+ }
+ if (ts == null || currentLogTS > ts) {
newestLogs.add(currentLogFile);
}
}
@@ -343,7 +354,7 @@ public class IncrementalBackupManager extends BackupManager {
// Even if these logs belong to a obsolete region server, we still need
// to include they to avoid loss of edits for backup.
Long newTimestamp = newestTimestamps.get(host);
- if (newTimestamp != null && currentLogTS > newTimestamp) {
+ if (newTimestamp == null || currentLogTS > newTimestamp) {
newestLogs.add(currentLogFile);
}
}