diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-06-24 12:35:04 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-06-24 12:35:04 +0100 |
| commit | cb6cc18ed1abda641025bfb5ff5eba907f99bac2 (patch) | |
| tree | 872b246d5becdb25e58d71f93164d7abbd6dfdf4 /src | |
| parent | 3b867a0119b14e84b6edb65dadaa54349c2cded3 (diff) | |
| parent | 583511797127748468d289dcce26d055b6d849dc (diff) | |
| download | rabbitmq-server-git-cb6cc18ed1abda641025bfb5ff5eba907f99bac2.tar.gz | |
merging in from 19662
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_misc.erl | 2 | ||||
| -rw-r--r-- | src/rabbit_mnesia.erl | 33 |
2 files changed, 22 insertions, 13 deletions
diff --git a/src/rabbit_misc.erl b/src/rabbit_misc.erl index f38ee63155..2971e33265 100644 --- a/src/rabbit_misc.erl +++ b/src/rabbit_misc.erl @@ -409,7 +409,7 @@ format_stderr(Fmt, Args) -> manage_applications(Iterate, Do, Undo, SkipError, ErrorTag, Apps) -> Iterate(fun (App, Acc) -> case Do(App) of - ok -> timer:sleep(100), [App | Acc]; + ok -> [App | Acc]; {error, {SkipError, _}} -> Acc; {error, Reason} -> lists:foreach(Undo, Acc), diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index 6c583cb47b..0201017c0b 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -158,12 +158,14 @@ 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()]. -replicated_table_names() -> - [Tab || {Tab, _} <- replicated_table_definitions()]. - dir() -> mnesia:system_info(directory). ensure_mnesia_dir() -> @@ -189,7 +191,7 @@ ensure_mnesia_not_running() -> check_schema_integrity() -> %%TODO: more thorough checks case catch [mnesia:table_info(Tab, version) - || Tab <- replicated_table_names()] of + || Tab <- table_names()] of {'EXIT', Reason} -> {error, Reason}; _ -> ok end. @@ -292,12 +294,13 @@ init_db(ClusterNodes) -> ok = create_schema() end; {ok, [_|_]} -> + TableCopyType = case IsDiskNode of + true -> disc; + false -> ram + end, + ok = create_local_non_replicated_table_copies(TableCopyType), ok = wait_for_tables(), - ok = create_local_table_copies( - case IsDiskNode of - true -> disc; - false -> ram - end); + ok = create_local_replicated_table_copies(TableCopyType); {error, Reason} -> %% one reason we may end up here is if we try to join %% nodes together that are currently running standalone or @@ -348,7 +351,13 @@ create_tables() -> table_definitions()), ok. -create_local_table_copies(Type) -> +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) -> ok = create_local_table_copy(schema, disc_copies), lists:foreach( fun({Tab, TabDef}) -> @@ -384,7 +393,7 @@ create_local_table_copies(Type) -> end, ok = create_local_table_copy(Tab, StorageType) end, - table_definitions()), + TableDefinitions), ok. create_local_table_copy(Tab, Type) -> @@ -402,7 +411,7 @@ create_local_table_copy(Tab, Type) -> wait_for_tables() -> case check_schema_integrity() of ok -> - case mnesia:wait_for_tables(replicated_table_names(), 30000) of + case mnesia:wait_for_tables(table_names(), 30000) of ok -> ok; {timeout, BadTabs} -> throw({error, {timeout_waiting_for_tables, BadTabs}}); |
