summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRob Harrop <rharrop@vmware.com>2010-09-21 18:01:41 +0100
committerRob Harrop <rharrop@vmware.com>2010-09-21 18:01:41 +0100
commit1a4427984277dff425b894972291ca3921eb7114 (patch)
tree3f665cc5308d721102dc3d4b141d6f40ee901e99 /src
parentf56898059fe9ecd900d4d292e656c196b85284ef (diff)
downloadrabbitmq-server-git-1a4427984277dff425b894972291ca3921eb7114.tar.gz
cosmetic changes
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_queue_index.erl7
-rw-r--r--src/rabbit_variable_queue.erl23
2 files changed, 15 insertions, 15 deletions
diff --git a/src/rabbit_queue_index.erl b/src/rabbit_queue_index.erl
index 1af8dd7674..6ace4c8b22 100644
--- a/src/rabbit_queue_index.erl
+++ b/src/rabbit_queue_index.erl
@@ -538,11 +538,14 @@ expiry_to_binary(Expiry) ->
read_pub_record_body(Hdl) ->
{ok, Bin} = file_handle_cache:read(Hdl, ?GUID_BYTES + ?EXPIRY_BYTES),
+
+ %% work around for binary data fragmentation. See
+ %% rabbit_msg_file:read_next/2
<<GuidNum:?GUID_BITS, Expiry:?EXPIRY_BITS>> = Bin,
<<Guid:?GUID_BYTES/binary>> = <<GuidNum:?GUID_BITS>>,
Exp = case Expiry of
?NO_EXPIRY -> undefined;
- X -> X
+ X -> X
end,
{Guid, #msg_properties{expiry = Exp}}.
@@ -829,8 +832,6 @@ load_segment_entries(KeepAcked, Hdl, SegEntries, UnackedCount) ->
case file_handle_cache:read(Hdl, ?REL_SEQ_ONLY_ENTRY_LENGTH_BYTES) of
{ok, <<?PUBLISH_PREFIX:?PUBLISH_PREFIX_BITS,
IsPersistentNum:1, RelSeq:?REL_SEQ_BITS>>} ->
- %% because we specify /binary, and binaries are complete
- %% bytes, the size spec is in bytes, not bits.
{Guid, MsgProperties} = read_pub_record_body(Hdl),
Obj = {{Guid, MsgProperties, 1 == IsPersistentNum}, no_del, no_ack},
SegEntries1 = array:set(RelSeq, Obj, SegEntries),
diff --git a/src/rabbit_variable_queue.erl b/src/rabbit_variable_queue.erl
index e0cae48df9..6dc24e80b9 100644
--- a/src/rabbit_variable_queue.erl
+++ b/src/rabbit_variable_queue.erl
@@ -613,11 +613,10 @@ tx_rollback(Txn, State = #vqstate { durable = IsDurable }) ->
tx_commit(Txn, Fun, MsgPropsFun, State = #vqstate { durable = IsDurable }) ->
#tx { pending_acks = AckTags, pending_messages = Pubs } = lookup_tx(Txn),
erase_tx(Txn),
- F = fun({Msg, MsgProperties}) ->
- {Msg, MsgPropsFun(MsgProperties)}
- end,
- PubsProcessed = lists:map(F, Pubs),
- PubsOrdered = lists:reverse(PubsProcessed),
+ PubsOrdered = lists:foldl(
+ fun ({Msg, MsgProps}, Acc) ->
+ [{Msg, MsgPropsFun(MsgProps)} | Acc]
+ end, [], Pubs),
AckTags1 = lists:append(AckTags),
PersistentGuids = persistent_guids(PubsOrdered),
HasPersistentPubs = PersistentGuids =/= [],
@@ -848,13 +847,13 @@ betas_from_index_entries(List, TransientThreshold, IndexState) ->
true -> {Filtered1,
cons_if(not IsDelivered, SeqId, Delivers1),
[SeqId | Acks1]};
- false -> {[m(#msg_status { msg = undefined,
- guid = Guid,
- seq_id = SeqId,
- is_persistent = IsPersistent,
- is_delivered = IsDelivered,
- msg_on_disk = true,
- index_on_disk = true,
+ false -> {[m(#msg_status { msg = undefined,
+ guid = Guid,
+ seq_id = SeqId,
+ is_persistent = IsPersistent,
+ is_delivered = IsDelivered,
+ msg_on_disk = true,
+ index_on_disk = true,
msg_properties = MsgProperties
}) | Filtered1],
Delivers1,