Skip to content

tae: flush eligible AObject prefixes before busy tails - #31723

Merged
XuPeng-SH merged 7 commits into
matrixorigin:mainfrom
jiangxinmeng1:fix/flush-ready-aobject-prefix
Oct 30, 2026
Merged

XuPeng-SH merged 7 commits into
matrixorigin:mainfrom
jiangxinmeng1:fix/flush-ready-aobject-prefix

Conversation

@jiangxinmeng1

@jiangxinmeng1 jiangxinmeng1 commented Oct 29, 2026 •

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 #31350 (the Sysbench memory-pressure follow-up in that issue; this PR does not fix or validate the original oversized-WAL/DN-panic incident).

What this PR does / why we need it:

This PR addresses memory pressure caused by flushable appendable objects accumulating behind an object that temporarily fails PrepareCompact. The flusher can now admit the contiguous oldest-to-newest ready prefix instead of letting the busy object block that prefix. Data and tombstone objects have independent prefixes. For a partial flush, it applies the existing memory/pressure/deadline policy to the ready prefix and keeps the retry deadline for the deferred suffix.

This lets eligible objects be flushed and cleaned up earlier. Reducing TN flush backlog can indirectly reduce the lifetime and amount of CN logtail row state retained for unflushed objects; this PR does not change CN logtail replay itself and does not claim to eliminate every source of CN memory growth. Focused tests cover prefix order, memory and pressure thresholds, busy tombstones, retry behavior, and chunk boundaries.

Memory evidence and limits

The Sysbench 1000W runs used the 129 shared runner. The baseline used matrixorigin/matrixone@7597f979e7904cf37ff077c94ffad191367d4d89; the candidate used this change at 65c0f20aa8e2de73c9b9abb4703f4c34481af693. The 30-second samples inside each five-minute case show peak Go heap_alloc of 33.75 -> 16.37 GiB and process RSS of 67.89 -> 50.31 GiB for update_index; for update_non_index, the corresponding peaks are 30.50 -> 12.71 GiB and 69.08 -> 49.26 GiB. The baseline samples are in its workflow artifact; the candidate's complete time series and 73 heap plus 73 malloc profiles are preserved on 129 at /data3/mo-benchmark-preserved/gh-40838393893-1-sysbench1000w/. See the measurement comment for cgroup and tracked off-heap cache values. These are one observed run per commit under different concurrent host load, not a controlled A/B or proof that the patch alone caused the reduction. The current PR head cf34087d858060c521845275c524cd62ed60e13a includes a later main merge and the lazy-prefix-allocation follow-up; it was not the commit measured by Sysbench.

Validation

  • The PR diff contains only flusher.go and its focused test file. gofmt and git diff --check passed on the original change.
  • On current head cf34087d858060c521845275c524cd62ed60e13a, the focused checkpoint tests passed locally: .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 -timeout=180s -run '^Test(FireFlushTabletail|FlushDeadline|FlushPartialPrefix|FlushBusyTombstone|PartialFlushPreservesDeletesAndWriter)' ./pkg/vm/engine/tae/db/checkpoint. The isolated worktree's CGo build used ONNX Runtime extracted from the previous-head CI build artifact, with SHA256 matching the repository-pinned Linux amd64 checksum. gofmt and git diff --check also passed. The previous head 482e41904aebd016397890c1f37d1908b9e0cb9a passed CI UT Coverage; CI for the current head is pending. The Sysbench workload at 65c0f20 does not replace tests at the current head.

@mergify mergify Bot added the kind/bug Something isn't working label Oct 29, 2026
@jiangxinmeng1
jiangxinmeng1 marked this pull request as ready for review October 29, 2026 07:38
@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 →

@jiangxinmeng1

Copy link
Copy Markdown
Contributor Author

sysbench1000w memory comparison on 129 Slot B

  • Main tested commit: 7597f979e7904cf37ff077c94ffad191367d4d89 — run 40813545886 (the relevant cases passed; the run was canceled later).
  • Fix branch tested commit: 65c0f20aa8e2de73c9b9abb4703f4c34481af693 from jiangxinmeng1/matrixone:fix/flush-ready-aobject-prefix — run 40838393893 (passed).
  • The PR head is currently 482e41904aebd016397890c1f37d1908b9e0cb9a; these measurements are for the tested 65c0f20a commit, not the newer head.

Peak values below use the 30-second samples inside each five-minute case window (GiB):

Case Metric Main Fix Change
update_index Go heap_alloc 33.75 16.37 −51.5%
update_index Process RSS 67.89 50.31 −25.9%
update_index cgroup memory charge 78.61 72.57 −7.7%
update_non_index Go heap_alloc 30.50 12.71 −58.3%
update_non_index Process RSS 69.08 49.26 −28.7%
update_non_index cgroup memory charge 78.29 73.83 −5.7%

The tracked off-heap file-service memory cache peak was 30.09 → 30.13 GiB for update_index and 26.66 → 30.28 GiB for update_non_index; the lower Go heap/RSS peaks do not imply that this cache shrank. cgroup charge includes file cache, and these metrics use different accounting rules, so the columns should not be added together.

The fix run's complete memory time series, case logs, and heap/malloc profiles are preserved on 129 at /data3/mo-benchmark-preserved/gh-40838393893-1-sysbench1000w/ (73 heap and 73 malloc profiles). The main run's time series is in its GitHub artifact. This is one observed run per commit under different concurrent host load; the sampled peaks show a clear reduction in this test, but do not by themselves establish the precise cause.

@XuPeng-SH

XuPeng-SH commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 427da30f63cab783788ddc70f2dc709df7b29cd2

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: 427da30f63cab783788ddc70f2dc709df7b29cd2

Assessment: approve

Reviewed the complete delta, affected storage and scheduling paths, and all discussion. Prefix admission preserves readiness checks, delete transfer, rollback and retry behavior. No actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a1869d-820c-7212-9788-aecfb86a4141 · slot 0 · generation 2

Validation:

  • Reused supplied current-head successful UT, coverage, build, SCA, proxy BVT and pessimistic multi-CN BVT statuses.

  • Static audit passed; retained log static-audit-v2.log matches receipt checks/1793330585304360024-3.json. Verified frozen delta, clean source, whitespace and complete discussion coverage.

  • Saved review-plan.md and discussion-assessment.json.

Limitations:

  • No local Go tests were run; raw CI per-test logs and execution flags were unavailable.

  • Older uncontrolled memory measurements were treated as context, not verified current-head performance evidence.

@mergify mergify Bot added the queued label Oct 30, 2026
@mergify

mergify Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue

1 h 3 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Fri 30 Oct, 03:25 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 04:28 · e1cddf7

Reason

Pull request #31723 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.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Merge conditions: 2 of 3 met

This pull request

Condition Required by
✅ #review-threads-unresolved = 0 GitHub branch protection
✅ github-review-approved GitHub branch protection

The batch, tested in place

Condition Required by
❌ any of: check-neutral = CI Required, check-skipped = CI Required, check-success = CI Required GitHub branch protection

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

  • Requeue this pull request

Times in UTC · dashboard · how the merge queue works

This branch was previously deployed

1 inactive deployment
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 size/L Denotes a PR that changes [500,999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants