Skip to content

fix(tae): flush ready table-tail objects past busy peers - #30396

Merged
mergify[bot] merged 5 commits into
matrixorigin:mainfrom
LeftHandCold:fix/30244-flush-progress-20261016
Oct 17, 2026
Merged

mergify[bot] merged 5 commits into
matrixorigin:mainfrom
LeftHandCold:fix/30244-flush-progress-20261016

Conversation

@LeftHandCold

@LeftHandCold LeftHandCold commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

What type of PR is this?

  • BUG

Which issue(s) this PR fixes:

Related to #30244 (partial remediation; do not automatically close the incident).

What this PR does / why we need it:

Related to #30244. This fixes the demonstrated normal-flush scheduling/progress
defect identified while investigating that incident; it does not establish
that the entire 84 GiB memory-pressure incident is resolved.

fireFlushTabletail previously stopped the whole loop when any data object's
PrepareCompact returned false. It then returned nil, allowing the caller to
reset the table's flush deadline despite deferring work. A single busy object
could prevent ready peers in the same chunk and later chunks from progressing.

  • Select ready data objects within each existing 400-object chunk, retaining the
    original chunk boundaries and immutable per-task selection slices.
  • Return ExpectedEOB when any data object was deferred, including after partial
    scheduling, so the caller does not postpone retries by resetting the deadline.
  • Keep tombstones all-or-none and attached only to the first scheduled chunk.
  • Preserve truly tombstone-only work, but do not introduce a tombstone-only
    fallback when every data object is busy.

Safety boundary

No changes to PrepareCompact, appender reference ownership, freeze/MVCC checks,
flush-task retry, delete transfer, persistence format, scheduler scope exclusion,
GC/cache settings or memory admission. The existing flush task already supports
partial data sets with the full tombstone set for tables larger than 400 objects.
As before, a successful scheduling return is not a completed flush transaction.

Validation

Local Linux/amd64, Go1.27.1, CGo CPU build produced via repository make cgo;
tests use the repository provenance-checking mo-cgo-test wrapper:

  • Old-source overlay negative control fails the new ready/busy/ready regression;
    the candidate passes it (no copied-model-only proof).
  • Entire checkpoint package passes in normal mode and under -race.
  • Each of the four new exact tests passes -race -count=100, run separately.
  • Nine existing downstream flush/delete-transfer/rollback/replay controls pass
    on both clean baseline and candidate.
  • Real-engine regression dispatches actual captured flush factories, holds a real
    appender reference, checks exact physical source identity, PK and payload values,
    persisted deletes, writer commit/rollback, retry, and restart.
  • gofmt, git diff --check and default go test vet pass.
  • Repository-configured incremental lint on the changed checkpoint package passes
    with task-local golangci-lint v2.14.0 built with Go1.27.1: 0 issues.

The local validation manifest retains source/native hashes, exact commands,
terminal JSON test records, and negative controls. Independent downstream/hunk
review found no remaining correctness blocker in this scoped patch.

No remote TKE/129 scale workload has been dispatched for this patch. Replaying
the original 1000-thread Sysbench sequence and measuring memory/admission errors
remains a separate acceptance step, at the user's chosen environment.
That replay should also compare flush task/object counts, bytes written and
throughput: allowing ready subsets to progress can change batching under
continuous contention. This patch does not claim scale-level performance
neutrality from local functional tests.

@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 →

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 72a75b760c78bb4186d4b369551123f22ed7a9ae

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: 72a75b760c78bb4186d4b369551123f22ed7a9ae

Assessment: request_changes

