File tree 1 file changed +10
-0
lines changed
clients/da-vinci-client/src/main/java/com/linkedin/davinci/store/rocksdb
1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 1
1
package com .linkedin .davinci .store .rocksdb ;
2
2
3
+ import static com .linkedin .venice .utils .ByteUtils .generateHumanReadableByteCountString ;
3
4
import static org .rocksdb .RateLimiter .DEFAULT_FAIRNESS ;
4
5
import static org .rocksdb .RateLimiter .DEFAULT_MODE ;
5
6
import static org .rocksdb .RateLimiter .DEFAULT_REFILL_PERIOD_MICROS ;
@@ -139,6 +140,15 @@ public RocksDBStorageEngineFactory(
139
140
this .env .setBackgroundThreads (rocksDBServerConfig .getRocksDBEnvFlushPoolSize (), Priority .HIGH );
140
141
this .env .setBackgroundThreads (rocksDBServerConfig .getRocksDBEnvCompactionPoolSize (), Priority .LOW );
141
142
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
+ }
142
152
// Shared cache across all the RocksDB databases
143
153
if (RocksDBBlockCacheImplementations .CLOCK .equals (rocksDBServerConfig .getRocksDBBlockCacheImplementation ())) {
144
154
if (rocksDBServerConfig .isUseSeparateRMDCacheEnabled ()) {
You can’t perform that action at this time.
0 commit comments