Retrieving zero answers using mnemosyne
Tue Dec 21 21:12:21 CET 1999
On Tue, 21 Dec 1999, Sean Hinde wrote:
Sean> The solution I have tried is to use mnesia:dirty_first/1 in the transaction.
Sean> This actually works, but with goodness knows what potential side effects!
Sean> What happens if I put a write lock on the table then call
Sean> mnesia:dirty_first/1? Surely if nothing can write to the table then I am
Yes, it is safe to call mnesia:dirty* functions inside transactions.
Simultaneous dirty updates on the same records must as always be
synchronized somehow (e.g. by using Mnesia's locker).
But updating the table while your are iterating over it with
mnesia:dirty_first/1 and mnesia:dirty_next/2 may cause surprises. If
it is plain updates of existing records everything is fine, but if you
are inserting new records or deleting old ones, your updates may cause
the hash table may dynamically grow or shrink. As an effect of this,
your iteration may find too many or too few keys.
Sean> Also, I've done a bit more digging on the mnemosyne problem. My code hangs
Sean> in the line containing mnemosyne:next_answers(Cursor,1,1). Mnemosyne appears
Sean> to get into an infinite loop in mnemosyne_exec:pending/10 while it is
Sean> waiting for the answer which will never come.
Sean> The documentation is also a little vague as it states that "If less than
Sean> Nmin answers are returned; for example, 0, there are no more answers. If
Sean> enough answers are not available, but more are expected the functions wait
Sean> for them"
Sean> This seems to imply that if there are less than Nmin answers available we
Sean> will wait forever. As the minimum value for Nmin is 1, any time there are 0
Sean> answers available we wait.
I suspect that the bugfix I mentioned in my previous mail,
never was released...
More information about the erlang-questions