Reviewed the complete delta and its scheduling, transaction, delete-transfer and cleanup paths. The selection design preserves existing ownership and passes functional validation, but introduces avoidable logging and allocation amplification under contention.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1517-7f90-b3f9-c5f9f9e7031b · slot 0 · generation 1

  • P2 pkg/vm/engine/tae/db/checkpoint/flusher.go:759: A flush encounters many data objects whose PrepareCompact returns false. Replacing the break with continue now executes the existing INFO diagnostic for every busy object across all chunks.
    Impact: Repeated attempts incur per-object formatting, allocations and log I/O on the flush-admission path, even when no task can progress. Aggregate deferred counts or bound diagnostic sampling before formatting object IDs, while preserving readiness scanning and ExpectedEOB.
    Evidence: A production-selector probe with 400 busy objects emitted 400 records totaling 88,400 bytes versus one 221-byte record on the base. With logging disabled, median allocation rose from 28,138 B/18 allocations to 127,364 B/1,615 allocations. Removing only this diagnostic in an overlay retained full scanning and reduced allocation to 31,354 B/15 allocations. Retained bench-base.log, bench-head.log, bench-no-busy-log.log and info-{base,head}.log are reconciled in evidence-audit.json.

Validation:

  • Preflight and current-revision native provenance passed. Full checkpoint package passed normally and under -race.

  • Four exact tests passed separate adaptive race stress: selection 100 repetitions, chunk boundaries 100, deadlines 100, real-engine commit/rollback/restart 8.

  • Nine downstream flush, delete-transfer, error-handling and replay controls passed. Base-source overlay failed the new regression as expected; candidate passed.

  • Selector benchmarks measured one additional allocation for all-ready chunks and confirmed the logging regression. gofmt and git diff --check passed; source remains unchanged.

  • Commands, source fingerprints, exit receipts, selections and retained logs were reconciled in /home/xupeng/.local/state/mo-bot/jobs/4e170a4f734a2ba48b09c01a/attempt-1/evidence-audit.json; complete review map is in review-notes.md.

Limitations:

  • Performance probes use mocked readiness with the production selector, not end-to-end storage throughput.

  • The original scale workload and memory-pressure incident were not reproduced; this PR explicitly addresses only partial remediation.

  • Frozen evidence contains no linked issue body or retained author-validation inventory. Author execution claims were not treated as independently verified.

@LeftHandCold

Copy link
Copy Markdown
Collaborator Author

Addressed the P2 in 093b290.

The concern is valid: continuing past busy objects amplified the existing diagnostic. The selector now counts deferred data objects and emits at most one flusher.data.prepare.compact.false record per invocation, with deferred-count. It no longer formats an object ID for each failure. The summary is also emitted on the existing tombstone/scheduler early-return paths. Selection, original chunk boundaries, tombstone ownership and ExpectedEOB/deadline behavior are unchanged; no persistent rate-limit state or scheduler mechanism was introduced.

Validation on 50 (Go1.27.1, provenance-checked CPU native artifacts):

  • New exact production-selector test covers 401 busy objects across chunks, all-ready/no-summary, busy-tombstone early return and scheduler early return. It asserts actual readiness calls as well as log count/count field. Reviewed-head source overlay fails the new regression; candidate passes.
  • Full checkpoint package normal and race: PASS. New exact log test: -race -count=100 PASS. Existing integration and deadline tests run as part of the package. Incremental configured SCA: 0 issues; gofmt/diff-check clean.
  • Same production-selector benchmark with 400 objects and logging output disabled equally on both sides, 5 x 1000 iterations: busy median 127364 B/op / 1615 allocs -> 31483 B/op / 16 allocs. All-ready control remains approximately 31418 B/op / 16 allocs. This measures selector allocation, not end-to-end throughput; shared-host timing variance and original scale-acceptance limitations remain explicit.

Raw logs, overlays, fingerprints and delivery notes are retained in /tmp/mo-flush-progress-30244-20261016.ucVCOiVj/evidence/ (review-fix-*, review-bench-*). New-head CI is separate from the preceding green CI and is not claimed passed yet. Please re-review the updated head.

@XuPeng-SH

XuPeng-SH commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 093b290198750ab9fd260b7ebef8cda780dd2a2e

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: 093b290198750ab9fd260b7ebef8cda780dd2a2e

Assessment: approve

Reviewed the complete delta and affected scheduling, transaction, delete-transfer and cleanup paths. The fix preserves existing ownership, chunk boundaries and retry semantics while allowing ready peers to progress. The prior logging-amplification finding is resolved; no actionable findings remain.

Model: gpt-6-astra / xhigh

