[erlang-questions] {aborted,nomore} from mnesia
Park, Sungjin
jinni.park@REDACTED
Wed Jul 17 12:58:43 CEST 2013
Great thanks!
On Wed, Jul 17, 2013 at 7:36 PM, Håkan Mattsson <hm@REDACTED> wrote:
> When Mnesia detects that your transaction have run into a potential
> deadlock, it may restart your transaction. By default there is no
> restart limit. But you have explicitly configured Mnesia to only allow
> a certain number of restarts. When that limit is reached, the
> transaction will be aborted with 'nomore' as reason.
>
> /Håkan
>
> On Wed, Jul 17, 2013 at 11:06 AM, Park, Sungjin <jinni.park@REDACTED>
> wrote:
> > 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
> >
> -------------------------------------------------------------------------------------------------------------------
> >
> > _______________________________________________
> > erlang-questions mailing list
> > erlang-questions@REDACTED
> > http://erlang.org/mailman/listinfo/erlang-questions
> >
>
--
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/5ade164f/attachment.htm>
More information about the erlang-questions
mailing list