Author: jdcryans
Date: Thu Mar 17 23:45:00 2011
New Revision: 1082751

URL: http://svn.apache.org/viewvc?rev=1082751&view=rev
Log:
HBASE-3664  [replication] Adding a slave when there's none may kill the cluster

Modified:
    hbase/branches/0.90/CHANGES.txt
    
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java

Modified: hbase/branches/0.90/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hbase/branches/0.90/CHANGES.txt?rev=1082751&r1=1082750&r2=1082751&view=diff
==============================================================================
--- hbase/branches/0.90/CHANGES.txt (original)
+++ hbase/branches/0.90/CHANGES.txt Thu Mar 17 23:45:00 2011
@@ -37,6 +37,7 @@ Release 0.90.2 - Unreleased
    HBASE-3595  get_counter broken in shell
    HBASE-3662  REST server does not respect client supplied max versions when
                creating scanner
+   HBASE-3664  [replication] Adding a slave when there's none may kill the 
cluster
 
   IMPROVEMENTS
    HBASE-3542  MultiGet methods in Thrift

Modified: 
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
URL: 
http://svn.apache.org/viewvc/hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java?rev=1082751&r1=1082750&r2=1082751&view=diff
==============================================================================
--- 
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
 (original)
+++ 
hbase/branches/0.90/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
 Thu Mar 17 23:45:00 2011
@@ -228,12 +228,16 @@ public class ReplicationSourceManager {
       LOG.warn("Replication stopped, won't add new log");
       return;
     }
-    
-    if (this.sources.size() > 0) {
-      this.zkHelper.addLogToList(newLog.getName(),
-          this.sources.get(0).getPeerClusterZnode());
-    }
+
     synchronized (this.hlogs) {
+      if (this.sources.size() > 0) {
+        this.zkHelper.addLogToList(newLog.getName(),
+            this.sources.get(0).getPeerClusterZnode());
+      } else {
+        // If there's no slaves, don't need to keep the old hlogs since
+        // we only consider the last one when a new slave comes in
+        this.hlogs.clear();
+      }
       this.hlogs.add(newLog.getName());
     }
     this.latestPath = newLog;


Reply via email to