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

Problem: persisting keys in binary script form is bad for traversing #23

Closed
yrashk opened this issue Feb 12, 2017 · 0 comments · Fixed by #24
Closed

Problem: persisting keys in binary script form is bad for traversing #23

yrashk opened this issue Feb 12, 2017 · 0 comments · Fixed by #24

Comments

@yrashk
Copy link
Contributor

yrashk commented Feb 12, 2017

Right now, both keys and values are persisted with their size prefixes (according to the binary form data representation rules). This motivation for this was to avoid allocating memory to put a prefix in front of them upon retrieval.

However, when traversing a range of keys (CURSOR/SEEK and then /NEXT), it'll trip up the cursor when a "composite key" size changes, changing the very beginning of it.

Proposed solution: make Env stack store references to data without their size prefixes (as slices already have length) and hence we can move to persisting data as is in the database. Having stack that was is not big of a deal because we can write size prefixes on demand when we are sending data back, avoiding allocations there.

yrashk added a commit to yrashk/PumpkinDB that referenced this issue Feb 12, 2017
Solution: make Env stack store references to data without their size prefixes
(as slices already have length) and hence we can move to persisting data as is
in the database. Having stack that was is not big of a deal because we can
write size prefixes on demand when we are sending data back, avoiding
allocations there.

Fixes PumpkinDB#23
@yrashk yrashk modified the milestone: 0.1.0 ("Aladdin") Feb 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant