Index: src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java =================================================================== --- src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java (revision 1177393) +++ src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java (working copy) @@ -106,6 +106,8 @@ private HLog.Reader reader; // Current position in the log private long position = 0; + // Last position in the log that we sent to ZooKeeper + private long lastLoggedPosition = -1; // Path of the current log private volatile Path currentPath; private FileSystem fs; @@ -349,8 +351,11 @@ // wait a bit and retry. // But if we need to stop, don't bother sleeping if (this.isActive() && (gotIOE || currentNbEntries == 0)) { - this.manager.logPositionAndCleanOldLogs(this.currentPath, - this.peerClusterZnode, this.position, queueRecovered); + if (this.lastLoggedPosition != this.position) { + this.manager.logPositionAndCleanOldLogs(this.currentPath, + this.peerClusterZnode, this.position, queueRecovered); + this.lastLoggedPosition = this.position; + } if (sleepForRetries("Nothing to replicate", sleepMultiplier)) { sleepMultiplier++; } @@ -592,8 +597,11 @@ HRegionInterface rrs = getRS(); LOG.debug("Replicating " + currentNbEntries); rrs.replicateLogEntries(Arrays.copyOf(this.entriesArray, currentNbEntries)); - this.manager.logPositionAndCleanOldLogs(this.currentPath, - this.peerClusterZnode, this.position, queueRecovered); + if (this.lastLoggedPosition != this.position) { + this.manager.logPositionAndCleanOldLogs(this.currentPath, + this.peerClusterZnode, this.position, queueRecovered); + this.lastLoggedPosition = this.position; + } this.totalReplicatedEdits += currentNbEntries; this.metrics.shippedBatchesRate.inc(1); this.metrics.shippedOpsRate.inc(