Skip to content

Commit 6b335cc

Browse files
authored
Add custom compaction policy based on number of range deletions in file
* compaction policy * fix build error
1 parent b433326 commit 6b335cc

File tree

4 files changed

+337
-196
lines changed

4 files changed

+337
-196
lines changed

fdbclient/ServerKnobs.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,9 @@ void ServerKnobs::initialize(Randomize randomize, ClientKnobs* clientKnobs, IsSi
600600
init( SHARDED_ROCKSDB_MAX_WRITE_BUFFER_NUMBER, 6 ); // RocksDB default.
601601
init( SHARDED_ROCKSDB_TARGET_FILE_SIZE_BASE, 16 << 20 ); // 16MB
602602
init( SHARDED_ROCKSDB_TARGET_FILE_SIZE_MULTIPLIER, 1 ); // RocksDB default.
603-
init( SHARDED_ROCKSDB_SUGGEST_COMPACT_CLEAR_RANGE, true );
603+
bool suggestCompactRange = deterministicRandom()->coinflip();
604+
init( SHARDED_ROCKSDB_SUGGEST_COMPACT_CLEAR_RANGE, false ); if (isSimulated) SHARDED_ROCKSDB_SUGGEST_COMPACT_CLEAR_RANGE = suggestCompactRange;
605+
init( SHARDED_ROCKSDB_COMPACT_ON_RANGE_DELETION_THRESHOLD, 200 ); if (isSimulated) SHARDED_ROCKSDB_COMPACT_ON_RANGE_DELETION_THRESHOLD = suggestCompactRange? 0:50;
604606
init( SHARDED_ROCKSDB_MAX_BACKGROUND_JOBS, 4 );
605607
init( SHARDED_ROCKSDB_BLOCK_CACHE_SIZE, isSimulated? 128 << 20 : 3LL << 30); // 3GB
606608
init( SHARDED_ROCKSDB_CACHE_HIGH_PRI_POOL_RATIO, 0.5 ); /* Share of high priority Index&filter blocks in cache */

fdbclient/include/fdbclient/ServerKnobs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,7 @@ class ServerKnobs : public KnobsImpl<ServerKnobs> {
569569
int SHARDED_ROCKSDB_TARGET_FILE_SIZE_BASE;
570570
int SHARDED_ROCKSDB_TARGET_FILE_SIZE_MULTIPLIER;
571571
bool SHARDED_ROCKSDB_SUGGEST_COMPACT_CLEAR_RANGE;
572+
int SHARDED_ROCKSDB_COMPACT_ON_RANGE_DELETION_THRESHOLD;
572573
int SHARDED_ROCKSDB_MAX_BACKGROUND_JOBS;
573574
int64_t SHARDED_ROCKSDB_BLOCK_CACHE_SIZE;
574575
double SHARDED_ROCKSDB_CACHE_HIGH_PRI_POOL_RATIO;

0 commit comments

Comments
 (0)