Skip to content

Comments

Add a new API updateGlobalConfig#210

Merged
greensky00 merged 2 commits intoeBay:masterfrom
greensky00:pr1
Jan 8, 2026
Merged

Add a new API updateGlobalConfig#210
greensky00 merged 2 commits intoeBay:masterfrom
greensky00:pr1

Conversation

@greensky00
Copy link
Contributor

  • It will update global config (such as sleep time and throttling limits) on-the-fly, without restarting the singleton instance.

* It will update global config (such as sleep time and throttling
limits) on-the-fly, without restarting the singleton instance.
@greensky00 greensky00 requested a review from Copilot January 8, 2026 00:21
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR adds a new API updateGlobalConfig that enables dynamic updates to global configuration settings (such as sleep times and throttling limits) without requiring a restart of the singleton instance.

Key changes:

  • Added updateGlobalConfig() method to the public API (DB class and jungle namespace)
  • Refactored worker management to support on-the-fly configuration updates via new virtual method applyNewGlobalConfig()
  • Renamed sleepDuration_ms to sleepDurationMs for consistency across the codebase

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
include/libjungle/jungle.h Added public API declarations for updateGlobalConfig()
src/jungle.cc Implemented DB::updateGlobalConfig() to delegate to DBMgr
src/db_mgr.h, src/db_mgr.cc Added updateGlobalConfig() to propagate config changes to workers
src/worker_mgr.h, src/worker_mgr.cc Refactored worker loop to check for and apply new configs; renamed sleep duration field
src/flusher.h, src/flusher.cc Implemented applyNewGlobalConfig() for Flusher worker
src/compactor.h, src/compactor.cc Implemented applyNewGlobalConfig() for Compactor worker
src/log_reclaimer.h, src/log_reclaimer.cc Implemented applyNewGlobalConfig() for LogReclaimer worker
src/cmd_handler.h, src/cmd_handler.cc Implemented applyNewGlobalConfig() for CmdHandler worker
tests/stress/flush_stress_test.cc Added stress test validating dynamic config updates during runtime

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

* @return OK on success.
*/
static inline Status updateGlobalConfig(const GlobalConfig& new_config) {
(void)updateGlobalConfig;
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

This line suppresses the unused function warning for the wrong function. It should suppress the warning for the parameter new_config instead, similar to how the init function handles its parameter with (void)init;. The correct statement should be (void)new_config;.

Suggested change
(void)updateGlobalConfig;
(void)new_config;

Copilot uses AI. Check for mistakes.
Comment on lines 39 to 47
void WorkerBase::applyNewGlobalConfig(const GlobalConfig& g_config) {
gConfig = g_config;
WorkerOptions options;
options.sleepDurationMs = gConfig.flusherSleepDuration_ms;
options.worker = this;
curOptions = options;
_log_info(DBMgr::getWithoutInit()->getLogger(),
"worker %s applied new global config", workerName.c_str());
}
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

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

The base implementation assumes all workers use flusherSleepDuration_ms, but this is not appropriate for all worker types. Since each worker subclass has its own applyNewGlobalConfig() implementation that sets the correct sleep duration, this base implementation should not set sleepDurationMs at all, or it should be removed entirely if not needed as a default implementation.

Copilot uses AI. Check for mistakes.
@greensky00 greensky00 merged commit 5f383eb into eBay:master Jan 8, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant