Skip to content

Commit d61bed2

Browse files
committed
Merge branch 'maint'
2 parents 5042575 + 3057c09 commit d61bed2

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

lib/mnesia/src/mnesia_tm.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,7 +885,7 @@ execute_transaction(Fun, Args, Factor, Retries, Type) ->
885885
Reason = {aborted, {throw, Value}},
886886
return_abort(Fun, Args, Reason);
887887
error:Reason:ST ->
888-
check_exit(Fun, Args, Factor, Retries, Reason, ST, Type);
888+
check_exit(Fun, Args, Factor, Retries, {Reason, ST}, ST, Type);
889889
exit:{aborted, _R} = Reason:ST ->
890890
check_exit(Fun, Args, Factor, Retries, Reason, ST, Type);
891891
_:Reason:ST ->

lib/mnesia/test/mnesia_trans_access_test.erl

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
create_live_table_index_disc_only/1, del_table_index_ram/1,
4747
del_table_index_disc/1, del_table_index_disc_only/1,
4848
idx_schema_changes_ram/1, idx_schema_changes_disc/1,
49-
idx_schema_changes_disc_only/1]).
49+
idx_schema_changes_disc_only/1, stacktrace_return/1]).
5050

5151
-export([do_nested/1]).
5252

@@ -75,7 +75,7 @@ all() ->
7575
select_reverse_index, all_keys,
7676
transaction, transaction_counters,
7777
{group, nested_activities}, {group, index_tabs},
78-
{group, index_lifecycle}].
78+
{group, index_lifecycle}, stacktrace_return].
7979

8080
groups() ->
8181
[{nested_activities, [],
@@ -1620,3 +1620,27 @@ idx_schema_changes(Config, Storage) ->
16201620
?match([{Tab, 16, 66}], rpc:call(N1, mnesia, dirty_index_read, [Tab, 66, Idx])),
16211621

16221622
?verify_mnesia(Nodes, []).
1623+
1624+
%% Check return value of aborted mnesia:transaction/1
1625+
1626+
stacktrace_return(suite) -> [];
1627+
stacktrace_return(Config) ->
1628+
[_N] = ?acquire_nodes(1, Config),
1629+
Throw = fun() -> throw(test) end,
1630+
Exit = fun() -> exit(test) end,
1631+
Error = fun() -> error(test) end,
1632+
1633+
?match({aborted, {throw, test}}, mnesia:transaction(Throw)),
1634+
?match({aborted, test}, mnesia:transaction(Exit)),
1635+
?match({aborted, {test, [{?MODULE, _, _, _} | _]}}, mnesia:transaction(Error)),
1636+
1637+
Nested = fun(F) ->
1638+
fun() ->
1639+
{aborted, Reason} = mnesia:transaction(F),
1640+
mnesia:abort(Reason)
1641+
end
1642+
end,
1643+
1644+
?match({aborted, {throw, test}}, mnesia:transaction(Nested(Throw))),
1645+
?match({aborted, test}, mnesia:transaction(Nested(Exit))),
1646+
?match({aborted, {test, [{?MODULE, _, _, _} | _]}}, mnesia:transaction(Nested(Error))).

0 commit comments

Comments
 (0)