Repository navigation
refactor bsupio concurrent puller - #7441
Merged
Merged
Conversation
This commit refactors the concurrency design of the bsupio reader so that concurrency is handled by a new entity called dispatcher and the reader merely worries about its own state. There are no longer slices of vector queues and slices of metafilters. This will make it easier to add the forthcoming BSUP columns search pushdown and two-pass predicate pushdown.
nwt
reviewed
Oct 9, 2026
| if filter != nil { | ||
| for range concurrentReaders { | ||
| filter, projection, err := p.MetaFilter() | ||
| readers = append(readers, r) |
Collaborator
There was a problem hiding this comment.
Nit: Don't really need readers.
Suggested change
| readers = append(readers, r) | |
| d.readers = append(d.readers, r) | |
Comment on lines
+90
to
+97
| case f, ok := <-d.frameCh: | ||
| if !ok || f.err != nil { | ||
| if f.err == io.EOF { | ||
| return nil, nil | ||
| } | ||
| return nil, f.err | ||
| } | ||
| return f.frame, nil |
Collaborator
There was a problem hiding this comment.
Nit: Simplify this by putting if err == io.EOF { err = nil } in once.Do function (before it sends each frame{}).
Suggested change
| case f, ok := <-d.frameCh: | |
| if !ok || f.err != nil { | |
| if f.err == io.EOF { | |
| return nil, nil | |
| } | |
| return nil, f.err | |
| } | |
| return f.frame, nil | |
| case f := <-d.frameCh: | |
| return f.frame, f.err |
Comment on lines
+147
to
+149
| // XXX This used to go last first. I don't think it matters. Noah? | ||
| vec := r.q[0] | ||
| r.q = r.q[1:] |
Collaborator
There was a problem hiding this comment.
Not a big deal but last first allows reuse of r.q's backing array. If you slice off elements at the front, then their storage becomes unreachable and can't be reused, so the appends to r.q that happen in loader.LoadUnordered are likely to trigger allocation of a new backing array. (I say likely because the runtime allocates small objects from "size classes" so the append built-in will often return a slice with a capacity greater than its length.)
| ) | ||
|
|
||
| type reader struct { | ||
| type dispatcher struct { |
nwt
approved these changes
Oct 9, 2026
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.
This commit refactors the concurrency design of the bsupio reader so that concurrency is handled by a new entity called dispatcher and the reader merely worries about its own state. There are no longer slices of vector queues and slices of metafilters. This will make it easier to add the forthcoming BSUP columns search pushdown and two-pass predicate pushdown.