diff options
| author | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2018-10-24 18:19:01 +0200 |
|---|---|---|
| committer | Jean-Sébastien Pédron <jean-sebastien@rabbitmq.com> | 2019-02-01 11:23:15 +0100 |
| commit | a87f5b19164946c594fc17f1d229aeb0c2335bbb (patch) | |
| tree | 6bc096152072beb453acbfde253470163377763f /include | |
| parent | 93168ae5cc707efd524116d85bd9a62d867f6699 (diff) | |
| download | rabbitmq-server-git-a87f5b19164946c594fc17f1d229aeb0c2335bbb.tar.gz | |
Handle races with quorum_queue feature flag migration fun
In a few places, the migration of the `rabbit_queue` and
`rabbit_durable_queue` Mnesia tables might conflict with accesses to
those tables.
[#159298729]
Diffstat (limited to 'include')
| -rw-r--r-- | include/amqqueue.hrl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/include/amqqueue.hrl b/include/amqqueue.hrl index d08a740d95..7d187738d1 100644 --- a/include/amqqueue.hrl +++ b/include/amqqueue.hrl @@ -111,3 +111,26 @@ ?amqqueue_v2_vhost(Q) =:= VHost) orelse (?is_amqqueue_v1(Q) andalso ?amqqueue_v1_vhost(Q) =:= VHost))). + +-ifdef(DEBUG_QUORUM_QUEUE_FF). +-define(enable_quorum_queue_if_debug, + begin + rabbit_log:info( + "---- ENABLING quorum_queue as part of " + "?try_mnesia_tx_or_upgrade_amqqueue_and_retry() ----"), + ok = rabbit_feature_flags:enable(quorum_queue) + end). +-else. +-define(enable_quorum_queue_if_debug, noop). +-endif. + +-define(try_mnesia_tx_or_upgrade_amqqueue_and_retry(Expr1, Expr2), + try + ?enable_quorum_queue_if_debug, + Expr1 + catch + throw:{error, {bad_type, T}} when ?is_amqqueue(T) -> + Expr2; + throw:{aborted, {bad_type, T}} when ?is_amqqueue(T) -> + Expr2 + end). |
