Repository navigation
perf(objectio): compress directly into available writer arena - #32774
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
This pull request is merged. |
|
mo-bot review · Commit: "interrupted" |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 3ad1e360abb59f81985652a86510251bb3d574f6
Assessment: approve
Direct compression reuses the existing arena owner and accounting. Full-bound and overlap guards preserve encoding and required fallbacks. The small fast path adds justified complexity to avoid compression scratch allocation and copying.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Full pkg/objectio normal and race suites passed on this head with Go 1.27.1: 190 top-level tests in each, including all five new cases.
-
The independent-arena concurrency test passed 100 focused race repetitions.
-
go vet, changed-file gofmt and complete-delta whitespace checks passed.
-
Preflight and native prerequisite verification passed. validation-audit.json reconciles nine current check receipts with retained logs; all four discussion entries are accounted for and source is unchanged.
Limitations:
-
Author SQL/RSS and benchmark results were not independently reproduced; raw logs were unavailable. This assessment does not establish umbrella issue #32751 acceptance or production OOM resolution.
-
Hosted UT, SCA, coverage, E2E and Go-analysis checks remained pending in the frozen snapshot.
3ad1e36 to
97c5bcd
Compare
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: "interrupted" |
…ena-compress-main-20261115
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
mo-bot review · mo-bot-local · review
Commit: 11e75981aa3ce38812484cb533c093be89bf9260
Assessment: approve
Approve the scoped compression optimization. The full-bound fit and overflow-safe overlap guard reuse the existing arena, codec, allocation accounting and scratch fallback without adding state or changing object format. The small private helper and exact file-specific linter permission are proportionate to accepting arbitrary borrowed input. Current S3/cache and retry consumers preserve output lifetime, and the official pin's complete policy delta and negative controls were reviewed. Prior approvals remain consistent with the current source; no actionable finding or unmet required contract remains.
Model: gpt-6.1-sol / max
Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0
Validation:
-
Current full objectio package passed normally and under race detection: 198 root tests/seed runs in each mode, no skips. This includes all seven added compression roots and public writer/S3FS cache readback after arena release plus retry-policy preservation. See objectio-normal.jsonl, objectio-race.jsonl and their receipts in validation-audit.json.
-
The independent-arena concurrency root passed 100 race repetitions, selected from its measured 0.01s race duration. See race-stress-plan.json and arena-stress-race.jsonl.
-
Official make static-check-selected passed for ./pkg/objectio with pinned standalone molint 147a3f213653 and checksum-verified golangci-lint v2.14.0, using the repository configuration. Changed files passed gofmt and git diff --check; source remained unchanged.
-
Exact old/new linter module identities and the complete six-file policy diff were retained. Both affected analyzer packages passed three test roots with positive and negative fixtures; tested input hashes were rechecked. See linter-modules.json, linter-pin.patch and linter-policy-tests.jsonl.
-
Preflight passed; reused native prerequisites matched 195 current inputs, 69 artifact hashes and compiler identity. Claimed checks were matched to command/source/exit receipts and retained logs, with module identity binding the upstream analyzer tests. All ten discussion keys are accounted for exactly once.
Limitations:
-
No new whole-SQL, RSS, GPU or benchmark campaign was run. Author performance reports are context without matching raw execution artifacts; no full-OOM or universal latency conclusion is claimed.
-
The S3FS integration test uses its disk-backed object-storage endpoint, not a live cloud service. Static analysis was selected for the owning package rather than the whole repository.
-
The supplied #57/#58 linked-issue records do not provide the external linter discussion. The exact official pinned module, policy diff and negative fixtures establish the material permission scope. An unavailable old tool cache was recovered by provisioning the pinned tools in this member's cache.
## What type of PR is this? - [x] Improvement ## Which issue(s) this PR fixes: Related to #32751; 4.2-dev counterpart of #32774. ## What this PR does / why we need it: When an arena has enough unused capacity for the LZ4 compression bound, compress independently owned writer buffers directly into its tail and commit only the actual output length. This avoids the separate compression scratch buffer and the subsequent copy on those writes. The existing scratch path remains in use when the bound does not fit or no arena is available. The internal serialization and metadata buffers are created independently of the arena and marked with a private ownership type. `WriteWithCompress`, which accepts arbitrary borrowed bytes, always keeps the original scratch path even when the bytes happen not to overlap. Thus existing external callers retain their previous behavior, while the in-tree serialization and metadata paths can use direct compression. The object format, extent and arena accounting, SQL behavior, and 4.2 pool limits are unchanged. No `unsafe` import, new linter exception, or linter pin change is needed on 4.2. This PR no longer depends on the unmerged linter compatibility branch in linter #58. The main implementation and its reviewed narrow exception are tracked separately in #32774 and linter #57. ## Validation On CPU-only 57, Go 1.26.4, final commit `93e4450817` rebased onto `25305b6137`: - The complete `pkg/objectio` suite passed normally and under race. This includes the new direct-compression, overlapping/adjacent borrowed inputs, empty and incompressible input, no-arena and insufficient-tail fallbacks, arena reuse, multicolumn readback, and the new base's S3-cache interaction tests. For these runs the existing hardcoded test directory was temporarily redirected into the task-owned test directory and restored afterwards. - The independent concurrent-arena test also passed 100 race repetitions before the final rebase; the full race run passed again on the final base. - Official merged `molint check -mod=readonly ./pkg/objectio` passed; the existing selected golangci checks passed. A separate negative control verified that the official checker fails on an injected unapproved `unsafe` import. - A 1-CN LOAD/ALTER run with one 8 MiB field and 31 64 KiB fields verified all 32 complete payload hashes after each operation. The test services exited and their isolated data was removed. - Four alternating shared-host benchmark pairs showed similar small-input and 4-producer allocations and timings to the previous overlap-guard implementation. A further eight alternating 8 MiB pairs had a +2.38% median latency difference, with individual pairs from -12.34% to +8.82%; this noisy sample does not establish a stable regression or improvement. Both versions measured 16 B/op and 1 alloc/op in that direct-path benchmark. Earlier comparisons of the overlap-guard version against the original scratch baseline showed a benefit for the 8 MiB direct path; those earlier measurements are not a direct measurement of this final commit. The 4.2-dev `go vet -vettool` SCA step has a pre-existing limitation: it can print linter diagnostics while returning success. This was reproduced with a negative control and observed in a previous green CI run. This PR does not change that branch-wide CI behavior, so the standalone official `molint check` above is independent evidence for the modified package; a green legacy SCA job alone is not proof that its linter findings were enforced. Large rows whose compression bound cannot fit in the remaining arena still use the existing scratch path; this optimization alone does not resolve the original very-large-row OOM.
What type of PR is this?
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:
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
unsafeis confined tocompression_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.goremains 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.147a3f213653merged in linter PR 57; it no longer depends on the unmerged compatibility branch. Compared with the previous MatrixOne main pin, this version also includes three function-scopedrecoverapprovals already merged in linter PR 56.pkg/objectiosuite passed normally and under race on the earlier PR head. After merging the latest main including perf(fileservice): avoid buffering S3 uploads for disk cache #32782, compression and S3 writer/cache interaction tests passed under race, and the official merged molint plus golangci passedmake static-check-selected STATIC_CHECK_PACKAGES=./pkg/objectioon commit11e75981aa3ce38812484cb533c093be89bf9260. Full CI is running on that head. The linter itself passedgo test ./...before merge.