[erlang-questions] mnesia question

Vance Shipley <>
Sat Nov 22 15:29:33 CET 2008


On Sat, Nov 22, 2008 at 12:28:03AM +0000, Linan Wang wrote:
}  I found one strange thing that the last inserted row would lost
}  if not referenced after restart.

The problem is with the use of a sticky write lock:
}              mnesia:transaction(fun()->
}                      mnesia:s_write(#oid{name = task, id = 0})
}                  end),

If you change this to not use a sticky write lock it works as you
expect:

   mnesia:transaction(fun()-> mnesia:write(#oid{name = task, id = 0}) end),

I can't help but offer the advice given in Erlang Programming
Rules section 3.8:  Don't optimize code.

	http://www.erlang.se/doc/programming_rules.shtml#HDR6

	-Vance



More information about the erlang-questions mailing list