Author: jdcryans
Date: Thu Mar 17 23:45:38 2011
New Revision: 1082752
URL: http://svn.apache.org/viewvc?rev=1082752&view=rev
Log:
HBASE-3664 [replication] Adding a slave when there's none may kill the cluster
Modified:
hbase/trunk/CHANGES.txt
hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
Modified: hbase/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1082752&r1=1082751&r2=1082752&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Thu Mar 17 23:45:38 2011
@@ -145,6 +145,7 @@ Release 0.90.2 - Unreleased
HBASE-3650 HBA.delete can return too fast
HBASE-3659 Fix TestHLog to pass on newer versions of Hadoop
HBASE-3595 get_counter broken in shell
+ HBASE-3664 [replication] Adding a slave when there's none may kill the
cluster
IMPROVEMENTS
HBASE-3542 MultiGet methods in Thrift
Modified:
hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
URL:
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java?rev=1082752&r1=1082751&r2=1082752&view=diff
==============================================================================
---
hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
(original)
+++
hbase/trunk/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java
Thu Mar 17 23:45:38 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;