Permalink
Browse files

Updated to RabbitMQ 2.7.1

  • Loading branch information...
1 parent 127e052 commit 062e726b61fc9ee8f99715cdfc6622d5299904d4 @jbrisbin committed Feb 14, 2012
View
@@ -6,10 +6,15 @@ This is a fork of the rabbit_common dependency, which is needed by the
It's meant to be included in your rebar projects in your rebar.config file:
{deps, [
- {rabbit_common, ".*", {git, "git://github.com/jbrisbin/rabbit_common.git", "rabbitmq_2.7.0"}}
+ {rabbit_common, ".*", {git, "git://github.com/jbrisbin/rabbit_common.git", "rabbitmq_2.7.1"}}
]}.
-This is simply a re-packaging of the rabbit_common AMQP client dependency, which is licensed under the MPL:
+The "master" branch of this port is a simple re-packaging of the rabbit_common AMQP client dependency.
+
+The "community" branch, however, is a port of the RabbitMQ source code with additional strict compilation
+checking turned on and the source code edited to eliminate warnings. It should be 100% compatible with the
+unaltered source code. The community branch is simply a tweak to allow projects that depend on rabbit_common
+and also have strict compilation options turned on with this project introducing warnings into those projects.
This package, the RabbitMQ server is licensed under the MPL. For the
MPL, please see LICENSE-MPL-RabbitMQ.
View
@@ -2,4 +2,18 @@
"src/gen_server2.erl",
"src/supervisor2.erl",
"src/mirrored_supervisor.erl"
-]}.
+]}.
+
+{erl_opts, [
+ debug_info,
+ compressed,
+ report,
+ warn_export_all,
+ warn_export_vars,
+ warn_shadow_vars,
+ warn_unused_function,
+ warn_deprecated_function,
+ warn_obsolete_guard,
+ warn_unused_import
+% warnings_as_errors
+]}.
View
@@ -1079,7 +1079,7 @@ get_proc_name({local, Name}) ->
exit(process_not_registered)
end;
get_proc_name({global, Name}) ->
- case global:safe_whereis_name(Name) of
+ case whereis_name(Name) of
undefined ->
exit(process_not_registered_globally);
Pid when Pid =:= self() ->
@@ -1101,7 +1101,7 @@ get_parent() ->
name_to_pid(Name) ->
case whereis(Name) of
undefined ->
- case global:safe_whereis_name(Name) of
+ case whereis_name(Name) of
undefined ->
exit(could_not_find_registerd_name);
Pid ->
@@ -1111,6 +1111,20 @@ name_to_pid(Name) ->
Pid
end.
+whereis_name(Name) ->
+ case ets:lookup(global_names, Name) of
+ [{_Name, Pid, _Method, _RPid, _Ref}] ->
+ if node(Pid) == node() ->
+ case is_process_alive(Pid) of
+ true -> Pid;
+ false -> undefined
+ end;
+ true ->
+ Pid
+ end;
+ [] -> undefined
+ end.
+
find_prioritisers(GS2State = #gs2_state { mod = Mod }) ->
PrioriCall = function_exported_or_default(
Mod, 'prioritise_call', 3,
@@ -242,8 +242,10 @@ start_link({global, _SupName}, _Group, _Mod, _Args) ->
start_link0(Prefix, Group, Init) ->
case apply(?SUPERVISOR, start_link,
Prefix ++ [?MODULE, {overall, Group, Init}]) of
- {ok, Pid} -> call(Pid, {init, Pid}),
- {ok, Pid};
+ {ok, Pid} -> case catch call(Pid, {init, Pid}) of
+ ok -> {ok, Pid};
+ E -> E
+ end;
Other -> Other
end.
@@ -346,13 +348,20 @@ handle_call({init, Overall}, _From,
end || Pid <- Rest],
Delegate = child(Overall, delegate),
erlang:monitor(process, Delegate),
- [maybe_start(Group, Delegate, S) || S <- ChildSpecs],
- {reply, ok, State#state{overall = Overall, delegate = Delegate}};
+ State1 = State#state{overall = Overall, delegate = Delegate},
+ case all_started([maybe_start(Group, Delegate, S) || S <- ChildSpecs]) of
+ true -> {reply, ok, State1};
+ false -> {stop, shutdown, State1}
+ end;
handle_call({start_child, ChildSpec}, _From,
State = #state{delegate = Delegate,
group = Group}) ->
- {reply, maybe_start(Group, Delegate, ChildSpec), State};
+ {reply, case maybe_start(Group, Delegate, ChildSpec) of
+ already_in_mnesia -> {error, already_present};
+ {already_in_mnesia, Pid} -> {error, {already_started, Pid}};
+ Else -> Else
+ end, State};
handle_call({delete_child, Id}, _From, State = #state{delegate = Delegate,
group = Group}) ->
@@ -400,13 +409,16 @@ handle_info({'DOWN', _Ref, process, Pid, _Reason},
%% TODO load balance this
%% No guarantee pg2 will have received the DOWN before us.
Self = self(),
- case lists:sort(?PG2:get_members(Group)) -- [Pid] of
- [Self | _] -> {atomic, ChildSpecs} =
- mnesia:transaction(fun() -> update_all(Pid) end),
- [start(Delegate, ChildSpec) || ChildSpec <- ChildSpecs];
- _ -> ok
- end,
- {noreply, State};
+ R = case lists:sort(?PG2:get_members(Group)) -- [Pid] of
+ [Self | _] -> {atomic, ChildSpecs} =
+ mnesia:transaction(fun() -> update_all(Pid) end),
+ [start(Delegate, ChildSpec) || ChildSpec <- ChildSpecs];
+ _ -> []
+ end,
+ case all_started(R) of
+ true -> {noreply, State};
+ false -> {stop, shutdown, State}
+ end;
handle_info(Info, State) ->
{stop, {unexpected_info, Info}, State}.
@@ -428,8 +440,8 @@ maybe_start(Group, Delegate, ChildSpec) ->
check_start(Group, Delegate, ChildSpec)
end) of
{atomic, start} -> start(Delegate, ChildSpec);
- {atomic, undefined} -> {error, already_present};
- {atomic, Pid} -> {error, {already_started, Pid}};
+ {atomic, undefined} -> already_in_mnesia;
+ {atomic, Pid} -> {already_in_mnesia, Pid};
%% If we are torn down while in the transaction...
{aborted, E} -> {error, E}
end.
@@ -499,6 +511,8 @@ delete_all(Group) ->
[delete(Group, id(C)) ||
C <- mnesia:select(?TABLE, [{MatchHead, [], ['$1']}])].
+all_started(Results) -> [] =:= [R || R = {error, _} <- Results].
+
%%----------------------------------------------------------------------------
create_tables() ->
View
@@ -244,7 +244,7 @@ determine_queue_nodes(Args) ->
case [list_to_atom(binary_to_list(Node)) ||
{longstr, Node} <- Nodes] of
[Node] -> {Node, undefined};
- [First | Rest] -> {First, Rest}
+ [First | Rest] -> {First, [First | Rest]}
end;
{{_Type, <<"all">>}, _} ->
{node(), all};
@@ -1,6 +1,6 @@
{application, rabbit_common,
[{description, "RabbitMQ Common Libraries"},
- {vsn, "2.7.0"},
+ {vsn, "2.7.1"},
{modules, []},
{registered, []},
{env, []},
@@ -136,60 +136,60 @@
| #'test.string_ok'{} | #'test.table'{} | #'test.table_ok'{} | #'test.content'{}
| #'test.content_ok'{} )).
-type(amqp_method_field_name() ::
- ( message_count | exchange | reply_code | delivery_tag
- | ticket | content_checksum | nowait | prefetch_count
- | no_ack | nowait | identifier | server_properties
- | prefetch_size | details | routing_key | message_count
- | arguments | no_local | exchange | global
- | table | integer_2 | class_id | requeue
- | nowait | no_ack | known_hosts | mandatory
- | integer_op | prefetch_size | frame_max | if_unused
- | queue | consumer_tag | response | content_size
- | ticket | read | challenge | exchange
- | reply_code | consumer_tag | queue | queue
- | version_major | queue | consumer_tag | exchange
- | ticket | exchange | consumer_tag | active
- | heartbeat | reply_text | multiple | nowait
- | prefetch_count | consumer_tag | string_2 | consumer_tag
- | heartbeat | reply_code | delivery_tag | passive
- | exchange | consumer_tag | string_op | mechanism
- | consumer_tag | routing_key | prefetch_count | exclusive
- | delivery_tag | integer_4 | version_minor | immediate
- | cluster_id | dtx_identifier | reply_code | host
- | integer_3 | no_local | ticket | consumer_tag
- | exchange | arguments | queue | routing_key
- | routing_key | ticket | reply_text | ticket
- | method_id | channel_max | queue | routing_key
- | result | if_empty | exchange | ticket
- | routing_key | client_properties | requeue | exchange
- | message_count | locale | reply_text | delivery_tag
- | active | active | redelivered | consume_rate
- | no_local | nowait | mandatory | known_hosts
- | durable | nowait | redelivered | virtual_host
- | operation | frame_max | auto_delete | global
- | delivery_tag | nowait | nowait | method_id
- | mandatory | mechanisms | exchange | consumer_tag
- | exchange | class_id | response | consumer_tag
- | exchange | prefetch_size | exchange | integer_result
- | queue | passive | meta_data | passive
- | exchange | capabilities | reply_code | insist
- | internal | ticket | requeue | consumer_tag
- | consumer_tag | reply_text | operation | write
- | global | exclusive | delivery_tag | locales
- | no_ack | immediate | string_result | ticket
- | consumer_tag | delivery_tag | routing_key | if_unused
- | requeue | out_of_band | exclusive | reply_code
- | exclusive | staged_size | multiple | immediate
- | nowait | routing_key | nowait | type
- | nowait | arguments | ticket | ticket
- | ticket | integer_1 | durable | consumer_tag
- | queue | routing_key | routing_key | ticket
- | delivery_tag | queue | channel_max | result
- | reply_text | identifier | identifier | queue
- | ticket | auto_delete | consumer_count | queue
- | reply_text | exclusive | nowait | ticket
- | message_count | realm | string_1 | arguments
- | routing_key | redelivered )).
+ ( consumer_tag | prefetch_count | message_count | exclusive
+ | delivery_tag | string_2 | immediate | cluster_id
+ | ticket | content_checksum | ticket | no_local
+ | routing_key | frame_max | routing_key | out_of_band
+ | routing_key | durable | if_empty | exchange
+ | nowait | queue | routing_key | nowait
+ | exchange | routing_key | result | ticket
+ | routing_key | ticket | requeue | active
+ | channel_max | exchange | delivery_tag | queue
+ | consumer_tag | integer_3 | operation | consume_rate
+ | reply_text | consumer_tag | consumer_count | nowait
+ | global | reply_text | nowait | redelivered
+ | mandatory | operation | message_count | auto_delete
+ | nowait | channel_max | string_op | message_count
+ | method_id | delivery_tag | write | mandatory
+ | integer_4 | ticket | integer_result | nowait
+ | consumer_tag | nowait | nowait | prefetch_size
+ | details | passive | ticket | no_local
+ | meta_data | ticket | class_id | reply_code
+ | ticket | consumer_tag | known_hosts | routing_key
+ | exchange | frame_max | exclusive | reply_code
+ | response | global | consumer_tag | exclusive
+ | delivery_tag | read | no_ack | delivery_tag
+ | reply_code | exchange | version_major | if_unused
+ | reply_code | identifier | requeue | exclusive
+ | active | exclusive | nowait | consumer_tag
+ | staged_size | method_id | immediate | realm
+ | prefetch_count | type | ticket | routing_key
+ | heartbeat | arguments | content_size | ticket
+ | passive | reply_code | integer_1 | consumer_tag
+ | mechanism | routing_key | table | reply_text
+ | delivery_tag | arguments | queue | version_minor
+ | consumer_tag | identifier | identifier | reply_code
+ | client_properties | ticket | auto_delete | reply_text
+ | ticket | queue | arguments | insist
+ | host | reply_text | multiple | routing_key
+ | ticket | queue | redelivered | delivery_tag
+ | durable | response | nowait | exchange
+ | string_result | server_properties | routing_key | consumer_tag
+ | prefetch_size | message_count | reply_text | immediate
+ | arguments | exchange | active | ticket
+ | no_ack | integer_2 | no_local | nowait
+ | no_ack | consumer_tag | mandatory | integer_op
+ | queue | capabilities | requeue | prefetch_size
+ | result | exchange | exchange | queue
+ | challenge | exchange | locale | exchange
+ | redelivered | nowait | requeue | known_hosts
+ | queue | consumer_tag | mechanisms | ticket
+ | exchange | class_id | heartbeat | exchange
+ | exchange | multiple | queue | queue
+ | locales | string_1 | consumer_tag | passive
+ | if_unused | virtual_host | delivery_tag | prefetch_count
+ | queue | internal | consumer_tag | global
+ | consumer_tag | dtx_identifier )).
-type(amqp_property_record() ::
( #'P_connection'{} | #'P_channel'{} | #'P_access'{} | #'P_exchange'{}
| #'P_queue'{} | #'P_basic'{} | #'P_file'{} | #'P_stream'{}
@@ -115,43 +115,43 @@
| #'tx.commit'{} | #'tx.commit_ok'{} | #'tx.rollback'{} | #'tx.rollback_ok'{}
| #'confirm.select'{} | #'confirm.select_ok'{} )).
-type(amqp_method_field_name() ::
- ( arguments | routing_key | if_empty | exchange
- | ticket | queue | nowait | exchange
- | out_of_band | requeue | exchange | reply_code
- | destination | ticket | channel_max | response
- | version_minor | ticket | arguments | consumer_tag
- | queue | source | delivery_tag | nowait
- | delivery_tag | internal | exchange | ticket
- | ticket | virtual_host | consumer_count | ticket
- | nowait | no_local | routing_key | durable
- | exchange | exchange | routing_key | server_properties
- | delivery_tag | realm | routing_key | passive
- | reply_text | auto_delete | channel_id | class_id
- | ticket | capabilities | consumer_tag | heartbeat
- | passive | redelivered | requeue | multiple
- | auto_delete | exchange | frame_max | exclusive
- | durable | mechanisms | global | no_ack
- | arguments | class_id | prefetch_count | delivery_tag
- | source | delivery_tag | ticket | insist
- | locale | message_count | response | if_unused
- | challenge | queue | locales | queue
- | ticket | message_count | mandatory | queue
- | ticket | ticket | exclusive | reply_code
- | ticket | active | requeue | routing_key
- | reply_text | nowait | channel_max | passive
- | nowait | message_count | exclusive | nowait
- | arguments | nowait | active | requeue
- | method_id | method_id | prefetch_size | ticket
- | nowait | known_hosts | reply_code | if_unused
- | queue | frame_max | queue | consumer_tag
- | arguments | mechanism | reply_text | multiple
- | routing_key | arguments | redelivered | write
- | message_count | consumer_tag | nowait | nowait
- | active | routing_key | arguments | version_major
- | exchange | immediate | cluster_id | consumer_tag
- | heartbeat | nowait | no_ack | routing_key
- | type | client_properties | read | destination
- | queue )).
+ ( passive | message_count | nowait | message_count
+ | queue | active | consumer_tag | routing_key
+ | mechanisms | no_ack | arguments | nowait
+ | prefetch_count | channel_max | if_empty | ticket
+ | nowait | message_count | requeue | nowait
+ | locale | active | method_id | queue
+ | ticket | ticket | ticket | prefetch_size
+ | mandatory | reply_code | nowait | known_hosts
+ | server_properties | nowait | frame_max | no_local
+ | response | if_unused | arguments | write
+ | response | exclusive | nowait | nowait
+ | global | requeue | arguments | requeue
+ | queue | active | arguments | class_id
+ | exchange | arguments | heartbeat | ticket
+ | queue | routing_key | queue | consumer_tag
+ | type | queue | version_major | reply_text
+ | multiple | routing_key | arguments | mechanism
+ | redelivered | virtual_host | read | queue
+ | message_count | delivery_tag | out_of_band | delivery_tag
+ | reply_code | durable | ticket | channel_max
+ | method_id | consumer_tag | passive | no_ack
+ | version_minor | nowait | consumer_tag | nowait
+ | destination | client_properties | reply_code | nowait
+ | delivery_tag | insist | exchange | frame_max
+ | ticket | ticket | exchange | reply_text
+ | passive | immediate | ticket | durable
+ | destination | ticket | realm | arguments
+ | reply_text | ticket | delivery_tag | channel_id
+ | delivery_tag | cluster_id | class_id | source
+ | queue | capabilities | exchange | exchange
+ | challenge | auto_delete | exchange | consumer_count
+ | routing_key | exclusive | exchange | consumer_tag
+ | routing_key | heartbeat | routing_key | exclusive
+ | exchange | locales | source | routing_key
+ | auto_delete | ticket | if_unused | internal
+ | ticket | routing_key | redelivered | requeue
+ | multiple )).
-type(amqp_property_record() ::
( #'P_connection'{} | #'P_channel'{} | #'P_access'{} | #'P_exchange'{}
| #'P_queue'{} | #'P_basic'{} | #'P_tx'{} | #'P_confirm'{} )).
Oops, something went wrong.

0 comments on commit 062e726

Please sign in to comment.