diff options
author | Jerry Kuch <jerryk@vmware.com> | 2011-03-02 10:24:56 -0800 |
---|---|---|
committer | Jerry Kuch <jerryk@vmware.com> | 2011-03-02 10:24:56 -0800 |
commit | 16b9a617caab680939b962817bc8b2a7864af713 (patch) | |
tree | 974a856416062373085cf99fb75a999cfad211f7 | |
parent | e1f0432a566190a76bc3ea0d28ff905fa9076019 (diff) | |
download | rabbitmq-server-16b9a617caab680939b962817bc8b2a7864af713.tar.gz |
Move rubicon forward. 'init' redone.
-rw-r--r-- | src/mysql_helper.erl | 3 | ||||
-rw-r--r-- | src/rabbit_mysql_queue.erl | 45 |
2 files changed, 15 insertions, 33 deletions
diff --git a/src/mysql_helper.erl b/src/mysql_helper.erl index 97d2da0f..38d1391e 100644 --- a/src/mysql_helper.erl +++ b/src/mysql_helper.erl @@ -113,7 +113,8 @@ write_n_record(DbQueueName, NextSeqId) -> [DbQueueName, NextSeqId]) end. -%% Delete non-persistent msgs after a restart. +%% Delete non-persistent msgs after a restart. Maybe used within a +%% MySQL transaction. -spec delete_nonpersistent_msgs(string()) -> ok. delete_nonpersistent_msgs(DbQueueName) -> diff --git a/src/rabbit_mysql_queue.erl b/src/rabbit_mysql_queue.erl index 76e23b60..ad28c4a6 100644 --- a/src/rabbit_mysql_queue.erl +++ b/src/rabbit_mysql_queue.erl @@ -201,11 +201,6 @@ start(_DurableQueues) -> stop() -> ok. - -%%############################################################################# -%% THE RUBICON... -%%############################################################################# - %%---------------------------------------------------------------------------- %% init/3 creates one backing queue, returning its state. Names are %% local to the vhost, and must be unique. @@ -217,7 +212,7 @@ stop() -> ok. %% (rabbit_amqqueue:name(), is_durable(), attempt_recovery()) %% -> state()). %% -%% BUGBUG: Error checking... +%% BUGBUG: Error checking needs to be treated coherently. init(QueueName, IsDurable, Recover) -> rabbit_log:info("init(~n ~p,~n ~p,~n ~p) ->", [QueueName, IsDurable, Recover]), @@ -251,29 +246,35 @@ init(QueueName, IsDurable, Recover) -> callback([]), Result. + %%############################################################################# -%% OTHER SIDE OF THE RUBICON... +%% THE RUBICON... %%############################################################################# - %%---------------------------------------------------------------------------- %% terminate/1 deletes all of a queue's pending acks, prior to %% shutdown. %% -%% terminate/1 creates an Mnesia transaction to run in, and therefore -%% may not be called from inside another Mnesia transaction. +%% +%% BUGBUG: [Wrong comment]terminate/1 creates a Mnesia transaction to +%% run in, and therefore may not be called from inside another Mnesia +%% transaction. %% %% -spec(terminate/1 :: (state()) -> state()). terminate(S = #s { queue_name = DbQueueName}) -> - %% % rabbit_log:info("terminate(~n ~p) ->", [S]), + rabbit_log:info("terminate(~n ~p) ->", [S]), %% {atomic, Result} = %% mnesia:transaction(fun () -> clear_table(PTable), S end), %% mnesia:dump_tables([QTable, PTable, NTable]), - %% % rabbit_log:info("terminate ->~n ~p", [Result]), + % rabbit_log:info("terminate ->~n ~p", [Result]), %% Result. yo_mama_bogus_result. +%%############################################################################# +%% OTHER SIDE OF THE RUBICON... +%%############################################################################# + %%---------------------------------------------------------------------------- %% delete_and_terminate/1 deletes all of a queue's enqueued msgs and %% pending acks, prior to shutdown. @@ -720,23 +721,6 @@ clear_table(Table) -> clear_table(Table) end. -%% Delete non-persistent msgs after a restart. - --spec delete_nonpersistent_msgs(atom()) -> ok. - -delete_nonpersistent_msgs(QTable) -> - %% lists:foreach( - %% fun (Key) -> - %% [#q_record { out_id = Key, m = M }] = - %% mnesia:read(QTable, Key, 'read'), - %% case M of - %% #m { msg = #basic_message { is_persistent = true }} -> ok; - %% _ -> mnesia:delete(QTable, Key, 'write') - %% end - %% end, - %% mnesia:all_keys(QTable)). - yo_mama_bogus_result. - %% internal_fetch/2 fetches the next msg, if any, inside an Mnesia %% transaction, generating a pending ack as necessary. @@ -949,8 +933,6 @@ callback(Pubs) -> - - %%----------------------------------------------------------------------------- %% Sub-basement of sub-helper functions... %%----------------------------------------------------------------------------- @@ -961,4 +943,3 @@ ensure_app_running(App) -> {error, {already_started,App}} -> ok; {Result, {Description, App}} -> {Result, {Description, App}} end. - |