rabbitmq-server
rabbitmq-server copied to clipboard
rabbit: Stop Khepri store and Ra systems in `stop/1`
Why
The Khepri store and the coordinators are Ra servers and thus run under the Ra supervision tree. Therefore we need to explicitly stop them otherwise they will continue to run after rabbit was stopped.
Likewise, the Ra systems are under the Ra supervision tree. We also need to stop them.
How
We need to stop Ra servers and Ra systems that we started but live under the Ra supervision tree. The order is important:
- The
quorum_queuesRa system because it may host Ra servers that depend on Khepri. - The stream coordinator because it depends on Khepri.
- The Khepri store; it could be stopped automatically with the termination of the underlying Ra system, but Khepri needs to do some cleanup too.
- The remaining Ra systems.
Stopping Ra systems and servers with the rabbit application has some unfortunate consequences. We discovered that several areas of RabbitMQ willingly or unwillingly rely on the fact the these processes still run after rabbit has stopped.
One of them is the forget_cluster_node CLI command: changing the Ra cluster membership requires the Ra servers to run.
Ideally, we want to redesign the operations that require a stop_app/start_app pair of commands around them today to work. We would like to replace that with the maintenance mode and let rabbit run durring the operation otherwise. However to achieve, we need to stop using Mnesia.
Therefore this pull request is put on hold until we come back to it after Khepri is the only database we use.