From dff52d0b26869caab886c82f71f0b11cbcdd33b1 Mon Sep 17 00:00:00 2001 From: Dan Gudmundsson Date: Wed, 12 Nov 2014 14:44:44 +0100 Subject: mnesia: Fix match_object bug match_object returned wrong objects when matching on non key fields and updates in the same transaction had been performed. --- lib/mnesia/src/mnesia.erl | 6 ++++-- lib/mnesia/src/mnesia_subscr.erl | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'lib/mnesia/src') diff --git a/lib/mnesia/src/mnesia.erl b/lib/mnesia/src/mnesia.erl index b7d80c1370..8f14831ad3 100644 --- a/lib/mnesia/src/mnesia.erl +++ b/lib/mnesia/src/mnesia.erl @@ -1140,10 +1140,12 @@ match_object(_Tid, _Ts, Tab, Pat, _LockKind) -> add_written_match(S, Pat, Tab, Objs) -> Ops = find_ops(S, Tab, Pat), - add_match(Ops, Objs, val({Tab, setorbag})). + FixedRes = add_match(Ops, Objs, val({Tab, setorbag})), + MS = ets:match_spec_compile([{Pat, [], ['$_']}]), + ets:match_spec_run(FixedRes, MS). find_ops(S, Tab, Pat) -> - GetWritten = [{{{Tab, '_'}, Pat, write}, [], ['$_']}, + GetWritten = [{{{Tab, '_'}, '_', write}, [], ['$_']}, {{{Tab, '_'}, '_', delete}, [], ['$_']}, {{{Tab, '_'}, Pat, delete_object}, [], ['$_']}], ets:select(S, GetWritten). diff --git a/lib/mnesia/src/mnesia_subscr.erl b/lib/mnesia/src/mnesia_subscr.erl index 9272211ad2..866a57e370 100644 --- a/lib/mnesia/src/mnesia_subscr.erl +++ b/lib/mnesia/src/mnesia_subscr.erl @@ -225,7 +225,7 @@ call(Msg) -> Res = gen_server:call(Pid, Msg, infinity), %% We get an exit signal if server dies receive - {'EXIT', _Pid, _Reason} -> + {'EXIT', Pid, _Reason} -> {error, {node_not_running, node()}} after 0 -> Res -- cgit v1.2.3