diff options
| author | Matthew Sackman <matthew@lshift.net> | 2009-08-21 17:22:50 +0100 |
|---|---|---|
| committer | Matthew Sackman <matthew@lshift.net> | 2009-08-21 17:22:50 +0100 |
| commit | e9f81f2abcfa4c51410904bf9b01f1c5d5f9dd77 (patch) | |
| tree | 60ee1c478b8847f4a431d89e3d6d55133ec0941f /src | |
| parent | e2d596b7f4fae2cd3180ff608d23048a9621ed31 (diff) | |
| download | rabbitmq-server-git-e9f81f2abcfa4c51410904bf9b01f1c5d5f9dd77.tar.gz | |
oops. Need to support ram nodes which still have local content as disc_copies
Diffstat (limited to 'src')
| -rw-r--r-- | src/rabbit_mnesia.erl | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl index 223a552336..348b1e7154 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, disc_copies), + ok = create_local_table_copy(schema, false, disc_copies), ok = create_local_table_copies(case IsDiskNode of true -> disc; false -> ram @@ -344,6 +344,12 @@ table_has_copy_type(TabDef, DiscType) -> {value, {DiscType, List}} -> lists:member(node(), List) end. +is_local_content_table(TabDef) -> + case lists:keysearch(local_content, 1, TabDef) of + false -> false; + {value, {local_content, Bool}} -> Bool + end. + create_local_table_copies(Type) -> lists:foreach( fun({Tab, TabDef}) -> @@ -367,18 +373,20 @@ create_local_table_copies(Type) -> ram -> ram_copies end, - ok = create_local_table_copy(Tab, StorageType) + IsLocalTab = is_local_content_table(TabDef), + ok = create_local_table_copy(Tab, IsLocalTab, StorageType) end, table_definitions()), ok. -create_local_table_copy(Tab, Type) -> +create_local_table_copy(Tab, IsLocal, Type) -> StorageType = mnesia:table_info(Tab, storage_type), {atomic, ok} = if StorageType == unknown -> mnesia:add_table_copy(Tab, node(), Type); - StorageType /= Type -> + StorageType /= Type andalso + ((not IsLocal) orelse (Type /= ram_copies))-> mnesia:change_table_copy_type(Tab, node(), Type); true -> {atomic, ok} end, |
