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

Conversation

Projects
None yet
4 participants
@PlasmaPower
Copy link
Contributor

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 Nov 8, 2018

@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;

This comment has been minimized.

Copy link
@clemahieu

clemahieu Nov 8, 2018

Collaborator

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.

This comment has been minimized.

Copy link
@PlasmaPower

PlasmaPower Nov 8, 2018

Author Contributor

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.

@PlasmaPower PlasmaPower force-pushed the PlasmaPower:vote-cache-fix branch from 152cb2a to c7d0221 Nov 8, 2018

Show resolved Hide resolved rai/node/lmdb.cpp

@rkeene rkeene merged commit 9a92d4f into nanocurrency:master Nov 8, 2018

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.