diff options
author | Matthew Sackman <matthew@lshift.net> | 2009-08-21 18:57:22 +0100 |
---|---|---|
committer | Matthew Sackman <matthew@lshift.net> | 2009-08-21 18:57:22 +0100 |
commit | fcc85d2adfe47a717b447193206ff65d49322f62 (patch) | |
tree | cd21f4e416dc7e323505ab00594458404b06c973 | |
parent | a98f2d1fb06c64aac821a4ca4ae950f08294d4c0 (diff) | |
download | rabbitmq-server-fcc85d2adfe47a717b447193206ff65d49322f62.tar.gz |
And another go. If the new node is a ram node then local_content tables are still honoured as to their own table storage type
-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 348b1e71..dedcf85c 100644 --- a/src/rabbit_mnesia.erl +++ b/src/rabbit_mnesia.erl @@ -283,7 +283,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 @@ -355,38 +355,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, |