Michael Conrad wrote:
Hi, I'm scoping out my options for databases that support snapshotting. From what I've read so far, this is a natural feature of LMDB,
Not really. The persistent state only records the 2 most recent transactions.
however all the documentation talks about making sure not to let read transactions linger around. What if I *want* to hold onto a read transaction long-term, hours or even months?
You should probably use the mdb_copy interface to just make a copy of that snapshot.
Also, I haven't yet seen a way for a new client to re-open the database as of the point in time of an existing transaction. Is this possible?
See above, only the 2 most recent transactions' metadata is preserved. So in general, no.
If I manage to do something like this, will the storage overhead be roughly equivalent to the quantity of changed data between the snapshot and the latest write? or will the overhead be more like the sum of all writes + overwrites that happened since the read transaction started? i.e. if a read transaction is held starting from t0, then data is written at t1, then overwritten at t2 can the blocks affected by t1 be reclaimed for a write at t3?
No. For any read transaction started at time t, only old pages up to t-2 can be reclaimed. Once they're all consumed, only new pages will be used, for as long as that txn stays open.
On 07/10/2017 12:16 PM, Howard Chu wrote:
Michael Conrad wrote:
Hi, I'm scoping out my options for databases that support snapshotting. From what I've read so far, this is a natural feature of LMDB,
Not really. The persistent state only records the 2 most recent transactions.
Hm, well so much for that idea ;-) But could you clarify what would happen in a scenario like:
Proc1: Begin Read Transaction t1 Proc2: Write Transaction t2 Proc2: Write transaction t3 Proc3: Begin Read Transaction t4 Proc2: Write Transaction t5 Proc2: Write Transaction t6
After those steps, are process 1 and process 3 still able to continue reading their data, and is all the data they see consistent with the state of the database at the time they began the transaction?
Thanks, -Mike
openldap-technical@openldap.org