rabbitmq-server
rabbitmq-server copied to clipboard
Move projection registration out of Khepri setup
rabbit_khepri:setup/0 is always called during boot for the sake of clustering. Previously we registered projections during rabbit_khepri:setup/0 meaning that even if you run Rabbit 3.13.x without enabling the khepri_db feature flag you will attempt to register projections. It's a benign bug - it doesn't cause any bad behavior other than a potential timeout on boot if a server is in a minority - but it modifies the Khepri store so we need to consider the projections when we reorganize the tree (#11225).
Instead of registering projections during rabbit_khepri:setup/0 we should register them in two spots:
- In init (
rabbit_db:init/0), a boot step run afterrabbit_khepri:setup/0which has a Khepri-specific branch, and only if we detect that the database is blank. (We could always register on init when Khepri is enabled but there's no need to unless the database is blank.) - In the enable callback for the
khepri_dbfeature flag.
In the future when we want to unregister projections, we can add that step before rabbit_khepri:register_projections/0 to the enable callback for the khepri_db feature flag (using https://github.com/rabbitmq/khepri/pull/282).
In the future when we want to unregister projections, we can add that step before
rabbit_khepri:register_projections/0to the enable callback for thekhepri_dbfeature flag (using rabbitmq/khepri#282).
Do you want to wait for the unregister_projections() API to use it in this pull request? I’m not sure I get all the ins and outs of the upgrade problem.
Yeah let's wait for that since we also want the fence API to await a leader (as mentioned above)
Khepri 0.15.0 is now released and used in RabbitMQ main branch.
I'll set up the backports once we have the prerequisite PRs backported. In particular this PR needs https://github.com/rabbitmq/rabbitmq-server/pull/11672