You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by gi...@git.apache.org on 2017/10/06 15:00:30 UTC

[GitHub] keith-turner commented on a change in pull request #304: ACCUMULO-4716 Don't cache blks over max array size

keith-turner commented on a change in pull request #304: ACCUMULO-4716 Don't cache blks over max array size
URL: https://github.com/apache/accumulo/pull/304#discussion_r143213486
 
 

 ##########
 File path: core/src/main/java/org/apache/accumulo/core/file/blockfile/impl/CachableBlockFile.java
 ##########
 @@ -342,7 +342,11 @@ private BlockRead getBlock(String _lookup, BlockCache cache, BlockLoader loader)
 
     private BlockRead cacheBlock(String _lookup, BlockCache cache, BlockReader _currBlock, String block) throws IOException {
 
-      if ((cache == null) || (_currBlock.getRawSize() > cache.getMaxSize())) {
+      // ACCUMULO-4716 - Define MAX_ARRAY_SIZE smaller than Integer.MAX_VALUE to prevent possible OutOfMemory
+      // error as described in stackoverflow post: https://stackoverflow.com/a/8381338.
+      int MAX_ARRAY_SIZE = Integer.MAX_VALUE - 8;
 
 Review comment:
   Personally, I would make this a static constants because all caps usually implies that by convention.
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services