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

Add validation for n_val and other riak_kv bucket props #667

Closed
wants to merge 4 commits into from

Conversation

russelldb
Copy link
Member

Addresses issue #666 test at basho/riak_test#389

@slfritchie
Copy link
Contributor

This seems quite sane, despite needing to check atom() and binary() versions of the same option, oh well. +1.

-spec is_quorum(term()) -> true | false.
is_quorum(Q) when is_integer(Q), Q > 0 ->
true;
is_quorum(Q) when is_atom(Q), Q =:= quorum
Copy link
Contributor

Choose a reason for hiding this comment

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

There is no need for the is_atom here since you are matching exactly (=:=) against atoms anyway. The same with binaries below.

Copy link
Member Author

Choose a reason for hiding this comment

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

oh yeah, doh!

@russelldb
Copy link
Member Author

Addressed comments.

validate([Prop|T], ValidProps, Errors) ->
validate(T, [Prop|ValidProps], Errors).


-spec is_quorum(term()) -> true | false.
is_quorum(Q) when is_integer(Q), Q > 0 ->
Copy link
Contributor

Choose a reason for hiding this comment

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

The default for pr and pw is zero, which doesn't pass this validation. So, for example, getting the default properties and setting them again, maybe with a modification, will fail. I'm not sure why it's zero. The code seems to make sure that zero is never used I believe.

Maybe @Vagabond or @jrwest know the answer?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Do you think other quora can be zero? I mean can you zero R? W? DW? RW?

@russelldb
Copy link
Member Author

Ping @engelsanchez addressed comments

@russelldb
Copy link
Member Author

Bump?

@russelldb
Copy link
Member Author

re-re-bump ping bueller, bueller

@jrwest
Copy link
Contributor

jrwest commented Dec 4, 2013

Oh, I assumed this no longer merges cleanly but it looks like it does :). I'm doing some separate n_val validation from strong consistency, so I wouldn't mind double checking that it won't change anything here (I should know tomorrow). From what I can tell so far it shouldn't. If it does, I can merge this into that PR.

@slfritchie
Copy link
Contributor

Pulling PRs out of the freezer ... re-re-re-bump?

@russelldb
Copy link
Member Author

@slfritchie see riak_kv#747… @jrwest has said he'll merge this with that.

@jrwest
Copy link
Contributor

jrwest commented Dec 12, 2013

yep and I'm just looking for the final +1 from @jtuple on #747 before I do so

@jrwest
Copy link
Contributor

jrwest commented Dec 19, 2013

closing for rebased/merged version in #770

@jrwest jrwest closed this Dec 19, 2013
@seancribbs seancribbs deleted the support/gh666-validate branch January 6, 2014 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants