diff options
author | Dan Gudmundsson <[email protected]> | 2014-11-26 11:10:13 +0100 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2014-11-26 11:10:13 +0100 |
commit | 3fe044dec08ccca9469c5d8b8bec1892072212f0 (patch) | |
tree | aee49993eac86ecfb81fc2ab00650c63d17ce6bf | |
parent | 748de459e6e3ff5cf574eb0d4be126aa2e529206 (diff) | |
parent | dff52d0b26869caab886c82f71f0b11cbcdd33b1 (diff) | |
download | otp-3fe044dec08ccca9469c5d8b8bec1892072212f0.tar.gz otp-3fe044dec08ccca9469c5d8b8bec1892072212f0.tar.bz2 otp-3fe044dec08ccca9469c5d8b8bec1892072212f0.zip |
Merge branch 'dgud/mnesia/match_object_bug/OTP-12304' into maint
* dgud/mnesia/match_object_bug/OTP-12304:
mnesia: Fix match_object bug
-rw-r--r-- | lib/mnesia/src/mnesia.erl | 6 | ||||
-rw-r--r-- | lib/mnesia/src/mnesia_subscr.erl | 2 | ||||
-rw-r--r-- | lib/mnesia/test/mnesia_isolation_test.erl | 4 |
3 files changed, 8 insertions, 4 deletions
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 diff --git a/lib/mnesia/test/mnesia_isolation_test.erl b/lib/mnesia/test/mnesia_isolation_test.erl index d57f976d1f..8468472cf2 100644 --- a/lib/mnesia/test/mnesia_isolation_test.erl +++ b/lib/mnesia/test/mnesia_isolation_test.erl @@ -1584,7 +1584,8 @@ write_shadows(Config) when is_list(Config) -> ?match([RecA2], mnesia:read({Tab, a})), ?match([RecA2], mnesia:wread({Tab, a})), - ?match([RecA2], mnesia:match_object(PatA2)), %% delete shadow old but not new write - is the new value visable + ?match([], mnesia:match_object(PatA1)), %% delete shadow old but not new write + ?match([RecA2], mnesia:match_object(PatA2)), %% is the new value visable ?match([a], mnesia:all_keys(Tab)), ?match([RecA2], mnesia:index_match_object(PatA2, ValPos)), @@ -1643,6 +1644,7 @@ delete_shadows(Config) when is_list(Config) -> ?match([RecA2], mnesia:read({Tab, a})), ?match([RecA2], mnesia:wread({Tab, a})), + ?match([], mnesia:match_object(PatA1)), ?match([RecA2], mnesia:match_object(PatA2)), ?match([a], mnesia:all_keys(Tab)), ?match([RecA2], mnesia:index_match_object(PatA2, ValPos)), |