Skip to content

Conversation

@phrwlk
Copy link
Contributor

@phrwlk phrwlk commented Nov 28, 2025

BpsTree.Get(nil) incorrectly returned “not found” because the fast-path tested if err != nil || k0 != nil, which treats the presence of the first key as an error. This contradicts the function comment and the behavior of Seek(nil), both of which expect the first key to be returned when the key is empty. It also contradicts the dataLookup contract that a valid di returns a non-nil key/value. The fix removes the k0 != nil condition and returns the first record’s actual offset obtained from dataLookup. A new test asserts that Get(nil) returns found == true, the first key’s value, and the correct first offset, ensuring consistency with the index and preventing regressions.

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.

1 participant