diff options
author | Dan Gudmundsson <[email protected]> | 2018-08-13 15:24:03 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2018-08-13 15:25:25 +0200 |
commit | 4fc61aa178faa80290356a63d8e38d93697b9669 (patch) | |
tree | f98854f6e215a760fbe2040451dd16d019485831 /lib/mnesia/src | |
parent | 8442906fca8f52757e473e82c72c9b04d98ad996 (diff) | |
parent | e052249e6ce4da0c6a022bb8da0186cd678e1054 (diff) | |
download | otp-4fc61aa178faa80290356a63d8e38d93697b9669.tar.gz otp-4fc61aa178faa80290356a63d8e38d93697b9669.tar.bz2 otp-4fc61aa178faa80290356a63d8e38d93697b9669.zip |
Merge remote-tracking branch 'upstream/pr/1858' into maint
* upstream/pr/1858:
Fix delete_object and write convergence in transaction.
OTP-15231
Diffstat (limited to 'lib/mnesia/src')
-rw-r--r-- | lib/mnesia/src/mnesia.erl | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/lib/mnesia/src/mnesia.erl b/lib/mnesia/src/mnesia.erl index 62202401ed..223dba3f90 100644 --- a/lib/mnesia/src/mnesia.erl +++ b/lib/mnesia/src/mnesia.erl @@ -783,12 +783,16 @@ do_delete_object(Tid, Ts, Tab, Val, LockKind) -> ?ets_insert(Store, {Oid, Val, delete_object}); _ -> case ?ets_match_object(Store, {Oid, '_', write}) of - [] -> - ?ets_match_delete(Store, {Oid, Val, '_'}), - ?ets_insert(Store, {Oid, Val, delete_object}); - _ -> - ?ets_delete(Store, Oid), - ?ets_insert(Store, {Oid, Oid, delete}) + [] -> + ?ets_match_delete(Store, {Oid, Val, '_'}), + ?ets_insert(Store, {Oid, Val, delete_object}); + Ops -> + case lists:member({Oid, Val, write}, Ops) of + true -> + ?ets_delete(Store, Oid), + ?ets_insert(Store, {Oid, Oid, delete}); + false -> ok + end end end, ok; |