[erlang-questions] QLC Cursor confusion
Jachym Holecek
freza@REDACTED
Wed Feb 22 16:13:51 CET 2012
# Ignas Vyšniauskas 2012-02-22:
> I'm confused. Does that mean the cursor lives in some process owned by
> mnesia and I can only access it from within a single transaction? What
> am I doing wrong here?
You're violating Mnesia activity semantics -- first trying to manipulate
something that is transaction sensitive outside transaction context, or
in next try doing that from the context of different transaction.
It could work (but no promises) to obtain the query handle inside dirty
(sync_dirty, async_dirty or ets -- they all assume you know what you're
doing!) activity context instead. The API is mnesia:activity/N. Even
better perhaps: execute your whole query inside activity context of
your choice.
Hmm, this is perhaps a bit confusing initially: all Mnesia APIs assume
they're executing inside activity context you've set up for them using
the above function or its older friends, mnesia:transaction/N. The APIs
beginning with 'dirty_' prefix are also older interfaces, you can think
they do the mnesia:activity/N dance for you internally (they may not
really do that, and there may be more exceptions besides dirty_*, but
you get the point).
HTH,
-- Jachym
More information about the erlang-questions
mailing list