Index: src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java (revision 1522746) +++ src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java (working copy) @@ -350,8 +350,6 @@ sleepMultiplier++; } continue; - } else if (oldPath != null && !oldPath.getName().equals(getCurrentPath().getName())) { - this.manager.cleanOldLogs(getCurrentPath().getName(), this.peerId, this.queueRecovered); } boolean currentWALisBeingWrittenTo = false; //For WAL files we own (rather than recovered), take a snapshot of whether the @@ -552,6 +550,11 @@ if (this.currentPath == null) { this.currentPath = queue.poll(this.sleepForRetries, TimeUnit.MILLISECONDS); this.metrics.sizeOfLogQueue.set(queue.size()); + if (this.currentPath != null) { + this.manager.cleanOldLogs(this.currentPath.getName(), + this.peerId, + this.queueRecovered); + } } } catch (InterruptedException e) { LOG.warn("Interrupted while reading edits", e);