Skip to content

fix(logtailreplay): cancel pending catalog metadata reads on replay failure - #32992

Merged
XuPeng-SH merged 11 commits into
matrixorigin:mainfrom
gouhongshen:codex/cancel-branch-metadata-prefetch
Nov 30, 2026
Merged

XuPeng-SH merged 11 commits into
matrixorigin:mainfrom
gouhongshen:codex/cancel-branch-metadata-prefetch

Conversation

@gouhongshen

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

Related to #32708. Follow-up to #32707 and the 4.2-dev review finding in #32925.

What this PR does / why we need it:

Historical catalog replay reads metadata in parallel. If a required object was missing, replay waited for all later reads before checking the error. A slow read could exhaust the request deadline and prevent DATA BRANCH MERGE from using the existing snapshot fallback.

Wait for metadata plans in object order. Once a required plan fails, cancel and join the later reads using a child context. Preserve the original error and the request context. Keep the existing bound on parallel reads.

The regression exercises a missing first or second object's metadata with a later read held open. Both cases exhausted the caller deadline before the fix. The fixed version passed 100 runs under the race detector, including the existing data-block cases.

Wait for plans in object order and stop later metadata reads as soon as a required plan fails. Preserve the original error and the caller context for snapshot recovery.
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@mergify

mergify Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Queue requested — the merge queue status continues in this comment ↓.

…eady

Consume metadata plans in replay order, but wait only for the current object. Cancel and join speculative plans when the payload window exits, preserving the caller context for snapshot recovery.
@XuPeng-SH

XuPeng-SH commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 56ba25b9676898caf5675fc7467e361ce4b141c9

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 56ba25b9676898caf5675fc7467e361ce4b141c9

Assessment: request_changes

The ordered metadata path reuses the existing plan builder and the new collector gives submitted jobs a cleanup owner. The collector also introduces a liveness regression for non-cancellable payload reads. The earlier metadata-read and abandoned-job concerns are addressed in their original scopes.

Model: gpt-6.1-terra / max

Session: 01a21c74-6ebf-7b82-9860-40a978022cab · slot 0 · generation 23

  • P2 pkg/vm/engine/disttae/logtailreplay/change_handle.go:4572: An unbounded CN replay, or an unbounded non-coalesced A-object replay, receives a missing-file error while a later submitted payload read is blocked in a backend such as HDFS that does not interrupt reads on cancellation.
    Impact: The collector waits for the later read after detecting the error, potentially exhausting the request deadline. DATA BRANCH MERGE then returns the deadline error before attempting its reader fallback, even when fallback could recover.
    Evidence: CN and window prefetch submit up to 20 jobs before this unconditional join; HDFS Open and reads do not accept a context (pkg/fileservice/hdfs.go:265). The paired probe in cn-head-verified.log returned only after the deadline, while its cancellable control passed. Both cases passed with the merge-base replay files overlaid (cn-base-verified.log). Limit payload read-ahead for non-cancellable services, or provide equivalent cleanup ownership that does not delay the error.

Validation:

  • Isolation preflight and diff whitespace check passed.

  • The logtailreplay package passed under the race detector; each of the four affected concurrency tests passed 100 race-enabled repetitions.

  • The paired CN probe failed on the reviewed head and passed with baseline replay files; its cancellable control passed in both runs.

  • Frozen CI evidence reports successful unit and multi-CN BVT checks. Command receipts and retained logs are mapped in validation-assessment.md.

Limitations:

  • The HDFS failure was modeled with a controlled non-cancellable FileService; no live HDFS cluster or SQL MERGE fault injection was used.

  • The baseline comparison overlaid the merge-base replay source and tests onto the head checkout rather than building a complete baseline checkout. The native libraries were built locally from a frozen source archive, which does not receive a reusable Git provenance stamp.

@XuPeng-SH

XuPeng-SH commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 98f85ffa05d3808d3c85b238e4c3b798722980f3

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

mo-bot review · mo-bot-local · review

Commit: 98f85ffa05d3808d3c85b238e4c3b798722980f3

Assessment: approve

The change reuses the existing replay planner and job machinery while limiting read-ahead on services that do not guarantee cancellation. The earlier findings concerning HDFS metadata reads, memory-service lock waits, abandoned jobs, and blocked payload joins are resolved in their reported paths.

Model: gpt-6.1-terra / max

Session: 01a22aff-bb68-7e31-ae71-ee4ab48ad9d0 · slot 0 · generation 45

Validation:

  • Isolation preflight and native input verification passed. The retained native build matched 198 current tracked inputs and dependency files.

  • Focused cancellation, dispatch, capability, and cleanup tests passed under the race detector. Five concurrency tests each passed 100 repetitions; the complete logtailreplay package also passed under the race detector.

  • The frozen current-head CI evidence reports successful unit and multi-CN BVT jobs. The review records, logs, and matching check receipts are retained in the diagnostic directory.

Limitations:

  • No live HDFS cluster or fault-injected SQL service was used; backend failure behavior was assessed through source tracing and controlled test services.

  • No comparative throughput measurement was performed for backends restricted to one outstanding read.

@mergify

mergify Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue · pull request dequeued

41 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Mon 30 Nov, 10:42 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 11:22 · fdf11dd

Reason

Pull request #32992 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

To get back in the queue

  • Push a change if one is needed: the pull request is queued again once its queue conditions match.
  • If no change is needed, tick the box below to queue it again as it is.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = CI Required
    • check-skipped = CI Required
    • check-success = CI Required

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request
2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

This branch was successfully deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dequeued kind/bug Something isn't working kind/test-ci size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants