aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/src
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2016-10-07 09:58:03 +0200
committerDan Gudmundsson <[email protected]>2016-10-07 09:58:03 +0200
commit2110e59e971af2f114eba36b04f36dc6b25a443d (patch)
tree06019f9ca3ccc63f8caea271af8a5204e9db8416 /lib/mnesia/src
parent217bec24c9d369c1bfc14584270ffc90efe5f40c (diff)
parent1b4969db6ca0062f629f58c8d3838bcca1ab326b (diff)
downloadotp-2110e59e971af2f114eba36b04f36dc6b25a443d.tar.gz
otp-2110e59e971af2f114eba36b04f36dc6b25a443d.tar.bz2
otp-2110e59e971af2f114eba36b04f36dc6b25a443d.zip
Merge branch 'dgud/mnesia/dirty_select_cont/PR-1184/OTP-13944' into maint
* dgud/mnesia/dirty_select_cont/PR-1184/OTP-13944: Allow reusing mnesia select continuations
Diffstat (limited to 'lib/mnesia/src')
-rw-r--r--lib/mnesia/src/mnesia.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/mnesia/src/mnesia.erl b/lib/mnesia/src/mnesia.erl
index 9586adbf93..5bf2fc2dc3 100644
--- a/lib/mnesia/src/mnesia.erl
+++ b/lib/mnesia/src/mnesia.erl
@@ -1409,8 +1409,14 @@ select_cont(Tid,_,State=#mnesia_select{tid=Tid,written=[]}) ->
select_state(dirty_sel_cont(State),State);
select_cont(Tid,_Ts,State=#mnesia_select{tid=Tid}) ->
trans_select(dirty_sel_cont(State), State);
-select_cont(_Tid2,_,#mnesia_select{tid=_Tid1}) -> % Missmatching tids
+select_cont(Tid2,_,#mnesia_select{tid=_Tid1})
+ when element(1,Tid2) == tid -> % Mismatching tids
abort(wrong_transaction);
+select_cont(Tid,Ts,State=#mnesia_select{}) ->
+ % Repair mismatching tids in non-transactional contexts
+ RepairedState = State#mnesia_select{tid = Tid, written = [],
+ spec = undefined, type = undefined},
+ select_cont(Tid,Ts,RepairedState);
select_cont(_,_,Cont) ->
abort({badarg, Cont}).