diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-08-21 16:49:01 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-08-21 16:49:01 +0100 |
| commit | e2d596b7f4fae2cd3180ff608d23048a9621ed31 (patch) | |
| tree | 55a14e932f457fcc5b6edcc9af3f8be22864a7bd /src | |
| parent | e3c9e953242917e88dddfc8330a28722c7ee5f62 (diff) | |
| download | rabbitmq-server-git-e2d596b7f4fae2cd3180ff608d23048a9621ed31.tar.gz | |
Refactoring as suggested. This has been tested by for local_content by patching 21368 and ensuring clustering still works
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_mnesia.erl | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index 6d65262431..223a552336 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) -> |
