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

Feature/ensembles wait for riak kv #649

Merged
merged 3 commits into from
Jun 23, 2014

Conversation

engelsanchez
Copy link
Contributor

Test that ensemble peers will not start until the riak_kv service is up. This verifies basho/riak_kv#989 and basho/riak_ensemble#32

Functionality was added to the intercepts so that they can save the generated modules in the basho-patches directory of a node, so that they can be loaded on startup. This should be useful to other tests that require modifying the behavior of Riak while it's starting up. /cc @jburwell since you needed something like this recently.

You can now choose to save the intercept modules in basho-patches so
that they are loaded on a restart. This should be useful to modify
Riak's behavior at startup time.
Now ensemble peers are prevented from starting up until the riak_kv
service is up to avoid nasty races that could even lead to node crashes
as the ensembles frantically query for data that isn't ready.
lager:info("Verifying peers wait for riak_kv_service"),
rt_intercept:add_and_save(Node, {riak_kv_vnode, [{{init, 1}, {[],
fun(Args) ->
timer:sleep(5000),
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be a good idea to make the sleep duration configurable.

@lordnull
Copy link
Contributor

Test failed twice when using the appropriate kv and ensemble branches.

Test output: https://gist.github.com/lordnull/ca2ee6d88eb0e1fcb095

@engelsanchez
Copy link
Contributor Author

@lordnull I realize how this can fail. I didn't do the check the way I thought it in my head. Will be pushing a fix soon. We need to take the list of ensembles first, then check for the service. If the service is off, assert on the list if it's not empty. The way it is now, it is possible for the peers to start because the riak_kv service has started since we checked.

Changing to fetching the list of peers first, then check if the riak_kv
service is up. If the service is up, then check the peers. Otherwise it
is possible to see the service down, then peers up because it went up in
the interim.

Also, making KV vnode delay configurable.
@engelsanchez
Copy link
Contributor Author

The last commit should address the check race and makes the delay configurable @lordnull

@lordnull
Copy link
Contributor

Test fails w/o the ensemble/kv patch, passes with them, so it's a 👍 from me.

@engelsanchez
Copy link
Contributor Author

@lordnull does the 👍 extend to the PRs? basho/riak_kv#989 basho/riak_ensemble#32

engelsanchez added a commit that referenced this pull request Jun 23, 2014
@engelsanchez engelsanchez merged commit 3662965 into master Jun 23, 2014
@engelsanchez engelsanchez deleted the feature/ensembles-wait-for-riak-kv branch June 23, 2014 18:24
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