diff options
author | Dániel Szoboszlay <[email protected]> | 2016-10-06 10:20:41 +0200 |
---|---|---|
committer | Dániel Szoboszlay <[email protected]> | 2016-10-06 10:20:41 +0200 |
commit | 1b4969db6ca0062f629f58c8d3838bcca1ab326b (patch) | |
tree | 855c8ec971ac8f3cea36d90836048f71527c3d87 /lib/mnesia/test/mnesia_trans_access_test.erl | |
parent | dabc6644991a6e732dc4404433215d1333a0ea07 (diff) | |
download | otp-1b4969db6ca0062f629f58c8d3838bcca1ab326b.tar.gz otp-1b4969db6ca0062f629f58c8d3838bcca1ab326b.tar.bz2 otp-1b4969db6ca0062f629f58c8d3838bcca1ab326b.zip |
Allow reusing mnesia select continuations
A continuation returned by mnesia:select/[14] should be reusable in
different, non-transactional activities. Aborting with
wrong_transaction doesn't make sense in a dirty context.
Diffstat (limited to 'lib/mnesia/test/mnesia_trans_access_test.erl')
-rw-r--r-- | lib/mnesia/test/mnesia_trans_access_test.erl | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/mnesia/test/mnesia_trans_access_test.erl b/lib/mnesia/test/mnesia_trans_access_test.erl index aa50ee4cb1..4ed73ea859 100644 --- a/lib/mnesia/test/mnesia_trans_access_test.erl +++ b/lib/mnesia/test/mnesia_trans_access_test.erl @@ -307,6 +307,7 @@ select14(Config) when is_list(Config) -> %% Some Helpers Trans = fun(Fun) -> mnesia:transaction(Fun) end, + Dirty = fun(Fun) -> mnesia:async_dirty(Fun) end, LoopHelp = fun('$end_of_table',_) -> []; ({Recs,Cont},Fun) -> Sel = mnesia:select(Cont), @@ -334,8 +335,13 @@ select14(Config) when is_list(Config) -> ?match({atomic, [OneRec]}, Trans(fun() -> Loop(Tab, OnePat) end)), ?match({atomic, All}, Trans(fun() -> Loop(Tab, AllPat) end)), - {atomic,{_, Cont}} = Trans(fun() -> mnesia:select(Tab, OnePat, 1, read) end), - ?match({aborted, wrong_transaction}, Trans(fun() -> mnesia:select(Cont) end)), + {atomic,{_, ContOne}} = Trans(fun() -> mnesia:select(Tab, OnePat, 1, read) end), + ?match({aborted, wrong_transaction}, Trans(fun() -> mnesia:select(ContOne) end)), + ?match('$end_of_table', Dirty(fun() -> mnesia:select(ContOne) end)), + + {atomic,{_, ContAll}} = Trans(fun() -> mnesia:select(Tab, AllPat, 1, read) end), + ?match({aborted, wrong_transaction}, Trans(fun() -> mnesia:select(ContAll) end)), + ?match({[_], _}, Dirty(fun() -> mnesia:select(ContAll) end)), ?match({aborted, _}, Trans(fun() -> mnesia:select(Tab, {match, '$1', 2},1,read) end)), ?match({aborted, _}, Trans(fun() -> mnesia:select(Tab, [{'_', [], '$1'}],1,read) end)), |