Mnesia odd behaviour - delete_object

Martin Bjorklund mbj@REDACTED
Tue Oct 30 13:50:22 CET 2001


I've got a funny mnesia situation.  The problem is delete_object
vs. delete.

I've got a simple 'set' table a:

  mnesia:create_table(a, []).

Add an object:

  mnesia:dirty_write({a, key, [1,2]}).

Now, I've got this fun:

   F1 = fun() -> 
            mnesia:write({a, key, [1]}),  % modify the one&only object
            [X] = mnesia:read({a, key}),  % read it
            mnesia:delete_object(X)       % delete the one&only object
        end.

After executing F1 within a transaction, my table still contains the
original object.  Since 'a' is a set, I'd think that the object would
be removed.

After executing F1 'async_dirty', the object is removed.


   F2 = fun() -> 
            mnesia:write({a, key, [1]}),  % modify the one&only object
            mnesia:delete({a, key})       % delete the one&only object
        end.

After executing F2 within a transaction, the object is removed.


Can someone explain this behaviour??


I've tested on mnesia 3.9.2 and 4.0.  It's probably not a bug, but I
cannot come up with a interpretation that feels consistent...



/martin



More information about the erlang-questions mailing list