summaryrefslogtreecommitdiff
path: root/src/rabbit_queue_index.erl
Commit message (Collapse)AuthorAgeFilesLines
* Switch to Erlang 17-style types, /0 versions at least.Simon MacMullen2014-09-171-4/+4
|
* Allow crashing queue processes to come back as slaves if that's what we need.Simon MacMullen2014-08-201-1/+9
|
* Minor tweaks: reduce distance to default, fix spec, improve assertion, ↵Simon MacMullen2014-08-111-4/+3
| | | | improve comment, cosmetic.
* Upgrades to the queue index and recovery terms format.Simon MacMullen2014-08-051-3/+40
|
* The expectation is we will only return details for persistent messages here.Simon MacMullen2014-07-281-2/+5
|
* First pass at queue-size-in-bytes. Only lightly tested, and with no upgrade ↵Simon MacMullen2014-07-231-21/+32
| | | | step for QI. But I wanted to commit something...
* give in to dialyzerbug26087Matthias Radestock2014-03-271-3/+2
|
* appease dialyzerMatthias Radestock2014-03-271-8/+3
|
* Update copyright for 2014bug25940Simon MacMullen2014-03-171-1/+1
|
* merge default into bug25853Matthias Radestock2014-02-101-6/+6
|\
| * unbreak durable queue dir cleanupbug25827Matthias Radestock2014-01-301-6/+6
| | | | | | | | | | | | | | | | | | all_queue_directory_names returns just names, not paths Also, gain some efficiency by performing just one invocation of rabbit_file:recursive_delete/1, with all dirs. And some cosmetics.
* | cosmeticMatthias Radestock2014-02-101-6/+4
| |
* | rename misleading variablesMatthias Radestock2014-02-061-7/+7
| | | | | | | | ...and fix a counting error
* | merge default into bug25853Matthias Radestock2014-01-241-19/+34
|\ \ | |/ |/| | | containing the recently merged bug25827
| * Optimise queue index initialisationTim Watson2014-01-201-19/+34
| | | | | | | | | | Avoid loading the journal when the file doesn?t exist. Also try to avoid flushing the journal unless necessary.
* | Refactor rabbit_recovery_terms startupTim Watson2014-01-231-4/+6
| | | | | | | | | | | | | | | | Rename rabbit_queue_index:{recover => start}/1. Rename rabbit_shutdown_terms{recover => start}/0. Stop handling supervisor child-start errors explicitly. Add {rabbit_recovery_terms, rabbit_queue_index}:stop/0 variants. Introduce a `stop? code path from BQ:stop/0 to qi:stop/0.
* | Refactor (recovery-terms restart strategy)Tim Watson2014-01-231-1/+1
| | | | | | | | | | Use rabbit_sup:start_child/1, since a transient restart is fine. Match on rabbit_recovery_terms:recover/0, since we want to crash if that fails.
* | API consistency, clarity and cosmetics:Matthias Radestock2014-01-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | - store/2 took a full dir path whereas read/1 only took the basename; now they both take the basename. - clearly separate the public API and the internal API in exports - don't have specs for internal API - remove unused UPGRADE_TABLE define - ditch rabbit.hrl include - it was only needed for ?MAX_WAIT - sensible order of function definitions, plus some separators for clarity
* | cosmeticMatthias Radestock2014-01-161-2/+1
| |
* | Fix type spec and modify backing_queue_qc to call init correctlyTim Watson2014-01-161-1/+1
| |
* | cosmeticMatthias Radestock2014-01-151-2/+1
| |
* | Refactor - simplify BQ/QI interface & reduce the distance to defaultTim Watson2014-01-151-4/+3
| |
* | Cosmetic (ish)Tim Watson2014-01-141-9/+1
| | | | | | | | Strip extraneous comment lines and remove an unused function.
* | Refactor: reduce the distance to defaultTim Watson2014-01-141-2/+1
| |
* | Refactor / maintain a clean interface to the backing queueTim Watson2014-01-141-36/+26
| | | | | | | | | | | | | | | | | | | | | | Instead of passing amqqueue records to BQ:start/1, revert to passing queue names and return a list of queue recovery terms ordered identically to the given queue names. As a result, we can go back to keying recovery data off the unique queue directory (base)name and no longer need to track the queue name in the qi. We now also only need the queue directory name to lookup recovery terms. Also update the BQ interface documentation and callbacks/specs.
* | Refactor to avoid O(N*2) lookups during queue recoveryTim Watson2014-01-131-24/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | cosmeticMatthias Radestock2014-01-131-5/+3
| |
* | Stop using the full path to the queue directory as the recovery keyTim Watson2014-01-101-4/+3
| |
* | Better handling of file system directories during shutdown/recoveryTim Watson2014-01-091-21/+21
| | | | | | | | | | | | | | Ensure the ?queues? directory exists before attempting to sync the recovery terms dets table. Drive qi recovery off the durable queues we?re passed, rather than relying on the existence of queue dirs, which are created lazily.
* | Scrub un-used code and introduce a lookup-by-recovery-key APITim Watson2013-12-311-2/+0
| |
* | push down recovery index handling into qi recoveryTim Watson2013-12-191-0/+1
| |
* | Tidy of specs and further re-working of testsTim Watson2013-12-191-1/+2
| |
* | Rework/Refactor to handle recovery terms up-frontTim Watson2013-12-191-21/+23
| | | | | | | | | | | | | | | | We process all the recovery terms up-front, during qi recovery, and clear + sync the dets table immediately afterwards. The recovery terms and keys, based on the queue directory?s ?basename?, are then passed throughout the initialisation process and checked in the various places they?re used.
* | Further refactoringTim Watson2013-12-111-2/+4
| | | | | | | | | | Inline check_clean_shutdown for improved clarity, move index table recovery up into rabbit:recover/0, fix/update recovery index specs.
* | Minor refactoringTim Watson2013-12-101-3/+3
| | | | | | | | | | read_recovery_terms hides unused keys, better name for clean shutdown checking and comment explaining why recovery_indexes is a gen_server.
* | Reduce distance to default (again)Tim Watson2013-12-091-2/+2
| |
* | Track queue index recovery data using detsTim Watson2013-12-091-26/+16
|/ | | | | | | We now hold a single dets table with all the queue recovery data. This is synchronised after we've started up (at which point all recovery data should be deleted) and just before shutting down, after the queue indexes have writen their recovery data to it.
* Merged stable into defaultEmile Joubert2013-07-311-2/+2
|\
| * s/VMware/GoPivotal/gSimon MacMullen2013-07-011-2/+2
| |
* | Merged stable into defaultEmile Joubert2013-06-061-5/+27
|\ \ | |/ |/|
| * Implement feedbackbug25390Emile Joubert2013-05-141-4/+3
| |
| * Cope with trailing zeroes in journal and segment filesEmile Joubert2013-05-141-4/+27
| | | | | | | | | | | | | | | | Makes the on-disk journal format tolerant of runs of zeroes at the end of the file. This could occur if file operations are interrupted by a crashing server. Also changes the definition of segment prefixes so that runs of zero bytes will never appear in a valid segment.
* | Attempt to deal with missing segment file.bug25576Simon MacMullen2013-05-311-1/+12
|/
* Change to 'confirms' | 'other' | 'false'bug25429Simon MacMullen2013-02-081-2/+5
|
* merge bug25428 into bug25429Matthias Radestock2013-01-311-6/+6
|\
| * merge default into bug25428bug25428Matthias Radestock2013-01-311-6/+6
| |\
| | * remove spurious generalityMatthias Radestock2013-01-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after spending hours trawling through the qi code and its history, Matthew and I are convinced that qi:add_to_journal/3 is unnecessarily general, handling a case that can never arise, namely adding an 'ack' when we do have an entry for the given sequence number but that entry does no contain a 'del'. add_to_journal/3 gets called, indirectly, from four places: 1) load_journal/1. This is always called with no segements in the State. So all the segment journal entries originate from the very add_journal/3 code. And the only way we'd end up with an entry of the form {Pub, no_del, no_ack} and get an 'ack' is if the journal contained a pub and (later) an ack, with no del inbetween. That can only happen through a misuse of the qi API. Which doesn't happen. And there are plenty of other cases (e.g. duplicate dels or acks) where qi insists on callers doing the right thing. 2) publish/5 This ends up adding a {?PUB, no_del, no_ack} entry, so is of no direct concern to our investigation. 3) deliver_or_ack/3 This would hit the aforementioned {Pub, no_del, no_ack} & 'ack' case only if we lost a 'del'. 4) recover_message/5 this only adds an 'ack' to the segment journal if either a) the combination of the segment entries and the segment journal produces an entry {?PUB, del, no_ack}, or b) it's just added a 'del' (thus making a {Pub, no_del, no_ack} entry impossible). Re (a)... for there to be a combined entry of {?PUB, del, no_ack} when the segment journal contains {Pub, no_del, no_ack} (which would trigger the case we are concerned about), the segment would have to contain a 'del' w/o a 'pub', which is impossible.
* | | ask qi whether it needs sync'ing, and whyMatthias Radestock2013-01-301-3/+6
|/ /
* | don't hold on to 'complete' in-memory qi journal entriesMatthias Radestock2013-01-301-13/+15
| | | | | | | | | | | | | | | | | | When a pub, del and ack for a message are all recorded in the journal then we don't bother writing any of that to the segment files when the journal is flushed, since the message is well and truly in the past and forgotten. So... there is no point keeping the entry in the in-memory journal either, where it just eats up space until a flush for no good reason.
* | only keep track of *unconfirmed* unsync'ed messages ids in qiMatthias Radestock2013-01-301-9/+15
|/ | | | | | | | | | | | ...so we don't bloat memory with stuff nobody cares about, and reduce the qi->queue callbacks (to zero when no confirms/tx are used) This does expose qi to a bit more messaging semantics, but imo to an acceptable degree. related changes: - rename the state var to better capture its (revised) meaning - only invoke the OnSyncFun when we have something to say