File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
clients/da-vinci-client/src/main/java/com/linkedin/davinci/store/rocksdb Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 11package com .linkedin .davinci .store .rocksdb ;
22
3+ import static com .linkedin .venice .utils .ByteUtils .generateHumanReadableByteCountString ;
34import static org .rocksdb .RateLimiter .DEFAULT_FAIRNESS ;
45import static org .rocksdb .RateLimiter .DEFAULT_MODE ;
56import static org .rocksdb .RateLimiter .DEFAULT_REFILL_PERIOD_MICROS ;
@@ -139,6 +140,15 @@ public RocksDBStorageEngineFactory(
139140 this .env .setBackgroundThreads (rocksDBServerConfig .getRocksDBEnvFlushPoolSize (), Priority .HIGH );
140141 this .env .setBackgroundThreads (rocksDBServerConfig .getRocksDBEnvCompactionPoolSize (), Priority .LOW );
141142
143+ long cacheBytesNeeded =
144+ rocksDBServerConfig .getRocksDBBlockCacheSizeInBytes () + (rocksDBServerConfig .isUseSeparateRMDCacheEnabled ()
145+ ? rocksDBServerConfig .getRocksDBRMDBlockCacheSizeInBytes ()
146+ : 0 );
147+ if (Runtime .getRuntime ().maxMemory () * 0.8 < cacheBytesNeeded ) {
148+ throw new RuntimeException (
149+ "Cannot setup rocksdb instance with block-cache size "
150+ + generateHumanReadableByteCountString (cacheBytesNeeded ));
151+ }
142152 // Shared cache across all the RocksDB databases
143153 if (RocksDBBlockCacheImplementations .CLOCK .equals (rocksDBServerConfig .getRocksDBBlockCacheImplementation ())) {
144154 if (rocksDBServerConfig .isUseSeparateRMDCacheEnabled ()) {
You can’t perform that action at this time.
0 commit comments