From 30b056ba9ebea088fb657c4bd0872a462870432d Mon Sep 17 00:00:00 2001 From: Victor Date: Thu, 12 Dec 2024 06:21:55 +0000 Subject: [PATCH] ttl compact --- src/config.c | 2 +- src/ctrip_swap_exec.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index 685a78d8be8..bfbe408a652 100644 --- a/src/config.c +++ b/src/config.c @@ -3085,7 +3085,7 @@ standardConfig configs[] = { createULongLongConfig("rocksdb.data.blob_file_size", "rocksdb.blob_file_size", MODIFIABLE_CONFIG, 0, ULLONG_MAX, server.rocksdb_data_blob_file_size, 256*1024*1024, MEMORY_CONFIG, NULL, updateRocksdbDataBlobFileSize), createULongLongConfig("rocksdb.meta.blob_file_size", NULL, MODIFIABLE_CONFIG, 0, ULLONG_MAX, server.rocksdb_meta_blob_file_size, 256*1024*1024, MEMORY_CONFIG, NULL, updateRocksdbMetaBlobFileSize), createULongLongConfig("swap-repl-rordb-max-write-bps", NULL, MODIFIABLE_CONFIG, 0, LLONG_MAX, server.swap_repl_rordb_max_write_bps, 200*1024*1024, MEMORY_CONFIG, NULL, NULL), - createULongLongConfig("swap-ttl-compact-period", NULL, MODIFIABLE_CONFIG, 1, 3600*24, server.swap_ttl_compact_period, 60*8, INTEGER_CONFIG, NULL, NULL), + createULongLongConfig("swap-ttl-compact-period", NULL, MODIFIABLE_CONFIG, 1, 3600*24, server.swap_ttl_compact_period, 60, INTEGER_CONFIG, NULL, NULL), createULongLongConfig("swap-sst-age-limit-refresh-period", NULL, MODIFIABLE_CONFIG, 1, 3600*24, server.swap_sst_age_limit_refresh_period, 60, INTEGER_CONFIG, NULL, NULL), createULongLongConfig("swap-swap-info-slave-period", NULL, MODIFIABLE_CONFIG, 1, 3600*24, server.swap_swap_info_slave_period, 60, INTEGER_CONFIG, NULL, NULL), diff --git a/src/ctrip_swap_exec.c b/src/ctrip_swap_exec.c index 3f14bd5bba1..c7f22771895 100644 --- a/src/ctrip_swap_exec.c +++ b/src/ctrip_swap_exec.c @@ -91,8 +91,8 @@ void swapRequestExecuteUtil_CompactRange(swapRequest *req) { long size_after = get_dir_size(dir); serverLog(LL_WARNING, "[rocksdb compact range after] dir(%s) size(%ld)", dir, size_after); - if (server.swap_ttl_compact_ctx && task->compact_type == TYPE_TTL_COMPACT) { - atomicIncr(server.swap_ttl_compact_ctx->stat_compacted_data_size, size_after - size_before); + if (server.swap_ttl_compact_ctx && task->compact_type == TYPE_TTL_COMPACT && size_before > size_after) { + atomicIncr(server.swap_ttl_compact_ctx->stat_compacted_data_size, size_before - size_after); } serverRocksUnlock(rocks); }