hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From la...@apache.org
Subject svn commit: r1504661 - in /hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver: ReplicationSource.java ReplicationSourceManager.java
Date Thu, 18 Jul 2013 21:09:44 GMT
Author: larsh
Date: Thu Jul 18 21:09:43 2013
New Revision: 1504661

URL: http://svn.apache.org/r1504661
Log:
HBASE-8599 HLogs in ZK are not cleaned up when replication lag is minimal (Varun Sharma)

Modified:
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
    hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java?rev=1504661&r1=1504660&r2=1504661&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
Thu Jul 18 21:09:43 2013
@@ -282,6 +282,10 @@ public class ReplicationSource extends T
           sleepMultiplier++;
         }
         continue;
+      } else if (oldPath != null && !oldPath.getName().equals(getCurrentPath().getName()))
{
+        this.manager.cleanOldLogs(getCurrentPath().getName(),
+                                  this.peerId,
+                                  this.replicationQueueInfo.isQueueRecovered());
       }
       boolean currentWALisBeingWrittenTo = false;
       //For WAL files we own (rather than recovered), take a snapshot of whether the

Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java?rev=1504661&r1=1504660&r2=1504661&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
(original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
Thu Jul 18 21:09:43 2013
@@ -155,15 +155,29 @@ public class ReplicationSourceManager {
     if (holdLogInZK) {
      return;
     }
+    cleanOldLogs(key, id, queueRecovered);
+  }
+
+  /**
+   * Cleans a log file and all older files from ZK. Called when we are sure that a
+   * log file is closed and has no more entries.
+   * @param key Path to the log
+   * @param id id of the peer cluster
+   * @param queueRecovered Whether this is a recovered queue
+   */
+  public void cleanOldLogs(String key,
+                           String id,
+                           boolean queueRecovered) {
     synchronized (this.hlogsById) {
       SortedSet<String> hlogs = this.hlogsById.get(id);
-      if (!queueRecovered && !hlogs.first().equals(key)) {
-        SortedSet<String> hlogSet = hlogs.headSet(key);
-        for (String hlog : hlogSet) {
-          this.zkHelper.removeLogFromList(hlog, id);
-        }
-        hlogSet.clear();
+      if (queueRecovered || hlogs.first().equals(key)) {
+        return;
+      }
+      SortedSet<String> hlogSet = hlogs.headSet(key);
+      for (String hlog : hlogSet) {
+        this.zkHelper.removeLogFromList(hlog, id);
       }
+      hlogSet.clear();
     }
   }
 



Mime
View raw message