aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mnesia/test/mnesia_trans_access_test.erl
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2011-12-06 15:47:54 +0100
committerDan Gudmundsson <[email protected]>2011-12-06 15:49:52 +0100
commit8bce2d5a342bda12aad6607312e3796a37d7c8eb (patch)
tree7779d955032416e1af00c968907030c9cb967277 /lib/mnesia/test/mnesia_trans_access_test.erl
parente166ed9661944a951ca0a2828d04e7141414dfa1 (diff)
downloadotp-8bce2d5a342bda12aad6607312e3796a37d7c8eb.tar.gz
otp-8bce2d5a342bda12aad6607312e3796a37d7c8eb.tar.bz2
otp-8bce2d5a342bda12aad6607312e3796a37d7c8eb.zip
[mnesia] Fixed sticky read lock bug
wread on locks stuck at non-local node could return unexpected value. Thanks to Magnus Henoch who posted a nice testcase showing the bug.
Diffstat (limited to 'lib/mnesia/test/mnesia_trans_access_test.erl')
-rw-r--r--lib/mnesia/test/mnesia_trans_access_test.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/mnesia/test/mnesia_trans_access_test.erl b/lib/mnesia/test/mnesia_trans_access_test.erl
index f826d7fb34..c040d0ca3f 100644
--- a/lib/mnesia/test/mnesia_trans_access_test.erl
+++ b/lib/mnesia/test/mnesia_trans_access_test.erl
@@ -132,9 +132,9 @@ read(Config) when is_list(Config) ->
wread(suite) -> [];
wread(Config) when is_list(Config) ->
- [Node1] = Nodes = ?acquire_nodes(1, Config),
+ [_N1,N2] = Nodes = ?acquire_nodes(2, Config),
Tab = wread,
- Schema = [{name, Tab}, {type, set}, {attributes, [k, v]}, {ram_copies, [Node1]}],
+ Schema = [{name, Tab}, {type, set}, {attributes, [k, v]}, {ram_copies, Nodes}],
?match({atomic, ok}, mnesia:create_table(Schema)),
OneRec = {Tab, 1, 2},
@@ -159,6 +159,11 @@ wread(Config) when is_list(Config) ->
mnesia:transaction(fun() -> mnesia:wread({Tab, 1}) end)),
?match({'EXIT', {aborted, no_transaction}}, mnesia:wread({Tab, 1})),
+
+ ?match({atomic, ok},
+ mnesia:transaction(fun() -> mnesia:write(Tab, {Tab, 42, a}, sticky_write) end)),
+ ?match({atomic, [{Tab,42, a}]},
+ rpc:call(N2, mnesia, transaction, [fun() -> mnesia:wread({Tab, 42}) end])),
?verify_mnesia(Nodes, []).
%% Delete record