diff options
| -rw-r--r-- | ebin/rabbit_app.in | 1 | ||||
| -rw-r--r-- | src/rabbit_mirror_queue_misc.erl | 10 |
2 files changed, 8 insertions, 3 deletions
diff --git a/ebin/rabbit_app.in b/ebin/rabbit_app.in index 7c4be6f7f2..3510474527 100644 --- a/ebin/rabbit_app.in +++ b/ebin/rabbit_app.in @@ -85,6 +85,7 @@ {ssl_apps, [asn1, crypto, public_key, ssl]}, %% see rabbitmq-server#114 {mirroring_flow_control, true}, + {mirroring_sync_batch_size, 4096}, %% see rabbitmq-server#227 and related tickets. %% msg_store_credit_disc_bound only takes effect when %% messages are persisted to the message store. If messages diff --git a/src/rabbit_mirror_queue_misc.erl b/src/rabbit_mirror_queue_misc.erl index 7b6c259e99..c68b799c7d 100644 --- a/src/rabbit_mirror_queue_misc.erl +++ b/src/rabbit_mirror_queue_misc.erl @@ -46,7 +46,7 @@ {enables, recovery}]}). %% For compatibility with versions that don't support sync batching. --define(DEFAULT_BATCH_SIZE, 1). +-define(DEFAULT_BATCH_SIZE, 4096). %%---------------------------------------------------------------------------- @@ -371,13 +371,17 @@ maybe_auto_sync(Q = #amqqueue{pid = QPid}) -> sync_batch_size(#amqqueue{} = Q) -> case policy(<<"ha-sync-batch-size">>, Q) of none -> %% we need this case because none > 1 == true - ?DEFAULT_BATCH_SIZE; + default_batch_size(); BatchSize when BatchSize > 1 -> BatchSize; _ -> - ?DEFAULT_BATCH_SIZE + default_batch_size() end. +default_batch_size() -> + rabbit_misc:get_env(rabbit, mirroring_sync_batch_size, + ?DEFAULT_BATCH_SIZE). + update_mirrors(OldQ = #amqqueue{pid = QPid}, NewQ = #amqqueue{pid = QPid}) -> case {is_mirrored(OldQ), is_mirrored(NewQ)} of |
