Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ elseif((WITH_DATA_STORE STREQUAL "ELOQDSS_ROCKSDB_CLOUD_S3") OR
store_handler/eloq_data_store_service/rocksdb_config.cpp
store_handler/eloq_data_store_service/purger_event_listener.cpp
store_handler/eloq_data_store_service/purger_sliding_window.cpp
store_handler/eloq_data_store_service/s3_file_downloader.cpp
)
elseif(WITH_DATA_STORE STREQUAL "ELOQDSS_ROCKSDB")
SET(RESELOQ_RESOURCES ${RESELOQ_RESOURCES}
Expand Down
14 changes: 14 additions & 0 deletions src/redis_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,9 @@ DEFINE_string(eloq_dss_peer_node,
DEFINE_string(eloq_dss_branch_name,
"development",
"Branch name of EloqDataStore");
DEFINE_uint32(dss_file_cache_sync_interval_sec,
30,
"File cache sync interval in seconds for standby warm-up");
#endif

namespace EloqKV
Expand Down Expand Up @@ -1037,6 +1040,14 @@ bool RedisServiceImpl::Init(brpc::Server &brpc_server)
: config_reader.GetString(
"store", "eloq_dss_peer_node", FLAGS_eloq_dss_peer_node);

uint32_t dss_file_cache_sync_interval_sec =
!CheckCommandLineFlagIsDefault("dss_file_cache_sync_interval_sec")
? FLAGS_dss_file_cache_sync_interval_sec
: config_reader.GetInteger(
"store",
"dss_file_cache_sync_interval_sec",
FLAGS_dss_file_cache_sync_interval_sec);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Negative config value silently converted to large positive

The config_reader.GetInteger() method returns a long (signed type), which is assigned to dss_file_cache_sync_interval_sec of type uint32_t (unsigned). If a user provides a negative value in the configuration file, it will be implicitly converted to a large positive uint32_t value through two's complement representation, potentially causing the file cache sync to occur at an unexpectedly long interval instead of being rejected as invalid.

Fix in Cursor Fix in Web


std::string eloq_dss_data_path = eloq_data_path + "/eloq_dss";
if (!std::filesystem::exists(eloq_dss_data_path))
{
Expand Down Expand Up @@ -1086,6 +1097,9 @@ bool RedisServiceImpl::Init(brpc::Server &brpc_server)
ds_config);
}

// Set file cache sync interval
ds_config.SetFileCacheSyncIntervalSec(dss_file_cache_sync_interval_sec);

#if defined(DATA_STORE_TYPE_ELOQDSS_ROCKSDB_CLOUD_S3) || \
defined(DATA_STORE_TYPE_ELOQDSS_ROCKSDB_CLOUD_GCS)
EloqDS::RocksDBConfig rocksdb_config(config_reader, eloq_dss_data_path);
Expand Down