[erlang-questions] {aborted,nomore} from mnesia

Park, Sungjin jinni.park@REDACTED
Wed Jul 17 11:06:10 CEST 2013


Following is my code to use mnesia and I get {aborted,nomore} sometimes.
What would be the reason?

up(Name, Module) ->

  Pid = self(),

  Route = #?MODULE{name=Name, addr=Pid, module=Module},

  F = fun() ->

    case mnesia:wread({?MODULE, Name}) of

      [#?MODULE{name=Name, addr=Pid, module=Module}] ->

        ok;

      [#?MODULE{name=Name, addr=undefined, module=Module}] ->

        mnesia:write(Route);

      [#?MODULE{name=Name, addr=Addr, module=Module}] ->

        exit(Addr, kill),

        mnesia:write(Route);

      [#?MODULE{name=Name}] ->

        {error, collision};

      [] ->

        mnesia:write(Route);

      Error ->

        {error, Error}

    end

  end,

  case mnesia:transaction(F, ?MNESIA_TRANSACTION) of

    {atomic, Result} -> Result;

    Aborted -> Aborted

  end.

-- 
Park, Sungjin
-------------------------------------------------------------------------------------------------------------------
Peculiar travel suggestions are dancing lessons from god.
  -- The Books of Bokonon
-------------------------------------------------------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20130717/d4f6f8d2/attachment.htm>


More information about the erlang-questions mailing list