basho / riak

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

Migrate to recent OTP #929

Closed jeanparpaillon closed 5 years ago

jeanparpaillon commented 6 years ago

In order to ease integration with existing system, or integrating new features/libs into riak, we need to migrate to a recent version of OTP.

We would like to have riak migrated for the version after 2.2.5

I propose to follow this long-running task here: https://github.com/basho/riak/wiki/OTP-migration-task-follow-up

OTP 19 or OTP 20

nickelization commented 6 years ago

I don't know of any existing way to automatically convert gen_fsm modules to gen_statem, and my gut says it would be tricky to develop such a thing since you would need some way to programmatically distinguish whether a given function is a state handler or not. But, it can be done by hand in a relatively straightforward, mechanical fashion. There's a good example of this right in the gen_fsm documentation: http://erlang.org/doc/man/gen_fsm.html

Doing it by hand would not be risk-free (nor particularly fun) but I don't think it would be hugely risky or take that much effort. It would also just be nice to have all of Riak updated to use gen_statem, since it is generally more powerful and flexible. (This is a bit of a tangent, and this wouldn't be a necessary change for a first pass, but I'd really like to be able to strip out the late message protection code in riak_ensemble. gen_statem has this sort of functionality built into its call mechanism already so we wouldn't need to manually implement it anymore.)

On the other hand, I would also say let's not let the perfect be the enemy of the good. I'd much rather see OTP 20 support at all, even if it has some deprecated module warnings when you build it. Whether we convert to gen_statem or accept some build warnings, I think it's still better to go straight to OTP 20 than to try and target 19 now and then just have to upgrade again later.

bryanhuntesl commented 6 years ago

We don't have to convert gen_fsm to gen_statem - we can copy the gen_fsm source into riak_core or a project dependency, remove the deprecation warning and just move on - the erlang code is Apache 2 licensed so no conflict with riak code.

russelldb commented 6 years ago

+1 to that @bryanhuntesl. And then at leisure migrate fsms to statem. I think that way is safer for sure.

martincox commented 5 years ago

Fixed with gen_fsm_compat.