Index: src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java (revision 1082198) +++ src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSourceManager.java (working copy) @@ -228,12 +228,16 @@ 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;