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

warn about inability to downgrade after activating bucket type #827

Merged
merged 1 commit into from
Feb 12, 2014

Conversation

jrwest
Copy link
Contributor

@jrwest jrwest commented Feb 5, 2014

As discussed.

This implementation is less ideal than potentially writing a flag, serialized through the claimant like other bucket type operations, and checking that. A potential degenerate case is a user creating thousands of bucket types without activating any of them. However, after creating 50k+ bucket types without activation the time to create or activate a type in scientific"" tests on my machine didn't take noticeably longer than on a node with only a few types.

Example:

User first has no types:

$ dev/dev1/bin/riak-admin bucket-type list
default (active)

User first creates a type:

$ dev/dev1/bin/riak-admin bucket-type create type1 '{"props": {}}'
type1 created

WARNING: After activating type1, nodes in this cluster
can no longer be downgraded to a version of Riak prior to 2.0

User creates another type, but no types have been activated, so warning still emitted. Same
when create is called again to change the properties on the type.

$ dev/dev1/bin/riak-admin bucket-type create type2 '{"props": {}}'
type2 created

WARNING: After activating type2, nodes in this cluster
can no longer be downgraded to a version of Riak prior to 2.0
$ dev/dev1/bin/riak-admin bucket-type create type2 '{"props": {"allow_mult": false}}'
type2 created

WARNING: After activating type2, nodes in this cluster
can no longer be downgraded to a version of Riak prior to 2.0

User activates a type, a final warning is emitted:

$ dev/dev1/bin/riak-admin bucket-type activate type1
type1 has been activated

WARNING: Nodes in this cluster can no longer be
downgraded to a version of Riak prior to 2.0

Future operations have no warning:

$ dev/dev1/bin/riak-admin bucket-type create type2 '{"props": {"allow_mult": true}}'
type2 created
$ dev/dev1/bin/riak-admin bucket-type activate type2
type2 has been activated
$ dev/dev1/bin/riak-admin bucket-type create type3 '{"props": {"datatype": "set"}}'
type3 created
$ dev/dev1/bin/riak-admin bucket-type activate type3
type3 has been activated
$ dev/dev1/bin/riak-admin bucket-type list
default (active)
type3 (active)
type1 (active)
type2 (active)

@jrwest
Copy link
Contributor Author

jrwest commented Feb 5, 2014

tried 100k types as well w/o seeing too much issue

bucket_type_print_activate_result(Type, ok) ->
io:format("~s has been activated~n", [Type]);
bucket_type_print_activate_result(Type, {error, undefined}) ->
bucket_type_print_activate_result(Type, ok, IsFirst) ->
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of passing in IsFirst as a new argument, the entire case clause below should be abstracted into a maybe_print_warning/1 function that takes a Type parameter. This same function can be used in bucket_type_print_create_result/2 below. The /3 versions of these functions will no longer be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason IsFirst is passed through here is because bucket_type_is_first() must be called before the operation has completed otherwise the warning is never printed (the check finds the just activated type, which is the condition for skipping the warning). But perhaps there is still a way to clean that up...

Copy link
Contributor

Choose a reason for hiding this comment

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

That makes sense. In that case don't worry about it. I was thinking about maybe just abstracting the message itself, but that's no big deal.

@andrewjstone
Copy link
Contributor

  • code inspection
  • dialyzer
  • manual testing

👍

@gburd
Copy link

gburd commented Feb 12, 2014

+1

jrwest added a commit that referenced this pull request Feb 12, 2014
warn about inability to downgrade after activating bucket type
@jrwest jrwest merged commit 5efff55 into develop Feb 12, 2014
@seancribbs seancribbs deleted the jrw-bucket-type-downgrade-warning branch April 1, 2015 23:36
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.

3 participants