Author: catholicon Date: Fri Dec 22 00:35:30 2017 New Revision: 1818991 URL: http://svn.apache.org/viewvc?rev=1818991&view=rev Log: OAK-7108: TraverseWithSortStrategy fails to register memory pool listener with heap less than 2GB
Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/TraverseWithSortStrategy.java Modified: jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/TraverseWithSortStrategy.java URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/TraverseWithSortStrategy.java?rev=1818991&r1=1818990&r2=1818991&view=diff ============================================================================== --- jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/TraverseWithSortStrategy.java (original) +++ jackrabbit/oak/trunk/oak-run/src/main/java/org/apache/jackrabbit/oak/index/indexer/document/flatfile/TraverseWithSortStrategy.java Fri Dec 22 00:35:30 2017 @@ -228,6 +228,11 @@ class TraverseWithSortStrategy implement MemoryUsage usage = pool.getCollectionUsage(); long maxMemory = usage.getMax(); long warningThreshold = minMemory * ONE_GB; + if (warningThreshold > maxMemory) { + log.warn("Configured minimum memory {} GB more than available memory ({})." + + "Overriding configuration accordingly.", minMemory, humanReadableByteCount(maxMemory)); + warningThreshold = maxMemory; + } log.info("Setting up a listener to monitor pool '{}' and trigger batch save " + "if memory drop below {} GB (max {})", pool.getName(), minMemory, humanReadableByteCount(maxMemory)); pool.setCollectionUsageThreshold(warningThreshold);