You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by la...@apache.org on 2013/12/17 06:42:05 UTC
svn commit: r1551462 - in
/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver:
ReplicationSource.java ReplicationSourceManager.java
Author: larsh
Date: Tue Dec 17 05:42:05 2013
New Revision: 1551462
URL: http://svn.apache.org/r1551462
Log:
HBASE-9047 Tool to handle finishing replication when the cluster is offline (Demai Ni)
Modified:
hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java?rev=1551462&r1=1551461&r2=1551462&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java (original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java Tue Dec 17 05:42:05 2013
@@ -498,6 +498,26 @@ public class ReplicationSource extends T
}
}
}
+ // In the case of disaster/recovery, HMaster may be shutdown/crashed before flush data
+ // from .logs to .oldlogs. Loop into .logs folders and check whether a match exists
+ if (stopper instanceof ReplicationSyncUp.DummyServer) {
+ FileStatus[] rss = fs.listStatus(manager.getLogDir());
+ for (FileStatus rs : rss) {
+ Path p = rs.getPath();
+ FileStatus[] logs = fs.listStatus(p);
+ for (FileStatus log : logs) {
+ p = new Path(p, log.getPath().getName());
+ if (p.getName().equals(currentPath.getName())) {
+ currentPath = p;
+ LOG.info("Log " + this.currentPath + " exists under " + manager.getLogDir());
+ // Open the log at the new location
+ this.openReader(sleepMultiplier);
+ return true;
+ }
+ }
+ }
+ }
+
// TODO What happens if the log was missing from every single location?
// Although we need to check a couple of times as the log could have
// been moved by the master between the checks
Modified: hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java?rev=1551462&r1=1551461&r2=1551462&view=diff
==============================================================================
--- hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java (original)
+++ hbase/branches/0.96/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java Tue Dec 17 05:42:05 2013
@@ -285,6 +285,14 @@ public class ReplicationSourceManager im
return this.sources;
}
+ /**
+ * Get a list of all the old sources of this rs
+ * @return list of all old sources
+ */
+ public List<ReplicationSourceInterface> getOldSources() {
+ return this.oldsources;
+ }
+
void preLogRoll(Path newLog) throws IOException {
synchronized (this.hlogsById) {