long seenEntries = 0;
this.repLogReader.seek();
HLog.Entry entry =
this.repLogReader.readNextAndSetPosition();
while (entry != null) {
WALEdit edit = entry.getEdit();
this.metrics.logEditsReadRate.inc(1);
seenEntries++;
// Remove all KVs that should not be replicated
HLogKey logKey = entry.getKey();
List<UUID> consumedClusterIds = edit.getClusterIds();
// This cluster id has been added to resolve the scenario of A -> B -> A where A has old
// point release and B has the new point release which has the fix HBASE-7709. A change on
// cluster A would infinitely replicate to
// cluster B if we don't add the original cluster id to the set.
consumedClusterIds.add(logKey.getClusterId());
// don't replicate if the log entries if it has not already been replicated
if (!consumedClusterIds.contains(peerClusterId)) {
removeNonReplicableEdits(edit);
// Don't replicate catalog entries, if the WALEdit wasn't
// containing anything to replicate and if we're currently not set to replicate
if (!(Bytes.equals(logKey.getTablename(), HConstants.ROOT_TABLE_NAME) ||
Bytes.equals(logKey.getTablename(), HConstants.META_TABLE_NAME)) &&
edit.size() != 0 && replicating.get()) {
// Only set the clusterId if is a local key.
// This ensures that the originator sets the cluster id
// and all replicas retain the initial cluster id.
// This is *only* place where a cluster id other than the default is set.
if (HConstants.DEFAULT_CLUSTER_ID == logKey.getClusterId()) {
logKey.setClusterId(this.clusterId);
} else if (logKey.getClusterId() != this.clusterId) {
edit.addClusterId(clusterId);
}
currentNbOperations += countDistinctRowKeys(edit);
entries.add(entry);
currentSize += entry.getEdit().heapSize();
} else {