HBASE-3664 [replication] Adding a slave when there's none may kill the cluster

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1082752 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2011-03-17 23:45:38 +00:00
parent 5997bc3ca5
commit 95661df251
2 changed files with 10 additions and 5 deletions

View File

@ -145,6 +145,7 @@ Release 0.90.2 - Unreleased
HBASE-3650 HBA.delete can return too fast HBASE-3650 HBA.delete can return too fast
HBASE-3659 Fix TestHLog to pass on newer versions of Hadoop HBASE-3659 Fix TestHLog to pass on newer versions of Hadoop
HBASE-3595 get_counter broken in shell HBASE-3595 get_counter broken in shell
HBASE-3664 [replication] Adding a slave when there's none may kill the cluster
IMPROVEMENTS IMPROVEMENTS
HBASE-3542 MultiGet methods in Thrift HBASE-3542 MultiGet methods in Thrift

View File

@ -228,12 +228,16 @@ public class ReplicationSourceManager {
LOG.warn("Replication stopped, won't add new log"); LOG.warn("Replication stopped, won't add new log");
return; return;
} }
if (this.sources.size() > 0) {
this.zkHelper.addLogToList(newLog.getName(),
this.sources.get(0).getPeerClusterZnode());
}
synchronized (this.hlogs) { 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.hlogs.add(newLog.getName());
} }
this.latestPath = newLog; this.latestPath = newLog;