Repository navigation
refactor(storage): remove containers.Vectors, fastrand and mock (#33539) - #33540
Merged
Merged
Conversation
Column loaders fill a *batch.Batch and set its row count; read-filter searches take []*vector.Vector. containers.Vectors is removed, and objectio no longer imports the TAE containers package for it. Batch.InitVectors allocates up to 8 vectors and their pointers at once, and the Batch stays on the caller's stack. The reader creates its scratch vectors on the first load, sized to the block: scans that copy straight to the output never allocate them. LoadColumnsDataFromMeta's release no longer moves the IOVector to the heap. The checkpoint readers no longer copy vector headers that share ownership of their buffers. VectorsCopyToBatch becomes CopyBatch; its test now checks the appends. In containers, VectorPool picks an element with math/rand/v2 instead of a linkname to runtime.cheaprand (about 3 ns per GetVector), and both runtime*.go files are removed; runtime.go was never built. Add benchmarks for tombstone reads, a reader's life, and the vector pool. Co-Authored-By: Claude Opus 5.5 <[email protected]>
containers/mock.go holds test data generators but was part of the production package. Move it, with its test, to tae/testutils. catalog.MockBatch, a wrapper over it in a non-test file, becomes testutils.MockSchemaBatch, so no production package imports testutils. It takes an interface: testutils cannot import the catalog without import cycles. MockNullableBatch, only the body of MockBatch, is merged into it. The containers tests that use the mocks become package containers_test. Co-Authored-By: Claude Opus 5.5 <[email protected]>
fengttt
requested review from
LeftHandCold,
XuPeng-SH and
gouhongshen
as code owners
November 30, 2026 18:02
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? |
Contributor
|
This pull request is merged. |
The same switches moved from tae/containers/mock.go to tae/testutils/mock.go; no entry is added. Co-Authored-By: Claude Opus 5.5 <[email protected]>
2 of 7 tasks
The type-switch baseline may only shrink: tag MockVector and MockVector2, whose default handles the remaining types, and drop their baseline entries. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
issue #33539
What this PR does / why we need it:
Two commits; the second is a mechanical move and is easier to review alone.
1. Replace
containers.Vectorswithbatch.BatchLoadColumnsData,ReadDeletes, ...) fill a*batch.Batchand set its row count. Read-filter searches take[]*vector.Vector.objectiono longer imports the TAEcontainerspackage.Batch.InitVectors(n)allocates up to 8 vectors and their pointers at once. Scratch batches stay on the stack in the tombstone and reader paths.LoadColumnsDataFromMeta'sreleaseno longer moves theIOVectorto the heap.VectorsCopyToBatchbecomesCopyBatch. Its test ignored append errors and compared zero rows; it now checks the data.VectorPool.GetVectorusesmath/rand/v2instead of alinknametoruntime.cheaprand. Bothruntime*.gofiles are removed;runtime.go(!go1.22) was never built.2. Move
containers/mock.gototae/testutilscatalog.MockBatch, a wrapper in a non-test file, becomestestutils.MockSchemaBatch, so no production package importstestutils. It takes an interface because importing the catalog fromtestutilswould create import cycles.Benchmarks
Base and new alternated on pinned cores, 8 to 24 samples each.
Costs:
GetVector+ release is about 2% (3 ns) slower serially, with the same allocations.BlockDataReadInnerDeletes1measured +0.6% (p=0.006);Deletes10shows no difference.Testing
tae/db/test,engine/test,disttaeandbackup.make static-check-changed: 0 issues.🤖 Generated with Claude Code