[PR #1174] [CLOSED] [Store] refactor: config loading and CLI parsing by iflytek #2052

Closed
opened 2026-10-29 21:32:24 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/kvcache-ai/Mooncake/pull/1174
Author: @cocktail828
Created: 12/6/2025
Status: ❌ Closed

Base: main ← Head: refactor_config


📝 Commits (3)

  • b6d2cc2 [Store] refactor: config loading and CLI parsing
  • e18b634 [Store] fix typos and issues raised by the AI assistant.
  • e240c6d [Store] fix ci errors

📊 Changes

23 files changed (+12721 additions, -1116 deletions)

View changed files

📝 .gitignore (+2 -0)
📝 mooncake-store/CMakeLists.txt (+1 -0)
➕ mooncake-store/include/CLI11/CLI11.hpp (+12045 -0)
➕ mooncake-store/include/cli.h (+65 -0)
📝 mooncake-store/include/client_metric.h (+0 -6)
➖ mooncake-store/include/config_helper.h (+0 -98)
📝 mooncake-store/include/ha_helper.h (+2 -2)
📝 mooncake-store/include/master_config.h (+192 -448)
📝 mooncake-store/include/master_service.h (+1 -1)
📝 mooncake-store/include/rpc_service.h (+1 -1)
📝 mooncake-store/include/utils.h (+23 -1)
📝 mooncake-store/src/ha_helper.cpp (+7 -6)
📝 mooncake-store/src/master.cpp (+137 -432)
📝 mooncake-store/src/master_metric_manager.cpp (+2 -2)
📝 mooncake-store/src/master_service.cpp (+9 -5)
📝 mooncake-store/src/rpc_service.cpp (+3 -4)
📝 mooncake-store/tests/CMakeLists.txt (+2 -0)
➕ mooncake-store/tests/conf/master.conf (+4 -0)
📝 mooncake-store/tests/master_metrics_test.cpp (+3 -3)
📝 mooncake-store/tests/master_service_ssd_test.cpp (+4 -3)

...and 3 more files

📄 Description

Description

The current command-line parsing uses gflags, which doesn't support hot updates and has limited extensibility. Additionally, the various config structure definitions and initialization code are verbose and difficult to read. Furthermore, logging has never supported persistence and always prints to screen, making it unsuitable for production environments.

This PR replaces gflags with CLI11, which allows configuration and command-line parsing to be handled together while flexibly supporting parameter deprecation mechanisms. It also makes configuration hot-reloading possible with minimal overhead - no need to write redundant code for parsing configuration files, just re-call the Parser interface. Priority mechanisms are also supported (Command Line > Configuration File > Default Values).

Additionally, duplicate code related to Master config has been refactored and streamlined. This modification significantly simplifies master-related code.

Type of Change

  • Types
    • Refactor
      • Transfer Engine
      • Mooncake Store
      • Mooncake EP
      • Integration
      • P2P Store
      • Python Wheel
    • Breaking change
    • CI/CD
    • Documentation update
    • Other

How Has This Been Tested?

  • Added comprehensive unit tests for configuration loading and command-line parsing scenarios
  • Verified existing integration tests continue to pass
  • Manual testing on Linux to confirm proper config resolution when executing from different working directories
  • Confirmed backward compatibility with existing command-line usage patterns

Checklist

  • I have performed a self-review of my own code.
  • I have updated the documentation.
  • I have added tests to prove my changes are effective.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/kvcache-ai/Mooncake/pull/1174 **Author:** [@cocktail828](https://github.com/cocktail828) **Created:** 12/6/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `refactor_config` --- ### 📝 Commits (3) - [`b6d2cc2`](https://github.com/kvcache-ai/Mooncake/commit/b6d2cc226c6b51a5225ba1e004e25706ed2e3f86) [Store] refactor: config loading and CLI parsing - [`e18b634`](https://github.com/kvcache-ai/Mooncake/commit/e18b63499f31ac17872fdc2856ea3563a289deb2) [Store] fix typos and issues raised by the AI assistant. - [`e240c6d`](https://github.com/kvcache-ai/Mooncake/commit/e240c6de1c0f501db869507b517a78c71c642ccd) [Store] fix ci errors ### 📊 Changes **23 files changed** (+12721 additions, -1116 deletions) <details> <summary>View changed files</summary> 📝 `.gitignore` (+2 -0) 📝 `mooncake-store/CMakeLists.txt` (+1 -0) ➕ `mooncake-store/include/CLI11/CLI11.hpp` (+12045 -0) ➕ `mooncake-store/include/cli.h` (+65 -0) 📝 `mooncake-store/include/client_metric.h` (+0 -6) ➖ `mooncake-store/include/config_helper.h` (+0 -98) 📝 `mooncake-store/include/ha_helper.h` (+2 -2) 📝 `mooncake-store/include/master_config.h` (+192 -448) 📝 `mooncake-store/include/master_service.h` (+1 -1) 📝 `mooncake-store/include/rpc_service.h` (+1 -1) 📝 `mooncake-store/include/utils.h` (+23 -1) 📝 `mooncake-store/src/ha_helper.cpp` (+7 -6) 📝 `mooncake-store/src/master.cpp` (+137 -432) 📝 `mooncake-store/src/master_metric_manager.cpp` (+2 -2) 📝 `mooncake-store/src/master_service.cpp` (+9 -5) 📝 `mooncake-store/src/rpc_service.cpp` (+3 -4) 📝 `mooncake-store/tests/CMakeLists.txt` (+2 -0) ➕ `mooncake-store/tests/conf/master.conf` (+4 -0) 📝 `mooncake-store/tests/master_metrics_test.cpp` (+3 -3) 📝 `mooncake-store/tests/master_service_ssd_test.cpp` (+4 -3) _...and 3 more files_ </details> ### 📄 Description ## Description The current command-line parsing uses gflags, which doesn't support hot updates and has limited extensibility. Additionally, the various config structure definitions and initialization code are verbose and difficult to read. Furthermore, logging has never supported persistence and always prints to screen, making it unsuitable for production environments. This PR replaces gflags with CLI11, which allows configuration and command-line parsing to be handled together while flexibly supporting parameter deprecation mechanisms. It also makes configuration hot-reloading possible with minimal overhead - no need to write redundant code for parsing configuration files, just re-call the Parser interface. Priority mechanisms are also supported (Command Line > Configuration File > Default Values). Additionally, duplicate code related to Master config has been refactored and streamlined. This modification significantly simplifies master-related code. ## Type of Change * Types - [x] Refactor - [ ] Transfer Engine - [x] Mooncake Store - [ ] Mooncake EP - [ ] Integration - [ ] P2P Store - [ ] Python Wheel - [ ] Breaking change - [ ] CI/CD - [ ] Documentation update - [ ] Other ## How Has This Been Tested? - Added comprehensive unit tests for configuration loading and command-line parsing scenarios - Verified existing integration tests continue to pass - Manual testing on Linux to confirm proper config resolution when executing from different working directories - Confirmed backward compatibility with existing command-line usage patterns ## Checklist - [x] I have performed a self-review of my own code. - [x] I have updated the documentation. - [x] I have added tests to prove my changes are effective. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-29 21:32:24 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/Mooncake#2052
No description provided.