Repository: hbase Updated Branches: refs/heads/0.98 8f768c247 -> 036c684e1
HBASE-13703 ReplicateContext should not be a member of ReplicationSource. Project: http://git-wip-us.apache.org/repos/asf/hbase/repo Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/036c684e Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/036c684e Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/036c684e Branch: refs/heads/0.98 Commit: 036c684e161fdfa1f4f7a612a412b0d894b91c64 Parents: 8f768c2 Author: Lars Hofhansl <la...@apache.org> Authored: Thu May 21 22:10:09 2015 -0700 Committer: Lars Hofhansl <la...@apache.org> Committed: Thu May 21 22:10:09 2015 -0700 ---------------------------------------------------------------------- .../apache/hadoop/hbase/replication/ReplicationEndpoint.java | 2 +- .../hbase/replication/regionserver/ReplicationSource.java | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hbase/blob/036c684e/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationEndpoint.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationEndpoint.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationEndpoint.java index 03b66d2..5a2e96f 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationEndpoint.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/ReplicationEndpoint.java @@ -127,7 +127,7 @@ public interface ReplicationEndpoint extends Service { * A context for {@link ReplicationEndpoint#replicate(ReplicateContext)} method. */ @InterfaceAudience.LimitedPrivate(HBaseInterfaceAudience.REPLICATION) - class ReplicateContext { + static class ReplicateContext { List<HLog.Entry> entries; int size; @InterfaceAudience.Private http://git-wip-us.apache.org/repos/asf/hbase/blob/036c684e/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java ---------------------------------------------------------------------- diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java index 17b8ef0..d684dbb 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java @@ -126,8 +126,6 @@ public class ReplicationSource extends Thread private ReplicationEndpoint replicationEndpoint; // A filter (or a chain of filters) for the WAL entries. private WALEntryFilter walEntryFilter; - // Context for ReplicationEndpoint#replicate() - private ReplicationEndpoint.ReplicateContext replicateContext; // throttler private ReplicationThrottler throttler; @@ -181,8 +179,6 @@ public class ReplicationSource extends Thread this.peerId = this.replicationQueueInfo.getPeerId(); this.logQueueWarnThreshold = this.conf.getInt("replication.source.log.queue.warn", 2); this.replicationEndpoint = replicationEndpoint; - - this.replicateContext = new ReplicationEndpoint.ReplicateContext(); } private void decorateConf() { @@ -679,6 +675,8 @@ public class ReplicationSource extends Thread this.throttler.resetStartTick(); } } + // create replicateContext here, so the entries can be GC'd upon return from this call stack + ReplicationEndpoint.ReplicateContext replicateContext = new ReplicationEndpoint.ReplicateContext(); replicateContext.setEntries(entries).setSize(currentSize); // send the edits to the endpoint. Will block until the edits are shipped and acknowledged