Session: 01a13dcf-1586-7a01-9000-d45e20995cf8 · slot 1 · generation 1

Validation:

  • Current checkpoint package passed under -race, including real-engine commit/rollback and restart coverage. The logging regression passed 100 repetitions and failed against the previously reviewed implementation as expected.

  • Independently reconciled 19 retained receipts and logs covering source-compatible normal tests, focused race stress, downstream controls and the original negative control.

  • Verified 192 native inputs, 47 native artifacts and repository provenance. Isolation preflight, gofmt and diff checks passed; source remains unchanged.

  • Five-sample selector benchmarks confirmed busy-object allocations fell from 127365 B/1615 allocations at the previous head to 31483 B/16. All-ready overhead versus the merge base is 27962→31419 B and 15→16 allocations, supporting immutable task selections.

  • Commands, fingerprints, receipts and logs are reconciled in /home/xupeng/.local/state/mo-bot/jobs/31bad1e183f529e76a6e66d4/attempt-1/evidence-audit.json; complete review notes are in review-notes.json.

Limitations:

  • Benchmarks use the production selector with mocked readiness, not storage throughput. Scale-level batching, write amplification and the original memory-pressure incident remain outside this explicitly partial remediation.

  • Latest author /tmp artifacts were unavailable; current checks and verified retained artifacts supplied the required evidence.

  • The standalone linked issue body was not supplied; its contract was reviewed as recorded in the frozen PR description.

@mergify

mergify Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Queued — the merge queue status continues in this comment ↓.

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

mergify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-17 01:12 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🚫 Left the queue — 2026-10-17 01:12 UTC · at 093b290198750ab9fd260b7ebef8cda780dd2a2e

This pull request spent 14 seconds in the queue, with no time running CI.

Reason

The pull request can't be updated

GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/ci-scope-check.yml without workflows permission
GitHub only lets Mergify write to .github/workflows/ with the workflows permission. An organization owner can accept Mergify's pending permissions at https://dashboard.mergify.com/orgs/matrixorigin/repositories.

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Requeued — the merge queue status continues in this comment ↓.

@mergify mergify Bot added dequeued and removed queued labels Oct 17, 2026
@mergify

mergify Bot commented Oct 17, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-17 02:06 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-17 06:03 UTC · at 38a27e67a15890df7ca6fc418c6a57ae3a0b924d · squash

This pull request spent 3 hours 56 minutes 41 seconds in the queue, including 1 hour 3 minutes 51 seconds running CI.

Required conditions to merge

Copy link
Copy Markdown
Contributor

独立合并后实测(2026-10-17,本轮冻结 main d9cf2dd4e2b92e2193bb390115be624b76099764,Linux/amd64、Go 1.27.1、匹配的 make cgo 产物):

  • 实际执行完整 pkg/vm/engine/tae/db/checkpoint 普通及 -race -count=1 测试,分别 80 个测试/子测试通过,零失败、零跳过。
  • 覆盖 ready/busy/ready、全 busy、tombstone-only、busy tombstone、400-object 分块、后续调度冲突、重试 deadline 及日志边界。
  • TestPartialFlushPreservesDeletesAndWriter 的 commit/rollback 两个真实 engine 场景均执行通过,包含捕获后执行真实 flush factory、物理 source/PK/payload、删除、释放 appender 后重试及重启检查。
  • 仅将 flusher.go 切回修复前 a322466757 的 Go overlay 负对照:TestFireFlushTabletailSelectsReadyObjects 的 ready-busy-ready 和 all-busy-does-not-flush-tombstones 失败,其余对照通过;当前原始源码对应场景通过。生产工作树未改动。

结论:#30396 修复的局部 flush 推进/重试缺陷已验证。#30244 的原始 129 / 100M rows / 1000 threads / 84 GiB 压力链,本轮没有在该规模重放;不把小型 engine 通过或既有 128 压测报告写成整个内存事件已解决,也不声称性能无回退。#30244 已在 @Ariznawlll 测试名下,保持 OPEN 及当前指派。

This branch was previously deployed

1 inactive deployment
ci — 60afc3cb Deployed Oct 17, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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