[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Re: LMDB persistent snapshots
- To: Michael Conrad <mike@nrdvana.net>, openldap-technical@openldap.org
- Subject: Re: LMDB persistent snapshots
- From: Howard Chu <hyc@symas.com>
- Date: Mon, 10 Jul 2017 17:16:43 +0100
- In-reply-to: <WM!cfff94d2282f1e090337e3f2a1496006de74ea61a14a815ef630ddcb7a54ec58d22da0a5b7471703726b46a7c4d88c8d!@mailstronghold-2.zmailcloud.com>
- References: <51C7F61C-3F0D-4B32-B554-11C25E35831D@nrdvana.net> <WM!cfff94d2282f1e090337e3f2a1496006de74ea61a14a815ef630ddcb7a54ec58d22da0a5b7471703726b46a7c4d88c8d!@mailstronghold-2.zmailcloud.com>
- User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0 SeaMonkey/2.53a1
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.
--
-- Howard Chu
CTO, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc/
Chief Architect, OpenLDAP http://www.openldap.org/project/