Skip to content

perf: reduce checkpoint metadata allocations - #33098

Merged
XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
XuPeng-SH:codex/33097-checkpoint-meta
Nov 23, 2026
Merged

XuPeng-SH merged 1 commit into
matrixorigin:mainfrom
XuPeng-SH:codex/33097-checkpoint-meta

Conversation

@XuPeng-SH

@XuPeng-SH XuPeng-SH commented Nov 23, 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 #33097. This PR improves the current main reader; release rollout and production workload validation are tracked separately in the issue.

What this PR does / why we need it:

For v13 checkpoint metadata, use a valid table-ID block zone map to avoid reading the ID column when its bounds prove the requested table is absent. An ID inside the bounds still uses the existing exact lookup, so a gap does not trigger speculative reads of the large metadata columns. Reuse the header already loaded by the reader when reading the ID column; this avoids an additional backing-store request when the metadata cache does not admit the header.

Allocate filtered TableRange results to their exact size in the existing conversion function. This removes repeated growth and copies while preserving row order, nil results, and owned object-stat values.

On an 8,192-row synthetic checkpoint using the actual ObjectIO writer and reader, Go 1.27.1, and a warm memory cache:

  • One matching row (three 300 ms runs): both versions allocated 3,960 B/op in 31 allocations; the timings overlap at 4.68–4.84 µs before and 4.59–4.75 µs after.
  • 64 matching rows (three 300 ms runs): 31,696 to 18,064 B/op, 42 to 32 allocs/op, and 11.1–12.3 to 8.1–8.9 µs/op. With 4,096 matches: 3,295,720 to 921,256 B/op, 59 to 33 allocs/op, and 486–529 to 262–272 µs/op. These can be reproduced with BenchmarkCheckpointMetadataSelection.
  • All 8,192 rows matching (three 500 ms runs): 6,670,992 to 1,838,928 B/op, 66 to 36 allocs/op, and 805–845 to 424–442 µs/op.
  • A 10-lookup public-reader window (three 500 ms runs) with an assumed 60% outside misses, 20% in-range misses and 20% one-row hits: 13,872 to 9,744 B/window and 16.7–17.3 to 11.7–11.9 µs/window. This mix is not an observed production distribution.

The 64-, 4,096-, and 8,192-match cases are dense synthetic stress cases, not measured production frequencies. Each metadata range represents a table/object-type run in a checkpoint data file; with sorted data, each file contributes at most one range per type. The actual request-weighted match count and outside-range miss rates, especially for alphaTask subscriptions, have not been measured.

On an isolated local MinIO server over HTTP, with the same synthetic checkpoint, an outside miss changed from 2 to 1 GET with an unprimed header and from 1 to 0 GET with a primed header. The in-range miss and matching cases kept the same GET and byte counts. These are loopback measurements, not remote-S3 or production replay measurements. The 4.2.9 release source already contains #32894's earlier selective-read fix; the deployed image and its allocation, GC and RSS effects are not established by this PR.

Validation:

  • Focused reader, cleanup, malformed zone-map, cancellation, concurrent subscription and range-export tests.
  • Real ObjectIO/S3FS backing-read tests, including disabled file cache and metadata-cache admission, first cold read, and blocks over 8,192 rows.
  • Full owning-package tests with -race: ./pkg/objectio/ioutil, ./pkg/vm/engine/ckputil, ./pkg/vm/engine/tae/logtail; focused logtailreplay tests cover the existing appendable-object caller.
  • Repository incremental SCA against the main merge base, plus changed-file gofmt and git diff --check.

@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 23, 2026 •

Copy link
Copy Markdown
Contributor

This pull request is merged.

@XuPeng-SH

XuPeng-SH commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor Author

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

Commit: 61e4920c2887ed907e938d27ef86073f3c45d939

Review completed. Read the assessment.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor Author

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: 61e4920c2887ed907e938d27ef86073f3c45d939

Assessment: approve

The reader uses valid block bounds to skip definite misses and retains the exact ID lookup for in-range IDs and unusable bounds. It reuses the existing column decoder and allocates range results to size while preserving row order and ownership.

Model: gpt-6.2-sol / xhigh

Session: 01a1f0a0-5126-78f3-9ab8-ef4e87f2f119 · slot 0 · generation 3

Validation:

  • All 168 test roots in the three owning packages passed under race detection. The concurrent subscriber case passed 100 repetitions, and the focused appendable-object replay test passed.

  • With cache admission disabled, an outside miss dropped from two backend reads to one. The baseline and candidate both used two reads for an in-range miss and four for a hit.

  • Three interleaved benchmark runs per variant used the same 8,192-row fixture. Allocated bytes fell from 31,696 to 18,064 per lookup at 64 matches and from 3,295,720 to 921,256 at 4,096 matches. Zero-match and one-match allocations were stable.

  • Verified the six-file frozen delta, gofmt, native inputs, and isolation preflight. Compared the unsigned bound layout and producer against the available 4.2.8 and hotfix source tags. Commands and receipts are matched to logs in validation-reconciliation.json.

Limitations:

  • Local performance checks used synthetic checkpoints and disk-backed storage. Production RSS and GC, remote storage performance, and deployed-image rollout remain in scope for #33097.

@XuPeng-SH
XuPeng-SH merged commit 8f3ec29 into matrixorigin:main Nov 23, 2026
@XuPeng-SH
XuPeng-SH deleted the codex/33097-checkpoint-meta branch November 23, 2026 12:03

This branch was successfully deployed

No deployments
ci — 61e4920c Deployed Nov 23, 2026 by XuPeng-SH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants