summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2009-06-20 23:43:23 +0100
committerMatthew Sackman <matthew@lshift.net>2009-06-20 23:43:23 +0100
commitea2c26453586d616d0e37679f7d66c766000463d (patch)
treecd4bd4c5d5689873e849b7814186895a0d5e21f9 /src
parent8f84cce78788d89d9d78ca61f77f7a130d148183 (diff)
downloadrabbitmq-server-git-ea2c26453586d616d0e37679f7d66c766000463d.tar.gz
A test. The problem really does exist. Not worked out how to fix it yet.
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_tests.erl49
1 files changed, 49 insertions, 0 deletions
diff --git a/src/rabbit_tests.erl b/src/rabbit_tests.erl
index bddb451a17..f53ce6e6bc 100644
--- a/src/rabbit_tests.erl
+++ b/src/rabbit_tests.erl
@@ -696,6 +696,7 @@ test_disk_queue() ->
passed = rdq_test_purge(),
passed = rdq_test_dump_queue(),
passed = rdq_test_mixed_queue_modes(),
+ passed = rdq_test_mode_conversion_mid_txn(),
rdq_virgin(),
ok = control_action(stop_app, []),
ok = control_action(start_app, []),
@@ -1050,6 +1051,54 @@ rdq_test_mixed_queue_modes() ->
rdq_stop(),
passed.
+rdq_test_mode_conversion_mid_txn() ->
+ rdq_virgin(),
+ rdq_start(),
+ Payload = <<0:(8*256)>>,
+ {ok, MS} = rabbit_mixed_queue:init(q, true, mixed),
+ MsgIds = lists:seq(1,10),
+ {MS2, Msgs} =
+ lists:foldl(
+ fun (N, {MS1, Acc}) ->
+ Msg = rabbit_basic:message(x, <<>>, <<>>, Payload, N),
+ {ok, MS1a} = rabbit_mixed_queue:tx_publish(Msg, MS1),
+ {MS1a, [Msg | Acc]}
+ end, {MS, []}, MsgIds),
+ {ok, MS3} = rabbit_mixed_queue:to_disk_only_mode(MS2),
+ {ok, MS4} = rabbit_mixed_queue:tx_commit(lists:reverse(Msgs), [], MS3),
+ MS6 =
+ lists:foldl(
+ fun (N, MS5) ->
+ Rem = 10 - N,
+ {{#basic_message { is_persistent = false },
+ false, _AckTag, Rem},
+ MS5a} = rabbit_mixed_queue:deliver(MS5),
+ MS5a
+ end, MS4, MsgIds),
+ 0 = rabbit_mixed_queue:length(MS6),
+ {ok, MS7} = rabbit_mixed_queue:init(q, true, disk),
+ {MS9, Msgs1} =
+ lists:foldl(
+ fun (N, {MS8, Acc}) ->
+ Msg = rabbit_basic:message(x, <<>>, <<>>, Payload, N),
+ {ok, MS8a} = rabbit_mixed_queue:tx_publish(Msg, MS8),
+ {MS8a, [Msg | Acc]}
+ end, {MS7, []}, MsgIds),
+ {ok, MS10} = rabbit_mixed_queue:to_mixed_mode(MS9),
+ {ok, MS11} = rabbit_mixed_queue:tx_commit(lists:reverse(Msgs1), [], MS10),
+ MS13 =
+ lists:foldl(
+ fun (N, MS12) ->
+ Rem = 10 - N,
+ {{#basic_message { is_persistent = false },
+ false, _AckTag, Rem},
+ MS12a} = rabbit_mixed_queue:deliver(MS12),
+ MS12a
+ end, MS11, MsgIds),
+ 0 = rabbit_mixed_queue:length(MS13),
+ rdq_stop(),
+ passed.
+
rdq_time_commands(Funcs) ->
lists:foreach(fun (F) -> F() end, Funcs).