You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2018/09/11 01:25:58 UTC
[2/2] hbase git commit: HBASE-21162 Revert suspicious change to
BoundedByteBufferPool and disable use of direct buffers for IPC reservoir by
default
HBASE-21162 Revert suspicious change to BoundedByteBufferPool and disable use of direct buffers for IPC reservoir by default
Revert suspicious change to BoundedByteBufferPool made on HBASE-19239 (Fix
findbugs and error-prone issues).
In addition the allocation of direct memory for the server RPC reservoir is
problematic in that tracing native memory or direct buffer leaks to a
particular class or compilation unit is difficult, so allocate the reservoir
on the heap by default instead.
Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/89bbc306
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/89bbc306
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/89bbc306
Branch: refs/heads/branch-1.4
Commit: 89bbc3065cfa4e40b055fb3865469c496c5cfac0
Parents: c9e1665
Author: Andrew Purtell <ap...@apache.org>
Authored: Fri Sep 7 11:46:19 2018 -0700
Committer: Andrew Purtell <ap...@apache.org>
Committed: Mon Sep 10 18:25:34 2018 -0700
----------------------------------------------------------------------
.../org/apache/hadoop/hbase/io/BoundedByteBufferPool.java | 9 +++++----
.../main/java/org/apache/hadoop/hbase/ipc/RpcServer.java | 2 +-
2 files changed, 6 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hbase/blob/89bbc306/hbase-common/src/main/java/org/apache/hadoop/hbase/io/BoundedByteBufferPool.java
----------------------------------------------------------------------
diff --git a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/BoundedByteBufferPool.java b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/BoundedByteBufferPool.java
index 8c371a6..e2984b3 100644
--- a/hbase-common/src/main/java/org/apache/hadoop/hbase/io/BoundedByteBufferPool.java
+++ b/hbase-common/src/main/java/org/apache/hadoop/hbase/io/BoundedByteBufferPool.java
@@ -46,6 +46,7 @@ import com.google.common.annotations.VisibleForTesting;
* <p>This class is thread safe.
*/
@InterfaceAudience.Private
+@SuppressWarnings("NonAtomicVolatileUpdate") // Suppress error-prone warning, see HBASE-21162
public class BoundedByteBufferPool {
private static final Log LOG = LogFactory.getLog(BoundedByteBufferPool.class);
@@ -60,7 +61,7 @@ public class BoundedByteBufferPool {
volatile int runningAverage;
// Scratch that keeps rough total size of pooled bytebuffers
- private AtomicLong totalReservoirCapacity = new AtomicLong(0);
+ private volatile int totalReservoirCapacity;
// For reporting
private AtomicLong allocations = new AtomicLong(0);
@@ -89,7 +90,7 @@ public class BoundedByteBufferPool {
try {
bb = this.buffers.poll();
if (bb != null) {
- this.totalReservoirCapacity.addAndGet(-bb.capacity());
+ this.totalReservoirCapacity -= bb.capacity();
}
} finally {
lock.unlock();
@@ -119,8 +120,8 @@ public class BoundedByteBufferPool {
try {
success = this.buffers.offer(bb);
if (success) {
- average = (int) this.totalReservoirCapacity.addAndGet(bb.capacity()) /
- this.buffers.size(); // size will never be 0.
+ this.totalReservoirCapacity += bb.capacity();
+ average = this.totalReservoirCapacity / this.buffers.size(); // size will never be 0.
}
} finally {
lock.unlock();
http://git-wip-us.apache.org/repos/asf/hbase/blob/89bbc306/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
index e318f3f..3f11233 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/RpcServer.java
@@ -2182,7 +2182,7 @@ public class RpcServer implements RpcServerInterface, ConfigurationObserver {
conf.getInt(HConstants.REGION_SERVER_HANDLER_COUNT,
HConstants.DEFAULT_REGION_SERVER_HANDLER_COUNT) * 2),
// By default make direct byte buffers from the buffer pool.
- conf.getBoolean("hbase.ipc.server.reservoir.direct.buffer", true));
+ conf.getBoolean("hbase.ipc.server.reservoir.direct.buffer", false));
} else {
reservoir = null;
}