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 vote_cache #1362

Merged
merged 1 commit into from Nov 8, 2018
Merged

Fix vote_cache #1362

merged 1 commit into from Nov 8, 2018

Conversation

PlasmaPower
Copy link
Contributor

@PlasmaPower PlasmaPower commented Nov 8, 2018

This adds a second cache layer, so that the vote store remains consistent during flushing.

Fixes #1206

@rkeene rkeene requested a review from SergiySW November 8, 2018 20:56
@rkeene rkeene added the bug label Nov 8, 2018
@rkeene rkeene added this to the V17.0 milestone Nov 8, 2018
{
std::lock_guard<std::mutex> lock (cache_mutex);
sequence_cache_l.swap (vote_cache);
vote_cache_l2 = vote_cache_l1;
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're checking both l1 and l2, do we need to copy this, it seems like a swap would still work.
At the end of the for-look that checks l2 we could clear l2.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since we're checking both l1 and l2, do we need to copy this, it seems like a swap would still work.

Yeah good point.

At the end of the for-look that checks l2 we could clear l2.

I believe that would result in worse performance. Also, we'd need to do it after the transaction expires, not at the end of the function.

@rkeene rkeene merged commit 9a92d4f into nanocurrency:master Nov 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants