summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Sackman <matthew@lshift.net>2009-08-21 17:22:50 +0100
committerMatthew Sackman <matthew@lshift.net>2009-08-21 17:22:50 +0100
commita98f2d1fb06c64aac821a4ca4ae950f08294d4c0 (patch)
tree60ee1c478b8847f4a431d89e3d6d55133ec0941f
parentc94c32642ed6ab7d8da216f463ee244704c2fa5b (diff)
downloadrabbitmq-server-a98f2d1fb06c64aac821a4ca4ae950f08294d4c0.tar.gz
oops. Need to support ram nodes which still have local content as disc_copies
-rw-r--r--src/rabbit_mnesia.erl16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/rabbit_mnesia.erl b/src/rabbit_mnesia.erl
index 223a5523..348b1e71 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,