summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@rabbitmq.com>2010-10-26 14:08:37 +0100
committerMatthew Sackman <matthew@rabbitmq.com>2010-10-26 14:08:37 +0100
commit5ad6eb6b61232d72503d57997cb2d92752f10381 (patch)
tree1842110bf1985e63472d0251206db269a083b5f9
parenta50d716964269a81dea5fd48ac75b46b9b1a8e92 (diff)
downloadrabbitmq-server-5ad6eb6b61232d72503d57997cb2d92752f10381.tar.gz
If Terms differs from Terms1, then it'll be because there was an issue in recovering the msg_store client refs from Terms. Now given that the terms are stored in the clean_file_name, there's a possibility that we crashed _during_ writing the clean_file_name (e.g. ran out of disk space). Thus we could then read in a corrupted terms file, set Terms1 to [], but still think we terminated cleanly (as we could delete the file). However, in that case, qi:recover/1 will detect the error when reading the terms file and will not try and present those terms as client_refs to the msg_store on startup. At which point, the msg_store will record dirty shutdown in its state, and then qi:recover/4, at which point the qi will do a dirty recovery. Thus in conclusion, the structure of the term file essentially forms its own checksum: if it's parsable then the data in it is trustable. Consequently, it doesn't actually matter if we pass in Terms or Terms1 here, but Terms1 is more intuitively correct
-rw-r--r--src/rabbit_variable_queue.erl2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index ce0d6956..1429e0a8 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -394,7 +394,7 @@ init(QueueName, true, true) ->
TRef),
{DeltaCount, IndexState} =
rabbit_queue_index:recover(
- QueueName, Terms,
+ QueueName, Terms1,
rabbit_msg_store:successfully_recovered_state(?PERSISTENT_MSG_STORE),
fun (Guid) ->
rabbit_msg_store:contains(Guid, PersistentClient)