summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rabbit_table.erl12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/rabbit_table.erl b/src/rabbit_table.erl
index 3909096964..1bb19b23da 100644
--- a/src/rabbit_table.erl
+++ b/src/rabbit_table.erl
@@ -50,8 +50,20 @@ create() ->
Tab, TabDef1, Reason}})
end
end, definitions()),
+ ensure_secondary_indexes(),
ok.
+%% Sets up secondary indexes in a blank node database.
+ensure_secondary_indexes() ->
+ ensure_secondary_index(rabbit_queue, vhost),
+ ok.
+
+ensure_secondary_index(Table, Field) ->
+ case mnesia:add_table_index(Table, Field) of
+ {atomic, ok} -> ok;
+ {aborted, {already_exists, Table, _}} -> ok
+ end.
+
%% The sequence in which we delete the schema and then the other
%% tables is important: if we delete the schema first when moving to
%% RAM mnesia will loudly complain since it doesn't make much sense to