-
Notifications
You must be signed in to change notification settings - Fork 373
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use z.Buffer backing for B+ tree #268
Conversation
z/buffer.go
Outdated
if b.maxSz-int(b.offset) < n { | ||
panic(fmt.Sprintf("Buffer max size exceeded: %d."+ | ||
" Offset: %d. Grow: %d", b.maxSz, b.offset, n)) | ||
if b.maxSz != 0 && int(b.offset)+n > b.maxSz { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When can b.maxSz be 0? It should always have a valid value.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've kept the zero value as an "unbounded" buffer. The earlier API set maxSz = math.MaxInt32
(roughly 2.1GB) by default. The caller is expected to set this using the WithMaxSize
API now. Should I change it back?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 4 of 4 files at r2.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ajeetdsouza and @jarifibrahim)
z.Tree
should use az.Buffer
backing.z.Buffer
should use az.MmapFile
backing.z.Buffer
, so it doesn't delete the file after closing.z.Tree
, so that we can use it for persistent storage.This change is