summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2009-08-21 16:49:01 +0100
committerMatthew Sackman <matthew@lshift.net>2009-08-21 16:49:01 +0100
commitc94c32642ed6ab7d8da216f463ee244704c2fa5b (patch)
tree55a14e932f457fcc5b6edcc9af3f8be22864a7bd
parente850b8ec85dbc911477f91a64bc646ae8b6c9165 (diff)
downloadrabbitmq-server-c94c32642ed6ab7d8da216f463ee244704c2fa5b.tar.gz
Refactoring as suggested. This has been tested by for local_content by patching 21368 and ensuring clustering still works
-rw-r--r--src/rabbit_mnesia.erl24
1 files changed, 6 insertions, 18 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 6d652624..223a5523 100644
--- a/src/rabbit_mnesia.erl
+++ b/src/rabbit_mnesia.erl
@@ -151,11 +151,6 @@ replicated_table_definitions() ->
not lists:member({local_content, true}, Attrs)
].
-non_replicated_table_definitions() ->
- [{Tab, Attrs} || {Tab, Attrs} <- table_definitions(),
- lists:member({local_content, true}, Attrs)
- ].
-
table_names() ->
[Tab || {Tab, _} <- table_definitions()].
@@ -289,11 +284,10 @@ init_db(ClusterNodes) ->
lists:member(node(), ClusterNodes),
ok = wait_for_replicated_tables(),
ok = create_local_table_copy(schema, disc_copies),
- ok = create_local_non_replicated_table_copies(disc),
- ok = create_local_replicated_table_copies(case IsDiskNode of
- true -> disc;
- false -> ram
- end);
+ ok = create_local_table_copies(case IsDiskNode of
+ true -> disc;
+ false -> ram
+ end);
{error, Reason} ->
%% one reason we may end up here is if we try to join
%% nodes together that are currently running standalone or
@@ -350,13 +344,7 @@ table_has_copy_type(TabDef, DiscType) ->
{value, {DiscType, List}} -> lists:member(node(), List)
end.
-create_local_replicated_table_copies(Type) ->
- create_local_table_copies(Type, replicated_table_definitions()).
-
-create_local_non_replicated_table_copies(Type) ->
- create_local_table_copies(Type, non_replicated_table_definitions()).
-
-create_local_table_copies(Type, TableDefinitions) ->
+create_local_table_copies(Type) ->
lists:foreach(
fun({Tab, TabDef}) ->
HasDiscCopies = table_has_copy_type(TabDef, disc_copies),
@@ -381,7 +369,7 @@ create_local_table_copies(Type, TableDefinitions) ->
end,
ok = create_local_table_copy(Tab, StorageType)
end,
- TableDefinitions),
+ table_definitions()),
ok.
create_local_table_copy(Tab, Type) ->