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

rocksdb: only create single read batch in bg call #578

Merged
merged 6 commits into from
Oct 7, 2024

Conversation

chm-diederichs
Copy link
Contributor

No description provided.

const reader = this.core.storage.createReadBatch()
reader.tryFlush()

for (const b of this._blocks) {
Copy link
Contributor

@HDegroote HDegroote Oct 4, 2024

Choose a reason for hiding this comment

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

Sanity check: this shouldn't be for (const b of blocks) { ? Otherwise it's iterating over a data structure than can mutate during iteration, so line 1854 can have pretty strange behaviour if the entry doesn't exist.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

nice catch

for (const b of this._blocks) {
if (this.core.bitfield.get(b.index) === false) continue
blocks.set(b.index, this.core.blocks.get(reader, b.index))
Copy link
Contributor

Choose a reason for hiding this comment

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

Sanity check: this.core.blocks.get(reader, b.index) can never reject? Otherwise I think it needs a safetyCatch or noop catch-handler, since there are async operations before the promises are awaited

Copy link
Contributor

@HDegroote HDegroote left a comment

Choose a reason for hiding this comment

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

LGTM (with the caveat that I don't understand the read-batch logic, so I didn't check that)

@chm-diederichs chm-diederichs merged commit f4047e5 into rocksdb Oct 7, 2024
4 checks passed
@chm-diederichs chm-diederichs deleted the rocksdb-batch-resolve branch October 7, 2024 10:43
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.

3 participants