Mnesia odd behaviour - delete_object
Martin Bjorklund
mbj@REDACTED
Tue Oct 30 20:20:27 CET 2001
Dan Gudmundsson <dgud@REDACTED> wrote:
>
> Hi
>
> A explanation of the implementation, then you can argument about
> semantics :-)
>
> mnesia:delete_object({a, key, [1]}) deletes the object if
> and only if exactly that object exists in the database.
>
> So a mnesia:transaction(fun() -> mnesia:delete_object({a, key, [1]}) end)
> will not delete the object {a, key, [1,2]} since they are not the same.
>
> And since transactions doesn't directly operate on the tables, (not
> until the transaction commits), this happens.
>
> Thus when you over write the {a, key, [1]} in your transaction,
> you transaction view shows you the only record in the {a, key, [1]},
> and you delete that. This DELETES the WRITE operation you just did.
> And when the transaction commits, it tries to delete exactly the object
> {a, key, [1]} from table, which doesn't exist and you are left with
> you old value.
Yes, I understand that this is how it's implemented. The question is
whether this is by design or accident :) What do you say Hakan?
The more I think about it, the more I think the current behaviour is
wrong.
/martin
More information about the erlang-questions
mailing list