Skip to content

feat: manual replication leader switchover

Georgy Moshkin requested to merge gmoshkin/replicaset-master-switchover into master

Summary

  • Change system table _pico_replicaset format:

    • remove master_id field
    • add current_master_id field
    • add target_master_id field
  • Add support for manually switching a given replicaset's master. Currently this can be done via cas dml request by changing the target_master_id of a given replicaset.

  • Add a new replication leader switchover step to the governor which is run if current_master_id != target_master_id:

    • if current master is not offline then make it read_only = true and get it's current vclock value
    • if current master is not offline then make the target master wait until it's vclock is synced with the current master's one
    • make the target master read_only = false
    • update _pico_replicaset such that target_master_id = current_master_id

Ensure that

Closes #297 (closed)

  • New code is covered by tests
  • API is documented
  • Changelog is up to date
  • (if Lua API changed) Lua API version is bumped in luamod.rs
  • (if necessary) A follow-up doc issue is created in picodata/docs and linked here
Edited by Georgy Moshkin

Merge request reports