summaryrefslogtreecommitdiff
path: root/src/pmon.erl
diff options
context:
space:
mode:
authorTim Watson <watson.timothy@gmail.com>2014-01-13 15:22:59 +0000
committerTim Watson <watson.timothy@gmail.com>2014-01-13 15:22:59 +0000
commitc42b9cdcfee2e3cea6d9ae29a864bbfde56d654c (patch)
tree00218ef1c3b3842d3c44ef909adc68d17a1454d3 /src/pmon.erl
parentf4cea4aea45d19284ccbd1500f003fd52366575b (diff)
downloadrabbitmq-server-git-c42b9cdcfee2e3cea6d9ae29a864bbfde56d654c.tar.gz
Refactor to avoid O(N*2) lookups during queue recovery
We remove knowledge of queue directories from rabbit_amqqueue, opting to key index recovery terms off the amqqueue record name (which is a resource record) instead. Although this simplifies the code somewhat and avoid a potentially costly lookup during queue initialisation, it does require a change to the backing queue API, since we now wish for r_amqqueue:recover/0 to iterate over all the queues (paired with their recovery terms, if any) and this means passing #amqqueue{} records around instead of using a #resource{} and/or directory name as keys. Also see rabbit_recovery_terms:read/1, which has gained an extra parameter, since during upgrades we have no access to #amqqueue{} records and /must/ therefore key any upgraded recovery data on the queue directory (basename) instead. This double keyed lookup is particularly gross since we could look the dirname up ourselves in rabbit_recovery_terms:read/1, but doing so avoids the need to export queue_name_to_dir_name from the qi _and_ calculating the MD5 on the queue’s name twice, since the qi (which is calling into read/2) has already done that anyway.
Diffstat (limited to 'src/pmon.erl')
0 files changed, 0 insertions, 0 deletions