byteayan commented on code in PR #3355:
URL: https://github.com/apache/hugegraph/pull/3355#discussion_r4279275783
##########
hugegraph-store/hg-store-node/src/main/java/org/apache/hugegraph/store/node/AppConfig.java:
##########
@@ -104,15 +105,11 @@ public void init() {
}
Map<String, String> rocksdb = rocksdbConfig.rocksdb;
- if (!rocksdb.containsKey("total_memory_size")
- || "0".equals(rocksdb.get("total_memory_size"))) {
- rocksdb.put("total_memory_size", Long.toString(rt.maxMemory()));
- }
- long totalMemory =
Long.parseLong(rocksdbConfig.rocksdb.get("total_memory_size"));
+ long totalMemory =
RocksdbMemoryBudget.resolve(rocksdb.get(RocksdbMemoryBudget.KEY));
+ rocksdb.put(RocksdbMemoryBudget.KEY, Long.toString(totalMemory));
if (raft.getDisruptorBufferSize() == 0) {
Review Comment:
Good catch, thanks. Fixed in 1927fbee8:
`RocksdbMemoryBudget.writeBufferSize()` now clamps the derived value to 1 MiB,
and `AppConfig` uses it. The new test takes your exact case (4 GiB, `-Xmx1g`,
512 MiB direct, so a 512 MiB budget), runs the result through the same
`OptionSpace`/`HugeConfig` validation `initRocksdb()` does, and checks that the
old 536870-byte value is rejected there.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]