Skip to content

replace database data storage with BSUP columns instead of old-bsup - #7424

Merged
mccanne merged 2 commits into
mainfrom
db-columns
Oct 8, 2026
Merged

mccanne merged 2 commits into
mainfrom
db-columns

Conversation

@mccanne

@mccanne mccanne commented Oct 8, 2026

Copy link
Copy Markdown
Collaborator

This commit replaces the storage format of the databsae with BSUP columns. We're currently suboptimally writing one big column frame per storage object but this will change in a subsequent PR when we add a row-group-like construct (pruner and vcache just need to understand this).

We put merge and the pool scanners in subdirectories of runtime/op to break import loops. We need to revisit interfaces again to come up with a cleaner design but this will come later.

The ingest path is now native columns though there is an scode boomerang to sort the input. We'll avoid this and add optional sort keys in a subsequent PR.

This commit replaces the storage format of the databsae with BSUP columns.
We're currently suboptimally writing one big column frame per storage
object but this will change in a subsequent PR when we add a row-group-like
construct (pruner and vcache just need to understand this).

We put merge and the pool scanners in subdirectories of runtime/op to break
import loops.  We need to revisit interfaces again to come up with a cleaner
design but this will come later.

The ingest path is now native columns though there is an scode boomerang
to sort the input.  We'll avoid this and add optional sort keys in a
subsequent PR.
Comment thread vector/vio/io.go
Comment on lines +15 to +18
type PullCloser interface {
Puller
io.Closer
}

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: Fine to merge this but in the long run I don't think we need or want this or ScanCloser since a call to sbuf.File.Pull that returns nil, nil can close the underlying file (after we we address the vector.TypeValue.loader issue, that is).

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Good point, let's fix later!

Comment thread service/handlers.go Outdated
Comment on lines +549 to +550
w.Respond(http.StatusOK, api.CommitResponse{Commit: branch.Commit})
return

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.

w.Respond has already been called up above.

Suggested change
w.Respond(http.StatusOK, api.CommitResponse{Commit: branch.Commit})
return

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It keeps coming back!

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: Call this poolscanner.go. And if you put it in runtime/op instead of a separate package, you won't have to duplicate runtime.op.applyMask.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'll follow up with a subsequent PR

return sbuf.NewDematerializer(sctx, scanner), nil
// XXX We're passing nil for pushdown here. In a subsequent PR, we will
// work out vector pushdown and put this back.
return poolscanner.NewPoolScanner(runtime.NewContext(ctx, sctx), l, pool, nil, nil, nil), 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: runtime/op.Robot.open is the only thing that calls this method, so instead of moving runtime/op.Merge into a separate package to break the import cycle, move this method to runtime/op by hanging it on runtime/op.Robot.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I'll follow up with a subsequent PR

Comment thread db/writer.go
Comment on lines +66 to +70
if sortKey != nil {
var minVal, maxVal super.Value
vec, minVal, maxVal = w.sort(vec)
if sortKey.Order == order.Desc {
minVal, maxVal = maxVal, minVal

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.

sortKey is never nil given sortKey := &key above.

Suggested change
if sortKey != nil {
var minVal, maxVal super.Value
vec, minVal, maxVal = w.sort(vec)
if sortKey.Order == order.Desc {
minVal, maxVal = maxVal, minVal
var minVal, maxVal super.Value
vec, minVal, maxVal = w.sort(vec)
if w.pool.SortKeys.Primary().Order == order.Desc {
minVal, maxVal = maxVal, minVal

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I wrote it this way because sortkey will soon change to be optional and the &sortkey will go away.

Comment thread db/pool.go
Comment on lines +340 to +359
uri := object.URI(p.DataPath)
r, err := p.engine.Get(ctx, uri)
if err != nil {
return nil, fmt.Errorf("%s: %w", uri, err)
}
scanner, err := bsupio.NewReader(ctx, sctx, r, pushdown, concurrency)
if err != nil {
return nil, err
}
return &struct {
vio.Scanner
io.Closer
}{
Scanner: scanner,
// XXX We block close because vcache does lazy loading of
// type values. This relies on GC to close files. We need
// to work out a better way at some point.
Closer: io.NopCloser(r),
}, 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: Use anyio.Open?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It's known to be bsup columns...?

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.

Yes, that's why you'd pass anyio.ReaderOpts{Format: "bsup"}.

The advantage of anyio.Open is that it takes care of things like closing the storage.Reader if bsupio.NewReader fails, which it looks like we're not doing here.

@mccanne
mccanne merged commit 8af7eea into main Oct 8, 2026
2 checks passed
@mccanne
mccanne deleted the db-columns branch October 8, 2026 16:34
@nwt nwt mentioned this pull request Oct 9, 2026
nwt added a commit that referenced this pull request Oct 9, 2026
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