Skip to content
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

fix: Limit badger iterator seek to iterator bounds #47

Merged

Conversation

AndrewSisley
Copy link
Collaborator

Relevant issue(s)

Resolves #38
Resolves #19

Description

Limit badger iterator seek to iterator bounds.

Also fixes a panic when calling badger.Next, and simplifies the badger iterator code.

@AndrewSisley AndrewSisley added the bug Something isn't working label Jan 30, 2025
@AndrewSisley AndrewSisley added this to the CoreKV v0.1 milestone Jan 30, 2025
@AndrewSisley AndrewSisley requested a review from a team January 30, 2025 19:01
@AndrewSisley AndrewSisley self-assigned this Jan 30, 2025
@AndrewSisley AndrewSisley force-pushed the 38-badger-seek-beyond-iter branch from ebdd67b to 765b33b Compare January 30, 2025 19:10
Fixing now, as it is quick, and it gets in the way of the primary change coming in a later commit.
@AndrewSisley AndrewSisley force-pushed the 38-badger-seek-beyond-iter branch from 765b33b to d1573f2 Compare January 30, 2025 20:12
Copy link
Member

@nasdf nasdf left a comment

Choose a reason for hiding this comment

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

LGTM

badger/iter.go Outdated

if !it.i.Valid() {
// `it.i.Next()` will panic if we attempt to call it having already reached
// the iterator end, so we much return before trying to make that call if we can.
Copy link
Member

Choose a reason for hiding this comment

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

typo: much -> must

Copy link
Collaborator Author

@AndrewSisley AndrewSisley Feb 3, 2025

Choose a reason for hiding this comment

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

:) I am introducing way too many typos atm, thanks Keenan

  • Fix typo

Sorry, something went wrong.

Copy link
Member

@shahzadlone shahzadlone left a comment

Choose a reason for hiding this comment

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

Cheers

@AndrewSisley AndrewSisley merged commit 4ac25b3 into sourcenetwork:main Feb 3, 2025
4 checks passed
@AndrewSisley AndrewSisley deleted the 38-badger-seek-beyond-iter branch February 3, 2025 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Badger allows seeking beyond end of the iterator Badger panics when iterating past the end of an iterator
3 participants