Good evening from Germany.
The LMDB "Caveats" documentation mentions:
Avoid suspending a process with active transactions. These would then be "long-lived" as above. Also read transactions suspended when writers commit could sometimes see wrong data.
Questions:
- What does "wrong data" mean? What guarantees are broken?
Is potentially undefined behaviour ("read returns junk"), or isolation weakening ("transaction reads value actually written after the transaction started"), or something else?
- If I do find myself in that unfortunate situation, how screwed am I?
For example, say someone spelled SIGSTP wrong, and suspended my program with an uncatchable SIGSTOP instead, and so I could not wait for transactions to complete before being suspended. My program simply catches a SIGCONT, with transactions in flight. What can it do to maintain correctness?
Guidance kindly appreciated.
-- Antti
Antti K wrote:
Good evening from Germany.
The LMDB "Caveats" documentation mentions:
Avoid suspending a process with active transactions. These would then be "long-lived" as above. Also read transactions suspended when writers commit could sometimes see wrong data.
Questions:
What does "wrong data" mean? What guarantees are broken?
Is potentially undefined behaviour ("read returns junk"),
Yes.
or isolation weakening ("transaction reads value actually written after the transaction started"),
No.
or something else?
If I do find myself in that unfortunate situation, how screwed am I?
For example, say someone spelled SIGSTP wrong, and suspended my program with an uncatchable SIGSTOP instead, and so I could not wait for transactions to complete before being suspended. My program simply catches a SIGCONT, with transactions in flight. What can it do to maintain correctness?
Nothing. The severity is unpredictable, but it will be worse the more write txns commit while the reader is suspended.
Note that the window of opportunity for this problem is tiny - the process must actually be suspended while running the txn_begin() function. Once the txn_begin returns, the reader is completely safe. Chances of any real programs running into this problem are quite small.
Guidance kindly appreciated.
-- Antti
openldap-technical@openldap.org