Skip to content

feat: add eloq_store_root_meta_cache_size to eloq_store_config#388

Merged
thweetkomputer merged 8 commits into
mainfrom
bump
Jan 31, 2026
Merged

feat: add eloq_store_root_meta_cache_size to eloq_store_config#388
thweetkomputer merged 8 commits into
mainfrom
bump

Conversation

@eatbreads

@eatbreads eatbreads commented Jan 30, 2026

Copy link
Copy Markdown
Collaborator

Here are some reminders before you submit the pull request

  • Add tests for the change
  • Document changes
  • Reference the link of issue using fixes eloqdb/tx_service#issue_id
  • Reference the link of RFC if exists
  • Pass ./mtr --suite=mono_main,mono_multi,mono_basic

Summary by CodeRabbit

  • New Features
    • Added a global, configurable root metadata cache size with optional manual override.
    • Cache size now auto-computes from available memory when unset, validates against system memory, and is enforced to ensure consistent and reliable memory management.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 30, 2026

Copy link
Copy Markdown

Walkthrough

Added a global configuration flag to control EloqStore root metadata cache size and integrated size parsing, validation against available memory, and adjustments to node memory accounting within EloqStoreConfig.

Changes

Cohort / File(s) Summary
Root Meta Cache Configuration
store_handler/eloq_data_store_service/eloq_store_config.cpp
Added DEFINE_string(eloq_store_root_meta_cache_size, "1GB", ...); constructor now selects cache size from CLI flag, INI, or automatic (node_memory_mb/20), parses and validates size vs. node memory, subtracts it from node_memory_mb, and assigns eloqstore_configs_.root_meta_cache_size. Fatal log added if configured size exceeds available memory.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • MrGuin

Poem

🐇 I nibble bytes beneath the sod,

a tiny cache, a jaunty nod.
Flag set, parsed, and counted right,
I guard the roots throughout the night. 🥕

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description contains only the template checklist with all items unchecked; it lacks actual implementation details, rationale, and specific issue/RFC references. Add a meaningful description explaining the change rationale, fill in the checklist items (reference the issue, RFC if applicable), and confirm test/documentation status.
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main change: adding a new configuration flag eloq_store_root_meta_cache_size to eloq_store_config.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch bump

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@thweetkomputer thweetkomputer changed the title add bump feat: add eloq_store_root_meta_cache_size to eloq_store_config Jan 30, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@store_handler/eloq_data_store_service/eloq_store_config.cpp`:
- Around line 365-396: The auto-sizing logic for root_meta_cache_size
(root_meta_cache_size_str, computed from node_memory_mb / 20) can produce "0MB"
on tiny nodes; change the auto-size branch to clamp the computed value to a
minimum of 1MB (i.e., compute auto_mb = std::max(node_memory_mb / 20, 1) and use
std::to_string(auto_mb) + "MB"), keep using parse_size(root_meta_cache_size_str)
and the existing FATAL check, update the logged message to report the clamped
value, and ensure eloqstore_configs_.root_meta_cache_size is set from the parsed
(clamped) value.
🧹 Nitpick comments (1)
store_handler/eloq_data_store_service/eloq_store_config.cpp (1)

77-79: Clarify accepted size units in the flag description.

Small doc tweak reduces misconfiguration risk when users pass values.

🔧 Suggested doc tweak
-DEFINE_string(eloq_store_root_meta_cache_size,
-              "1GB",
-              "EloqStore RootMeta mappings cache size (global).");
+DEFINE_string(eloq_store_root_meta_cache_size,
+              "1GB",
+              "EloqStore RootMeta mappings cache size (global, e.g., 512MB/1GB).");

Comment on lines +365 to +396
std::string root_meta_cache_size_str;
if (CheckCommandLineFlagIsDefault("eloq_store_root_meta_cache_size"))
{
if (config_reader.HasValue("store", "eloq_store_root_meta_cache_size"))
{
root_meta_cache_size_str =
config_reader.GetString("store",
"eloq_store_root_meta_cache_size",
FLAGS_eloq_store_root_meta_cache_size);
}
else
{
root_meta_cache_size_str =
std::to_string(node_memory_mb / 20) + "MB";
LOG(INFO) << "config is automatically set: "
<< "eloq_store_root_meta_cache_size="
<< root_meta_cache_size_str
<< ", available memory=" << node_memory_mb << "MB";
}
}
else
{
root_meta_cache_size_str = FLAGS_eloq_store_root_meta_cache_size;
}
uint64_t root_meta_cache_size = parse_size(root_meta_cache_size_str);
if (root_meta_cache_size / (1024 * 1024) > node_memory_mb)
{
LOG(FATAL) << "root meta cache size (" << root_meta_cache_size
<< ") exceeds node memory mb";
}
node_memory_mb -= root_meta_cache_size / (1024 * 1024);
eloqstore_configs_.root_meta_cache_size = root_meta_cache_size;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Guard the auto-sized cache against 0MB when memory is tiny.

node_memory_mb / 20 can yield 0MB for small test/dev nodes, silently disabling the cache. Consider clamping to a minimum to avoid surprising behavior.

🛠️ Proposed fix (min 1MB)
-            root_meta_cache_size_str =
-                std::to_string(node_memory_mb / 20) + "MB";
+            const uint32_t auto_root_meta_mb =
+                std::max<uint32_t>(1, node_memory_mb / 20);
+            root_meta_cache_size_str =
+                std::to_string(auto_root_meta_mb) + "MB";
🤖 Prompt for AI Agents
In `@store_handler/eloq_data_store_service/eloq_store_config.cpp` around lines 365
- 396, The auto-sizing logic for root_meta_cache_size (root_meta_cache_size_str,
computed from node_memory_mb / 20) can produce "0MB" on tiny nodes; change the
auto-size branch to clamp the computed value to a minimum of 1MB (i.e., compute
auto_mb = std::max(node_memory_mb / 20, 1) and use std::to_string(auto_mb) +
"MB"), keep using parse_size(root_meta_cache_size_str) and the existing FATAL
check, update the logged message to report the clamped value, and ensure
eloqstore_configs_.root_meta_cache_size is set from the parsed (clamped) value.

@thweetkomputer thweetkomputer merged commit dc8d129 into main Jan 31, 2026
4 checks passed
@thweetkomputer thweetkomputer deleted the bump branch January 31, 2026 09:49
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.

2 participants