ACCUMULO-4083 Check blockcache sizes when using native maps.

Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/76cf943f
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/76cf943f
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/76cf943f

Branch: refs/heads/1.7
Commit: 76cf943f73076d6c785499bf2e6454bafca2e40e
Parents: 57bc207
Author: Josh Elser <els...@apache.org>
Authored: Tue Dec 22 15:11:59 2015 -0500
Committer: Josh Elser <els...@apache.org>
Committed: Tue Dec 22 15:11:59 2015 -0500

----------------------------------------------------------------------
 .../apache/accumulo/tserver/TabletServerResourceManager.java | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/76cf943f/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
----------------------------------------------------------------------
diff --git 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
index 7c0eedc..ccdee32 100644
--- 
a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
+++ 
b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServerResourceManager.java
@@ -166,7 +166,13 @@ public class TabletServerResourceManager {
     _dCache = new LruBlockCache(dCacheSize, blockSize);
 
     Runtime runtime = Runtime.getRuntime();
-    if (!usingNativeMap && maxMemory + dCacheSize + iCacheSize > 
runtime.maxMemory()) {
+    if (usingNativeMap) {
+      // Still check block cache sizes when using native maps.
+      if (dCacheSize + iCacheSize > runtime.maxMemory()) {
+        throw new IllegalArgumentException(String.format(
+            "Block cache sizes %,d is too large for this JVM configuration 
%,d", dCacheSize + iCacheSize, runtime.maxMemory()));
+      }
+    } else if (maxMemory + dCacheSize + iCacheSize > runtime.maxMemory()) {
       throw new IllegalArgumentException(String.format(
           "Maximum tablet server map memory %,d and block cache sizes %,d is 
too large for this JVM configuration %,d", maxMemory, dCacheSize + iCacheSize,
           runtime.maxMemory()));

Reply via email to