Skip to content

refactor bsupio concurrent puller - #7441

Merged
mccanne merged 2 commits into
mainfrom
new-concurrent-puller
Oct 9, 2026
Merged

mccanne merged 2 commits into
mainfrom
new-concurrent-puller

Conversation

@mccanne

@mccanne mccanne commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

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.

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 nwt left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine.

Comment thread sio/bsupio/reader.go Outdated
if filter != nil {
for range concurrentReaders {
filter, projection, err := p.MetaFilter()
readers = append(readers, r)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Don't really need readers.

Suggested change
readers = append(readers, r)
d.readers = append(d.readers, r)

Comment thread sio/bsupio/reader.go Outdated
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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 thread sio/bsupio/reader.go Outdated
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:]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.)

Comment thread sio/bsupio/reader.go
)

type reader struct {
type dispatcher struct {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Maybe readDispatcher?

@mccanne
mccanne merged commit 20d791b into main Oct 9, 2026
2 checks passed
@mccanne
mccanne deleted the new-concurrent-puller branch October 9, 2026 19:47
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