diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-08-21 19:01:28 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-08-21 19:01:28 +0100 |
| commit | 08b05fae992823443d75fb8fd2eb1ddf88c4aeb3 (patch) | |
| tree | c90c0a0fb4787507b20284ecd452690ab581ac02 /src | |
| parent | 0312c469939bfa25647ddae1f5210f609b7a3dd7 (diff) | |
| parent | abd83b7380fb66c59d38d489d5e5e096fd12b4b8 (diff) | |
| download | rabbitmq-server-git-08b05fae992823443d75fb8fd2eb1ddf88c4aeb3.tar.gz | |
merging in from bug 21444 with the vain hope that 21444 does not need further work!
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_mnesia.erl | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index b36bce78ff..dc3c9316e0 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -279,7 +279,7 @@ init_db(ClusterNodes) -> IsDiskNode = ClusterNodes == [] orelse lists:member(node(), ClusterNodes), ok = wait_for_replicated_tables(), - ok = create_local_table_copy(schema, false, disc_copies), + ok = create_local_table_copy(schema, false, undefined, disc_copies), ok = create_local_table_copies(case IsDiskNode of true -> disc; false -> ram @@ -351,38 +351,39 @@ create_local_table_copies(Type) -> fun({Tab, TabDef}) -> HasDiscCopies = table_has_copy_type(TabDef, disc_copies), HasDiscOnlyCopies = table_has_copy_type(TabDef, disc_only_copies), + LocalTab = is_local_content_table(TabDef), StorageType = - case Type of - disc -> + if + Type =:= disc orelse LocalTab -> if HasDiscCopies -> disc_copies; HasDiscOnlyCopies -> disc_only_copies; true -> ram_copies end; %% unused code - commented out to keep dialyzer happy -%% disc_only -> +%% Type =:= disc_only -> %% if %% HasDiscCopies or HasDiscOnlyCopies -> %% disc_only_copies; %% true -> ram_copies %% end; - ram -> + Type =:= ram -> ram_copies end, - IsLocalTab = is_local_content_table(TabDef), - ok = create_local_table_copy(Tab, IsLocalTab, StorageType) + ok = create_local_table_copy(Tab, TabDef, LocalTab, StorageType) end, table_definitions()), ok. -create_local_table_copy(Tab, IsLocal, Type) -> +create_local_table_copy(Tab, TabDef, LocalTab, Type) -> StorageType = mnesia:table_info(Tab, storage_type), {atomic, ok} = if StorageType == unknown -> mnesia:add_table_copy(Tab, node(), Type); - StorageType /= Type andalso - ((not IsLocal) orelse (Type /= ram_copies))-> + LocalTab andalso StorageType /= Type andalso Tab /= schema -> + mnesia:create_table(Tab, TabDef); + StorageType /= Type -> mnesia:change_table_copy_type(Tab, node(), Type); true -> {atomic, ok} end, |
