Skip to content

fix(index): fine-tune fjall default for expected write throughput#896

Merged
scarmuega merged 1 commit intomainfrom
fix/fjall-defaults
Feb 12, 2026
Merged

fix(index): fine-tune fjall default for expected write throughput#896
scarmuega merged 1 commit intomainfrom
fix/fjall-defaults

Conversation

@scarmuega
Copy link
Member

@scarmuega scarmuega commented Feb 12, 2026

Summary by CodeRabbit

  • Chores
    • Updated default database configuration settings, including adjustments to transaction handling, memory allocation, worker thread concurrency, and cache behavior for improved consistency and performance.

@coderabbitai
Copy link

coderabbitai bot commented Feb 12, 2026

📝 Walkthrough

Walkthrough

This PR replaces the derived Default implementation for FjallIndexConfig with a manual one that establishes explicit default values for Fjall database configuration parameters including journal size, flush behavior, L0 threshold, worker threads, and memtable size.

Changes

Cohort / File(s) Summary
Fjall Configuration Defaults
crates/core/src/config.rs
Removed Default from derive attributes and added manual Default implementation with explicit values: max_journal_size=1024, flush_on_commit=false, l0_threshold=8, worker_threads=8, memtable_size_mb=128.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

  • txpipe/dolos#845: Directly modifies and propagates the same Fjall configuration fields (max_journal_size, flush_on_commit, l0_threshold, worker_threads, memtable_size_mb) across StateStore/IndexStore, making use of these newly-explicit defaults.

Poem

🐰 A config struct once left to chance,
Now defaults take their proper stance.
Journals set at 1024's might,
Threads and levels, tuned just right! 🎯

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
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 (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix(index): fine-tune fjall default for expected write throughput' directly and specifically describes the main change: adjusting FjallIndexConfig default values to optimize for write throughput.

✏️ 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 fix/fjall-defaults

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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/core/src/config.rs (1)

354-392: ⚠️ Potential issue | 🟠 Major

Per-field #[serde(default)] bypasses the new defaults during partial deserialization.

Each field carries #[serde(default)], which means serde uses Option::default() (i.e., None) for every omitted field — not the values from your manual Default impl. The custom defaults only take effect when the entire FjallIndexConfig is absent and IndexStoreConfig::default() is called. If a user supplies a partial config (e.g., only path), the tuned values for max_journal_size, worker_threads, etc. will silently be None.

Replace the per-field #[serde(default)] annotations with a single struct-level #[serde(default)] so that missing fields fall back to the Default impl:

Proposed fix
-#[derive(Serialize, Deserialize, Clone, Debug)]
+#[derive(Serialize, Deserialize, Clone, Debug)]
+#[serde(default)]
 pub struct FjallIndexConfig {
     /// Optional path override. If relative, resolved from storage root.
     /// If not specified, defaults to `<storage.path>/index`.
-    #[serde(default)]
     pub path: Option<PathBuf>,
     /// Size (in MB) of memory allocated for caching.
-    #[serde(default)]
     pub cache: Option<usize>,
     /// Maximum journal size in MB (default: 1024).
-    #[serde(default)]
     pub max_journal_size: Option<usize>,
     /// Flush journal after each commit (default: false).
-    #[serde(default)]
     pub flush_on_commit: Option<bool>,
     /// L0 compaction threshold (default: 8, lower = more aggressive).
-    #[serde(default)]
     pub l0_threshold: Option<u8>,
     /// Number of background compaction worker threads (default: 8).
-    #[serde(default)]
     pub worker_threads: Option<usize>,
     /// Memtable size in MB before flush (default: 128).
-    #[serde(default)]
     pub memtable_size_mb: Option<usize>,
 }
🧹 Nitpick comments (1)
crates/core/src/config.rs (1)

209-236: Consider applying similar tuned defaults to FjallStateConfig.

FjallStateConfig has the same set of tunable fields (max_journal_size, l0_threshold, worker_threads, memtable_size_mb, etc.) but still derives Default, so all fields default to None. The doc comments even reference non-None defaults (e.g., "default: 4" for l0_threshold, "default: 64" for memtable_size_mb) that don't match the derived behavior. If the index store benefits from explicit defaults for write throughput, the state store likely does too.

@scarmuega scarmuega merged commit e0c834a into main Feb 12, 2026
12 checks passed
@scarmuega scarmuega deleted the fix/fjall-defaults branch February 12, 2026 11:45
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