Skip to content

Commit

Permalink
Remove dead code left from a previous incarnation of the patch
Browse files Browse the repository at this point in the history
References rabbitmq#500.
[#116521809]
  • Loading branch information
dumbbell committed Aug 26, 2016
1 parent 99f7562 commit a5cdde1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 40 deletions.
4 changes: 1 addition & 3 deletions src/rabbit_mnesia.erl
Original file line number Diff line number Diff line change
Expand Up @@ -477,14 +477,12 @@ init_db(ClusterNodes, NodeType, CheckOtherNodes) ->
{[], true, disc} ->
%% First disc node up
maybe_force_load(),
ok = rabbit_table:ensure_secondary_indices(),
ok;
{[_ | _], _, _} ->
%% Subsequent node in cluster, catch up
maybe_force_load(),
ok = rabbit_table:wait_for_replicated(),
ok = rabbit_table:create_local_copy(NodeType),
ok = rabbit_table:ensure_secondary_indices()
ok = rabbit_table:create_local_copy(NodeType)
end,
ensure_schema_integrity(),
rabbit_node_monitor:update_cluster_status(),
Expand Down
32 changes: 4 additions & 28 deletions src/rabbit_table.erl
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@

-export([create/0, create_local_copy/1, wait_for_replicated/0, wait/1,
force_load/0, is_present/0, is_empty/0, needs_default_data/0,
check_schema_integrity/0, clear_ram_only_tables/0, wait_timeout/0,
ensure_secondary_indices/0, ensure_secondary_indices/2]).
check_schema_integrity/0, clear_ram_only_tables/0, wait_timeout/0]).

-include("rabbit.hrl").

Expand Down Expand Up @@ -51,7 +50,6 @@ create() ->
Tab, TabDef1, Reason}})
end
end, definitions()),
ok = rabbit_table:ensure_secondary_indices(),
ok.

%% The sequence in which we delete the schema and then the other
Expand All @@ -65,13 +63,6 @@ create_local_copy(ram) ->
create_local_copies(ram),
create_local_copy(schema, ram_copies).

ensure_secondary_indices() ->
ensure_secondary_indices(rabbit_tracked_connection, [vhost, username]),
ok.

ensure_secondary_indices(Tab, Fields) ->
[mnesia:add_table_index(Tab, Field) || Field <- Fields].

wait_for_replicated() ->
wait([Tab || {Tab, TabDef} <- definitions(),
not lists:member({local_content, true}, TabDef)]).
Expand Down Expand Up @@ -306,24 +297,9 @@ definitions() ->
{rabbit_queue,
[{record_name, amqqueue},
{attributes, record_info(fields, amqqueue)},
{match, #amqqueue{name = queue_name_match(), _='_'}}]},

%% Used to track connections across virtual hosts
%% e.g. so that limits can be enforced.
%%
%% All data in this table is transient.
{rabbit_tracked_connection,
[{record_name, tracked_connection},
{attributes, record_info(fields, tracked_connection)},
{match, #tracked_connection{_ = '_'}}]},

{rabbit_tracked_connection_per_vhost,
[{record_name, tracked_connection_per_vhost},
{attributes, record_info(fields, tracked_connection_per_vhost)},
{match, #tracked_connection_per_vhost{_ = '_'}}]}

] ++ gm:table_definitions()
++ mirrored_supervisor:table_definitions().
{match, #amqqueue{name = queue_name_match(), _='_'}}]}]
++ gm:table_definitions()
++ mirrored_supervisor:table_definitions().

binding_match() ->
#binding{source = exchange_name_match(),
Expand Down
9 changes: 0 additions & 9 deletions src/rabbit_upgrade_functions.erl
Original file line number Diff line number Diff line change
Expand Up @@ -524,11 +524,6 @@ create(Tab, TabDef) ->
{atomic, ok} = mnesia:create_table(Tab, TabDef),
ok.

create(Tab, TabDef, SecondaryIndices) ->
{atomic, ok} = mnesia:create_table(Tab, TabDef),
[mnesia:add_table_index(Tab, Idx) || Idx <- SecondaryIndices],
ok.

%% Dumb replacement for rabbit_exchange:declare that does not require
%% the exchange type registry or worker pool to be running by dint of
%% not validating anything and assuming the exchange type does not
Expand All @@ -537,7 +532,3 @@ create(Tab, TabDef, SecondaryIndices) ->
declare_exchange(XName, Type) ->
X = {exchange, XName, Type, true, false, false, []},
ok = mnesia:dirty_write(rabbit_durable_exchange, X).

add_indices(Tab, FieldList) ->
[mnesia:add_table_index(Tab, Field) || Field <- FieldList],
ok.

0 comments on commit a5cdde1

Please sign in to comment.