Skip to content

Improve error handling in ClusterVNode and refactor TFChunkDb processing#38

Merged
yordis merged 1 commit intomasterfrom
fix/unwrap-aggregate-exception-157
Feb 3, 2026
Merged

Improve error handling in ClusterVNode and refactor TFChunkDb processing#38
yordis merged 1 commit intomasterfrom
fix/unwrap-aggregate-exception-157

Conversation

@yordis
Copy link
Member

@yordis yordis commented Feb 2, 2026

Changed: Added error handling in StartNode method to throw the first inner exception from AggregateException.

Signed-off-by: Yordis Prieto [email protected]

Changed: Added error handling in StartNode method to throw the first inner exception from AggregateException.

Signed-off-by: Yordis Prieto <[email protected]>
@cursor
Copy link

cursor bot commented Feb 2, 2026

PR Summary

Low Risk
Mostly restructures exception propagation during startup/DB open; behavior should be equivalent but could slightly change which exception type bubbles up in parallel chunk-loading failures.

Overview
Improves startup error surfacing by wrapping ClusterVNode's StartNode to unwrap AggregateException and rethrow the first inner exception, making failures easier to diagnose.

Refactors TFChunkDb.Open chunk-loading parallel loop to remove the surrounding try/catch unwrapping logic and rely on Parallel.ForEachAsync exception propagation while keeping the chunk selection/completion logic the same.

Written by Cursor Bugbot for commit b399bdb. This will update automatically on new commits. Configure here.

@coderabbitai
Copy link

coderabbitai bot commented Feb 2, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

The PR modifies error handling and chunk loading logic across two core files. ClusterVNode.cs adds a defensive exception-flattening wrapper around node startup. TFChunkDb.cs refactors parallel chunk loading by removing outer exception handling and consolidating chunk creation branching paths based on completion state.

Changes

Cohort / File(s) Summary
Node Startup Error Handling
src/EventStore.Core/ClusterVNode.cs
Added defensive try-catch wrapper in StartNode that flattens AggregateException by rethrowing the first inner exception. Extracted original logic into StartNodeCore local function to separate error handling from core startup sequence.
Chunk Loading Refactoring
src/EventStore.Core/TransactionLog/Chunks/TFChunkDb.cs
Removed outer try-catch around Parallel.ForEachAsync. Consolidated per-chunk processing by introducing conditional branching for checkpoint boundary cases to decide between FromCompletedFile vs. FromOngoingFile paths. Eliminated nested conditionals and unified chunk creation flow with single addition point to chunk manager.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 A node starts clean with error grace,
Flattening exceptions in their place,
While chunks align in simpler ways,
No nested tangles in the maze!
Control flows smooth, conditions clear—
The EventStore refactors here!

✨ 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/unwrap-aggregate-exception-157

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Failure to add the new IP will result in interrupted reviews.


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.

@yordis yordis marked this pull request as ready for review February 3, 2026 16:06
@yordis yordis merged commit 20b8b42 into master Feb 3, 2026
7 of 8 checks passed
@yordis yordis deleted the fix/unwrap-aggregate-exception-157 branch February 3, 2026 16:06
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