-
Notifications
You must be signed in to change notification settings - Fork 4k
Description
Problem Definition
Every so often we see users delete virtual hosts by accident. This can happen both over the HTTP API
and with rabbitmqctl delete_vhost.
When this happen, certain kinds of virtual host data can be
restored relatively easily. The definitions data set is small (compared to tens or hundreds of
GiBs a stream can contain, for example). Unfortunately, for messages stored in queues (not streams),
the backup and restore problem is a very different in scope.
Tanzu RabbitMQ has a Warm Standby Replication feature that replicates both schema and messages (for QQs, streams, CQs) to a remote warm standby cluster or multiple clusters. This does help with certain fat finger errors but not all of them,
and only if a reasonably large schema synchronization interval is used.
Since virtual host deletion is one of the most destructive operations (up there with node reset),
it could use some extra protection, similarly to how opt-in (experimental) feature flag enablement was made much more difficult to do accidentally in #11998, #12643.
In addition, specific clusters, systems, and RabbitMQ-based distributions such as Tanzu RabbitMQ can
have system virtual host. "System" here means .
Proposed Solution
Virtual hosts can be marked with additional metadata. This metadata today stores the DQT (default queue type), a description, a and set of tags.
The same metadata map can be used to enable protection from deletion. If set,
rabbitmqctl delete_vhost and DELETE /api/vhosts/{name} will fail with a reasonably specific
error asking the user to delete the metadata key from the target virtual host first, then retry.
Deletion of the key will act as a confirmation for CLI tools, and will require the same permissions
as DELETE /api/vhosts/{name} in the case of HTTP API.
Dedicated CLI commands and HTTP API endpoints will be provided for locking and unlocking deletion.
Currently Available Options
DELETE /api/vhosts/{name} requires the user to be tagged as administrator.
For CLI tools, such "roles" do not exist, so an explicit confirmation is particularly important to have.