diff options
author | Simon MacMullen <simon@rabbitmq.com> | 2014-10-10 10:59:42 +0100 |
---|---|---|
committer | Simon MacMullen <simon@rabbitmq.com> | 2014-10-10 10:59:42 +0100 |
commit | 21c1737a32255780f9a5b89ffbd70d61d247194d (patch) | |
tree | 80dbdbbb2bac590912998880d9f105a25e67b181 | |
parent | abb0dc0b414e5166c83e32e5f76dae46a98e10df (diff) | |
download | rabbitmq-server-bug26410.tar.gz |
Use flow control when talking to the message store, on a fast machine this test could overwhelm the message store such that gen_server2:drain/1 never completed.bug26410
-rw-r--r-- | test/src/rabbit_tests.erl | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/test/src/rabbit_tests.erl b/test/src/rabbit_tests.erl index 9cef22c1..ef6b756b 100644 --- a/test/src/rabbit_tests.erl +++ b/test/src/rabbit_tests.erl @@ -1979,6 +1979,11 @@ msg_store_write(MsgIds, MSCState) -> rabbit_msg_store:write(MsgId, MsgId, MSCState) end, ok, MsgIds). +msg_store_write_flow(MsgIds, MSCState) -> + ok = lists:foldl(fun (MsgId, ok) -> + rabbit_msg_store:write_flow(MsgId, MsgId, MSCState) + end, ok, MsgIds). + msg_store_remove(MsgIds, MSCState) -> rabbit_msg_store:remove(MsgIds, MSCState). @@ -2169,18 +2174,26 @@ test_msg_store_confirm_timer() -> end end, undefined), ok = msg_store_write([MsgId], MSCState), - ok = msg_store_keep_busy_until_confirm([msg_id_bin(2)], MSCState), + ok = msg_store_keep_busy_until_confirm([msg_id_bin(2)], MSCState, false), ok = msg_store_remove([MsgId], MSCState), ok = rabbit_msg_store:client_delete_and_terminate(MSCState), passed. -msg_store_keep_busy_until_confirm(MsgIds, MSCState) -> +msg_store_keep_busy_until_confirm(MsgIds, MSCState, Blocked) -> + After = case Blocked of + false -> 0; + true -> ?MAX_WAIT + end, + Recurse = fun () -> msg_store_keep_busy_until_confirm( + MsgIds, MSCState, credit_flow:blocked()) end, receive - on_disk -> ok - after 0 -> - ok = msg_store_write(MsgIds, MSCState), + on_disk -> ok; + {bump_credit, Msg} -> credit_flow:handle_bump_msg(Msg), + Recurse() + after After -> + ok = msg_store_write_flow(MsgIds, MSCState), ok = msg_store_remove(MsgIds, MSCState), - msg_store_keep_busy_until_confirm(MsgIds, MSCState) + Recurse() end. test_msg_store_client_delete_and_terminate() -> |