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

Simplify nextFreeRelSlot in ImmDB logic #1212

Open
nfrisby opened this issue Aug 8, 2024 · 1 comment
Open

Simplify nextFreeRelSlot in ImmDB logic #1212

nfrisby opened this issue Aug 8, 2024 · 1 comment
Labels
needs-grooming ❓ The issue needs more details before people can start working on it

Comments

@nfrisby
Copy link
Contributor

nfrisby commented Aug 8, 2024

For the file-backed index, the relatively complicated nextFreeRelSlot logic avoids an extra read from disk (although: we're imminently writing to the same page, so does read+write necessarily cost much more than just the write? I don't recall.)

But with the cache, the necessary info is already in memory: nextFreeRelSlot = length currentChunkOffsets - 1.

This could alternatively be added as an assertion, perhaps.

@nfrisby nfrisby added the needs-grooming ❓ The issue needs more details before people can start working on it label Aug 8, 2024
@nfrisby
Copy link
Contributor Author

nfrisby commented Aug 8, 2024

length - 1 is the index of the latest offset written to the primary index. But recall: it's initialized to [0] and adding a block B to the index always adds the offset of the next block into the successor of B's slot in the index — that induction suffices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-grooming ❓ The issue needs more details before people can start working on it
Projects
Status: No status
Development

No branches or pull requests

1 participant