diff options
author | Fredrik Gustafsson <[email protected]> | 2013-05-17 10:03:54 +0200 |
---|---|---|
committer | Fredrik Gustafsson <[email protected]> | 2013-05-17 10:03:54 +0200 |
commit | 69bce6a2c7593098cdf2cf215cde187e8c437a54 (patch) | |
tree | 9b03830f6653dc55ed0ab58ea03410504c49ba9a /lib/mnesia | |
parent | 47f64512f8cc307f31ea06a0a7049370ba232eff (diff) | |
parent | a70d09b6e611771b467a91c7ebeca1e14390553a (diff) | |
download | otp-69bce6a2c7593098cdf2cf215cde187e8c437a54.tar.gz otp-69bce6a2c7593098cdf2cf215cde187e8c437a54.tar.bz2 otp-69bce6a2c7593098cdf2cf215cde187e8c437a54.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/mnesia')
-rw-r--r-- | lib/mnesia/src/mnesia_index.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/mnesia/src/mnesia_index.erl b/lib/mnesia/src/mnesia_index.erl index f9f3ce2ea4..6f9f575d93 100644 --- a/lib/mnesia/src/mnesia_index.erl +++ b/lib/mnesia/src/mnesia_index.erl @@ -301,7 +301,13 @@ make_ram_index(Tab, [Pos | Tail]) -> add_ram_index(Tab, Pos) when is_integer(Pos) -> verbose("Creating index for ~w ~n", [Tab]), - Index = mnesia_monitor:mktab(mnesia_index, [bag, public]), + SetOrBag = val({Tab, setorbag}), + IndexType = case SetOrBag of + set -> duplicate_bag; + ordered_set -> duplicate_bag; + bag -> bag + end, + Index = mnesia_monitor:mktab(mnesia_index, [IndexType, public]), Insert = fun(Rec, _Acc) -> true = ?ets_insert(Index, {element(Pos, Rec), element(2, Rec)}) end, @@ -309,7 +315,7 @@ add_ram_index(Tab, Pos) when is_integer(Pos) -> true = ets:foldl(Insert, true, Tab), mnesia_lib:db_fixtable(ram_copies, Tab, false), mnesia_lib:set({Tab, {index, Pos}}, Index), - add_index_info(Tab, val({Tab, setorbag}), {Pos, {ram, Index}}); + add_index_info(Tab, SetOrBag, {Pos, {ram, Index}}); add_ram_index(_Tab, snmp) -> ok. |