[erlang-questions] Some mnesia oddity
Chandru
chandrashekhar.mullaparthi@REDACTED
Fri Aug 29 13:02:12 CEST 2008
2008/8/29 Nicolas Thauvin <nthauvin@REDACTED>
> Hi folks,
>
> We found a strange mnesia behavior here...
>
> Some mnesia:write operations after a mnesia:delete_object seem to not have
> the expected result when executed in the same transaction.
>
> See attached example file:
> 1 - We fill a test_table
> 2 - In the same transaction, we read all records, delete them, and write
> them back (do not ask why :))
> 3 - Surprise! Only a subset of them can be read afterwards
>
> Same result in R11 and R12.
>
> It works if the delete_object and write operations are in separate
> transactions... But who knows what can happen between them...
>
>
According to the mnesia documentation, I don't think this is a valid
invocation of mnesia:delete_object/1 (though why it sort of works is a
mystery).
The following change to the fun makes it behave as you expect it to.
32c32,34
< ok = mnesia:delete_object(Wild_pattern),
---
> lists:foreach(fun(X) ->
> ok = mnesia:delete_object(X)
> end, Records),
cheers
Chandru
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080829/eb9cffbd/attachment.htm>
More information about the erlang-questions
mailing list