Skip to content

checkrecover: approve bounded M0 rewrite and backup recovery boundaries - #56

Merged
XuPeng-SH merged 2 commits into
matrixorigin:masterfrom
VioletQwQ-0:codex/m0-recovery-boundaries
Nov 10, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:masterfrom
VioletQwQ-0:codex/m0-recovery-boundaries

Conversation

@VioletQwQ-0

Copy link
Copy Markdown
Contributor

Purpose

Request exact recovery-boundary approval for matrixorigin/matrixone#30816. Keep checkrecover enabled and reject unrelated functions/directly launched unjoined workers.

Boundary necessity

  • Transaction.compactDeletionOnObjsLocked: a pool job must report panic as a failed rewrite before waiter.Done; the owner joins all jobs, retracts staged records and never publishes a failed pass. Ants otherwise catches a panic without populating this job result.
  • txnTable.rewriteObjectByDeletion: after output persistence, recovery is needed to return the persisted-name ownership snapshot to the caller even on panic. Ordinary unwind loses return values; the outer worker would have no exact cleanup names. Close-panic recovery also permits error joining and output-batch cleanup before returning failure.
  • logtail.ReWriteCheckpointAndBlockFromKey: partial unpublished outputs must be reclaimed; cleanup failure must retain the original panic and report cleanup diagnostics. Success/error discrimination plus combined panic/cleanup reporting cannot be supplied by unconditional ordinary defer alone.

No generic recovery helper, analyzer disable flag or package-wide exception is added. This is a policy approval request, not a claim that unsafe-recover diagnostics establish runtime defects. MatrixOne will update its fixed tool dependency only after this rule is accepted.

Validation

The evidence is bound to its original MatrixOne source and is not fresh Linux qualification or independent approval.

@VioletQwQ-0
VioletQwQ-0 marked this pull request as ready for review November 9, 2026 09:21
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Nov 10, 2026
Use main's scan-local snapshot transaction/context helpers in both modes.
Retain M0 remote bound-transaction checks, pipeline cancellation/account
precedence, and the immutable statement view during tombstone collection.
Remove the superseded M0-only process-clone selection helper.

Retain upstream mixed-snapshot SQL/BVT coverage. Keep the pinned linter
unchanged pending acceptance of the narrowly scoped recovery rules in
matrixorigin/linter#56.
VioletQwQ-0 added a commit to VioletQwQ-0/matrixone that referenced this pull request Nov 10, 2026
Run shared dispatch, account/cancellation and physical-header regressions in
both build modes, preserving tagged authority validation and all existing
assertions. Share the unchanged watermark checker while keeping production
registration M0-only. Add carrier/clone isolation and missing-owner controls.

Keep the required recovery boundaries and pinned linter unchanged pending
acceptance of matrixorigin/linter#56. Remote CI remains to verify coverage.
@XuPeng-SH
XuPeng-SH merged commit fffeed4 into matrixorigin:master Nov 10, 2026
XuPeng-SH added a commit to matrixorigin/matrixone that referenced this pull request Nov 16, 2026
## What type of PR is this?

- [ ] API-change
- [ ] BUG
- [x] Improvement
- [ ] Documentation
- [ ] Feature
- [ ] Test and CI
- [ ] Code Refactoring

## Which issue(s) this PR fixes:

Related to #32751

## What this PR does / why we need it:

The object writer currently compresses into a separate scratch buffer
and then copies the compressed bytes into the writer arena. When the
unused arena tail already fits the LZ4 compression bound, that creates
an avoidable live allocation and copy.

Compress directly into the unused tail when it is large enough and does
not overlap the input. Commit only the actual compressed length to the
arena after success. Inputs overlapping the tail, insufficient space,
and writers without an arena keep the existing scratch path. The LZ4
format, extent metadata, ownership of completed output, and arena
accounting remain unchanged.

Validation on a CPU-only 57 host:

- Exact compressed bytes, offsets, NULLs, multiple sequential writes,
alias and insufficient-capacity fallback, and an in-memory object
write/read after arena reuse were checked. The full objectio package
passed normally and under race; the independent concurrent-arena test
passed 100 race repetitions. Incremental lint and formatting passed.
- In two isolated 1-CN LOAD/ALTER cases (one 8 MiB field and 31 64 KiB
fields, large field first or last), all row hashes and strict/non-strict
diagnostics matched. The load-idle native profile dropped the 16 MiB
compression scratch while retaining the 32 MiB arena. Sampled LOAD RSS
deltas changed 115.13→105.11 MiB and 106.39→95.11 MiB; one run per order
with 5 ms sampling is not an exact peak or a production-scale estimate.
- Combined with merged #32771, an additional 1-CN case preserved all
hashes and diagnostics. Its sampled LOAD/ALTER RSS deltas were
96.68/34.46 MiB versus 115.13/50.46 MiB in the separate base run;
profile attribution confirms both allocation reductions, but individual
runs are not directly additive.
- Three alternating microbenchmark rounds showed little change for 64
B–4 KiB serial inputs and about 52% lower time for 8 MiB varied input in
the direct path. A four-producer 4 KiB case was 1.3% slower. The initial
8 MiB fallback samples were 4–6% slower; eight additional alternating
pairs had a +0.39% median with several-percent variation. These
shared-host samples do not prove a universal no-regression result.

Rows whose compression bound exceeds the unused arena capacity retain
the existing path; this alone does not resolve the original
very-large-row OOM.

## Overlap guard and SCA follow-up

- `unsafe` is confined to `compression_overlap.go`, which compares
addresses without dereferencing or reconstructing pointers. The caller
must keep both buffers and their owners valid and must not release the
arena concurrently. `writer.go` remains subject to the unsafe-import
check. Empty, same-start, containment, both partial-overlap directions,
adjacent and separate slices are tested; real compression tests verify
that overlapping input falls back and adjacent input uses the direct
path.
- The pinned molint is the official master commit `147a3f213653` merged
in [linter PR 57](matrixorigin/linter#57); it no
longer depends on the unmerged compatibility branch. Compared with the
previous MatrixOne main pin, this version also includes three
function-scoped `recover` approvals already merged in [linter PR
56](matrixorigin/linter#56).
- The complete `pkg/objectio` suite passed normally and under race on
the earlier PR head. After merging the latest main including #32782,
compression and S3 writer/cache interaction tests passed under race, and
the official merged molint plus golangci passed `make
static-check-selected STATIC_CHECK_PACKAGES=./pkg/objectio` on commit
`11e75981aa3ce38812484cb533c093be89bf9260`. Full CI is running on that
head. The linter itself passed `go test ./...` before merge.
- Comparing the guard extraction against the earlier PR head on the
shared 57 host, the first three-pair 64-byte sample had a +3.35% median;
six additional alternating pairs had a -0.23% paired median. The 4 KiB
follow-up paired median was +0.09%. These short samples are noisy and do
not establish a universal performance result.
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.

2 participants