basho / riak

Riak is a decentralized datastore from Basho Technologies.
http://docs.basho.com
Apache License 2.0
3.95k stars 537 forks source link

An upgrade to Riak 2.0 from Riak 1.4 (and continuing to use app.config) can lead to sibling generation [JIRA: RIAK-1681] #727

Closed roooms closed 9 years ago

roooms commented 9 years ago

In Riak 1.4 allow_mult defaults to false and therefore is false if allow_mult is not set in app.config.

During an upgrade to Riak 2.0, the app.config could continue to be used (therefore stopping the riak.conf being used). In this scenario the default bucket-type changes from allow_mult: false to allow_mult: true potentially resulting in unexpected sibling generation.

To reproduce:

  1. Install Riak 2.0
  2. Start Riak and check default bucket props

    sudo riak-admin bucket-type status default | grep allow_mult
  3. Stop Riak
  4. Copy a default Riak 1.4 app.config and vm.args in to /etc/riak/
  5. Start Riak and check default bucket props

    sudo riak-admin bucket-type status default | grep allow_mult

In the first instance (with riak.conf) I see:

allow_mult: false

In the second instance (with app.config) I see:

allow_mult: true

This means an upgrade to Riak 2.0 where the app.config continues to be used would result in a change of allow_mult setting from false to true for existing bucket properties.

kesslerm commented 9 years ago

Using cuttlefish (riak.conf), the allow_mult = true default is set for the default bucket type at https://github.com/basho/riak_kv/blob/develop/priv/riak_kv.schema#L512

Without riak.conf no further overrides of the bucket defaults for all buckets (https://github.com/basho/riak_core/blob/develop/src/riak_core_bucket_type.erl#L135) seem to happen. The defaults for the default bucket are assembled through app_helper:getenv in https://github.com/basho/riak_core/blob/develop/src/riak_core_bucket_props.erl#L108.

A default app.config from version 1.4 won't have the riak_core.default_bucket_props settings, and the code will therefore fall back to the hardcoded defaults. We should test if adding a section for riak_core.default_bucket_props to app.config can be used as a workaround and document it.

russelldb commented 9 years ago

Testing that now @kesslerm, thanks!

russelldb commented 9 years ago

Can confirm that adding

{default_bucket_props, [{allow_mult, false}]},

to app.config is a workaround and does not impact typed buckets defaults.

roooms commented 9 years ago

Full output of riak-admin bucket-type status default when using riak.conf and app.config as above:

Differences:

russelldb commented 9 years ago

This is "expected" behaviour. Please see https://github.com/basho/cuttlefish/wiki/Cuttlefish-for-Application-Users specifically Cuttlefish will see your app.config sitting where it's supposed to, and use that instead.

Looping in @seemaj for opinions. I think the right thing is add the workaround to the procedure for upgrading. The best thing would be a script that turned the legacy app.config into a valid riak.conf.

Basho-JIRA commented 9 years ago

I have found an alternative to Sean's approach that works; needs more review to make sure it's as otherwise harmless as I think it is.

bugfix/jrd/727

_[posted via JIRA by John Daily]_

Basho-JIRA commented 9 years ago

I have found an alternative to Sean's approach that works; needs more review to make sure it's as otherwise harmless as I think it is.

https://github.com/basho/riak_core/tree/bugfix/jrd/727

_[posted via JIRA by John Daily]_

Basho-JIRA commented 9 years ago

Filed https://github.com/basho/riak_core/pull/765

_[posted via JIRA by John Daily]_

Basho-JIRA commented 9 years ago

[~jdaily] Does that mean we should abandon [https://github.com/basho/riak_kv/pull/1109]?

_[posted via JIRA by Brett Hazen]_