diff options
| author | Michael Klishin <michael@clojurewerkz.org> | 2016-09-17 04:53:44 +0300 |
|---|---|---|
| committer | Michael Klishin <michael@clojurewerkz.org> | 2016-09-17 04:53:44 +0300 |
| commit | dde6d63c201782ea4ab1cde8013d1f20898909ca (patch) | |
| tree | ceb8cf420cac95688755fb3e54ddfeb296783424 | |
| parent | 0e60c60954378b4339ed77d1e5b71e07f0bac002 (diff) | |
| download | rabbitmq-server-git-dde6d63c201782ea4ab1cde8013d1f20898909ca.tar.gz | |
When setting up a node DB, create secondary indexes on queue tables
| -rw-r--r-- | src/rabbit_table.erl | 12 |
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 |
