Skip to content

feat: introduce batched dirty recovery - #74

Open
davidcheng0922 wants to merge 1 commit into
longhorn:longhorn-v25.09from
davidcheng0922:issue-12837-batch-dirty-recovery
Open

feat: introduce batched dirty recovery#74
davidcheng0922 wants to merge 1 commit into
longhorn:longhorn-v25.09from
davidcheng0922:issue-12837-batch-dirty-recovery

Conversation

@davidcheng0922

Copy link
Copy Markdown

Which issue(s) this PR fixes:

longhorn/longhorn#12837

What this PR does / why we need it:

Batch metadata root discovery and chain replay with bounded concurrency to accelerate dirty recovery on large blobstores. Commit phase remains serial and reuses existing recovery logic for correctness.

  • Phase 1: Scan metadata region in n-page chunks (parallel)
  • Phase 2: Replay chains with dynamic QD (parallel)
  • Phase 3: Commit chains and update masks (serial)

Special notes for your reviewer:

Additional documentation or context

Copilot AI 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.

Pull request overview

This PR introduces a batched (“bounded concurrency”) dirty recovery path for the SPDK blobstore to speed up recovery on large metadata regions, controlled via a new spdk_bs_opts.recovery_qd option. It also extends unit coverage to exercise both the legacy serial recovery path and the new batched path.

Changes:

  • Add recovery_qd to spdk_bs_opts, defaulting to 16, and plumb it through blobstore load to select batched vs. serial recovery.
  • Implement batched dirty recovery in blobstore.c with parallel metadata scanning + bounded-concurrency chain replay, followed by a serial commit phase.
  • Update unit tests to run dirty-shutdown recovery under both serial (recovery_qd=1) and batched (recovery_qd=8) settings.

Reviewed changes

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

File Description
test/unit/lib/blob/blob.c/blob_ut.c Refactors dirty shutdown test to run with configurable recovery QD and adds a batched-recovery variant.
lib/blob/blobstore.c Adds recovery_qd option default/copy, selects batched recovery when enabled, and implements the batched recovery pipeline.
include/spdk/blob.h Extends public blobstore options with recovery_qd and updates ABI size assertions.

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

Comment thread lib/blob/blobstore.c
Comment thread lib/blob/blobstore.c
  Scan blobstore metadata with chunk reads and record compact page summaries.
  Use those summaries to replay metadata chains as batched ranges, while keeping
  metadata commit serial and reusing the existing used-mask write path.

  If summary replay cannot be prepared, fall back to standard batched replay.
  Runtime I/O or validation failures fall back to legacy serial recovery.

Longhorn: 12837

Signed-off-by: David Cheng <david.cheng@suse.com>

Copilot AI 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.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread lib/blob/blobstore.c
Comment on lines 4153 to +4156
ctx->iter_cb_fn = opts->iter_cb_fn;
ctx->iter_cb_arg = opts->iter_cb_arg;
ctx->force_recover = opts->force_recover;
ctx->recovery_qd = opts->recovery_qd;
@derekbit

Copy link
Copy Markdown
Member

cc @hookak @bachmanity1

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.

3 participants