Onyx-Protocol / Onyx

Onyx

Home Page:https://Onyx.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cmd/cored: fix 1.1 to 1.3 migration

jbowens opened this issue · comments

Chain Core 1.1 did not have any raft service. In Chain Core 1.2 we automatically initialized the raft cluster on boot and migrated any existing Postgres config to the raft kv store in config.Load.

After Chain Core 1.2, we removed automatic initialization of the raft cluster, replacing it with explicit corectl commands init and join. Currently, if a Chain Core 1.1 upgrades to main, config.Load will fail when querying sinkdb for the config on an uninitialized raft service: https://github.com/chain/chain/blob/main/core/config/config.go#L66-L68

We should figure out a migration path from Chain Core 1.1 to Chain Core 1.3. High-availability deployments complicate the migration path a bit, because you don't want to automatically initialize the raft cluster if an existing cored process in the same Chain Core has already initialized a raft cluster. Instead you want to join that existing cluster.