[erlang-questions] mnesia:dirty_slot/2 returns [] for non-empty table?

Rick Pettit <>
Tue Apr 21 21:42:28 CEST 2009

I am maintaining yaws code which presents a user with a list of local
mnesia tables, presenting them with an HTML link for each table.

Upon clicking the link for a given table, the user is either presented
with a dump of the entire table (for "small" tables in which size <= 50),
or a dump of the first "slot" (i.e. slot 0).

This code has worked well for quite some time. Recently, however, someone
brought it to my attention that for a particular table the "slot 0"
display showed [] (even though the table was non-empty).

Here's some poking around I did at the shell:

  ()1> mnesia:table_info(test_tab,size).
  ()2> mnesia:dirty_slot(test_tab,0).
  ()3> mnesia:dirty_first(test_tab).
  ()4> ets:slot(test_tab,0).
  ()5> ets:first(test_tab).


I've just begun digging through the mnesia source code, so it is probably
a bit premature to ask, but does anyone have an idea why
mnesia:dirty_slot/2 might be returning [] in this case (i.e. where the
table is non-empty and where mnesia:dirty_first/1 returns a Key) ?


More information about the erlang-questions mailing list