carp84 commented on a change in pull request #10820: [FLINK-15512][statebackend] Refactor the mechanism to calculate the cache capacity shared among RocksDB instance(s) URL: https://github.com/apache/flink/pull/10820#discussion_r365565010
########## File path: flink-state-backends/flink-statebackend-rocksdb/src/main/java/org/apache/flink/contrib/streaming/state/RocksDBOperationUtils.java ########## @@ -213,4 +211,49 @@ public static void addColumnFamilyOptionsToCloseLater( throw new IOException("Failed to acquire shared cache resource for RocksDB", e); } } + + @VisibleForTesting + static RocksDBSharedResources allocateRocksDBSharedResources(long memorySize, double writeBufferRatio, double highPriorityPoolRatio) { + long calculatedCacheCapacity = calculateActualCacheCapacity(memorySize, writeBufferRatio); + final Cache cache = createCache(calculatedCacheCapacity, highPriorityPoolRatio); + long writeBufferManagerCapacity = calculateWriteBufferManagerCapacity(memorySize, writeBufferRatio); + final WriteBufferManager wbm = new WriteBufferManager(writeBufferManagerCapacity, cache); + return new RocksDBSharedResources(cache, wbm); + } + + /** + * Calculate the actual calculated memory size of cache, which would be shared among rocksDB instance(s). Review comment: Minor: the actual calculated memory size -> the actual memory size ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services