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

More AAE ports #308

Merged
merged 6 commits into from
Feb 18, 2014
Merged

More AAE ports #308

merged 6 commits into from
Feb 18, 2014

Conversation

rzezeski
Copy link
Contributor

More AAE ports from basho/riak_kv#765.

  • Allow use of never for value of anti_entropy_expire to indicate
    that trees should never expire automatically (they can still be
    expired manually).
  • Clear any pending AAE exchanges when switching from automatic to
    manual mode. Active exchanges will be allowed to finish. The reason
    for clearing pending exchanges is because manual mode is about
    letting the user control what exchanges happen and thus all pending
    automatic exchanges should be dropped.
  • Modify AAE trees to delay clearing trees up until the moment before
    rebuild. Thus when trees expire they are eligible for exchange up
    until the moment they are rebuilt. This is a big improvement from
    before which would immediately clear (delete) the tree upon
    expiration and could mean hours or days of time before that tree
    could be exchanged again thus creating a window of no AAE.
  • Add ability to manually expire all trees at once via
    yz_entropy_mgr:expire_trees/0. This may be useful in a production
    scenario where the trees are no longer trusted but you still want to
    be able to exchange before they are rebuilt. It may also be useful
    for testing.
  • Add a test to verify that trees can still be exchanged while they
    are expired but before they are rebuilt.

Allow the value of `never` so that hashtrees never expire.
When switching to manual mode make sure to clear any pending exchanges
in the queue.
This is a port of riak_kv commit
5c346c347beb7459fe70e53275f958a68633f5fb

Before this commit, AAE trees were immediately cleared after reaching
their expiration time. However, trees would not be rebuilt until some
time in the future depending on rebuild concurrency, lock acquisition,
etc. Until rebuilt, AAE exchange was impossible.

This commit changes rebuild logic to separate expiration from
deletion.  Once a tree reaches it's expiration time, it is marked as
expired but not cleared. AAE exchange against this tree can still
occur. Only after an expired tree is actually scheduled for rebuild,
and successfully grabs all necessary locks, is the tree cleared.
Add the ability to easily expire all hashtrees just like they can easily
be cleared. This may be useful sometime in production if you don't trust
the hashtrees for some reason and is also useful for testing.
Make sure that when trees are expired it does not prevent them from
exchanging. The entire purpose of expiration is to provide behavior
similar to clear except that exchange can occur up until the point of
tree rebuilding.
@rzezeski rzezeski added this to the 0.14.0 milestone Feb 14, 2014
_ = [ok = rpc:call(Node, yz_entropy_mgr, expire_trees, [])
|| Node <- Cluster],

%% The expire is done very cast so just give it a moment
Copy link
Contributor

Choose a reason for hiding this comment

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

very cast. such spelling. wow

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LOLOL.

@rzezeski
Copy link
Contributor Author

Forgot to link this to #253.

S.

-spec get_all_locks(build | rehash, pid()) -> boolean().
get_all_locks(Type, Pid) ->
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a strangely named function. It's only getting one lock, not all.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use this name to match KV AAE. A lot of this code is strange but want to keep it as close to KV as possible until these two systems merge. It makes porting patches easier.

@coderoshi
Copy link
Contributor

+1
aae_test-bitcask: pass

rzezeski added a commit that referenced this pull request Feb 18, 2014
@rzezeski rzezeski merged commit 6b31d32 into develop Feb 18, 2014
@rzezeski rzezeski deleted the feature/rz/more-aae-ports branch February 19, 2014 06:44
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.

2 participants