Skip to content

Commit

Permalink
In-memory Engine: conditional compilation (tikv#16357)
Browse files Browse the repository at this point in the history
ref tikv#16141

Do not start in-memory engine unless the `memory-engine` feature is enabled.

Signed-off-by: Alex Feinberg <[email protected]>
  • Loading branch information
afeinberg authored Jan 13, 2024
1 parent 00749cc commit dafd147
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions cmd/tikv-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ mimalloc = ["server/mimalloc"]
portable = ["server/portable"]
sse = ["server/sse"]
mem-profiling = ["server/mem-profiling"]
memory-engine = ["server/memory-engine"]
failpoints = ["server/failpoints"]
cloud-aws = ["server/cloud-aws"]
cloud-gcp = ["server/cloud-gcp"]
Expand Down
1 change: 1 addition & 0 deletions components/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ mimalloc = ["tikv/mimalloc"]
snmalloc = ["tikv/snmalloc"]
portable = ["tikv/portable"]
sse = ["tikv/sse"]
memory-engine = []
mem-profiling = ["tikv/mem-profiling"]
failpoints = ["tikv/failpoints"]
cloud-aws = ["encryption_export/cloud-aws"]
Expand Down
16 changes: 10 additions & 6 deletions components/server/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,28 +221,32 @@ pub fn run_tikv(

dispatch_api_version!(config.storage.api_version(), {
if !config.raft_engine.enable {
if config.region_cache_memory_limit == ReadableSize(0) {
run_impl::<RocksEngine, RocksEngine, API>(
if cfg!(feature = "memory-engine")
&& config.region_cache_memory_limit != ReadableSize(0)
{
run_impl::<HybridEngine<RocksEngine, RegionCacheMemoryEngine>, RocksEngine, API>(
config,
service_event_tx,
service_event_rx,
)
} else {
run_impl::<HybridEngine<RocksEngine, RegionCacheMemoryEngine>, RocksEngine, API>(
run_impl::<RocksEngine, RocksEngine, API>(
config,
service_event_tx,
service_event_rx,
)
}
} else {
if config.region_cache_memory_limit == ReadableSize(0) {
run_impl::<RocksEngine, RaftLogEngine, API>(
if cfg!(feature = "memory-engine")
&& config.region_cache_memory_limit != ReadableSize(0)
{
run_impl::<HybridEngine<RocksEngine, RegionCacheMemoryEngine>, RaftLogEngine, API>(
config,
service_event_tx,
service_event_rx,
)
} else {
run_impl::<HybridEngine<RocksEngine, RegionCacheMemoryEngine>, RaftLogEngine, API>(
run_impl::<RocksEngine, RaftLogEngine, API>(
config,
service_event_tx,
service_event_rx,
Expand Down

0 comments on commit dafd147

Please sign in to comment.