[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
LMDB: transactions across dbis, dbi lifetime
- To: openldap-technical@openldap.org
- Subject: LMDB: transactions across dbis, dbi lifetime
- From: Martin Lucina <martin@lucina.net>
- Date: Mon, 17 Feb 2014 18:03:36 +0100
- Content-disposition: inline
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/simple; d=lucina.net; s=dkim-201309; t=1392656616; bh=C2QJnF7ZZU4icNAiNdC67KQl5IpCEB63qlJtEmYsqno=; h=Date:From:To:Subject:From; b=EeMLBcXuTPeYVdljSEk7NqRLBnsh1bifXlGhvZk9xS3581YhLq7YRZIhhJY9ttBTG pFJ/QvA0MTcx97nimRz6qmSXWLEhEFnFA8ee+jvSdqIm+bl4qWlUeYcA0dPKs3jeGG fCgU9gRKRyDhwhX/u1DooWt7om46iJpJCTwaxVjk8PNKqBOhxLGj7mx+9cFDAznSYB WxP3w+9e7woGU8xK2iWyMRAaHZMiAi7Lz50LJPvsM+F8Ximle5fIw0V5WNPeWhEicG fL5mpOtgxcMjvPJpC3VPhWbrtkdOP0o+YjZNbQ7ljnXdCTbm1/i4oSyJ4JLbNzTtg1 1qQKlOedwYMwA==
- Mail-followup-to: openldap-technical@openldap.org
- User-agent: Mutt/1.5.21 (2010-09-15)
Hi,
I'm having trouble understanding the interaction between txns and dbis in
LMDB. Quoting from the docs for mdb_dbi_open():
The database handle will be private to the current transaction until
the transaction is successfully committed. If the transaction is
aborted the handle will be closed automatically.
After a successful commit the handle will reside in the shared
environment, and may be used by other transactions. This function must
not be called from multiple concurrent transactions. A transaction that
uses this function must finish (either commit or abort) before any
other transaction may use this function.
1. Is it legal to:
a. begin a txn
b. open a bunch of dbis in that txn.
c. perform some operations (get/put) on distinct dbis.
d. commit the txn.
In other words, may a txn span multiple dbis?
2. AFTER the initial transaction in which mdb_dbi_open() was called has
been committed, can I freely use the dbi in subsequent transactions?
I.e. stash it away in a static variable?
3. Is the dbi still valid if a subsequent transaction on it is aborted with
mdb_txn_abort()? The first part of the quoted paragraph suggests not...?
I have tested at least points 1. and 2. above and "it seems to work" but
I'd like to verify that this is actually expected usage.
I've not particularly tested for point 3. but it would make programming to
the API rather hard if I had to reopen dbis whenever a higher level
operation fails.
Martin