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

reduce garbage in blockstore #4406

Merged
merged 6 commits into from
Oct 14, 2020
Merged

reduce garbage in blockstore #4406

merged 6 commits into from
Oct 14, 2020

Conversation

Stebalien
Copy link
Member

Avoid writing messages/blocks that may not be useful to the blockstore until we've validated them.

These can't possibly be valid messages, so we should just drop the block.
Instead of using an in-memory datastore and dealing with the overhead of
computing datastore keys, creating new blocks, etc, use an in-memory blockstore.
This blockstore lets us write to a temporary scratch location where blocks older
than the specified cache time are automatically cleared.
If they end up validating, we'll write them back to the underlying blockstore.
Otherwise, there's no reason to keep them.
// We use a temporary bstore here to avoid writing intermediate pieces
// into the blockstore.
blockstore := bstore.NewTemporary()
cst := cbor.NewCborStore(blockstore)
Copy link
Contributor

Choose a reason for hiding this comment

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

Can the comments on 326-328 be removed? I believe this addresses them.

Copy link
Member Author

Choose a reason for hiding this comment

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

I think they're still valid? That is, at this point we know we have a "sane" block, but it may not be otherwise valid.

But I don't know the original intention of that comment.

Copy link
Member

@whyrusleeping whyrusleeping left a comment

Choose a reason for hiding this comment

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

Nice catch, should hopefully reduce the chainstore growth a bit

@magik6k magik6k merged commit 7ccb2aa into master Oct 14, 2020
@magik6k magik6k deleted the steb/reduce-garbage branch October 14, 2020 23:49
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.

None yet

5 participants