pax_global_header00006660000000000000000000000064137222345650014523gustar00rootroot0000000000000052 comment=62a36e8b847ec7b87de918827a9029b64108f63e py-lmdb-py-lmdb_1.0.0/000077500000000000000000000000001372223456500145115ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/.github/000077500000000000000000000000001372223456500160515ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/.github/ISSUE_TEMPLATE.md000066400000000000000000000025211372223456500205560ustar00rootroot00000000000000Edit this issue template as appropriate. If none of it seems relevant to your issue, then you may delete the entire template, however, I may not respond to issues that do not include important information that is mentioned in this template! ### Affected Operating Systems * Linux * Windows * BSD * [Other] ### Affected py-lmdb Version e.g. "print lmdb.__version__" ### py-lmdb Installation Method e.g. sudo pip install lmdb ### Using bundled or distribution-provided LMDB library? Bundled ### Distribution name and LMDB library version Use "print lmdb.version()" from a Python prompt. ### Machine "free -m" output e.g. ``` total used free shared buffers cached Mem: 24154 23874 279 21 386 8175 -/+ buffers/cache: 15313 8840 Swap: 0 0 0 ``` ### Other important machine info Running under cgroups? Containers? Weird filesystems in use? Network filesystem? Patched kernel? ... ### Describe Your Problem XXXXX ### Errors/exceptions Encountered e.g. ``` Traceback (most recent call last): File "", line 1, in MemoryError ``` ### Describe What You Expected To Happen e.g. I expected the transaction to commit successfully. ### Describe What Happened Instead e.g. The Python process crashed. py-lmdb-py-lmdb_1.0.0/.gitignore000066400000000000000000000001561372223456500165030ustar00rootroot00000000000000MANIFEST __pycache__ build dist docs/_build ll.sh lmdb.egg-info lmdb/_config.py lo.sh old .tox/ tests/test.py py-lmdb-py-lmdb_1.0.0/.travis.yml000077500000000000000000000013071372223456500166260ustar00rootroot00000000000000--- language: python matrix: exclude: - python: pypy env: LMDB_FORCE_CPYTHON=1 - python: pypy env: LMDB_FORCE_CPYTHON=1 LMDB_PURE=1 - python: pypy3 env: LMDB_FORCE_CPYTHON=1 - python: pypy3 env: LMDB_FORCE_CPYTHON=1 LMDB_PURE=1 python: - 2.7 - 3.4 - 3.5 - 3.6 - 3.7 - 3.8 - 3.9-dev - pypy # - pypy3 # - nightly env: - LMDB_FORCE_CFFI=1 - LMDB_FORCE_CPYTHON=1 - LMDB_FORCE_CFFI=1 LMDB_PURE=1 - LMDB_FORCE_CPYTHON=1 LMDB_PURE=1 install: - sudo apt-get install gdb - pip install cffi - python setup.py develop before_script: - source misc/helpers.sh script: - > with_gdb python -m pytest tests notifications: email: false py-lmdb-py-lmdb_1.0.0/ChangeLog000066400000000000000000000342601372223456500162700ustar00rootroot000000000000002020-08-28 v1.0.0 * Start of new semantic versioning scheme. This would be a minor version bump from the 0.99 release if it were semantically versioned. * Allow environment copy to take a passed-in transaction. This is the first released feature that requires a (very small) patch to the underlying C library. By default, the patch will be applied unless this module is built with LMDB_PURE environment variable set. 2020-08-13 v0.99 * Fix lmdb.tool encoding issues. * Fix -l lmdb invocation issue. * Minor documentation improvements. * Update LMDB to version 0.9.24. * Update for Python 3.9 (current release candidate) support. * Resolve a bug when using cursor.putmulti and append=True on dupsort DBs. * Allow _Database.flags method to take no arguments since the one argument wasn't being used. 2019-11-06 v0.98 * Fix that a duplicate argument to a lmdb method would cause an assert. * Solaris needs ```#include "python.h"``` as soon as possible. Fix contributed by Jesús Cea. * Fix crash under debug cpython when mdb_cursor_open failed 2019-08-11 v0.97 * Fix a missed GIL unlock sequence. Reported by ajschorr. * Fix argv check in JEP (cpython under Java) environment. Contributed by de-code. 2019-07-14 v0.96 * First release under new maintainer, Nic Watson. * Doc updates. * More removal of code for now-unsupported Python versions. * Only preload the value with the GIL unlocked when the value is actually requested. This significantly improves read performance to retrieve keys with large values when the value isn't retrieved. Reported by Dan Patton. 2019-06-08 v0.95 * The minimum supported version of Python is now 2.7. * The library is no longer tested on Python 3.2. * The address-book.py example was updated for Python 3. Contributed by Jamie Bliss. * Development-related files were removed from the distribution tarball. * Handling of the Environment(create=True) flag was improved. Fix contributed by Nir Soffer. * Database names may be reused after they are dropped on CFFI, without reopening the environment. Fix contributed by Gareth Bult. 2018-04-09 v0.94 * CPython argument parsing now matches the behaviour of CFFI, and most sane Python APIs: a bool parameter is considered to be true if it is any truthy value, not just if it is exactly True. Reported by Nic Watson. * Removed Python 2.6 support due to urllib3 warnings and pytest dropping it. * Updared LMDB to version 0.9.22. * Fixed several 2.7/3 bugs in command line tool. 2017-07-16 v0.93 * py-lmdb is now built with AppVeyor CI, providing early feedback on Windows build health. Egg and wheel artifacts are being generated, removing the need for a dedicated Windows build machine, however there is no mechanism to paublish these to PyPI yet. * The "warm" tool command did not function on Python 3.x. Reported by Github user dev351. * Tests now pass on non-4kb page-sized machines, such as ppc64le. Reported by Jonathan J. Helmus. * Windows 3.6 eggs and wheels are now available on PyPI, and tests are run against 3.6. Reported by Ofek Lev. * Python 3.2 is no longer supported, due to yet more pointless breakage introduced in pip/pkg_resources. * py-lmdb currently does not support LMDB >=0.9.19 due to interface changes in LMDB. Support will appear in a future release. 2016-10-17 v0.92 * Changes to support __all__ caused the CPython module to fail to import at runtime on Python 3. This was hidden during testing as the CFFI module was successfully imported. 2016-10-17 v0.91 * The docstring for NotFoundError was clarified to indicate that it is not raised in normal circumstances. * CFFI open_db() would always attempt to use a write transaction, even if the environment was opened with readonly=True. Now both CPython and CFFI will use a read-only transaction in this case. Reported by Github user handloomweaver. * The source distribution previously did not include a LICENSE file, and may have included random cached junk from the source tree during build. Reported by Thomas Petazzoni. * Transaction.id() was broken on Python 2.5. * Repair Travis CI build again. * CFFI Cursor did not correctly return empty strings for key()/value()/item() when iternext()/iterprev() had reached the start/end of the database. Detected by tests contributed by Ong Teck Wu. * The package can now be imported from within a CPython subinterpreter. Fix contributed by Vitaly Repin. * lmdb.tool --delete would not delete keys in some circumstances. Fix contributed by Vitaly Repin. * Calls to Cursor.set_range_dup() could lead to memory corruption due to Cursor's idea of the key and value failing to be updated correctly. Reported by Michael Lazarev. * The lmdb.tool copy command now supports a --compact flag. Contributed by Achal Dave. * The lmdb.tool edit command selects the correct database when --delete is specified. Contributed by ispequalnp. * lmdb.tool correctly supports the -r flag to select a read-only environment. Contributed by ispequalnp. * The lmdb.tool --txn_size parameter was removed, as it was never implemented, and its original function is no longer necessary with modern LMDB. Reported by Achal Dave. * The documentation template was updated to fix broken links. Contributed by Adam Chainz. * The Travis CI build configuration was heavily refactored by Alexander Zhukov. Automated tests are running under Travis CI once more. * The CPython extension module did not define __all__. It is now defined contain the same names as on CFFI. * Both implementations were updated to remove lmdb.open() from __all__, ensuring "from lmdb import *" does not shadow the builtin open(). The function can still be invoked using its fully qualified name, and the alias "Environment" may be used when "from lmdb import *" is used. Reported by Alexander Zhukov. * The CPython extension exported BadRSlotError, instead of BadRslotError. The exception's name was corrected to match CFFI. * Environment.open_db() now supports integerdup=True, dupfixed=True, and integerkey=True flags. Based on a patch by Jonathan Heyman. 2016-07-11 v0.90 * This release was deleted from PyPI due to an erroneous pull request upgrading the bundled LMDB to mdb.master. 2016-02-12 v0.89 * LMDB 0.9.18 is bundled. * CPython Iterator.next() was incorrectly defined as pointing at the implementation for Cursor.next(), triggering a crash if the method was ever invoked manually. Reported by Kimikazu Kato. 2016-01-24 v0.88 * LMDB 0.9.17 is bundled. * Transaction.id() is exposed. * Binary wheels are built for Python 3.5 Windows 32/64-bit. 2015-08-11 v0.87 * Environment.set_mapsize() was added to allow runtime adjustment of the environment map size. * Remove non-determinism from setup.py, to support Debian's reproducible builds project. Patch by Chris Lamb. * Documentation correctness and typo fixes. Patch by Gustav Larsson. * examples/keystore: beginnings of example that integrates py-lmdb with an asynchronous IO loop. 2015-06-07 v0.86 * LMDB_FORCE_SYSTEM builds were broken by the GIL/page fault change. This release fixes the problem. * Various cosmetic fixes to documentation. 2015-06-06 v0.85 * New exception class: lmdb.BadDbiError. * Environment.copy() and Environment.copyfd() now support compact=True, to trigger database compaction while copying. * Various small documentation updates. * CPython set_range_dup() and set_key_dup() both invoked MDB_GET_BOTH, however set_range_dup() should have instead invoked MDB_GET_BOTH_RANGE. Fix by Matthew Battifarano. * lmdb.tool module was broken on Win32, since Win32 lacks signal.SIGWINCH. Fix suggested by David Khess. * LMDB 0.9.14 is bundled along with extra fixes from mdb.RE/0.9 (release engineering) branch. * CPython previously lacked a Cursor.close() method. Problem was noticed by Jos Vos. * Several memory leaks affecting the CFFI implementation when running on CPython were fixed, apparent only when repeatedly opening and discarding a large number of environments. Noticed by Jos Vos. * The CPython extension previously did not support weakrefs on Environment objects, and the implementation for Transaction objects was flawed. The extension now correctly invalidates weakrefs during deallocation. * Both variants now try to avoid taking page faults with the GIL held, accomplished by touching one byte of every page in a value during reads. This does not guarantee faults will never occur with the GIL held, but it drastically reduces the possibility. The binding should now be suitable for use in multi-threaded applications with databases containing >2KB values where the entire database does not fit in RAM. 2014-09-22 v0.84 * LMDB 0.9.14 is bundled. * CFFI Cursor.putmulti() could crash when append=False and a key already existed. 2014-06-24 v0.83 * LMDB 0.9.13 is bundled along with extra fixes from upstream Git. * Environment.__enter__() and __exit__() are implemented, allowing Environments to behave like context managers. * Cursor.close(), __enter__() and __exit__() are implemented, allowing Cursors to be explicitly closed. In CFFI this mechanism *must* be used when many cursors are used within a single transaction, otherwise a resource leak will occur. * Dependency tracking in CFFI is now much faster, especially on PyPy, however at a cost: Cursor use must always be wrapped in a context manager, or .close() must be manually invoked for discarded Cursors when the parent transaction is long lived. * Fixed crash in CFFI Cursor.putmulti(). 2014-05-26 v0.82 * Both variants now implement max_spare_txns, reducing the cost of creating a read-only transaction 4x for an uncontended database and by up to 20x for very read-busy environments. By default only 1 read-only transaction is cached, adjust max_spare_txns= parameter if your script operates multiple simultaneous read transactions. * Patch from Vladimir Vladimirov implementing MDB_NOLOCK. * The max_spare_iters and max_spare_cursors parameters were removed, neither ever had any effect. * Cursor.putmulti() implemented based on a patch from Luke Kenneth Casson Leighton. This function moves the loop required to batch populate a database out of Python and into C. * The bundled LMDB 0.9.11 has been updated with several fixes from upstream Git. * The cost of using keyword arguments in the CPython extension was significantly reduced. 2014-04-26 v0.81 * On Python 2.x the extension module would silently interpret Unicode instances as buffer objects, causing UCS-2/UCS-4 string data to end up in the database. This was never intentional and now raises TypeError. Any Unicode data passed to py-lmdb must explicitly be encoded with .encode() first. * open_db()'s name argument was renamed to key, and its semantics now match get() and put(): in other words the key must be a bytestring, and passing Unicode will raise TypeError. * The extension module now builds under Python 3.4 on Windows. 2014-04-21 v0.80 * Both variants now build successfully as 32 bit / 64bit binaries on Windows under Visual Studio 9.0, the compiler for Python 2.7. This enables py-lmdb to be installed via pip on Windows without requiring a compiler to be available. In future, .egg/.whl releases will be pre-built for all recent Python versions on Windows. Known bugs: Environment.copy() and Environment.copyfd() currently produce a database that cannot be reopened. * The lmdb.enable_drop_gil() function was removed. Its purpose was experimental at best, confusing at worst. 2014-03-17 v0.79 * CPython Cursor.delete() lacked dupdata argument, fixed. * Fixed minor bug where CFFI _get_cursor() did not note its idea of the current key and value were up to date. * Cursor.replace() and Cursor.pop() updated for MDB_DUPSORT databases. For pop(), the first data item is popped and returned. For replace(), the first data item is returned, and all duplicates for the key are replaced. * Implement remaining Cursor methods necessary for working with MDB_DUPSORT databases: next_dup(), next_nodup(), prev_dup(), prev_nodup(), first_dup(), last_dup(), set_key_dup(), set_range_dup(), iternext_dup(), iternext_nodup(), iterprev_dup(), iterprev_nodup(). * The default for Transaction.put(dupdata=...) and Cursor.put(dupdata=...) has changed from False to True. The previous default did not reflect LMDB's normal mode of operation. * LMDB 0.9.11 is bundled along with extra fixes from upstream Git. 2014-01-18 v0.78 * Patch from bra-fsn to fix LMDB_LIBDIR. * Various inaccurate documentation improvements. * Initial work towards Windows/Microsoft Visual C++ 9.0 build. * LMDB 0.9.11 is now bundled. * To work around install failures minimum CFFI version is now >=0.8.0. * ticket #38: remove all buffer object hacks. This results in ~50% slowdown for cursor enumeration, but results in far simpler object lifetimes. A future version may introduce a better mechanism for achieving the same performance without loss of sanity. 2013-11-30 v0.77 * Added Environment.max_key_size(), Environment.max_readers(). * CFFI now raises the correct Error subclass associated with an MDB_* return code. * Numerous CFFI vs. CPython behavioural inconsistencies have been fixed. * An endless variety of Unicode related 2.x/3.x/CPython/CFFI fixes were made. * LMDB 0.9.10 is now bundled, along with some extra fixes from Git. * Added Environment(meminit=...) option. 2013-10-28 v0.76 * Added support for Environment(..., readahead=False). * LMDB 0.9.9 is now bundled. * Many Python 2.5 and 3.x fixes were made. Future changes are automatically tested via Travis CI . * When multiple cursors exist, and one cursor performs a mutation, remaining cursors may have returned corrupt results via key(), value(), or item(). Mutations are now explicitly tracked and cause the cursor's data to be refreshed in this case. * setup.py was adjusted to ensure the distutils default of '-DNDEBUG' is never defined while building LMDB. This caused many important checks in the engine to be disabled. * The old 'transactionless' API was removed. A future version may support the same API, but the implementation will be different. * Transaction.pop() and Cursor.pop() helpers added, to complement Transaction.replace() and Cursor.replace(). py-lmdb-py-lmdb_1.0.0/LICENSE000066400000000000000000000042461372223456500155240ustar00rootroot00000000000000The OpenLDAP Public License Version 2.8, 17 August 2003 Redistribution and use of this software and associated documentation ("Software"), with or without modification, are permitted provided that the following conditions are met: 1. Redistributions in source form must retain copyright statements and notices, 2. Redistributions in binary form must reproduce applicable copyright statements and notices, this list of conditions, and the following disclaimer in the documentation and/or other materials provided with the distribution, and 3. Redistributions must contain a verbatim copy of this document. The OpenLDAP Foundation may revise this license from time to time. Each revision is distinguished by a version number. You may use this Software under terms of this license revision or under the terms of any subsequent revision of the license. THIS SOFTWARE IS PROVIDED BY THE OPENLDAP FOUNDATION AND ITS CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OPENLDAP FOUNDATION, ITS CONTRIBUTORS, OR THE AUTHOR(S) OR OWNER(S) OF THE SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. The names of the authors and copyright holders must not be used in advertising or otherwise to promote the sale, use or other dealing in this Software without specific, written prior permission. Title to copyright in this Software shall at all times remain with copyright holders. OpenLDAP is a registered trademark of the OpenLDAP Foundation. Copyright 1999-2003 The OpenLDAP Foundation, Redwood City, California, USA. All Rights Reserved. Permission to copy and distribute verbatim copies of this document is granted. py-lmdb-py-lmdb_1.0.0/MANIFEST.in000066400000000000000000000002061372223456500162450ustar00rootroot00000000000000graft docs graft examples graft lib graft lmdb graft tests include ChangeLog include LICENSE prune docs/_build prune lmdb/__pycache__ py-lmdb-py-lmdb_1.0.0/README.md000066400000000000000000000034211372223456500157700ustar00rootroot00000000000000This is a universal Python binding for the LMDB ‘Lightning’ Database. See [the documentation](https://lmdb.readthedocs.io) for more information. ### CI State | Platform | Branch | Status | | -------- | ------ | ------ | | UNIX | ``master`` | [![master](https://travis-ci.org/jnwatson/py-lmdb.png?branch=master)](https://travis-ci.org/jnwatson/py-lmdb/branches) | | Windows | ``master`` | [![master](https://ci.appveyor.com/api/projects/status/cx2sau39bufi3t0t/branch/master?svg=true)](https://ci.appveyor.com/project/NicWatson/py-lmdb/branch/master) | | UNIX | ``release`` | [![release](https://travis-ci.org/jnwatson/py-lmdb.png?branch=release)](https://travis-ci.org/jnwatson/py-lmdb/branches) | | Windows | ``release`` | [![release](https://ci.appveyor.com/api/projects/status/cx2sau39bufi3t0t/branch/release?svg=true)](https://ci.appveyor.com/project/NicWatson/py-lmdb/branch/release) | If you care whether the tests are passing, check out the repository and execute the tests under your desired target Python release, as the Travis CI build has a bad habit of breaking due to external factors approximately every 3 months. # Python Version Support Statement This project has been around for a while. Previously, it supported all the way back to before 2.5. Currently py-lmdb supports Python 2.7, Python >= 3.4, and pypy. Python 2.7 is now end-of-life. If you are still using Python 2.7, you should strongly considering porting to Python 3. That said, this project will continue to support running on Python 2.7 until Travis CI or Appveyor remove support for it. # Sponsored by The Vertex Project My current employer, [The Vertex Project](https://vertex.link/) is generously sponsoring my time to maintain py-lmdb. If you like open source and systems programming in Python, check us out. py-lmdb-py-lmdb_1.0.0/appveyor.yml000066400000000000000000000017761372223456500171140ustar00rootroot00000000000000environment: matrix: - PYTHON: 'C:\Python27' - PYTHON: 'C:\Python27-x64' - PYTHON: 'C:\Python34' - PYTHON: 'C:\Python35' - PYTHON: 'C:\Python35-x64' - PYTHON: 'C:\Python36' - PYTHON: 'C:\Python36-x64' - PYTHON: 'C:\Python37' - PYTHON: 'C:\Python37-x64' - PYTHON: 'C:\Python38' - PYTHON: 'C:\Python38-x64' artifacts: - { path: 'dist\*.egg', type: 'file' } - { path: 'dist\*.whl', type: 'file' } install: # http://springflex.blogspot.co.uk/2014/02/how-to-fix-valueerror-when-trying-to.html. Works for 33-x64 only. - 'COPY "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvarsamd64.bat"' - '%PYTHON%\scripts\pip.exe install wheel patch-ng' - '%PYTHON%\scripts\pip.exe install pytest .' build_script: - '%PYTHON%\python.exe setup.py bdist_egg' - '%PYTHON%\python.exe setup.py bdist_wheel' test_script: - 'cd tests' - '%PYTHON%\python.exe -m pytest .' py-lmdb-py-lmdb_1.0.0/docs/000077500000000000000000000000001372223456500154415ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/docs/Makefile000066400000000000000000000126641372223456500171120ustar00rootroot00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/lmdb.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/lmdb.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/lmdb" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/lmdb" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." py-lmdb-py-lmdb_1.0.0/docs/conf.py000066400000000000000000000210361372223456500167420ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # lmdb documentation build configuration file, created by # sphinx-quickstart on Tue Feb 5 00:39:26 2013. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. import sys, os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('..')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx'] intersphinx_mapping = {'python': ('http://docs.python.org/2.7', None)} # Add any paths that contain templates here, relative to this directory. # templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = u'lmdb' copyright = u'2013-2019 David Wilson, 2019-2020 Nic Watson' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # def grep_version(): path = os.path.join(os.path.dirname(__file__), '../lmdb/__init__.py') with open(path) as fp: for line in fp: if line.startswith('__version__'): return eval(line.split()[-1]) # The short X.Y version. version = grep_version() # The full version, including alpha/beta/rc tags. release = version # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. html_theme = 'acid' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. html_theme_options = { 'github_repo': 'https://github.com/jnwatson/py-lmdb/' } # Add any paths that contain custom themes here, relative to this directory. html_theme_path = ['themes'] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. html_use_index = False # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. html_show_sourcelink = False # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. html_show_sphinx = False # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = 'lmdbdoc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', 'lmdb.tex', u'lmdb Documentation', u'David Wilson and Nic Watson', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', 'lmdb', u'lmdb Documentation', [u'David Wilson'], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', 'lmdb', u'lmdb Documentation', u'David Wilson', 'lmdb', 'One line description of project.', 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' import sys class Mock(object): def __init__(self, *args, **kwargs): pass def __call__(self, *args, **kwargs): return Mock() @classmethod def __getattr__(cls, name): if name in ('__file__', '__path__'): return '/dev/null' elif 0 and name[0] == name[0].upper(): mockType = type(name, (), {}) mockType.__module__ = __name__ return mockType else: return Mock() MOCK_MODULES = ['cffi'] for mod_name in MOCK_MODULES: sys.modules[mod_name] = Mock() py-lmdb-py-lmdb_1.0.0/docs/index.rst000066400000000000000000000631041372223456500173060ustar00rootroot00000000000000 lmdb ==== .. currentmodule:: lmdb .. toctree:: :hidden: :maxdepth: 2 This is a universal Python binding for the `LMDB 'Lightning' Database `_. Two variants are provided and automatically selected during install: a `CFFI `_ variant that supports `PyPy `_ and all versions of CPython >=2.7, and a C extension that supports CPython >=2.7 and >=3.4. Both variants provide the same interface. LMDB is a tiny database with some excellent properties: * Ordered map interface (keys are always lexicographically sorted). * Reader/writer transactions: readers don't block writers, writers don't block readers. Each environment supports one concurrent write transaction. * Read transactions are extremely cheap. * Environments may be opened by multiple processes on the same host, making it ideal for working around Python's `GIL `_. * Multiple named databases may be created with transactions covering all named databases. * Memory mapped, allowing for zero copy lookup and iteration. This is optionally exposed to Python using the :py:func:`buffer` interface. * Maintenance requires no external process or background threads. * No application-level caching is required: LMDB fully exploits the operating system's buffer cache. Installation: Windows +++++++++++++++++++++ Binary eggs and wheels are published via PyPI for Windows, allowing the binding to be installed via pip and easy_install without the need for a compiler to be present. The binary releases statically link against the bundled version of LMDB. Initially 32-bit and 64-bit binaries are provided for Python 2.7; in future binaries will be published for all supported versions of Python. To install, use a command like: :: C:\Python27\python -mpip install lmdb Or: :: C:\Python27\python -measy_install lmdb Installation: UNIX ++++++++++++++++++ For convenience, a supported version of LMDB is bundled with the binding and built statically by default. If your system distribution includes LMDB, set the ``LMDB_FORCE_SYSTEM`` environment variable, and optionally ``LMDB_INCLUDEDIR`` and ``LMDB_LIBDIR`` prior to invoking ``setup.py``. By default, the LMDB library is patched before building. This patch (located at ``lib/py-lmdb/env-copy-txn.patch``) provides a minor feature: the ability to copy/backup an environment under a particular transaction. If you prefer to bypass the patch, set the environment variable ``LMDB_PURE``. The CFFI variant depends on CFFI, which in turn depends on ``libffi``, which may need to be installed from a package. On CPython, both variants additionally depend on the CPython development headers. On Debian/Ubuntu: :: apt-get install libffi-dev python-dev build-essential To install the C extension, ensure a C compiler and `pip` or `easy_install` are available and type: :: pip install lmdb # or easy_install lmdb The CFFI variant may be used on CPython by setting the ``LMDB_FORCE_CFFI`` environment variable before installation, or before module import with an existing installation: :: >>> import os >>> os.environ['LMDB_FORCE_CFFI'] = '1' >>> # CFFI variant is loaded. >>> import lmdb Getting Help ++++++++++++ Before getting in contact, please ensure you have thoroughly reviewed this documentation, and if applicable, the associated `official Doxygen documentation `_. If you have found a bug, please report it on the `GitHub issue tracker `_, or mail it to the list below if you're allergic to GitHub. For all other problems and related discussion, please direct it to `the py-lmdb@freelists.org mailing list `_. You must be subscribed to post. The `list archives `_ are also available. Named Databases +++++++++++++++ Named databases require the `max_dbs=` parameter to be provided when calling :py:func:`lmdb.open` or :py:class:`lmdb.Environment`. This must be done by the first process or thread opening the environment. Once a correctly configured :py:class:`Environment` is created, new named databases may be created via :py:meth:`Environment.open_db`. Storage efficiency & limits +++++++++++++++++++++++++++ Records are grouped into pages matching the operating system's VM page size, which is usually 4096 bytes. Each page must contain at least 2 records, in addition to 8 bytes per record and a 16 byte header. Due to this the engine is most space-efficient when the combined size of any (8+key+value) combination does not exceed 2040 bytes. When an attempt to store a record would exceed the maximum size, its value part is written separately to one or more dedicated pages. Since the trailer of the last page containing the record value cannot be shared with other records, it is more efficient when large values are an approximate multiple of 4096 bytes, minus 16 bytes for an initial header. Space usage can be monitored using :py:meth:`Environment.stat`: :: >>> pprint(env.stat()) {'branch_pages': 1040L, 'depth': 4L, 'entries': 3761848L, 'leaf_pages': 73658L, 'overflow_pages': 0L, 'psize': 4096L} This database contains 3,761,848 records and no values were spilled (``overflow_pages``). By default record keys are limited to 511 bytes in length, however this can be adjusted by rebuilding the library. The compile-time key length can be queried via :py:meth:`Environment.max_key_size()`. Memory usage ++++++++++++ Diagnostic tools often overreport the memory usage of LMDB databases, since the tools poorly classify that memory. The Linux ``ps`` command ``RSS`` measurement may report a process as having an entire database resident, causing user alarm. While the entire database may really be resident, it is half the story. Unlike heap memory, pages in file-backed memory maps, such as those used by LMDB, may be efficiently reclaimed by the OS at any moment so long as the pages in the map are `clean`. `Clean` simply means that the resident pages' contents match the associated pages that live in the disk file that backs the mapping. A clean mapping works exactly like a cache, and in fact it is a cache: the `OS page cache `_. On Linux, the ``/proc//smaps`` file contains one section for each memory mapping in a process. To inspect the actual memory usage of an LMDB database, look for a ``data.mdb`` entry, then observe its `Dirty` and `Clean` values. When no write transaction is active, all pages in an LMDB database should be marked `clean`, unless the Environment was opened with `sync=False`, and no explicit :py:meth:`Environment.sync` has been called since the last write transaction, and the OS writeback mechanism has not yet opportunistically written the dirty pages to disk. Bytestrings +++++++++++ This documentation uses `bytestring` to mean either the Python<=2.7 :py:func:`str` type, or the Python>=3.0 :py:func:`bytes` type, depending on the Python version in use. Due to the design of Python 2.x, LMDB will happily accept Unicode instances where :py:func:`str` instances are expected, so long as they contain only ASCII characters, in which case they are implicitly encoded to ASCII. You should not rely on this behaviour! It results in brittle programs that often break the moment they are deployed in production. Always explicitly encode and decode any Unicode values before passing them to LMDB. This documentation uses :py:func:`bytes` in examples. In Python 3.x this is a distinct type, whereas in Python 2.7 it is simply an alias for :py:func:`str`. Buffers +++++++ Since LMDB is memory mapped it is possible to access record data without keys or values ever being copied by the kernel, database library, or application. To exploit this the library can be instructed to return :py:func:`buffer` objects instead of bytestrings by passing `buffers=True` to :py:meth:`Environment.begin` or :py:class:`Transaction`. In Python :py:func:`buffer` objects can be used in many places where bytestrings are expected. In every way they act like a regular sequence: they support slicing, indexing, iteration, and taking their length. Many Python APIs will automatically convert them to bytestrings as necessary: :: >>> txn = env.begin(buffers=True) >>> buf = txn.get('somekey') >>> buf >>> len(buf) 4096 >>> buf[0] 'a' >>> buf[:2] 'ab' >>> value = bytes(buf) >>> len(value) 4096 >>> type(value) It is also possible to pass buffers directly to many native APIs, for example :py:meth:`file.write`, :py:meth:`socket.send`, :py:meth:`zlib.decompress` and so on. A buffer may be sliced without copying by passing it to :py:func:`buffer`: :: >>> # Extract bytes 10 through 210: >>> sub_buf = buffer(buf, 10, 200) >>> len(sub_buf) 200 In both PyPy and CPython, returned buffers *must be discarded* after their producing transaction has completed or been modified in any way. To preserve buffer's contents, copy it using :py:func:`bytes`: .. code-block:: python with env.begin(write=True, buffers=True) as txn: buf = txn.get('foo') # only valid until the next write. buf_copy = bytes(buf) # valid forever txn.delete('foo') # this is a write! txn.put('foo2', 'bar2') # this is also a write! print('foo: %r' % (buf,)) # ERROR! invalidated by write print('foo: %r' % (buf_copy,)) # OK print('foo: %r' % (buf,)) # ERROR! also invalidated by txn end print('foo: %r' % (buf_copy,)) # still OK ``writemap`` mode +++++++++++++++++ When :py:class:`Environment` or :py:func:`open` is invoked with ``writemap=True``, the library will use a writeable memory mapping to directly update storage. This improves performance at a cost to safety: it is possible (though fairly unlikely) for buggy C code in the Python process to accidentally overwrite the map, resulting in database corruption. .. caution:: This option may cause filesystems that don't support sparse files, such as OSX, to immediately preallocate `map_size=` bytes of underlying storage when the environment is opened or closed for the first time. .. caution:: A filesystem failure (such as running out of space), will crash the Python process if this option is enabled. (This is a general OS limitation, and not limited to LMDB). Resource Management +++++++++++++++++++ :py:class:`Environment`, :py:class:`Transaction`, and :py:class:`Cursor` support the context manager protocol, allowing for robust resource cleanup in the case of exceptions. .. code-block:: python with env.begin() as txn: with txn.cursor() as curs: # do stuff print 'key is:', curs.get('key') On CFFI it is important to use the :py:class:`Cursor` context manager, or explicitly call :py:meth:`Cursor.close` if many cursors are created within a single transaction. Failure to close a cursor on CFFI may cause many dead objects to accumulate until the parent transaction is aborted or committed. Transaction management ++++++++++++++++++++++ While any reader exists, writers cannot reuse space in the database file that has become unused in later versions. Due to this, continual use of long-lived read transactions may cause the database to grow without bound. A lost reference to a read transaction will simply be aborted (and its reader slot freed) when the :py:class:`Transaction` is eventually garbage collected. This should occur immediately on CPython, but may be deferred indefinitely on PyPy. However the same is *not* true for write transactions: losing a reference to a write transaction can lead to deadlock, particularly on PyPy, since if the same process that lost the :py:class:`Transaction` reference immediately starts another write transaction, it will deadlock on its own lock. Subsequently the lost transaction may never be garbage collected (since the process is now blocked on itself) and the database will become unusable. These problems are easily avoided by always wrapping :py:class:`Transaction` in a ``with`` statement somewhere on the stack: .. code-block:: python # Even if this crashes, txn will be correctly finalized. with env.begin() as txn: if txn.get('foo'): function_that_stashes_away_txn_ref(txn) function_that_leaks_txn_refs(txn) crash() Threads +++++++ ``MDB_NOTLS`` mode is used exclusively, which allows read transactions to freely migrate across threads and for a single thread to maintain multiple read transactions. This enables mostly care-free use of read transactions, for example when using `gevent `_. Most objects can be safely called by a single caller from a single thread, and usually it only makes sense to to have a single caller, except in the case of :py:class:`Environment`. Most :py:class:`Environment` methods are thread-safe, and may be called concurrently, except for :py:meth:`Environment.close`. Running `close` at the same time as other database operations may crash the interpreter. A write :py:class:`Transaction` may only be used from the thread it was created on. A read-only :py:class:`Transaction` can move across threads, but it cannot be used concurrently from multiple threads. :py:class:`Cursor` is not thread-safe, but it does not make sense to use it on any thread except the thread that currently owns its associated :py:class:`Transaction`. Limitations running on 32-bit Processes +++++++++++++++++++++++++++++++++++++++ 32-bit processes (for example 32-bit builds of Python on Windows) are severely limited in the amount of virtual memory that can be mapped in. This is particularly true for any 32-bit process but is particularly true for Python running on Windows and long running processes. Virtual address space fragmentation is a significant issue for mapping files into memory, a requirement for lmdb, as lmdb requires a contiguous range of virtual addresses. See https://web.archive.org/web/20170701204304/http://forthescience.org/blog/2014/08/16/python-and-memory-fragmentation for more information and a solution that potentially gives another 50% of virtual address space on Windows. Importantly, using a 32-bit instance of Python (even with the OS being 64-bits) means that the maximum size file that can be ever be mapped into memory is around 1.1 GiB, and that number decreases as the python process lives and allocates/deallocates memory. That means the DB file you can open now might not be the DB file you can open in a hour, given the same process. On Windows, You can see the see the precise maximum mapping size by using the SysInternals tool VMMap, then selecting your Python process, then selecting the "free" row, then sorting by size. This is not a problem at all for 64-bit processes. Interface +++++++++ .. py:function:: lmdb.open(path, **kwargs) Shortcut for :py:class:`Environment` constructor. .. autofunction:: lmdb.version Environment class ################# .. autoclass:: lmdb.Environment :members: Database class ############## .. autoclass:: lmdb._Database :members: Transaction class ################# .. autoclass:: lmdb.Transaction :members: Cursor class ############ .. autoclass:: lmdb.Cursor :members: Exceptions ########## .. autoclass:: lmdb.Error () .. autoclass:: lmdb.KeyExistsError () .. autoclass:: lmdb.NotFoundError () .. autoclass:: lmdb.PageNotFoundError () .. autoclass:: lmdb.CorruptedError () .. autoclass:: lmdb.PanicError () .. autoclass:: lmdb.VersionMismatchError () .. autoclass:: lmdb.InvalidError () .. autoclass:: lmdb.MapFullError () .. autoclass:: lmdb.DbsFullError () .. autoclass:: lmdb.ReadersFullError () .. autoclass:: lmdb.TlsFullError () .. autoclass:: lmdb.TxnFullError () .. autoclass:: lmdb.CursorFullError () .. autoclass:: lmdb.PageFullError () .. autoclass:: lmdb.MapResizedError () .. autoclass:: lmdb.IncompatibleError () .. autoclass:: lmdb.BadDbiError () .. autoclass:: lmdb.BadRslotError () .. autoclass:: lmdb.BadTxnError () .. autoclass:: lmdb.BadValsizeError () .. autoclass:: lmdb.ReadonlyError () .. autoclass:: lmdb.InvalidParameterError () .. autoclass:: lmdb.LockError () .. autoclass:: lmdb.MemoryError () .. autoclass:: lmdb.DiskError () Command line tools ++++++++++++++++++ A rudimentary interface to most of the binding's functionality is provided. These functions are useful for e.g. backup jobs. :: $ python -mlmdb --help Usage: python -mlmdb [options] Basic tools for working with LMDB. copy: Consistent high speed backup an environment. python -mlmdb copy -e source.lmdb target.lmdb copyfd: Consistent high speed backup an environment to stdout. python -mlmdb copyfd -e source.lmdb > target.lmdb/data.mdb drop: Delete one or more sub-databases. python -mlmdb drop db1 dump: Dump one or more databases to disk in 'cdbmake' format. Usage: dump [db1=file1.cdbmake db2=file2.cdbmake] If no databases are given, dumps the main database to 'main.cdbmake'. edit: Add/delete/replace values from a database. python -mlmdb edit --set key=value --set-file key=/path \ --add key=value --add-file key=/path/to/file \ --delete key get: Read one or more values from a database. python -mlmdb get [ [ [..]]] readers: Display readers in the lock table python -mlmdb readers -e /path/to/db [-c] If -c is specified, clear stale readers. restore: Read one or more database from disk in 'cdbmake' format. python -mlmdb restore db1=file1.cdbmake db2=file2.cdbmake The special db name ":main:" may be used to indicate the main DB. rewrite: Re-create an environment using MDB_APPEND python -mlmdb rewrite -e src.lmdb -E dst.lmdb [ [ ..]] If no databases are given, rewrites only the main database. shell: Open interactive console with ENV set to the open environment. stat: Print environment statistics. warm: Read environment into page cache sequentially. watch: Show live environment statistics Options: -h, --help show this help message and exit -e ENV, --env=ENV Environment file to open -d DB, --db=DB Database to open (default: main) -r READ, --read=READ Open environment read-only -S MAP_SIZE, --map_size=MAP_SIZE Map size in megabytes (default: 10) -a, --all Make "dump" dump all databases -E TARGET_ENV, --target_env=TARGET_ENV Target environment file for "dumpfd" -x, --xxd Print values in xxd format -M MAX_DBS, --max-dbs=MAX_DBS Maximum open DBs (default: 128) --out-fd=OUT_FD "copyfd" command target fd Options for "copy" command: --compact Perform compaction while copying. Options for "edit" command: --set=SET List of key=value pairs to set. --set-file=SET_FILE List of key pairs to read from files. --add=ADD List of key=value pairs to add. --add-file=ADD_FILE List of key pairs to read from files. --delete=DELETE List of key=value pairs to delete. Options for "readers" command: -c, --clean Clean stale readers? (default: no) Options for "watch" command: --csv Generate CSV instead of terminal output. --interval=INTERVAL Interval size (default: 1sec) --window=WINDOW Average window size (default: 10) Implementation Notes ++++++++++++++++++++ Iterators ######### It was tempting to make :py:class:`Cursor` directly act as an iterator, however that would require overloading its `next()` method to mean something other than the natural definition of `next()` on an LMDB cursor. It would additionally introduce unintuitive state tied to the cursor that does not exist in LMDB: such as iteration direction and the type of value yielded. Instead a separate iterator is produced by `__iter__()`, `iternext()`, and `iterprev()`, with easily described semantics regarding how they interact with the cursor. Memsink Protocol ################ If the ``memsink`` package is available during installation of the CPython extension, then the resulting module's :py:class:`Transaction` object will act as a `source` for the `Memsink Protocol `_. This is an experimental protocol to allow extension of LMDB's zero-copy design outward to other C types, without requiring explicit management by the user. This design is a work in progress; if you have an application that would benefit from it, please leave a comment on the ticket above. Deviations from LMDB API ######################## `mdb_dbi_close()`: This is not exposed since its use is perilous at best. Users must ensure all activity on the DBI has ceased in all threads before closing the handle. Failure to do this could result in "impossible" errors, or the DBI slot becoming reused, resulting in operations being serviced by the wrong named database. Leaving handles open wastes a tiny amount of memory, which seems a good price to avoid subtle data corruption. :py:meth:`Cursor.replace`, :py:meth:`Cursor.pop`: There are no native equivalents to these calls, they just implement common operations in C to avoid a chunk of error prone, boilerplate Python from having to do the same. `mdb_set_compare()`, `mdb_set_dupsort()`: Neither function is exposed for a variety of reasons. In particular, neither can be supported safely, since exceptions cannot be propagated through LMDB callbacks, and can lead to database corruption if used incorrectly. Secondarily, since both functions are repeatedly invoked for every single lookup in the LMDB read path, most of the performance benefit of LMDB is lost by introducing Python interpreter callbacks to its hot path. There are a variety of workarounds that could make both functions useful, but not without either punishing binding users who do not require these features (especially on CFFI), or needlessly complicating the binding for what is essentially an edge case. In all cases where `mdb_set_compare()` might be useful, use of a special key encoding that encodes your custom order is usually desirable. See `issue #79 `_ for example approaches. The answer is not so clear for `mdb_set_dupsort()`, since a custom encoding there may necessitate wasted storage space, or complicating record decoding in an application's hot path. Please file a ticket if you think you have a use for `mdb_set_dupsort()`. Technology ########## The binding is implemented twice: once using CFFI, and once as native C extension. This is since a CFFI binding is necessary for PyPy, but its performance on CPython is very poor. For good performance on CPython, only Cython and a native extension are viable options. Initially Cython was used, however this was abandoned due to the effort and relative mismatch involved compared to writing a native extension. Invalidation lists ################## Much effort has gone into avoiding crashes: when some object is invalidated (e.g. due to :py:meth:`Transaction.abort`), child objects are updated to ensure they don't access memory of the no-longer-existent resource, and that they correspondingly free their own resources. On CPython this is accomplished by weaving a linked list into all ``PyObject`` structures. This avoids the need to maintain a separate heap-allocated structure, or produce excess ``weakref`` objects (which internally simply manage their own lists). With CFFI this isn't possible. Instead each object has a ``_deps`` dict that maps dependent object IDs to the corresponding objects. Weakrefs are avoided since they are very inefficient on PyPy. Prior to invalidation ``_deps`` is walked to notify each dependent that the resource is about to disappear. Finally, each object may either store an explicit ``_invalid`` attribute and check it prior to every operation, or rely on another mechanism to avoid the crash resulting from using an invalidated resource. Instead of performing these explicit tests continuously, on CFFI a magic ``Some_LMDB_Resource_That_Was_Deleted_Or_Closed`` object is used. During invalidation, all native handles are replaced with an instance of this object. Since CFFI cannot convert the magical object to a C type, any attempt to make a native call will raise ``TypeError`` with a nice descriptive type name indicating the problem. Hacky but efficient, and mission accomplished. Argument parsing ################ The CPython module `parse_args()` may look "special", at best. The alternative `PyArg_ParseTupleAndKeywords` performs continuous heap allocations and string copies, resulting in a difference of 10,000 lookups/sec slowdown in a particular microbenchmark. The 10k/sec slowdown could potentially disappear given a sufficiently large application, so this decision needs revisited at some stage. ChangeLog +++++++++ .. include:: ../ChangeLog :literal: License +++++++ .. include:: ../LICENSE :literal: py-lmdb-py-lmdb_1.0.0/docs/themes/000077500000000000000000000000001372223456500167265ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/docs/themes/acid/000077500000000000000000000000001372223456500176265ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/docs/themes/acid/conf.py.conf000066400000000000000000000012521372223456500220510ustar00rootroot00000000000000# -*- coding: utf-8 -*- import sys, os extensions = [] templates_path = ['{{ template_dir }}', 'templates', '_templates', '.templates'] source_suffix = '{{ project.suffix }}' master_doc = 'index' project = u'{{ project.name }}' copyright = u'{{ project.copyright }}' version = '{{ project.version }}' release = '{{ project.version }}' exclude_patterns = ['_build'] pygments_style = 'sphinx' html_theme = '{{ project.theme }}' html_theme_path = ['.', '_theme', '.theme'] htmlhelp_basename = '{{ project.slug }}' file_insertion_enabled = False latex_documents = [ ('index', '{{ project.slug }}.tex', u'{{ project.name }} Documentation', u'{{ project.copyright }}', 'manual'), ] py-lmdb-py-lmdb_1.0.0/docs/themes/acid/layout.html000066400000000000000000000074141372223456500220370ustar00rootroot00000000000000 {# Strip out the default script files we provide, but keep some, like mathjax. #} {% set script_files = [] %} {%- set url_root = pathto('', 1) %} {%- if url_root == '#' %}{% set url_root = '' %}{% endif %} {%- set titlesuffix = " — "|safe + docstitle|e %} {%- macro sidebar() %}
{%- if logo %} {%- endif %} {% if theme_github_repo %}

GitHub Repository

{% endif %}

Docs for last release

Docs for master branch

{%- block sidebartoc %} {%- include "localtoc.html" %} {%- endblock %} {%- block sidebarrel %} {%- include "relations.html" %} {%- endblock %}
{%- endmacro %} {{ title|striptags|e }}{{ titlesuffix }} {%- for cssfile in css_files %} {%- endfor %} {%- for scriptfile in script_files %} {%- endfor %} {%- block content %} {%- block sidebar1 %} {# possible location for sidebar #} {% endblock %}
{%- block document %}
{% block body %} {% endblock %}
{%- endblock %} {%- block sidebar2 %}{{ sidebar() }}{% endblock %}
{%- endblock %} {% macro relbar() %}{% endmacro %} {%- block relbar2 %}{{ relbar() }}{% endblock %} {% if not using_theme %} {# Keep this here, so that the RTD logo doesn't stomp on the bottom of the theme. #}


{% endif %} py-lmdb-py-lmdb_1.0.0/docs/themes/acid/sourcelink.html000066400000000000000000000000261372223456500226700ustar00rootroot00000000000000{% if 0 %}{% endif %} py-lmdb-py-lmdb_1.0.0/docs/themes/acid/static/000077500000000000000000000000001372223456500211155ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/docs/themes/acid/static/acid.css000066400000000000000000000621471372223456500225410ustar00rootroot00000000000000/* Based on rtd.css, copyright 2007-2010 Sphinx team. */ /* RTD colors * light blue: #e8ecef * medium blue: #8ca1af * dark blue: #465158 * dark grey: #444444 * * white hover: #d1d9df; * medium blue hover: #697983; * green highlight: #8ecc4c * light blue (project bar): #e8ecef */ div.clearer { clear: both; } div.related { width: 100%; font-size: 90%; } div.related h3 { display: none; } div.related ul { margin: 0; padding: 0 0 0 10px; list-style: none; } div.related li { display: inline; } div.related li.right { float: right; margin-right: 5px; } /* -- sidebar --------------------------------------------------------------- */ div.sphinxsidebarwrapper { padding: 10px 5px 0 10px; } div.sphinxsidebar { float: left; width: 250px; margin-left: -100%; font-size: 90%; } div.sphinxsidebar ul { list-style: none; } div.sphinxsidebar ul ul, div.sphinxsidebar ul.want-points { margin-left: 20px; list-style: square; } div.sphinxsidebar ul ul { margin-top: 0; margin-bottom: 0; } div.sphinxsidebar form { margin-top: 10px; } div.sphinxsidebar input { border: 1px solid #98dbcc; font-family: sans-serif; font-size: 1em; } div.sphinxsidebar #searchbox input[type="text"] { width: 170px; } div.sphinxsidebar #searchbox input[type="submit"] { width: 30px; } img { border: 0; } /* -- search page ----------------------------------------------------------- */ ul.search { margin: 10px 0 0 20px; padding: 0; } ul.search li { padding: 5px 0 5px 20px; background-image: url(file.png); background-repeat: no-repeat; background-position: 0 7px; } ul.search li a { font-weight: bold; } ul.search li div.context { color: #888; margin: 2px 0 0 30px; text-align: left; } ul.keywordmatches li.goodmatch a { font-weight: bold; } /* -- index page ------------------------------------------------------------ */ table.contentstable { width: 90%; } table.contentstable p.biglink { line-height: 150%; } a.biglink { font-size: 1.3em; } span.linkdescr { font-style: italic; padding-top: 5px; font-size: 90%; } /* -- general index --------------------------------------------------------- */ table.indextable { width: 100%; } table.indextable td { text-align: left; vertical-align: top; } table.indextable dl, table.indextable dd { margin-top: 0; margin-bottom: 0; } table.indextable tr.pcap { height: 10px; } table.indextable tr.cap { margin-top: 10px; background-color: #f2f2f2; } img.toggler { margin-right: 3px; margin-top: 3px; cursor: pointer; } div.modindex-jumpbox { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; margin: 1em 0 1em 0; padding: 0.4em; } div.genindex-jumpbox { border-top: 1px solid #ddd; border-bottom: 1px solid #ddd; margin: 1em 0 1em 0; padding: 0.4em; } /* -- general body styles --------------------------------------------------- */ a.headerlink { visibility: hidden; } h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, h4:hover > a.headerlink, h5:hover > a.headerlink, h6:hover > a.headerlink, dt:hover > a.headerlink { visibility: visible; } div.body p.caption { text-align: inherit; } div.body td { text-align: left; } .field-list ul { padding-left: 1em; } .first { margin-top: 0 !important; } p.rubric { margin-top: 30px; font-weight: bold; } img.align-left, .figure.align-left, object.align-left { clear: left; float: left; margin-right: 1em; } img.align-right, .figure.align-right, object.align-right { clear: right; float: right; margin-left: 1em; } img.align-center, .figure.align-center, object.align-center { display: block; margin-left: auto; margin-right: auto; } .align-left { text-align: left; } .align-center { text-align: center; } .align-right { text-align: right; } /* -- sidebars -------------------------------------------------------------- */ div.sidebar { margin: 0 0 0.5em 1em; border: 1px solid #ddb; padding: 7px 7px 0 7px; background-color: #ffe; width: 40%; float: right; } p.sidebar-title { font-weight: bold; } /* -- topics ---------------------------------------------------------------- */ div.topic { border: 1px solid #ccc; padding: 7px 7px 0 7px; margin: 10px 0 10px 0; } p.topic-title { font-size: 1.1em; font-weight: bold; margin-top: 10px; } /* -- admonitions ----------------------------------------------------------- */ div.admonition { margin-top: 10px; margin-bottom: 10px; padding: 7px; } div.admonition dt { font-weight: bold; } div.admonition dl { margin-bottom: 0; } p.admonition-title { margin: 0px 10px 5px 0px; font-weight: bold; } div.body p.centered { text-align: center; margin-top: 25px; } /* -- tables ---------------------------------------------------------------- */ table.docutils { border: 0; border-collapse: collapse; } table.docutils td, table.docutils th { padding: 1px 8px 1px 5px; border-top: 0; border-left: 0; border-right: 0; border-bottom: 1px solid #aaa; } table.field-list td, table.field-list th { border: 0 !important; } table.footnote td, table.footnote th { border: 0 !important; } th { text-align: left; padding-right: 5px; } table.citation { border-left: solid 1px gray; margin-left: 1px; } table.citation td { border-bottom: none; } /* -- other body styles ----------------------------------------------------- */ ol.arabic { list-style: decimal; } ol.loweralpha { list-style: lower-alpha; } ol.upperalpha { list-style: upper-alpha; } ol.lowerroman { list-style: lower-roman; } ol.upperroman { list-style: upper-roman; } dl { margin-bottom: 15px; } dd p { margin-top: 0px; } dd ul, dd table { margin-bottom: 10px; } dd { margin-top: 3px; margin-bottom: 10px; margin-left: 30px; } dt:target, .highlighted { background-color: #fbe54e; } dl.glossary dt { font-weight: bold; font-size: 1.1em; } .field-list ul { margin: 0; padding-left: 1em; } .field-list p { margin: 0; } .refcount { color: #060; } .optional { font-size: 1.3em; } .versionmodified { font-style: italic; } .system-message { background-color: #fda; padding: 5px; border: 3px solid red; } .footnote:target { background-color: #ffa; } .line-block { display: block; margin-top: 1em; margin-bottom: 1em; } .line-block .line-block { margin-top: 0; margin-bottom: 0; margin-left: 1.5em; } .guilabel, .menuselection { font-family: sans-serif; } .accelerator { text-decoration: underline; } .classifier { font-style: oblique; } abbr, acronym { border-bottom: dotted 1px; cursor: help; } /* -- code displays --------------------------------------------------------- */ pre { overflow: auto; overflow-y: hidden; /* fixes display issues on Chrome browsers */ } td.linenos pre { padding: 5px 0px; border: 0; background-color: transparent; color: #aaa; } table.highlighttable { margin-left: 0.5em; } table.highlighttable td { padding: 0 0.5em 0 0.5em; } tt.descname { background-color: transparent; font-weight: bold; font-size: 1.2em; } tt.descclassname { background-color: transparent; } tt.xref, a tt { background-color: transparent; font-weight: bold; } h1 tt, h2 tt, h3 tt, h4 tt, h5 tt, h6 tt { background-color: transparent; } .viewcode-link { float: right; } .viewcode-back { float: right; font-family: sans-serif; } div.viewcode-block:target { margin: -1px -10px; padding: 0 10px; } /* -- math display ---------------------------------------------------------- */ img.math { vertical-align: middle; } div.body div.math p { text-align: center; } span.eqno { float: right; } /* -- printout stylesheet --------------------------------------------------- */ @media print { div.document, div.documentwrapper, div.bodywrapper { margin: 0 !important; width: 100%; } div.sphinxsidebar, div.related, div.footer, #top-link { display: none; } } /* PAGE LAYOUT -------------------------------------------------------------- */ body { font: 100%/1.5 "ff-meta-web-pro-1","ff-meta-web-pro-2",Arial,"Helvetica Neue",sans-serif; text-align: center; color: black; background-color: #465158; padding: 0; margin: 0; } div.document { text-align: left; background-color: #e8ecef; } div.bodywrapper { background-color: #ffffff; border-left: 1px solid #ccc; border-bottom: 1px solid #ccc; margin: 0 0 0 16em; } div.body { margin: 0; padding: 0.5em 1.3em; min-width: 20em; } div.related { font-size: 1em; background-color: #465158; } div.documentwrapper { float: left; width: 100%; background-color: #e8ecef; } /* HEADINGS --------------------------------------------------------------- */ h1 { margin: 0; padding: 0.7em 0 0.3em 0; font-size: 1.5em; line-height: 1.15; color: #111; clear: both; } h2 { margin: 2em 0 0.2em 0; font-size: 1.35em; padding: 0; color: #465158; } h3 { margin: 1em 0 -0.3em 0; font-size: 1.2em; color: #6c818f; } div.body h1 a, div.body h2 a, div.body h3 a, div.body h4 a, div.body h5 a, div.body h6 a { color: black; } h1 a.anchor, h2 a.anchor, h3 a.anchor, h4 a.anchor, h5 a.anchor, h6 a.anchor { display: none; margin: 0 0 0 0.3em; padding: 0 0.2em 0 0.2em; color: #aaa !important; } h1:hover a.anchor, h2:hover a.anchor, h3:hover a.anchor, h4:hover a.anchor, h5:hover a.anchor, h6:hover a.anchor { display: inline; } h1 a.anchor:hover, h2 a.anchor:hover, h3 a.anchor:hover, h4 a.anchor:hover, h5 a.anchor:hover, h6 a.anchor:hover { color: #777; background-color: #eee; } /* LINKS ------------------------------------------------------------------ */ /* Normal links get a pseudo-underline */ a { color: #444; text-decoration: none; border-bottom: 1px solid #ccc; } /* Links in sidebar, TOC, index trees and tables have no underline */ .sphinxsidebar a, .toctree-wrapper a, .indextable a, #indices-and-tables a { color: #444; text-decoration: none; border-bottom: none; } /* Most links get an underline-effect when hovered */ a:hover, div.toctree-wrapper a:hover, .indextable a:hover, #indices-and-tables a:hover { color: #111; text-decoration: none; border-bottom: 1px solid #111; } /* Footer links */ div.footer a { color: #86989B; text-decoration: none; border: none; } div.footer a:hover { color: #a6b8bb; text-decoration: underline; border: none; } /* Permalink anchor (subtle grey with a red hover) */ div.body a.headerlink { color: #ccc; font-size: 1em; margin-left: 6px; padding: 0 4px 0 4px; text-decoration: none; border: none; } div.body a.headerlink:hover { color: #c60f0f; border: none; } /* NAVIGATION BAR --------------------------------------------------------- */ div.related ul { height: 2.5em; } div.related ul li { margin: 0; padding: 0.65em 0; float: left; display: block; color: white; /* For the >> separators */ font-size: 0.8em; } div.related ul li.right { float: right; margin-right: 5px; color: transparent; /* Hide the | separators */ } /* "Breadcrumb" links in nav bar */ div.related ul li a { order: none; background-color: inherit; font-weight: bold; margin: 6px 0 6px 4px; line-height: 1.75em; color: #ffffff; padding: 0.4em 0.8em; border: none; border-radius: 3px; } /* previous / next / modules / index links look more like buttons */ div.related ul li.right a { margin: 0.375em 0; background-color: #697983; text-shadow: 0 1px rgba(0, 0, 0, 0.5); border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; } /* All navbar links light up as buttons when hovered */ div.related ul li a:hover { background-color: #8ca1af; color: #ffffff; text-decoration: none; border-radius: 3px; -webkit-border-radius: 3px; -moz-border-radius: 3px; } /* Take extra precautions for tt within links */ a tt, div.related ul li a tt { background: inherit !important; color: inherit !important; } /* SIDEBAR ---------------------------------------------------------------- */ div.sphinxsidebarwrapper { padding: 0; } div.sphinxsidebar { margin: 0; margin-left: -100%; float: left; top: 3em; left: 0; padding: 0 1em; width: 14em; font-size: 1em; text-align: left; background-color: #e8ecef; } div.sphinxsidebar img { max-width: 12em; } div.sphinxsidebar h3, div.sphinxsidebar h4, div.sphinxsidebar p.logo { margin: 1.2em 0 0.3em 0; font-size: 1em; padding: 0; color: #222222; font-family: "ff-meta-web-pro-1", "ff-meta-web-pro-2", "Arial", "Helvetica Neue", sans-serif; } div.sphinxsidebar h3 a { color: #444444; } div.sphinxsidebar ul, div.sphinxsidebar p { margin-top: 0; padding-left: 0; line-height: 130%; background-color: #e8ecef; } /* No bullets for nested lists, but a little extra indentation */ div.sphinxsidebar ul ul { list-style-type: none; margin-left: 1.5em; padding: 0; } /* A little top/bottom padding to prevent adjacent links' borders * from overlapping each other */ div.sphinxsidebar ul li { padding: 1px 0; } /* A little left-padding to make these align with the ULs */ div.sphinxsidebar p.topless { padding-left: 0 0 0 1em; } /* Make these into hidden one-liners */ div.sphinxsidebar ul li, div.sphinxsidebar p.topless { white-space: nowrap; overflow: hidden; } /* ...which become visible when hovered */ div.sphinxsidebar ul li:hover, div.sphinxsidebar p.topless:hover { overflow: visible; } /* Search text box and "Go" button */ #searchbox { margin-top: 2em; margin-bottom: 1em; background: #ddd; padding: 0.5em; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px; } #searchbox h3 { margin-top: 0; } /* Make search box and button abut and have a border */ input, div.sphinxsidebar input { border: 1px solid #999; float: left; } /* Search textbox */ input[type="text"] { margin: 0; padding: 0 3px; height: 20px; width: 144px; border-top-left-radius: 3px; border-bottom-left-radius: 3px; -moz-border-radius-topleft: 3px; -moz-border-radius-bottomleft: 3px; -webkit-border-top-left-radius: 3px; -webkit-border-bottom-left-radius: 3px; } /* Search button */ input[type="submit"] { margin: 0 0 0 -1px; /* -1px prevents a double-border with textbox */ height: 22px; color: #444; background-color: #e8ecef; padding: 1px 4px; font-weight: bold; border-top-right-radius: 3px; border-bottom-right-radius: 3px; -moz-border-radius-topright: 3px; -moz-border-radius-bottomright: 3px; -webkit-border-top-right-radius: 3px; -webkit-border-bottom-right-radius: 3px; } input[type="submit"]:hover { color: #ffffff; background-color: #8ecc4c; } div.sphinxsidebar p.searchtip { clear: both; padding: 0.5em 0 0 0; background: #ddd; color: #666; font-size: 0.9em; } /* Sidebar links are unusual */ div.sphinxsidebar li a, div.sphinxsidebar p a { background: #e8ecef; /* In case links overlap main content */ border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; border: 1px solid transparent; /* To prevent things jumping around on hover */ padding: 0 5px 0 5px; } div.sphinxsidebar li a:hover, div.sphinxsidebar p a:hover { color: #111; text-decoration: none; border: 1px solid #888; } div.sphinxsidebar p.logo a { border: 0; } /* Tweak any link appearing in a heading */ div.sphinxsidebar h3 a { } /* OTHER STUFF ------------------------------------------------------------ */ cite, code, tt { font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; font-size: 0.95em; letter-spacing: 0.01em; } tt { background-color: #f2f2f2; color: #444; } tt.descname, tt.descclassname, tt.xref { border: 0; } hr { border: 1px solid #abc; margin: 2em; } pre, #_fontwidthtest { font-family: 'Consolas', 'Deja Vu Sans Mono', 'Bitstream Vera Sans Mono', monospace; margin: 1em 2em; font-size: 0.95em; letter-spacing: 0.015em; line-height: 120%; padding: 0.5em; border: 1px solid #ccc; background-color: #eee; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px; } pre a { color: inherit; text-decoration: underline; } td.linenos pre { margin: 1em 0em; } td.code pre { margin: 1em 0em; } div.quotebar { background-color: #f8f8f8; max-width: 250px; float: right; padding: 2px 7px; border: 1px solid #ccc; } div.topic { background-color: #f8f8f8; } table { border-collapse: collapse; margin: 0 -0.5em 0 -0.5em; } table td, table th { padding: 0.2em 0.5em 0.2em 0.5em; } /* ADMONITIONS AND WARNINGS ------------------------------------------------- */ /* Shared by admonitions, warnings and sidebars */ div.admonition, div.warning, div.sidebar { font-size: 0.9em; margin: 2em; padding: 0; /* border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px; */ } div.admonition p, div.warning p, div.sidebar p { margin: 0.5em 1em 0.5em 1em; padding: 0; } div.admonition pre, div.warning pre, div.sidebar pre { margin: 0.4em 1em 0.4em 1em; } div.admonition p.admonition-title, div.warning p.admonition-title, div.sidebar p.sidebar-title { margin: 0; padding: 0.1em 0 0.1em 0.5em; color: white; font-weight: bold; font-size: 1.1em; text-shadow: 0 1px rgba(0, 0, 0, 0.5); } div.admonition ul, div.admonition ol, div.warning ul, div.warning ol, div.sidebar ul, div.sidebar ol { margin: 0.1em 0.5em 0.5em 3em; padding: 0; } /* Admonitions and sidebars only */ div.admonition, div.sidebar { border: 1px solid #609060; background-color: #e9ffe9; } div.admonition p.admonition-title, div.sidebar p.sidebar-title { background-color: #70A070; border-bottom: 1px solid #609060; } /* Warnings only */ div.warning { border: 1px solid #900000; background-color: #ffe9e9; } div.warning p.admonition-title { background-color: #b04040; border-bottom: 1px solid #900000; } /* Sidebars only */ div.sidebar { max-width: 30%; } div.versioninfo { margin: 1em 0 0 0; border: 1px solid #ccc; background-color: #DDEAF0; padding: 8px; line-height: 1.3em; font-size: 0.9em; } .viewcode-back { font-family: 'Lucida Grande', 'Lucida Sans Unicode', 'Geneva', 'Verdana', sans-serif; } div.viewcode-block:target { background-color: #f4debf; border-top: 1px solid #ac9; border-bottom: 1px solid #ac9; } dl { margin: 1em 0 2.5em 0; } dl dt { font-style: italic; } dl dd { color: rgb(68, 68, 68); font-size: 0.95em; } /* Highlight target when you click an internal link */ dt:target { background: #ffe080; } /* Don't highlight whole divs */ div.highlight { background: transparent; } /* But do highlight spans (so search results can be highlighted) */ span.highlight { background: #ffe080; } div.footer { background-color: #465158; color: #eeeeee; padding: 0 2em 2em 2em; clear: both; font-size: 0.8em; text-align: center; } p { margin: 0.8em 0 0.5em 0; } .section p img.math { margin: 0; } .section p img { margin: 1em 2em; } /* MOBILE LAYOUT -------------------------------------------------------------- */ @media screen and (max-width: 600px) { h1, h2, h3, h4, h5 { position: relative; } ul { padding-left: 1.25em; } div.bodywrapper a.headerlink, #indices-and-tables h1 a { color: #e6e6e6; font-size: 80%; float: right; line-height: 1.8; position: absolute; right: -0.7em; visibility: inherit; } div.bodywrapper h1 a.headerlink, #indices-and-tables h1 a { line-height: 1.5; } pre { font-size: 0.7em; overflow: auto; word-wrap: break-word; white-space: pre-wrap; } div.related ul { height: 2.5em; padding: 0; text-align: left; } div.related ul li { clear: both; color: #465158; padding: 0.2em 0; } div.related ul li:last-child { border-bottom: 1px dotted #8ca1af; padding-bottom: 0.4em; margin-bottom: 1em; width: 100%; } div.related ul li a { color: #465158; padding-right: 0; } div.related ul li a:hover { background: inherit; color: inherit; } div.related ul li.right { clear: none; padding: 0.65em 0; margin-bottom: 0.5em; } div.related ul li.right a { color: #fff; padding-right: 0.8em; } div.related ul li.right a:hover { background-color: #8ca1af; } div.body { clear: both; min-width: 0; word-wrap: break-word; } div.bodywrapper { margin: 0 0 0 0; } div.sphinxsidebar { float: none; margin: 0; width: auto; } div.sphinxsidebar input[type="text"] { height: 2em; line-height: 2em; width: 70%; } div.sphinxsidebar input[type="submit"] { height: 2em; margin-left: 0.5em; width: 20%; } div.sphinxsidebar p.searchtip { background: inherit; margin-bottom: 1em; } div.sphinxsidebar ul li, div.sphinxsidebar p.topless { white-space: normal; } .bodywrapper img { display: block; margin-left: auto; margin-right: auto; max-width: 100%; } div.documentwrapper { float: none; } div.admonition, div.warning, pre, blockquote { margin-left: 0em; margin-right: 0em; } .body p img { margin: 0; } #searchbox { background: transparent; } .related:not(:first-child) li { display: none; } .related:not(:first-child) li.right { display: block; } div.footer { padding: 1em; } .rtd_doc_footer .rtd-badge { float: none; margin: 1em auto; position: static; } .rtd_doc_footer .rtd-badge.revsys-inline { margin-right: auto; margin-bottom: 2em; } table.indextable { display: block; width: auto; } .indextable tr { display: block; } .indextable td { display: block; padding: 0; width: auto !important; } .indextable td dt { margin: 1em 0; } ul.search { margin-left: 0.25em; } ul.search li div.context { font-size: 90%; line-height: 1.1; margin-bottom: 1; margin-left: 0; } } #version_menu, .rtd-badge.rtd { -webkit-transition: all 0.25s 0.75s; transition: all 0.25s 0.75s; } .footer_popout:hover #version_menu, .footer_popout:hover .rtd-badge.rtd { -webkit-transition: all 0.25s 0s; transition: all 0.25s 0s; } .rtd-badge { position: fixed; display: block; bottom: 5px; height: 40px; text-indent: -9999em; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.2) inset; -moz-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.2) inset; -webkit-box-shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 1px 0 rgba(255, 255, 255, 0.2) inset; } #version_menu { position: fixed; visibility: hidden; opacity: 0; bottom: 11px; right: 47px; list-style-type: none; margin: 0; } .footer_popout:hover #version_menu { visibility: visible; opacity: 1; right: 166px; } #version_menu li { display: block; float: right; } #version_menu li a { display: block; padding: 6px 10px 4px 10px; margin: 7px 7px 0 0; font-weight: bold; font-size: 14px; height: 20px; line-height: 17px; text-decoration: none; color: #fff; background: #8ca1af url(http://media.readthedocs.org/images/gradient-light.png) bottom left repeat-x; border-radius: 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; box-shadow: 0 1px 1px #465158; -moz-box-shadow: 0 1px 1px #465158; -webkit-box-shadow: 0 1px 1px #465158; text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5); } #version_menu li a:hover { text-decoration: none; background-color: #697983; box-shadow: 0 1px 0px #465158; -moz-box-shadow: 0 1px 0px #465158; -webkit-box-shadow: 0 1px 0px #465158; } .rtd-badge.rtd { background: #3b4449 url(http://media.readthedocs.org/images/badge-rtd.png) scroll top left no-repeat; border: 1px solid #282E32; width: 41px; right: 5px; } .footer_popout:hover .rtd-badge.rtd { width: 160px; } .rtd-badge.revsys { display: none; } .rtd-badge.revsys-inline-sponsored { display none; } .rtd-badge.revsys-inline { display: none; } .rtd_doc_footer { background-color: #465158;} py-lmdb-py-lmdb_1.0.0/docs/themes/acid/theme.conf000066400000000000000000000013371372223456500216030ustar00rootroot00000000000000[theme] inherit = basic stylesheet = acid.css pygments_style = sphinx [options] github_repo = rightsidebar = false stickysidebar = false collapsiblesidebar = false externalrefs = false footerbgcolor = #11303d footertextcolor = #ffffff sidebarbgcolor = #1c4e63 sidebarbtncolor = #3c6e83 sidebartextcolor = #ffffff sidebarlinkcolor = #98dbcc relbarbgcolor = #133f52 relbartextcolor = #ffffff relbarlinkcolor = #ffffff bgcolor = #ffffff textcolor = #000000 headbgcolor = #f2f2f2 headtextcolor = #20435c headlinkcolor = #c60f0f linkcolor = #355f7c visitedlinkcolor = #355f7c codebgcolor = #eeffcc codetextcolor = #333333 bodyfont = sans-serif headfont = 'Trebuchet MS', sans-serif py-lmdb-py-lmdb_1.0.0/examples/000077500000000000000000000000001372223456500163275ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/examples/address-book.py000066400000000000000000000041651372223456500212640ustar00rootroot00000000000000 import lmdb # Open (and create if necessary) our database environment. Must specify # max_dbs=... since we're opening subdbs. env = lmdb.open('/tmp/address-book.lmdb', max_dbs=10) # Now create subdbs for home and business addresses. home_db = env.open_db(b'home') business_db = env.open_db(b'business') # Add some telephone numbers to each DB: with env.begin(write=True) as txn: txn.put(b'mum', b'012345678', db=home_db) txn.put(b'dad', b'011232211', db=home_db) txn.put(b'dentist', b'044415121', db=home_db) txn.put(b'hospital', b'078126321', db=home_db) txn.put(b'vendor', b'0917465628', db=business_db) txn.put(b'customer', b'0553211232', db=business_db) txn.put(b'coworker', b'0147652935', db=business_db) txn.put(b'boss', b'0123151232', db=business_db) txn.put(b'manager', b'0644810485', db=business_db) # Iterate each DB to show the keys are sorted: with env.begin() as txn: for name, db in ('home', home_db), ('business', business_db): print('DB:', name) for key, value in txn.cursor(db=db): print(' ', key, value) print() # Now let's update some phone numbers. We can specify the default subdb when # starting the transaction, rather than pass it in every time: with env.begin(write=True, db=home_db) as txn: print('Updating number for dentist') txn.put(b'dentist', b'099991231') print('Deleting number for hospital') txn.delete(b'hospital') print() print('Home DB is now:') for key, value in txn.cursor(): print(' ', key, value) print() # Now let's look up a number in the business DB with env.begin(db=business_db) as txn: print('Boss telephone number:', txn.get(b'boss')) print() # We got fired, time to delete all keys from the business DB. with env.begin(write=True) as txn: print('Deleting all numbers from business DB:') txn.drop(business_db, delete=False) print('Adding number for recruiter to business DB') txn.put(b'recruiter', b'04123125324', db=business_db) print('Business DB is now:') for key, value in txn.cursor(db=business_db): print(' ', key, value) print() py-lmdb-py-lmdb_1.0.0/examples/dirtybench-gdbm.py000066400000000000000000000072331372223456500217500ustar00rootroot00000000000000 from pprint import pprint import os import shutil import tempfile from time import time as now import random import gdbm MAP_SIZE = 1048576 * 400 DB_PATH = '/ram/testdb-gdbm' if os.path.exists('/ram'): DB_PATH = '/ram/testdb-gdbm' else: DB_PATH = tempfile.mktemp(prefix='dirtybench-gdbm') def x(): big = '' # '*' * 400 if os.path.exists(DB_PATH): os.unlink(DB_PATH) t0 = now() words = set(file('/usr/share/dict/words').readlines()) words.update([w.upper() for w in words]) words.update([w[::-1] for w in words]) words.update([w[::-1].upper() for w in words]) words.update(['-'.join(w) for w in words]) #words.update(['+'.join(w) for w in words]) #words.update(['/'.join(w) for w in words]) words = list(words) alllen = sum(len(w) for w in words) avglen = alllen / len(words) print 'permutate %d words avglen %d took %.2fsec' % (len(words), avglen, now()-t0) getword = iter(words).next env = gdbm.open(DB_PATH, 'c') run = True t0 = now() last = t0 while run: try: for _ in xrange(50000): word = getword() env[word] = big or word except StopIteration: run = False t1 = now() if (t1 - last) > 2: print '%.2fs (%d/sec)' % (t1-t0, len(words)/(t1-t0)) last = t1 t1 = now() print 'done all %d in %.2fs (%d/sec)' % (len(words), t1-t0, len(words)/(t1-t0)) last = t1 print print t0 = now() lst = sum(env[k] and 1 for k in env.keys()) t1 = now() print 'enum %d (key, value) pairs took %.2f sec' % ((lst), t1-t0) t0 = now() lst = sum(1 or env[k] for k in reversed(env.keys())) t1 = now() print 'reverse enum %d (key, value) pairs took %.2f sec' % ((lst), t1-t0) t0 = now() for word in words: env[word] t1 = now() print 'rand lookup all keys %.2f sec (%d/sec)' % (t1-t0, lst/(t1-t0)) t0 = now() for word in words: hash(env[word]) t1 = now() print 'per txn rand lookup+hash all keys %.2f sec (%d/sec)' % (t1-t0, lst/(t1-t0)) t0 = now() for word in words: hash(env[word]) t1 = now() print 'rand lookup+hash all keys %.2f sec (%d/sec)' % (t1-t0, lst/(t1-t0)) t0 = now() for word in words: env[word] t1 = now() print 'rand lookup all buffers %.2f sec (%d/sec)' % (t1-t0, lst/(t1-t0)) t0 = now() for word in words: hash(env[word]) t1 = now() print 'rand lookup+hash all buffers %.2f sec (%d/sec)' % (t1-t0, lst/(t1-t0)) # # get+put # getword = iter(sorted(words)).next run = True t0 = now() last = t0 while run: try: for _ in xrange(50000): word = getword() old = env[word] env[word] = word except StopIteration: run = False t1 = now() if (t1 - last) > 2: print '%.2fs (%d/sec)' % (t1-t0, len(words)/(t1-t0)) last = t1 t1 = now() print 'get+put all %d in %.2fs (%d/sec)' % (len(words), t1-t0, len(words)/(t1-t0)) last = t1 # # REPLACE # getword = iter(sorted(words)).next run = True t0 = now() last = t0 while run: try: for _ in xrange(50000): word = getword() old = env[word] except StopIteration: run = False t1 = now() if (t1 - last) > 2: print '%.2fs (%d/sec)' % (t1-t0, len(words)/(t1-t0)) last = t1 t1 = now() print 'replace all %d in %.2fs (%d/sec)' % (len(words), t1-t0, len(words)/(t1-t0)) last = t1 x() py-lmdb-py-lmdb_1.0.0/examples/dirtybench.py000066400000000000000000000157151372223456500210450ustar00rootroot00000000000000 from pprint import pprint import atexit import gzip import itertools import os import shutil import sys import tempfile from time import time as now import random import lmdb MAP_SIZE = 1048576 * 400 DB_PATH = '/ram/testdb' USE_SPARSE_FILES = sys.platform != 'darwin' if os.path.exists('/ram'): DB_PATH = '/ram/testdb' else: DB_PATH = tempfile.mktemp(prefix='dirtybench') env = None @atexit.register def cleanup(): if env: env.close() if os.path.exists(DB_PATH): shutil.rmtree(DB_PATH) def reopen_env(**kwargs): if env: env.close() if os.path.exists(DB_PATH): shutil.rmtree(DB_PATH) return lmdb.open(DB_PATH, map_size=MAP_SIZE, writemap=USE_SPARSE_FILES, **kwargs) def case(title, **params): def wrapper(func): t0 = now() count = func() t1 = now() print('%40s: %2.3fs %8d/sec' % (title, t1-t0, count/(t1-t0))) return func return wrapper def x(): big = '' # '*' * 400 t0 = now() words_path = os.path.join(os.path.dirname(__file__), 'words.gz') words = set(gzip.open(words_path).read().splitlines()) words.update([w.upper() for w in words]) words.update([w[::-1] for w in words]) words.update([w[::-1].upper() for w in words]) words.update(['-'.join(w) for w in words]) #words.update(['+'.join(w) for w in words]) #words.update(['/'.join(w) for w in words]) words = list(words) alllen = sum(len(w) for w in words) avglen = alllen / len(words) print 'permutate %d words avglen %d took %.2fsec' % (len(words), avglen, now()-t0) print 'DB_PATH:', DB_PATH words_sorted = sorted(words) items = [(w, big or w) for w in words] items_sorted = [(w, big or w) for w in words_sorted] global env env = reopen_env() @case('insert') def test(): with env.begin(write=True) as txn: for word in words: txn.put(word, big or word) return len(words) st = env.stat() print print 'stat:', st print 'k+v size %.2fkb avg %d, on-disk size: %.2fkb avg %d' %\ ((2*alllen) / 1024., (2*alllen)/len(words), (st['psize'] * st['leaf_pages']) / 1024., (st['psize'] * st['leaf_pages']) / len(words)) print @case('enum (key, value) pairs') def test(): with env.begin() as txn: return sum(1 for _ in txn.cursor()) @case('reverse enum (key, value) pairs') def test(): with env.begin() as txn: return sum(1 for _ in txn.cursor().iterprev()) @case('enum (key, value) buffers') def test(): with env.begin(buffers=True) as txn: return sum(1 for _ in txn.cursor()) print @case('rand lookup') def test(): with env.begin() as txn: for word in words: txn.get(word) return len(words) @case('per txn rand lookup') def test(): for word in words: with env.begin() as txn: txn.get(word) return len(words) @case('rand lookup+hash') def test(): with env.begin() as txn: for word in words: hash(txn.get(word)) return len(words) @case('rand lookup buffers') def test(): with env.begin(buffers=True) as txn: for word in words: txn.get(word) return len(words) @case('rand lookup+hash buffers') def test(): with env.begin(buffers=True) as txn: for word in words: hash(txn.get(word)) return len(words) @case('rand lookup buffers (cursor)') def test(): with env.begin(buffers=True) as txn: cursget = txn.cursor().get for word in words: cursget(word) return len(words) print @case('get+put') def test(): with env.begin(write=True) as txn: for word in words: txn.get(word) txn.put(word, word) return len(words) @case('replace') def test(): with env.begin(write=True) as txn: for word in words: txn.replace(word, word) return len(words) @case('get+put (cursor)') def test(): with env.begin(write=True) as txn: with txn.cursor() as cursor: for word in words: cursor.get(word) cursor.put(word, word) return len(words) @case('replace (cursor)') def test(): with env.begin(write=True) as txn: with txn.cursor() as cursor: for word in words: cursor.replace(word, word) return len(words) print env = reopen_env() @case('insert (rand)') def test(): with env.begin(write=True) as txn: for word in words: txn.put(word, big or word) return len(words) env = reopen_env() @case('insert (seq)') def test(): with env.begin(write=True) as txn: for word in words_sorted: txn.put(word, big or word) return len(words) env = reopen_env() @case('insert (rand), reuse cursor') def test(): with env.begin(write=True) as txn: curs = txn.cursor() for word in words: curs.put(word, big or word) return len(words) env = reopen_env() @case('insert (seq), reuse cursor') def test(): with env.begin(write=True) as txn: curs = txn.cursor() for word in words_sorted: curs.put(word, big or word) return len(words) env = reopen_env() @case('insert, putmulti') def test(): with env.begin(write=True) as txn: txn.cursor().putmulti(items) return len(words) env = reopen_env() @case('insert, putmulti+generator') def test(): with env.begin(write=True) as txn: txn.cursor().putmulti((w, big or w) for w in words) return len(words) print env = reopen_env() @case('append') def test(): with env.begin(write=True) as txn: for word in words_sorted: txn.put(word, big or word, append=True) return len(words) env = reopen_env() @case('append, reuse cursor') def test(): with env.begin(write=True) as txn: curs = txn.cursor() for word in words_sorted: curs.put(word, big or word, append=True) return len(words) env = reopen_env() @case('append+putmulti') def test(): with env.begin(write=True) as txn: txn.cursor().putmulti(items_sorted, append=True) return len(words) print st = env.stat() print 'stat:', st print 'k+v size %.2fkb avg %d, on-disk size: %.2fkb avg %d' %\ ((2*alllen) / 1024., (2*alllen)/len(words), (st['psize'] * st['leaf_pages']) / 1024., (st['psize'] * st['leaf_pages']) / len(words)) x() py-lmdb-py-lmdb_1.0.0/examples/keystore/000077500000000000000000000000001372223456500201745ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/examples/keystore/README.md000066400000000000000000000027431372223456500214610ustar00rootroot00000000000000 ## Ultra minimal async IO example This requires a recent version of Twisted to run. From the parent directory, execute it as: python -m keystore.main It wraps LMDB in a very basic REST API, demonstrating how to handle database IO using a thread pool without blocking the main thread's select loop. The internals are structured relatively sanely, but the `keystore.lmdb` implementation itself is fairly horrid: a single GET will always cause a large amount of machinery to run. However, given a large and slow enough (non RAM, spinning rust) DB, this example will successfully keep the main loop responsive at all times even though multiple LMDB `mdb_get()` invocations are running concurrently. Not shown here, but may be added sometime later to demonstrate the techniques: * Combining multiple reads into a single transaction and context switch. * Combining writes into a single write transaction and context switch. ## Calling LMDB synchronously This example never calls LMDB directly from the main loop, even though in some restricted circumstances that may be completely safe. Such a situation might look like: * The database is guaranteed to always be in RAM. * Database writes are never contended. * Disk IO is very fast, or `sync=False` is used. In almost every case, it is likely better to design an application that handles the possibility that calls into LMDB will trigger slow IO, if not now then at some point in 10 years when all the original developers have left your project. py-lmdb-py-lmdb_1.0.0/examples/keystore/__init__.py000066400000000000000000000000001372223456500222730ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/examples/keystore/interfaces.py000066400000000000000000000061131372223456500226720ustar00rootroot00000000000000 from __future__ import absolute_import import zope.interface class IKeyStoreSync(zope.interface.Interface): def get(key): """ Fetch a key @return None or bytestring value. """ def put(key, value): """ Create or overwrite a key. @param key Bytestring key. @param value Bytestring alue. @return deferred producing None or error. """ def delete(key): """ Delete a key. @param key Bytestring key. @return deferred producing None or error. """ def seek(key): """ Seek to a key, or the next highest key. @param key Bytestring key. """ def first(): """ Seek to the first key in the store. @return True if positioned on a key. """ def last(): """ Seek to the last key in the store. @return True if positioned on a key. """ def next(): """ Seek to the next key in the store. @return True if positioned on a key. """ def prev(): """ Seek to the previous key in the store. @return True if positioned on a key. """ class IKeyStore(zope.interface.Interface): def get(key): """ Fetch a key. @return deferred producing None or bytestring value. """ def getKeys(key, count): """ Fetch a list of keys. @param key Bytestring first key to return, or None for first/last key in space. @param count Number of keys including first key to return. """ def getKeysReverse(key, count): """ Fetch a list of keys, walking in reverse. @param key Bytestring first key to return, or None for first/last key in space. @param count Number of keys including first key to return. """ def getItems(key, count): """ Fetch a list of (key, value) tuples. @param key Bytestring first key to return, or None for first/last key in space. @param count Number of keys including first key to return. """ def getItemsReverse(key, count): """ Fetch a list of (key, value) tuples. @param key Bytestring first key to return, or None for first/last key in space. @param count Number of keys including first key to return. """ def put(key): """ Create or overwrite a key. @param key Bytestring key. @param value Bytestring alue. @return deferred producing None or error. """ def delete(key): """ Delete a key. @param key Bytestring key. @return deferred producing None or error. """ def putGroup(func): """ Execute a function in the context of synchronous (IKeyStoreSync) transaction, in a private thread. @param func Function accepting IKeyStoreSync parameter. @returns deferred producing None or error. """ py-lmdb-py-lmdb_1.0.0/examples/keystore/lmdb.py000066400000000000000000000077031372223456500214730ustar00rootroot00000000000000 from __future__ import absolute_import import operator import twisted.internet.defer import twisted.internet.threads import zope.interface import keystore.interfaces class LmdbKeyStoreSync(object): zope.interface.implements(keystore.interfaces.IKeyStoreSync) cursor = None def __init__(self, env, write): self.txn = env.begin(write=write) def __enter__(self): return self def __exit__(self, e_type, e_val, e_tb): if e_type: self.txn.abort() else: self.txn.commit() self.txn = None def get(self, key): return self.txn.get(key) def put(self, key, value): self.txn.put(key, value) def delete(self, key): self.txn.delete(key) # # Cursor. # @property def key(self): return self.cursor.key() @property def value(self): return self.cursor.value() def seek(self, key): self.cursor.set_range(key) def next(self): return self.cursor.next() def prev(self): return self.cursor.prev() def _reader_task(env, func): with LmdbKeyStoreSync(env, write=False) as sync: return func(sync) def _writer_task(env, func): with LmdbKeyStoreSync(env, write=True) as sync: return func(sync) class LmdbKeyStore(object): zope.interface.implements(keystore.interfaces.IKeyStore) def __init__(self, reactor, pool, env): self.reactor = reactor self.pool = pool self.env = env def _call_in_thread(self, func): return twisted.internet.threads.deferToThreadPool( self.reactor, self.pool, func) def get(self, key): twisted.python.log.msg('get(%r, %r)', key) get = lambda sync: sync.get(key) return self._call_in_thread(lambda: _reader_task(self.env, get)) def _get_forward(self, sync, key, count, getter): positioned = sync.seek(key) out = [] for x in xrange(count): if not positioned: break out.append(getter(sync)) positioned = sync.next() return out def _get_reverse(self, sync, key, count, getter): out = [] positioned = sync.seek(key) if not positioned: positioned = sync.last() for x in xrange(count): if not positioned: break out.append(sync.key) positioned = sync.prev() return out _key_getter = operator.attrgetter('key') _item_getter = operator.attrgetter('key', 'value') def getKeys(self, key, count): get = lambda sync: self._get_forward(sync, key, count, self._key_getter) return self._call_in_thread(lambda: _reader_task(self.env, get)) def getKeysReverse(self, key, count): get = lambda sync: self._get_reverse(sync, key, count, self._key_getter) return self._call_in_thread(lambda: _reader_task(self.env, get)) def getItems(self, key, count): get = lambda sync: self._get_forward(sync, key, count, self._item_getter) return self._call_in_thread(lambda: _reader_task(self.env, get)) def getItemsReverse(self, key, count): get = lambda sync: self._get_reverse(sync, key, count, self._item_getter) return self._call_in_thread(lambda: _reader_task(self.env, get)) def put(self, key, value): twisted.python.log.msg('put(%r, %r)', key, value) put = lambda sync: sync.put(key, value) return self._call_in_thread(lambda: _writer_task(self.env, put)) def delete(self, key): delete = lambda sync: sync.delete(key) return self._call_in_thread(lambda: _writer_task(self.env, delete)) def putGroup(self, func): return self._call_in_thread(lambda: _writer_task(self.env, func)) py-lmdb-py-lmdb_1.0.0/examples/keystore/main.py000066400000000000000000000011561372223456500214750ustar00rootroot00000000000000 from __future__ import absolute_import import webbrowser import twisted.internet.reactor import lmdb import keystore.lmdb import keystore.webapi def main(): port = 9999 interface = '127.0.0.1' url = 'http://%s:%d/' % (interface, port) env = lmdb.open('/tmp/foo') reactor = twisted.internet.reactor pool = reactor.getThreadPool() store = keystore.lmdb.LmdbKeyStore(reactor, pool, env) site = keystore.webapi.create_site(store) reactor.listenTCP(port, site, interface=interface) reactor.callLater(0, webbrowser.open, url) reactor.run() if __name__ == '__main__': main() py-lmdb-py-lmdb_1.0.0/examples/keystore/static/000077500000000000000000000000001372223456500214635ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/examples/keystore/static/index.html000066400000000000000000000035351372223456500234660ustar00rootroot00000000000000
Request path:
Request body:
py-lmdb-py-lmdb_1.0.0/examples/keystore/web.py000066400000000000000000000045701372223456500213310ustar00rootroot00000000000000 from __future__ import absolute_import import twisted.python.failure import twisted.python.log import twisted.web.http import twisted.web.resource import twisted.web.server class Response(object): def __init__(self, body=None, headers=None, status=None): self.body = body self.headers = headers or {} self.status = status class DeferrableResourceRender(object): def __init__(self, resource_, request): self.resource = resource_ self.request = request self.closed = False def _notify_finish(self, resp): self.closed = resp def _on_render_error(self, failure): twisted.python.log.err(failure) if not self.closed: self.request.setResponseCode(twisted.web.http.INTERNAL_SERVER_ERROR) self.request.finish() def _on_render_done(self, resp): if not isinstance(resp, Response): exc = TypeError("render() didn't return Response, got %r" % (resp,)) self._on_render_error(twisted.python.failure.Failure(exc)) return if resp.body is not None and type(resp.body) is not bytes: exc = TypeError("render() returned %r, not bytes" % (type(resp.body),)) self._on_render_error(twisted.python.failure.Failure(exc)) return if self.closed: return if resp.status is not None: self.request.setResponseCode(resp.status) for key, value in resp.headers.iteritems(): self.request.setHeader(key, value) if resp.body is not None: self.request.setHeader('Content-Length', len(resp.body)) self.request.write(resp.body) self.request.finish() def start_render(self): method = self.request.method handler = getattr(self.resource, 'render_' + method, None) if handler is None: self._on_render_done(Response(status=405)) return self.request.notifyFinish().addBoth(self._notify_finish) d = twisted.internet.defer.maybeDeferred(handler, self.request) d.addCallbacks(self._on_render_done, self._on_render_error) return twisted.web.server.NOT_DONE_YET class DeferrableResource(twisted.web.resource.Resource): def render(self, request): render = DeferrableResourceRender(self, request) return render.start_render() py-lmdb-py-lmdb_1.0.0/examples/keystore/webapi.py000066400000000000000000000034061372223456500220200ustar00rootroot00000000000000 from __future__ import absolute_import import pkg_resources import keystore.web import twisted.web.server def read_resource(path): return pkg_resources.resource_string('keystore', path) class KeyResource(keystore.web.DeferrableResource): isLeaf = True def __init__(self, store): keystore.web.DeferrableResource.__init__(self) self.store = store def _get_done(self, value): if value is None: return keystore.web.Response(status=404) else: return keystore.web.Response(body=value) def render_GET(self, request): d = self.store.get(request.path) d.addCallback(self._get_done) return d def render_PUT(self, request): value = request.content.read() d = self.store.put(request.path, value) d.addCallback(lambda _: keystore.web.Response(status=202)) return d def render_DELETE(self, request): d = self.store.delete(request.path) d.addCallback(lambda _: keystore.web.Response(status=204)) return d class NamespaceResource(keystore.web.DeferrableResource): isLeaf = False def __init__(self, store): keystore.web.DeferrableResource.__init__(self) self.store = store def getChild(self, path, request): return KeyResource(self.store) class StaticResource(twisted.web.resource.Resource): def __init__(self, pkg_path): twisted.web.resource.Resource.__init__(self) self.data = read_resource(pkg_path) def render(self, request): return self.data def create_site(store): root = twisted.web.resource.Resource() root.putChild('', StaticResource('static/index.html')) root.putChild('db', NamespaceResource(store)) return twisted.web.server.Site(root) py-lmdb-py-lmdb_1.0.0/examples/nastybench.py000066400000000000000000000042041372223456500210370ustar00rootroot00000000000000 # Roughly approximates some of Symas microbenchmark. from time import time import random import shutil import os import tempfile import lmdb val = ' ' * 100 MAX_KEYS = int(1e6) t0 = time() urandom = file('/dev/urandom', 'rb', 1048576).read keys = set() while len(keys) < MAX_KEYS: for _ in xrange(min(1000, MAX_KEYS - len(keys))): keys.add(urandom(16)) print 'make %d keys in %.2fsec' % (len(keys), time() - t0) keys = list(keys) if os.path.exists('/ram'): DB_PATH = '/ram/dbtest' else: DB_PATH = tempfile.mktemp(prefix='nastybench') if os.path.exists(DB_PATH): shutil.rmtree(DB_PATH) env = lmdb.open(DB_PATH, map_size=1048576 * 1024, metasync=False, sync=False, map_async=True) nextkey = iter(keys).next run = True while run: with env.begin(write=True) as txn: try: for _ in xrange(10000): txn.put(nextkey(), val) except StopIteration: run = False d = time() - t0 env.sync(True) print 'insert %d keys in %.2fsec (%d/sec)' % (len(keys), d, len(keys) / d) nextkey = iter(keys).next t0 = time() with env.begin() as txn: try: while 1: txn.get(nextkey()) except StopIteration: pass d = time() - t0 print 'random lookup %d keys in %.2fsec (%d/sec)' % (len(keys), d, len(keys)/d) nextkey = iter(keys).next t0 = time() with env.begin(buffers=True) as txn: try: while 1: txn.get(nextkey()) except StopIteration: pass d = time() - t0 print 'random lookup %d buffers in %.2fsec (%d/sec)' % (len(keys), d, len(keys)/d) nextkey = iter(keys).next t0 = time() with env.begin(buffers=True) as txn: try: while 1: hash(txn.get(nextkey())) except StopIteration: pass d = time() - t0 print 'random lookup+hash %d buffers in %.2fsec (%d/sec)' % (len(keys), d, len(keys)/d) nextkey = iter(keys).next t0 = time() with env.begin(buffers=True) as txn: nextrec = txn.cursor().iternext().next try: while 1: nextrec() except StopIteration: pass d = time() - t0 print 'seq read %d buffers in %.2fsec (%d/sec)' % (len(keys), d, len(keys)/d) py-lmdb-py-lmdb_1.0.0/examples/parabench.py000066400000000000000000000046041372223456500206300ustar00rootroot00000000000000 # Roughly approximates some of Symas microbenchmark. import multiprocessing import os import random import shutil import sys import tempfile import time try: import affinity except: affinity = False import lmdb USE_SPARSE_FILES = sys.platform != 'darwin' DB_PATH = '/ram/dbtest' MAX_KEYS = int(4e6) if os.path.exists('/ram'): DB_PATH = '/ram/dbtest' else: DB_PATH = tempfile.mktemp(prefix='parabench') def open_env(): return lmdb.open(DB_PATH, map_size=1048576 * 1024, metasync=False, sync=False, map_async=True, writemap=USE_SPARSE_FILES) def make_keys(): t0 = time.time() urandom = file('/dev/urandom', 'rb', 1048576).read keys = set() while len(keys) < MAX_KEYS: for _ in xrange(min(1000, MAX_KEYS - len(keys))): keys.add(urandom(16)) print 'make %d keys in %.2fsec' % (len(keys), time.time() - t0) keys = list(keys) nextkey = iter(keys).next run = True val = ' ' * 100 env = open_env() while run: with env.begin(write=True) as txn: try: for _ in xrange(10000): txn.put(nextkey(), val) except StopIteration: run = False d = time.time() - t0 env.sync(True) env.close() print 'insert %d keys in %.2fsec (%d/sec)' % (len(keys), d, len(keys) / d) if 'drop' in sys.argv and os.path.exists(DB_PATH): shutil.rmtree(DB_PATH) if not os.path.exists(DB_PATH): make_keys() env = open_env() with env.begin() as txn: keys = list(txn.cursor().iternext(values=False)) env.close() def run(idx): if affinity: affinity.set_process_affinity_mask(os.getpid(), 1 << idx) env = open_env() k = list(keys) random.shuffle(k) k = k[:1000] while 1: with env.begin() as txn: nextkey = iter(k).next try: while 1: hash(txn.get(nextkey())) except StopIteration: pass arr[idx] += len(k) nproc = int(sys.argv[1]) arr = multiprocessing.Array('L', xrange(nproc)) for x in xrange(nproc): arr[x] = 0 procs = [multiprocessing.Process(target=run, args=(x,)) for x in xrange(nproc)] [p.start() for p in procs] t0 = time.time() while True: time.sleep(2) d = time.time() - t0 lk = sum(arr) print 'lookup %d keys in %.2fsec (%d/sec)' % (lk, d, lk / d) py-lmdb-py-lmdb_1.0.0/examples/words.gz000066400000000000000000024201551372223456500200400ustar00rootroot00000000000000$SdiVs 2 uz ~oEb'!*?JJ뿼1_ Z$4eAyǿ#}$=v:WZ `$:!\PZvutpI9(OWA|uFt rOe#!j 2s-;1E e^izds7X  0>jYG08Zpj>⎄$UT(ԵjdCRM4B]pEV[$An-冦h Uh""2F>ɮy#E3hUQI)ZbEތg%Lmwa^WdWC{HR۩q* l>=!T,448=Zj)#9:TDLjzD90yT5Z5i OePG k4F=ثoE\Gmi{uwzb&Ht!`µ(a3NMR=F{ŽuNh_ ?N^ Iny(Yv`f?֢}F' v㘧vZBCS@NܜPڄI#W٬@rR)C5{H04WjiAͥOZn6B3qeZ%F+b)C6KZy|Ʉ04HokGA)! Xn P[LquΩBxLhNˠnZn7ipʿ]o0|A)U\iHT@Ōc:?xa6;%à Tr *_8Z+W"amSTNe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6G찇RЏs*rˆ8WA1;;xPV>e GVZtoϦPj ! -+sIuZ\(ݢaPImx;\i+vY W9Zӝ^PBKSZԬjfuṁ$ vvP-0,xzK=T_3%dN\̫R_YeƁ>ͧV?qqdVZ!,e`3'T^ hz%n^t'M`TpXO)EVK,˞ -IBβBxHX_RK]2uunV=USv&,L-<N hga&zCmfDe5"u+/DC Bή{,Ne4nG/7;tʳw/;8⃛'e89 NĊ&SV^3'] 4r,BW QS,&vvr,7P li6i1,Qe<)q?(,9}khv##$# -w34%qMMo8s[v:u_J.{wJݺp;\/O"]Oڕ$'Z(MK'Y;_WJW4LL]+& Ӫ+NG/+:h$oI(OOk޹JqЌ`V{EgqDUOw F,^)<@oz“ h'A[`51rDѧܙ~ԅ~Z#!jH<]Go_^JD$=ȥ ˤBgP'&+$;y@-G.G:b>?r\|Ku}Q;Oowl15‘'۹JwVHd (1g )|#@niw2sGe[&^\v|c tQGd`YVFf#vPa;Bh74iӂBp?4ͭ!͡Խ.+$0n7#F˸%=7oh&Sta; /?|VPVpX}.T #(> &py-lmdb-py-lmdb_1.0.0/lib/000077500000000000000000000000001372223456500152575ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/lib/lmdb.h000066400000000000000000002204351372223456500163540ustar00rootroot00000000000000/** @file lmdb.h * @brief Lightning memory-mapped database library * * @mainpage Lightning Memory-Mapped Database Manager (LMDB) * * @section intro_sec Introduction * LMDB is a Btree-based database management library modeled loosely on the * BerkeleyDB API, but much simplified. The entire database is exposed * in a memory map, and all data fetches return data directly * from the mapped memory, so no malloc's or memcpy's occur during * data fetches. As such, the library is extremely simple because it * requires no page caching layer of its own, and it is extremely high * performance and memory-efficient. It is also fully transactional with * full ACID semantics, and when the memory map is read-only, the * database integrity cannot be corrupted by stray pointer writes from * application code. * * The library is fully thread-aware and supports concurrent read/write * access from multiple processes and threads. Data pages use a copy-on- * write strategy so no active data pages are ever overwritten, which * also provides resistance to corruption and eliminates the need of any * special recovery procedures after a system crash. Writes are fully * serialized; only one write transaction may be active at a time, which * guarantees that writers can never deadlock. The database structure is * multi-versioned so readers run with no locks; writers cannot block * readers, and readers don't block writers. * * Unlike other well-known database mechanisms which use either write-ahead * transaction logs or append-only data writes, LMDB requires no maintenance * during operation. Both write-ahead loggers and append-only databases * require periodic checkpointing and/or compaction of their log or database * files otherwise they grow without bound. LMDB tracks free pages within * the database and re-uses them for new write operations, so the database * size does not grow without bound in normal use. * * The memory map can be used as a read-only or read-write map. It is * read-only by default as this provides total immunity to corruption. * Using read-write mode offers much higher write performance, but adds * the possibility for stray application writes thru pointers to silently * corrupt the database. Of course if your application code is known to * be bug-free (...) then this is not an issue. * * If this is your first time using a transactional embedded key/value * store, you may find the \ref starting page to be helpful. * * @section caveats_sec Caveats * Troubleshooting the lock file, plus semaphores on BSD systems: * * - A broken lockfile can cause sync issues. * Stale reader transactions left behind by an aborted program * cause further writes to grow the database quickly, and * stale locks can block further operation. * * Fix: Check for stale readers periodically, using the * #mdb_reader_check function or the \ref mdb_stat_1 "mdb_stat" tool. * Stale writers will be cleared automatically on some systems: * - Windows - automatic * - Linux, systems using POSIX mutexes with Robust option - automatic * - not on BSD, systems using POSIX semaphores. * Otherwise just make all programs using the database close it; * the lockfile is always reset on first open of the environment. * * - On BSD systems or others configured with MDB_USE_POSIX_SEM, * startup can fail due to semaphores owned by another userid. * * Fix: Open and close the database as the user which owns the * semaphores (likely last user) or as root, while no other * process is using the database. * * Restrictions/caveats (in addition to those listed for some functions): * * - Only the database owner should normally use the database on * BSD systems or when otherwise configured with MDB_USE_POSIX_SEM. * Multiple users can cause startup to fail later, as noted above. * * - There is normally no pure read-only mode, since readers need write * access to locks and lock file. Exceptions: On read-only filesystems * or with the #MDB_NOLOCK flag described under #mdb_env_open(). * * - An LMDB configuration will often reserve considerable \b unused * memory address space and maybe file size for future growth. * This does not use actual memory or disk space, but users may need * to understand the difference so they won't be scared off. * * - By default, in versions before 0.9.10, unused portions of the data * file might receive garbage data from memory freed by other code. * (This does not happen when using the #MDB_WRITEMAP flag.) As of * 0.9.10 the default behavior is to initialize such memory before * writing to the data file. Since there may be a slight performance * cost due to this initialization, applications may disable it using * the #MDB_NOMEMINIT flag. Applications handling sensitive data * which must not be written should not use this flag. This flag is * irrelevant when using #MDB_WRITEMAP. * * - A thread can only use one transaction at a time, plus any child * transactions. Each transaction belongs to one thread. See below. * The #MDB_NOTLS flag changes this for read-only transactions. * * - Use an MDB_env* in the process which opened it, not after fork(). * * - Do not have open an LMDB database twice in the same process at * the same time. Not even from a plain open() call - close()ing it * breaks fcntl() advisory locking. (It is OK to reopen it after * fork() - exec*(), since the lockfile has FD_CLOEXEC set.) * * - Avoid long-lived transactions. Read transactions prevent * reuse of pages freed by newer write transactions, thus the * database can grow quickly. Write transactions prevent * other write transactions, since writes are serialized. * * - 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. * * ...when several processes can use a database concurrently: * * - Avoid aborting a process with an active transaction. * The transaction becomes "long-lived" as above until a check * for stale readers is performed or the lockfile is reset, * since the process may not remove it from the lockfile. * * This does not apply to write transactions if the system clears * stale writers, see above. * * - If you do that anyway, do a periodic check for stale readers. Or * close the environment once in a while, so the lockfile can get reset. * * - Do not use LMDB databases on remote filesystems, even between * processes on the same host. This breaks flock() on some OSes, * possibly memory map sync, and certainly sync between programs * on different hosts. * * - Opening a database can fail if another process is opening or * closing it at exactly the same time. * * @author Howard Chu, Symas Corporation. * * @copyright Copyright 2011-2019 Howard Chu, Symas Corp. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted only as authorized by the OpenLDAP * Public License. * * A copy of this license is available in the file LICENSE in the * top-level directory of the distribution or, alternatively, at * . * * @par Derived From: * This code is derived from btree.c written by Martin Hedenfalk. * * Copyright (c) 2009, 2010 Martin Hedenfalk * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _LMDB_H_ #define _LMDB_H_ #include #ifdef __cplusplus extern "C" { #endif /** Unix permissions for creating files, or dummy definition for Windows */ #ifdef _MSC_VER typedef int mdb_mode_t; #else typedef mode_t mdb_mode_t; #endif /** An abstraction for a file handle. * On POSIX systems file handles are small integers. On Windows * they're opaque pointers. */ #ifdef _WIN32 typedef void *mdb_filehandle_t; #else typedef int mdb_filehandle_t; #endif /** @defgroup mdb LMDB API * @{ * @brief OpenLDAP Lightning Memory-Mapped Database Manager */ /** @defgroup Version Version Macros * @{ */ /** Library major version */ #define MDB_VERSION_MAJOR 0 /** Library minor version */ #define MDB_VERSION_MINOR 9 /** Library patch version */ #define MDB_VERSION_PATCH 24 /** Combine args a,b,c into a single integer for easy version comparisons */ #define MDB_VERINT(a,b,c) (((a) << 24) | ((b) << 16) | (c)) /** The full library version as a single integer */ #define MDB_VERSION_FULL \ MDB_VERINT(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH) /** The release date of this library version */ #define MDB_VERSION_DATE "July 24, 2019" /** A stringifier for the version info */ #define MDB_VERSTR(a,b,c,d) "LMDB " #a "." #b "." #c ": (" d ")" /** A helper for the stringifier macro */ #define MDB_VERFOO(a,b,c,d) MDB_VERSTR(a,b,c,d) /** The full library version as a C string */ #define MDB_VERSION_STRING \ MDB_VERFOO(MDB_VERSION_MAJOR,MDB_VERSION_MINOR,MDB_VERSION_PATCH,MDB_VERSION_DATE) /** @} */ /** @brief Opaque structure for a database environment. * * A DB environment supports multiple databases, all residing in the same * shared-memory map. */ typedef struct MDB_env MDB_env; /** @brief Opaque structure for a transaction handle. * * All database operations require a transaction handle. Transactions may be * read-only or read-write. */ typedef struct MDB_txn MDB_txn; /** @brief A handle for an individual database in the DB environment. */ typedef unsigned int MDB_dbi; /** @brief Opaque structure for navigating through a database */ typedef struct MDB_cursor MDB_cursor; /** @brief Generic structure used for passing keys and data in and out * of the database. * * Values returned from the database are valid only until a subsequent * update operation, or the end of the transaction. Do not modify or * free them, they commonly point into the database itself. * * Key sizes must be between 1 and #mdb_env_get_maxkeysize() inclusive. * The same applies to data sizes in databases with the #MDB_DUPSORT flag. * Other data items can in theory be from 0 to 0xffffffff bytes long. */ typedef struct MDB_val { size_t mv_size; /**< size of the data item */ void *mv_data; /**< address of the data item */ } MDB_val; /** @brief A callback function used to compare two keys in a database */ typedef int (MDB_cmp_func)(const MDB_val *a, const MDB_val *b); /** @brief A callback function used to relocate a position-dependent data item * in a fixed-address database. * * The \b newptr gives the item's desired address in * the memory map, and \b oldptr gives its previous address. The item's actual * data resides at the address in \b item. This callback is expected to walk * through the fields of the record in \b item and modify any * values based at the \b oldptr address to be relative to the \b newptr address. * @param[in,out] item The item that is to be relocated. * @param[in] oldptr The previous address. * @param[in] newptr The new address to relocate to. * @param[in] relctx An application-provided context, set by #mdb_set_relctx(). * @todo This feature is currently unimplemented. */ typedef void (MDB_rel_func)(MDB_val *item, void *oldptr, void *newptr, void *relctx); /** @defgroup mdb_env Environment Flags * @{ */ /** mmap at a fixed address (experimental) */ #define MDB_FIXEDMAP 0x01 /** no environment directory */ #define MDB_NOSUBDIR 0x4000 /** don't fsync after commit */ #define MDB_NOSYNC 0x10000 /** read only */ #define MDB_RDONLY 0x20000 /** don't fsync metapage after commit */ #define MDB_NOMETASYNC 0x40000 /** use writable mmap */ #define MDB_WRITEMAP 0x80000 /** use asynchronous msync when #MDB_WRITEMAP is used */ #define MDB_MAPASYNC 0x100000 /** tie reader locktable slots to #MDB_txn objects instead of to threads */ #define MDB_NOTLS 0x200000 /** don't do any locking, caller must manage their own locks */ #define MDB_NOLOCK 0x400000 /** don't do readahead (no effect on Windows) */ #define MDB_NORDAHEAD 0x800000 /** don't initialize malloc'd memory before writing to datafile */ #define MDB_NOMEMINIT 0x1000000 /** @} */ /** @defgroup mdb_dbi_open Database Flags * @{ */ /** use reverse string keys */ #define MDB_REVERSEKEY 0x02 /** use sorted duplicates */ #define MDB_DUPSORT 0x04 /** numeric keys in native byte order: either unsigned int or size_t. * The keys must all be of the same size. */ #define MDB_INTEGERKEY 0x08 /** with #MDB_DUPSORT, sorted dup items have fixed size */ #define MDB_DUPFIXED 0x10 /** with #MDB_DUPSORT, dups are #MDB_INTEGERKEY-style integers */ #define MDB_INTEGERDUP 0x20 /** with #MDB_DUPSORT, use reverse string dups */ #define MDB_REVERSEDUP 0x40 /** create DB if not already existing */ #define MDB_CREATE 0x40000 /** @} */ /** @defgroup mdb_put Write Flags * @{ */ /** For put: Don't write if the key already exists. */ #define MDB_NOOVERWRITE 0x10 /** Only for #MDB_DUPSORT
      * For put: don't write if the key and data pair already exist.
      * For mdb_cursor_del: remove all duplicate data items. */ #define MDB_NODUPDATA 0x20 /** For mdb_cursor_put: overwrite the current key/data pair */ #define MDB_CURRENT 0x40 /** For put: Just reserve space for data, don't copy it. Return a * pointer to the reserved space. */ #define MDB_RESERVE 0x10000 /** Data is being appended, don't split full pages. */ #define MDB_APPEND 0x20000 /** Duplicate data is being appended, don't split full pages. */ #define MDB_APPENDDUP 0x40000 /** Store multiple data items in one call. Only for #MDB_DUPFIXED. */ #define MDB_MULTIPLE 0x80000 /* @} */ /** @defgroup mdb_copy Copy Flags * @{ */ /** Compacting copy: Omit free space from copy, and renumber all * pages sequentially. */ #define MDB_CP_COMPACT 0x01 /* @} */ /** @brief Cursor Get operations. * * This is the set of all operations for retrieving data * using a cursor. */ typedef enum MDB_cursor_op { MDB_FIRST, /**< Position at first key/data item */ MDB_FIRST_DUP, /**< Position at first data item of current key. Only for #MDB_DUPSORT */ MDB_GET_BOTH, /**< Position at key/data pair. Only for #MDB_DUPSORT */ MDB_GET_BOTH_RANGE, /**< position at key, nearest data. Only for #MDB_DUPSORT */ MDB_GET_CURRENT, /**< Return key/data at current cursor position */ MDB_GET_MULTIPLE, /**< Return up to a page of duplicate data items from current cursor position. Move cursor to prepare for #MDB_NEXT_MULTIPLE. Only for #MDB_DUPFIXED */ MDB_LAST, /**< Position at last key/data item */ MDB_LAST_DUP, /**< Position at last data item of current key. Only for #MDB_DUPSORT */ MDB_NEXT, /**< Position at next data item */ MDB_NEXT_DUP, /**< Position at next data item of current key. Only for #MDB_DUPSORT */ MDB_NEXT_MULTIPLE, /**< Return up to a page of duplicate data items from next cursor position. Move cursor to prepare for #MDB_NEXT_MULTIPLE. Only for #MDB_DUPFIXED */ MDB_NEXT_NODUP, /**< Position at first data item of next key */ MDB_PREV, /**< Position at previous data item */ MDB_PREV_DUP, /**< Position at previous data item of current key. Only for #MDB_DUPSORT */ MDB_PREV_NODUP, /**< Position at last data item of previous key */ MDB_SET, /**< Position at specified key */ MDB_SET_KEY, /**< Position at specified key, return key + data */ MDB_SET_RANGE, /**< Position at first key greater than or equal to specified key. */ MDB_PREV_MULTIPLE /**< Position at previous page and return up to a page of duplicate data items. Only for #MDB_DUPFIXED */ } MDB_cursor_op; /** @defgroup errors Return Codes * * BerkeleyDB uses -30800 to -30999, we'll go under them * @{ */ /** Successful result */ #define MDB_SUCCESS 0 /** key/data pair already exists */ #define MDB_KEYEXIST (-30799) /** key/data pair not found (EOF) */ #define MDB_NOTFOUND (-30798) /** Requested page not found - this usually indicates corruption */ #define MDB_PAGE_NOTFOUND (-30797) /** Located page was wrong type */ #define MDB_CORRUPTED (-30796) /** Update of meta page failed or environment had fatal error */ #define MDB_PANIC (-30795) /** Environment version mismatch */ #define MDB_VERSION_MISMATCH (-30794) /** File is not a valid LMDB file */ #define MDB_INVALID (-30793) /** Environment mapsize reached */ #define MDB_MAP_FULL (-30792) /** Environment maxdbs reached */ #define MDB_DBS_FULL (-30791) /** Environment maxreaders reached */ #define MDB_READERS_FULL (-30790) /** Too many TLS keys in use - Windows only */ #define MDB_TLS_FULL (-30789) /** Txn has too many dirty pages */ #define MDB_TXN_FULL (-30788) /** Cursor stack too deep - internal error */ #define MDB_CURSOR_FULL (-30787) /** Page has not enough space - internal error */ #define MDB_PAGE_FULL (-30786) /** Database contents grew beyond environment mapsize */ #define MDB_MAP_RESIZED (-30785) /** Operation and DB incompatible, or DB type changed. This can mean: *

        *
      • The operation expects an #MDB_DUPSORT / #MDB_DUPFIXED database. *
      • Opening a named DB when the unnamed DB has #MDB_DUPSORT / #MDB_INTEGERKEY. *
      • Accessing a data record as a database, or vice versa. *
      • The database was dropped and recreated with different flags. *
      */ #define MDB_INCOMPATIBLE (-30784) /** Invalid reuse of reader locktable slot */ #define MDB_BAD_RSLOT (-30783) /** Transaction must abort, has a child, or is invalid */ #define MDB_BAD_TXN (-30782) /** Unsupported size of key/DB name/data, or wrong DUPFIXED size */ #define MDB_BAD_VALSIZE (-30781) /** The specified DBI was changed unexpectedly */ #define MDB_BAD_DBI (-30780) /** The last defined error code */ #define MDB_LAST_ERRCODE MDB_BAD_DBI /** @} */ /** @brief Statistics for a database in the environment */ typedef struct MDB_stat { unsigned int ms_psize; /**< Size of a database page. This is currently the same for all databases. */ unsigned int ms_depth; /**< Depth (height) of the B-tree */ size_t ms_branch_pages; /**< Number of internal (non-leaf) pages */ size_t ms_leaf_pages; /**< Number of leaf pages */ size_t ms_overflow_pages; /**< Number of overflow pages */ size_t ms_entries; /**< Number of data items */ } MDB_stat; /** @brief Information about the environment */ typedef struct MDB_envinfo { void *me_mapaddr; /**< Address of map, if fixed */ size_t me_mapsize; /**< Size of the data memory map */ size_t me_last_pgno; /**< ID of the last used page */ size_t me_last_txnid; /**< ID of the last committed transaction */ unsigned int me_maxreaders; /**< max reader slots in the environment */ unsigned int me_numreaders; /**< max reader slots used in the environment */ } MDB_envinfo; /** @brief Return the LMDB library version information. * * @param[out] major if non-NULL, the library major version number is copied here * @param[out] minor if non-NULL, the library minor version number is copied here * @param[out] patch if non-NULL, the library patch version number is copied here * @retval "version string" The library version as a string */ char *mdb_version(int *major, int *minor, int *patch); /** @brief Return a string describing a given error code. * * This function is a superset of the ANSI C X3.159-1989 (ANSI C) strerror(3) * function. If the error code is greater than or equal to 0, then the string * returned by the system function strerror(3) is returned. If the error code * is less than 0, an error string corresponding to the LMDB library error is * returned. See @ref errors for a list of LMDB-specific error codes. * @param[in] err The error code * @retval "error message" The description of the error */ char *mdb_strerror(int err); /** @brief Create an LMDB environment handle. * * This function allocates memory for a #MDB_env structure. To release * the allocated memory and discard the handle, call #mdb_env_close(). * Before the handle may be used, it must be opened using #mdb_env_open(). * Various other options may also need to be set before opening the handle, * e.g. #mdb_env_set_mapsize(), #mdb_env_set_maxreaders(), #mdb_env_set_maxdbs(), * depending on usage requirements. * @param[out] env The address where the new handle will be stored * @return A non-zero error value on failure and 0 on success. */ int mdb_env_create(MDB_env **env); /** @brief Open an environment handle. * * If this function fails, #mdb_env_close() must be called to discard the #MDB_env handle. * @param[in] env An environment handle returned by #mdb_env_create() * @param[in] path The directory in which the database files reside. This * directory must already exist and be writable. * @param[in] flags Special options for this environment. This parameter * must be set to 0 or by bitwise OR'ing together one or more of the * values described here. * Flags set by mdb_env_set_flags() are also used. *
        *
      • #MDB_FIXEDMAP * use a fixed address for the mmap region. This flag must be specified * when creating the environment, and is stored persistently in the environment. * If successful, the memory map will always reside at the same virtual address * and pointers used to reference data items in the database will be constant * across multiple invocations. This option may not always work, depending on * how the operating system has allocated memory to shared libraries and other uses. * The feature is highly experimental. *
      • #MDB_NOSUBDIR * By default, LMDB creates its environment in a directory whose * pathname is given in \b path, and creates its data and lock files * under that directory. With this option, \b path is used as-is for * the database main data file. The database lock file is the \b path * with "-lock" appended. *
      • #MDB_RDONLY * Open the environment in read-only mode. No write operations will be * allowed. LMDB will still modify the lock file - except on read-only * filesystems, where LMDB does not use locks. *
      • #MDB_WRITEMAP * Use a writeable memory map unless MDB_RDONLY is set. This uses * fewer mallocs but loses protection from application bugs * like wild pointer writes and other bad updates into the database. * This may be slightly faster for DBs that fit entirely in RAM, but * is slower for DBs larger than RAM. * Incompatible with nested transactions. * Do not mix processes with and without MDB_WRITEMAP on the same * environment. This can defeat durability (#mdb_env_sync etc). *
      • #MDB_NOMETASYNC * Flush system buffers to disk only once per transaction, omit the * metadata flush. Defer that until the system flushes files to disk, * or next non-MDB_RDONLY commit or #mdb_env_sync(). This optimization * maintains database integrity, but a system crash may undo the last * committed transaction. I.e. it preserves the ACI (atomicity, * consistency, isolation) but not D (durability) database property. * This flag may be changed at any time using #mdb_env_set_flags(). *
      • #MDB_NOSYNC * Don't flush system buffers to disk when committing a transaction. * This optimization means a system crash can corrupt the database or * lose the last transactions if buffers are not yet flushed to disk. * The risk is governed by how often the system flushes dirty buffers * to disk and how often #mdb_env_sync() is called. However, if the * filesystem preserves write order and the #MDB_WRITEMAP flag is not * used, transactions exhibit ACI (atomicity, consistency, isolation) * properties and only lose D (durability). I.e. database integrity * is maintained, but a system crash may undo the final transactions. * Note that (#MDB_NOSYNC | #MDB_WRITEMAP) leaves the system with no * hint for when to write transactions to disk, unless #mdb_env_sync() * is called. (#MDB_MAPASYNC | #MDB_WRITEMAP) may be preferable. * This flag may be changed at any time using #mdb_env_set_flags(). *
      • #MDB_MAPASYNC * When using #MDB_WRITEMAP, use asynchronous flushes to disk. * As with #MDB_NOSYNC, a system crash can then corrupt the * database or lose the last transactions. Calling #mdb_env_sync() * ensures on-disk database integrity until next commit. * This flag may be changed at any time using #mdb_env_set_flags(). *
      • #MDB_NOTLS * Don't use Thread-Local Storage. Tie reader locktable slots to * #MDB_txn objects instead of to threads. I.e. #mdb_txn_reset() keeps * the slot reseved for the #MDB_txn object. A thread may use parallel * read-only transactions. A read-only transaction may span threads if * the user synchronizes its use. Applications that multiplex many * user threads over individual OS threads need this option. Such an * application must also serialize the write transactions in an OS * thread, since LMDB's write locking is unaware of the user threads. *
      • #MDB_NOLOCK * Don't do any locking. If concurrent access is anticipated, the * caller must manage all concurrency itself. For proper operation * the caller must enforce single-writer semantics, and must ensure * that no readers are using old transactions while a writer is * active. The simplest approach is to use an exclusive lock so that * no readers may be active at all when a writer begins. *
      • #MDB_NORDAHEAD * Turn off readahead. Most operating systems perform readahead on * read requests by default. This option turns it off if the OS * supports it. Turning it off may help random read performance * when the DB is larger than RAM and system RAM is full. * The option is not implemented on Windows. *
      • #MDB_NOMEMINIT * Don't initialize malloc'd memory before writing to unused spaces * in the data file. By default, memory for pages written to the data * file is obtained using malloc. While these pages may be reused in * subsequent transactions, freshly malloc'd pages will be initialized * to zeroes before use. This avoids persisting leftover data from other * code (that used the heap and subsequently freed the memory) into the * data file. Note that many other system libraries may allocate * and free memory from the heap for arbitrary uses. E.g., stdio may * use the heap for file I/O buffers. This initialization step has a * modest performance cost so some applications may want to disable * it using this flag. This option can be a problem for applications * which handle sensitive data like passwords, and it makes memory * checkers like Valgrind noisy. This flag is not needed with #MDB_WRITEMAP, * which writes directly to the mmap instead of using malloc for pages. The * initialization is also skipped if #MDB_RESERVE is used; the * caller is expected to overwrite all of the memory that was * reserved in that case. * This flag may be changed at any time using #mdb_env_set_flags(). *
      * @param[in] mode The UNIX permissions to set on created files and semaphores. * This parameter is ignored on Windows. * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • #MDB_VERSION_MISMATCH - the version of the LMDB library doesn't match the * version that created the database environment. *
      • #MDB_INVALID - the environment file headers are corrupted. *
      • ENOENT - the directory specified by the path parameter doesn't exist. *
      • EACCES - the user didn't have permission to access the environment files. *
      • EAGAIN - the environment was locked by another process. *
      */ int mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode); /** @brief Copy an LMDB environment to the specified path. * * This function may be used to make a backup of an existing environment. * No lockfile is created, since it gets recreated at need. * @note This call can trigger significant file size growth if run in * parallel with write transactions, because it employs a read-only * transaction. See long-lived transactions under @ref caveats_sec. * @param[in] env An environment handle returned by #mdb_env_create(). It * must have already been opened successfully. * @param[in] path The directory in which the copy will reside. This * directory must already exist and be writable but must otherwise be * empty. * @return A non-zero error value on failure and 0 on success. */ int mdb_env_copy(MDB_env *env, const char *path); /** @brief Copy an LMDB environment to the specified file descriptor. * * This function may be used to make a backup of an existing environment. * No lockfile is created, since it gets recreated at need. * @note This call can trigger significant file size growth if run in * parallel with write transactions, because it employs a read-only * transaction. See long-lived transactions under @ref caveats_sec. * @param[in] env An environment handle returned by #mdb_env_create(). It * must have already been opened successfully. * @param[in] fd The filedescriptor to write the copy to. It must * have already been opened for Write access. * @return A non-zero error value on failure and 0 on success. */ int mdb_env_copyfd(MDB_env *env, mdb_filehandle_t fd); /** @brief Copy an LMDB environment to the specified path, with options. * * This function may be used to make a backup of an existing environment. * No lockfile is created, since it gets recreated at need. * @note This call can trigger significant file size growth if run in * parallel with write transactions, because it employs a read-only * transaction. See long-lived transactions under @ref caveats_sec. * @param[in] env An environment handle returned by #mdb_env_create(). It * must have already been opened successfully. * @param[in] path The directory in which the copy will reside. This * directory must already exist and be writable but must otherwise be * empty. * @param[in] flags Special options for this operation. This parameter * must be set to 0 or by bitwise OR'ing together one or more of the * values described here. *
        *
      • #MDB_CP_COMPACT - Perform compaction while copying: omit free * pages and sequentially renumber all pages in output. This option * consumes more CPU and runs more slowly than the default. * Currently it fails if the environment has suffered a page leak. *
      * @return A non-zero error value on failure and 0 on success. */ int mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags); /** @brief Copy an LMDB environment to the specified file descriptor, * with options. * * This function may be used to make a backup of an existing environment. * No lockfile is created, since it gets recreated at need. See * #mdb_env_copy2() for further details. * @note This call can trigger significant file size growth if run in * parallel with write transactions, because it employs a read-only * transaction. See long-lived transactions under @ref caveats_sec. * @param[in] env An environment handle returned by #mdb_env_create(). It * must have already been opened successfully. * @param[in] fd The filedescriptor to write the copy to. It must * have already been opened for Write access. * @param[in] flags Special options for this operation. * See #mdb_env_copy2() for options. * @return A non-zero error value on failure and 0 on success. */ int mdb_env_copyfd2(MDB_env *env, mdb_filehandle_t fd, unsigned int flags); /** @brief Return statistics about the LMDB environment. * * @param[in] env An environment handle returned by #mdb_env_create() * @param[out] stat The address of an #MDB_stat structure * where the statistics will be copied */ int mdb_env_stat(MDB_env *env, MDB_stat *stat); /** @brief Return information about the LMDB environment. * * @param[in] env An environment handle returned by #mdb_env_create() * @param[out] stat The address of an #MDB_envinfo structure * where the information will be copied */ int mdb_env_info(MDB_env *env, MDB_envinfo *stat); /** @brief Flush the data buffers to disk. * * Data is always written to disk when #mdb_txn_commit() is called, * but the operating system may keep it buffered. LMDB always flushes * the OS buffers upon commit as well, unless the environment was * opened with #MDB_NOSYNC or in part #MDB_NOMETASYNC. This call is * not valid if the environment was opened with #MDB_RDONLY. * @param[in] env An environment handle returned by #mdb_env_create() * @param[in] force If non-zero, force a synchronous flush. Otherwise * if the environment has the #MDB_NOSYNC flag set the flushes * will be omitted, and with #MDB_MAPASYNC they will be asynchronous. * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EACCES - the environment is read-only. *
      • EINVAL - an invalid parameter was specified. *
      • EIO - an error occurred during synchronization. *
      */ int mdb_env_sync(MDB_env *env, int force); /** @brief Close the environment and release the memory map. * * Only a single thread may call this function. All transactions, databases, * and cursors must already be closed before calling this function. Attempts to * use any such handles after calling this function will cause a SIGSEGV. * The environment handle will be freed and must not be used again after this call. * @param[in] env An environment handle returned by #mdb_env_create() */ void mdb_env_close(MDB_env *env); /** @brief Set environment flags. * * This may be used to set some flags in addition to those from * #mdb_env_open(), or to unset these flags. If several threads * change the flags at the same time, the result is undefined. * @param[in] env An environment handle returned by #mdb_env_create() * @param[in] flags The flags to change, bitwise OR'ed together * @param[in] onoff A non-zero value sets the flags, zero clears them. * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_env_set_flags(MDB_env *env, unsigned int flags, int onoff); /** @brief Get environment flags. * * @param[in] env An environment handle returned by #mdb_env_create() * @param[out] flags The address of an integer to store the flags * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_env_get_flags(MDB_env *env, unsigned int *flags); /** @brief Return the path that was used in #mdb_env_open(). * * @param[in] env An environment handle returned by #mdb_env_create() * @param[out] path Address of a string pointer to contain the path. This * is the actual string in the environment, not a copy. It should not be * altered in any way. * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_env_get_path(MDB_env *env, const char **path); /** @brief Return the filedescriptor for the given environment. * * This function may be called after fork(), so the descriptor can be * closed before exec*(). Other LMDB file descriptors have FD_CLOEXEC. * (Until LMDB 0.9.18, only the lockfile had that.) * * @param[in] env An environment handle returned by #mdb_env_create() * @param[out] fd Address of a mdb_filehandle_t to contain the descriptor. * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_env_get_fd(MDB_env *env, mdb_filehandle_t *fd); /** @brief Set the size of the memory map to use for this environment. * * The size should be a multiple of the OS page size. The default is * 10485760 bytes. The size of the memory map is also the maximum size * of the database. The value should be chosen as large as possible, * to accommodate future growth of the database. * This function should be called after #mdb_env_create() and before #mdb_env_open(). * It may be called at later times if no transactions are active in * this process. Note that the library does not check for this condition, * the caller must ensure it explicitly. * * The new size takes effect immediately for the current process but * will not be persisted to any others until a write transaction has been * committed by the current process. Also, only mapsize increases are * persisted into the environment. * * If the mapsize is increased by another process, and data has grown * beyond the range of the current mapsize, #mdb_txn_begin() will * return #MDB_MAP_RESIZED. This function may be called with a size * of zero to adopt the new size. * * Any attempt to set a size smaller than the space already consumed * by the environment will be silently changed to the current size of the used space. * @param[in] env An environment handle returned by #mdb_env_create() * @param[in] size The size in bytes * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified, or the environment has * an active write transaction. *
      */ int mdb_env_set_mapsize(MDB_env *env, size_t size); /** @brief Set the maximum number of threads/reader slots for the environment. * * This defines the number of slots in the lock table that is used to track readers in the * the environment. The default is 126. * Starting a read-only transaction normally ties a lock table slot to the * current thread until the environment closes or the thread exits. If * MDB_NOTLS is in use, #mdb_txn_begin() instead ties the slot to the * MDB_txn object until it or the #MDB_env object is destroyed. * This function may only be called after #mdb_env_create() and before #mdb_env_open(). * @param[in] env An environment handle returned by #mdb_env_create() * @param[in] readers The maximum number of reader lock table slots * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified, or the environment is already open. *
      */ int mdb_env_set_maxreaders(MDB_env *env, unsigned int readers); /** @brief Get the maximum number of threads/reader slots for the environment. * * @param[in] env An environment handle returned by #mdb_env_create() * @param[out] readers Address of an integer to store the number of readers * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers); /** @brief Set the maximum number of named databases for the environment. * * This function is only needed if multiple databases will be used in the * environment. Simpler applications that use the environment as a single * unnamed database can ignore this option. * This function may only be called after #mdb_env_create() and before #mdb_env_open(). * * Currently a moderate number of slots are cheap but a huge number gets * expensive: 7-120 words per transaction, and every #mdb_dbi_open() * does a linear search of the opened slots. * @param[in] env An environment handle returned by #mdb_env_create() * @param[in] dbs The maximum number of databases * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified, or the environment is already open. *
      */ int mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs); /** @brief Get the maximum size of keys and #MDB_DUPSORT data we can write. * * Depends on the compile-time constant #MDB_MAXKEYSIZE. Default 511. * See @ref MDB_val. * @param[in] env An environment handle returned by #mdb_env_create() * @return The maximum size of a key we can write */ int mdb_env_get_maxkeysize(MDB_env *env); /** @brief Set application information associated with the #MDB_env. * * @param[in] env An environment handle returned by #mdb_env_create() * @param[in] ctx An arbitrary pointer for whatever the application needs. * @return A non-zero error value on failure and 0 on success. */ int mdb_env_set_userctx(MDB_env *env, void *ctx); /** @brief Get the application information associated with the #MDB_env. * * @param[in] env An environment handle returned by #mdb_env_create() * @return The pointer set by #mdb_env_set_userctx(). */ void *mdb_env_get_userctx(MDB_env *env); /** @brief A callback function for most LMDB assert() failures, * called before printing the message and aborting. * * @param[in] env An environment handle returned by #mdb_env_create(). * @param[in] msg The assertion message, not including newline. */ typedef void MDB_assert_func(MDB_env *env, const char *msg); /** Set or reset the assert() callback of the environment. * Disabled if liblmdb is buillt with NDEBUG. * @note This hack should become obsolete as lmdb's error handling matures. * @param[in] env An environment handle returned by #mdb_env_create(). * @param[in] func An #MDB_assert_func function, or 0. * @return A non-zero error value on failure and 0 on success. */ int mdb_env_set_assert(MDB_env *env, MDB_assert_func *func); /** @brief Create a transaction for use with the environment. * * The transaction handle may be discarded using #mdb_txn_abort() or #mdb_txn_commit(). * @note A transaction and its cursors must only be used by a single * thread, and a thread may only have a single transaction at a time. * If #MDB_NOTLS is in use, this does not apply to read-only transactions. * @note Cursors may not span transactions. * @param[in] env An environment handle returned by #mdb_env_create() * @param[in] parent If this parameter is non-NULL, the new transaction * will be a nested transaction, with the transaction indicated by \b parent * as its parent. Transactions may be nested to any level. A parent * transaction and its cursors may not issue any other operations than * mdb_txn_commit and mdb_txn_abort while it has active child transactions. * @param[in] flags Special options for this transaction. This parameter * must be set to 0 or by bitwise OR'ing together one or more of the * values described here. *
        *
      • #MDB_RDONLY * This transaction will not perform any write operations. *
      * @param[out] txn Address where the new #MDB_txn handle will be stored * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • #MDB_PANIC - a fatal error occurred earlier and the environment * must be shut down. *
      • #MDB_MAP_RESIZED - another process wrote data beyond this MDB_env's * mapsize and this environment's map must be resized as well. * See #mdb_env_set_mapsize(). *
      • #MDB_READERS_FULL - a read-only transaction was requested and * the reader lock table is full. See #mdb_env_set_maxreaders(). *
      • ENOMEM - out of memory. *
      */ int mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **txn); /** @brief Returns the transaction's #MDB_env * * @param[in] txn A transaction handle returned by #mdb_txn_begin() */ MDB_env *mdb_txn_env(MDB_txn *txn); /** @brief Return the transaction's ID. * * This returns the identifier associated with this transaction. For a * read-only transaction, this corresponds to the snapshot being read; * concurrent readers will frequently have the same transaction ID. * * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @return A transaction ID, valid if input is an active transaction. */ size_t mdb_txn_id(MDB_txn *txn); /** @brief Commit all the operations of a transaction into the database. * * The transaction handle is freed. It and its cursors must not be used * again after this call, except with #mdb_cursor_renew(). * @note Earlier documentation incorrectly said all cursors would be freed. * Only write-transactions free cursors. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      • ENOSPC - no more disk space. *
      • EIO - a low-level I/O error occurred while writing. *
      • ENOMEM - out of memory. *
      */ int mdb_txn_commit(MDB_txn *txn); /** @brief Abandon all the operations of the transaction instead of saving them. * * The transaction handle is freed. It and its cursors must not be used * again after this call, except with #mdb_cursor_renew(). * @note Earlier documentation incorrectly said all cursors would be freed. * Only write-transactions free cursors. * @param[in] txn A transaction handle returned by #mdb_txn_begin() */ void mdb_txn_abort(MDB_txn *txn); /** @brief Reset a read-only transaction. * * Abort the transaction like #mdb_txn_abort(), but keep the transaction * handle. #mdb_txn_renew() may reuse the handle. This saves allocation * overhead if the process will start a new read-only transaction soon, * and also locking overhead if #MDB_NOTLS is in use. The reader table * lock is released, but the table slot stays tied to its thread or * #MDB_txn. Use mdb_txn_abort() to discard a reset handle, and to free * its lock table slot if MDB_NOTLS is in use. * Cursors opened within the transaction must not be used * again after this call, except with #mdb_cursor_renew(). * Reader locks generally don't interfere with writers, but they keep old * versions of database pages allocated. Thus they prevent the old pages * from being reused when writers commit new data, and so under heavy load * the database size may grow much more rapidly than otherwise. * @param[in] txn A transaction handle returned by #mdb_txn_begin() */ void mdb_txn_reset(MDB_txn *txn); /** @brief Renew a read-only transaction. * * This acquires a new reader lock for a transaction handle that had been * released by #mdb_txn_reset(). It must be called before a reset transaction * may be used again. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • #MDB_PANIC - a fatal error occurred earlier and the environment * must be shut down. *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_txn_renew(MDB_txn *txn); /** Compat with version <= 0.9.4, avoid clash with libmdb from MDB Tools project */ #define mdb_open(txn,name,flags,dbi) mdb_dbi_open(txn,name,flags,dbi) /** Compat with version <= 0.9.4, avoid clash with libmdb from MDB Tools project */ #define mdb_close(env,dbi) mdb_dbi_close(env,dbi) /** @brief Open a database in the environment. * * A database handle denotes the name and parameters of a database, * independently of whether such a database exists. * The database handle may be discarded by calling #mdb_dbi_close(). * The old database handle is returned if the database was already open. * The handle may only be closed once. * * 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 in the same process. A transaction that uses * this function must finish (either commit or abort) before * any other transaction in the process may use this function. * * To use named databases (with name != NULL), #mdb_env_set_maxdbs() * must be called before opening the environment. Database names are * keys in the unnamed database, and may be read but not written. * * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] name The name of the database to open. If only a single * database is needed in the environment, this value may be NULL. * @param[in] flags Special options for this database. This parameter * must be set to 0 or by bitwise OR'ing together one or more of the * values described here. *
        *
      • #MDB_REVERSEKEY * Keys are strings to be compared in reverse order, from the end * of the strings to the beginning. By default, Keys are treated as strings and * compared from beginning to end. *
      • #MDB_DUPSORT * Duplicate keys may be used in the database. (Or, from another perspective, * keys may have multiple data items, stored in sorted order.) By default * keys must be unique and may have only a single data item. *
      • #MDB_INTEGERKEY * Keys are binary integers in native byte order, either unsigned int * or size_t, and will be sorted as such. * The keys must all be of the same size. *
      • #MDB_DUPFIXED * This flag may only be used in combination with #MDB_DUPSORT. This option * tells the library that the data items for this database are all the same * size, which allows further optimizations in storage and retrieval. When * all data items are the same size, the #MDB_GET_MULTIPLE, #MDB_NEXT_MULTIPLE * and #MDB_PREV_MULTIPLE cursor operations may be used to retrieve multiple * items at once. *
      • #MDB_INTEGERDUP * This option specifies that duplicate data items are binary integers, * similar to #MDB_INTEGERKEY keys. *
      • #MDB_REVERSEDUP * This option specifies that duplicate data items should be compared as * strings in reverse order. *
      • #MDB_CREATE * Create the named database if it doesn't exist. This option is not * allowed in a read-only transaction or a read-only environment. *
      * @param[out] dbi Address where the new #MDB_dbi handle will be stored * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • #MDB_NOTFOUND - the specified database doesn't exist in the environment * and #MDB_CREATE was not specified. *
      • #MDB_DBS_FULL - too many databases have been opened. See #mdb_env_set_maxdbs(). *
      */ int mdb_dbi_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *dbi); /** @brief Retrieve statistics for a database. * * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[out] stat The address of an #MDB_stat structure * where the statistics will be copied * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_stat(MDB_txn *txn, MDB_dbi dbi, MDB_stat *stat); /** @brief Retrieve the DB flags for a database handle. * * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[out] flags Address where the flags will be returned. * @return A non-zero error value on failure and 0 on success. */ int mdb_dbi_flags(MDB_txn *txn, MDB_dbi dbi, unsigned int *flags); /** @brief Close a database handle. Normally unnecessary. Use with care: * * This call is not mutex protected. Handles should only be closed by * a single thread, and only if no other threads are going to reference * the database handle or one of its cursors any further. Do not close * a handle if an existing transaction has modified its database. * Doing so can cause misbehavior from database corruption to errors * like MDB_BAD_VALSIZE (since the DB name is gone). * * Closing a database handle is not necessary, but lets #mdb_dbi_open() * reuse the handle value. Usually it's better to set a bigger * #mdb_env_set_maxdbs(), unless that value would be large. * * @param[in] env An environment handle returned by #mdb_env_create() * @param[in] dbi A database handle returned by #mdb_dbi_open() */ void mdb_dbi_close(MDB_env *env, MDB_dbi dbi); /** @brief Empty or delete+close a database. * * See #mdb_dbi_close() for restrictions about closing the DB handle. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[in] del 0 to empty the DB, 1 to delete it from the * environment and close the DB handle. * @return A non-zero error value on failure and 0 on success. */ int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del); /** @brief Set a custom key comparison function for a database. * * The comparison function is called whenever it is necessary to compare a * key specified by the application with a key currently stored in the database. * If no comparison function is specified, and no special key flags were specified * with #mdb_dbi_open(), the keys are compared lexically, with shorter keys collating * before longer keys. * @warning This function must be called before any data access functions are used, * otherwise data corruption may occur. The same comparison function must be used by every * program accessing the database, every time the database is used. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[in] cmp A #MDB_cmp_func function * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_set_compare(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp); /** @brief Set a custom data comparison function for a #MDB_DUPSORT database. * * This comparison function is called whenever it is necessary to compare a data * item specified by the application with a data item currently stored in the database. * This function only takes effect if the database was opened with the #MDB_DUPSORT * flag. * If no comparison function is specified, and no special key flags were specified * with #mdb_dbi_open(), the data items are compared lexically, with shorter items collating * before longer items. * @warning This function must be called before any data access functions are used, * otherwise data corruption may occur. The same comparison function must be used by every * program accessing the database, every time the database is used. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[in] cmp A #MDB_cmp_func function * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_set_dupsort(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp); /** @brief Set a relocation function for a #MDB_FIXEDMAP database. * * @todo The relocation function is called whenever it is necessary to move the data * of an item to a different position in the database (e.g. through tree * balancing operations, shifts as a result of adds or deletes, etc.). It is * intended to allow address/position-dependent data items to be stored in * a database in an environment opened with the #MDB_FIXEDMAP option. * Currently the relocation feature is unimplemented and setting * this function has no effect. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[in] rel A #MDB_rel_func function * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_set_relfunc(MDB_txn *txn, MDB_dbi dbi, MDB_rel_func *rel); /** @brief Set a context pointer for a #MDB_FIXEDMAP database's relocation function. * * See #mdb_set_relfunc and #MDB_rel_func for more details. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[in] ctx An arbitrary pointer for whatever the application needs. * It will be passed to the callback function set by #mdb_set_relfunc * as its \b relctx parameter whenever the callback is invoked. * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_set_relctx(MDB_txn *txn, MDB_dbi dbi, void *ctx); /** @brief Get items from a database. * * This function retrieves key/data pairs from the database. The address * and length of the data associated with the specified \b key are returned * in the structure to which \b data refers. * If the database supports duplicate keys (#MDB_DUPSORT) then the * first data item for the key will be returned. Retrieval of other * items requires the use of #mdb_cursor_get(). * * @note The memory pointed to by the returned values is owned by the * database. The caller need not dispose of the memory, and may not * modify it in any way. For values returned in a read-only transaction * any modification attempts will cause a SIGSEGV. * @note Values returned from the database are valid only until a * subsequent update operation, or the end of the transaction. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[in] key The key to search for in the database * @param[out] data The data corresponding to the key * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • #MDB_NOTFOUND - the key was not in the database. *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_get(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data); /** @brief Store items into a database. * * This function stores key/data pairs in the database. The default behavior * is to enter the new key/data pair, replacing any previously existing key * if duplicates are disallowed, or adding a duplicate data item if * duplicates are allowed (#MDB_DUPSORT). * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[in] key The key to store in the database * @param[in,out] data The data to store * @param[in] flags Special options for this operation. This parameter * must be set to 0 or by bitwise OR'ing together one or more of the * values described here. *
        *
      • #MDB_NODUPDATA - enter the new key/data pair only if it does not * already appear in the database. This flag may only be specified * if the database was opened with #MDB_DUPSORT. The function will * return #MDB_KEYEXIST if the key/data pair already appears in the * database. *
      • #MDB_NOOVERWRITE - enter the new key/data pair only if the key * does not already appear in the database. The function will return * #MDB_KEYEXIST if the key already appears in the database, even if * the database supports duplicates (#MDB_DUPSORT). The \b data * parameter will be set to point to the existing item. *
      • #MDB_RESERVE - reserve space for data of the given size, but * don't copy the given data. Instead, return a pointer to the * reserved space, which the caller can fill in later - before * the next update operation or the transaction ends. This saves * an extra memcpy if the data is being generated later. * LMDB does nothing else with this memory, the caller is expected * to modify all of the space requested. This flag must not be * specified if the database was opened with #MDB_DUPSORT. *
      • #MDB_APPEND - append the given key/data pair to the end of the * database. This option allows fast bulk loading when keys are * already known to be in the correct order. Loading unsorted keys * with this flag will cause a #MDB_KEYEXIST error. *
      • #MDB_APPENDDUP - as above, but for sorted dup data. *
      * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • #MDB_MAP_FULL - the database is full, see #mdb_env_set_mapsize(). *
      • #MDB_TXN_FULL - the transaction has too many dirty pages. *
      • EACCES - an attempt was made to write in a read-only transaction. *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_put(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data, unsigned int flags); /** @brief Delete items from a database. * * This function removes key/data pairs from the database. * If the database does not support sorted duplicate data items * (#MDB_DUPSORT) the data parameter is ignored. * If the database supports sorted duplicates and the data parameter * is NULL, all of the duplicate data items for the key will be * deleted. Otherwise, if the data parameter is non-NULL * only the matching data item will be deleted. * This function will return #MDB_NOTFOUND if the specified key/data * pair is not in the database. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[in] key The key to delete from the database * @param[in] data The data to delete * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EACCES - an attempt was made to write in a read-only transaction. *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_del(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data); /** @brief Create a cursor handle. * * A cursor is associated with a specific transaction and database. * A cursor cannot be used when its database handle is closed. Nor * when its transaction has ended, except with #mdb_cursor_renew(). * It can be discarded with #mdb_cursor_close(). * A cursor in a write-transaction can be closed before its transaction * ends, and will otherwise be closed when its transaction ends. * A cursor in a read-only transaction must be closed explicitly, before * or after its transaction ends. It can be reused with * #mdb_cursor_renew() before finally closing it. * @note Earlier documentation said that cursors in every transaction * were closed when the transaction committed or aborted. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[out] cursor Address where the new #MDB_cursor handle will be stored * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_cursor_open(MDB_txn *txn, MDB_dbi dbi, MDB_cursor **cursor); /** @brief Close a cursor handle. * * The cursor handle will be freed and must not be used again after this call. * Its transaction must still be live if it is a write-transaction. * @param[in] cursor A cursor handle returned by #mdb_cursor_open() */ void mdb_cursor_close(MDB_cursor *cursor); /** @brief Renew a cursor handle. * * A cursor is associated with a specific transaction and database. * Cursors that are only used in read-only * transactions may be re-used, to avoid unnecessary malloc/free overhead. * The cursor may be associated with a new read-only transaction, and * referencing the same database handle as it was created with. * This may be done whether the previous transaction is live or dead. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] cursor A cursor handle returned by #mdb_cursor_open() * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_cursor_renew(MDB_txn *txn, MDB_cursor *cursor); /** @brief Return the cursor's transaction handle. * * @param[in] cursor A cursor handle returned by #mdb_cursor_open() */ MDB_txn *mdb_cursor_txn(MDB_cursor *cursor); /** @brief Return the cursor's database handle. * * @param[in] cursor A cursor handle returned by #mdb_cursor_open() */ MDB_dbi mdb_cursor_dbi(MDB_cursor *cursor); /** @brief Retrieve by cursor. * * This function retrieves key/data pairs from the database. The address and length * of the key are returned in the object to which \b key refers (except for the * case of the #MDB_SET option, in which the \b key object is unchanged), and * the address and length of the data are returned in the object to which \b data * refers. * See #mdb_get() for restrictions on using the output values. * @param[in] cursor A cursor handle returned by #mdb_cursor_open() * @param[in,out] key The key for a retrieved item * @param[in,out] data The data of a retrieved item * @param[in] op A cursor operation #MDB_cursor_op * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • #MDB_NOTFOUND - no matching key found. *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_cursor_get(MDB_cursor *cursor, MDB_val *key, MDB_val *data, MDB_cursor_op op); /** @brief Store by cursor. * * This function stores key/data pairs into the database. * The cursor is positioned at the new item, or on failure usually near it. * @note Earlier documentation incorrectly said errors would leave the * state of the cursor unchanged. * @param[in] cursor A cursor handle returned by #mdb_cursor_open() * @param[in] key The key operated on. * @param[in] data The data operated on. * @param[in] flags Options for this operation. This parameter * must be set to 0 or one of the values described here. *
        *
      • #MDB_CURRENT - replace the item at the current cursor position. * The \b key parameter must still be provided, and must match it. * If using sorted duplicates (#MDB_DUPSORT) the data item must still * sort into the same place. This is intended to be used when the * new data is the same size as the old. Otherwise it will simply * perform a delete of the old record followed by an insert. *
      • #MDB_NODUPDATA - enter the new key/data pair only if it does not * already appear in the database. This flag may only be specified * if the database was opened with #MDB_DUPSORT. The function will * return #MDB_KEYEXIST if the key/data pair already appears in the * database. *
      • #MDB_NOOVERWRITE - enter the new key/data pair only if the key * does not already appear in the database. The function will return * #MDB_KEYEXIST if the key already appears in the database, even if * the database supports duplicates (#MDB_DUPSORT). *
      • #MDB_RESERVE - reserve space for data of the given size, but * don't copy the given data. Instead, return a pointer to the * reserved space, which the caller can fill in later - before * the next update operation or the transaction ends. This saves * an extra memcpy if the data is being generated later. This flag * must not be specified if the database was opened with #MDB_DUPSORT. *
      • #MDB_APPEND - append the given key/data pair to the end of the * database. No key comparisons are performed. This option allows * fast bulk loading when keys are already known to be in the * correct order. Loading unsorted keys with this flag will cause * a #MDB_KEYEXIST error. *
      • #MDB_APPENDDUP - as above, but for sorted dup data. *
      • #MDB_MULTIPLE - store multiple contiguous data elements in a * single request. This flag may only be specified if the database * was opened with #MDB_DUPFIXED. The \b data argument must be an * array of two MDB_vals. The mv_size of the first MDB_val must be * the size of a single data element. The mv_data of the first MDB_val * must point to the beginning of the array of contiguous data elements. * The mv_size of the second MDB_val must be the count of the number * of data elements to store. On return this field will be set to * the count of the number of elements actually written. The mv_data * of the second MDB_val is unused. *
      * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • #MDB_MAP_FULL - the database is full, see #mdb_env_set_mapsize(). *
      • #MDB_TXN_FULL - the transaction has too many dirty pages. *
      • EACCES - an attempt was made to write in a read-only transaction. *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_cursor_put(MDB_cursor *cursor, MDB_val *key, MDB_val *data, unsigned int flags); /** @brief Delete current key/data pair * * This function deletes the key/data pair to which the cursor refers. * This does not invalidate the cursor, so operations such as MDB_NEXT * can still be used on it. * Both MDB_NEXT and MDB_GET_CURRENT will return the same record after * this operation. * @param[in] cursor A cursor handle returned by #mdb_cursor_open() * @param[in] flags Options for this operation. This parameter * must be set to 0 or one of the values described here. *
        *
      • #MDB_NODUPDATA - delete all of the data items for the current key. * This flag may only be specified if the database was opened with #MDB_DUPSORT. *
      * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EACCES - an attempt was made to write in a read-only transaction. *
      • EINVAL - an invalid parameter was specified. *
      */ int mdb_cursor_del(MDB_cursor *cursor, unsigned int flags); /** @brief Return count of duplicates for current key. * * This call is only valid on databases that support sorted duplicate * data items #MDB_DUPSORT. * @param[in] cursor A cursor handle returned by #mdb_cursor_open() * @param[out] countp Address where the count will be stored * @return A non-zero error value on failure and 0 on success. Some possible * errors are: *
        *
      • EINVAL - cursor is not initialized, or an invalid parameter was specified. *
      */ int mdb_cursor_count(MDB_cursor *cursor, size_t *countp); /** @brief Compare two data items according to a particular database. * * This returns a comparison as if the two data items were keys in the * specified database. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[in] a The first item to compare * @param[in] b The second item to compare * @return < 0 if a < b, 0 if a == b, > 0 if a > b */ int mdb_cmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b); /** @brief Compare two data items according to a particular database. * * This returns a comparison as if the two items were data items of * the specified database. The database must have the #MDB_DUPSORT flag. * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() * @param[in] a The first item to compare * @param[in] b The second item to compare * @return < 0 if a < b, 0 if a == b, > 0 if a > b */ int mdb_dcmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b); /** @brief A callback function used to print a message from the library. * * @param[in] msg The string to be printed. * @param[in] ctx An arbitrary context pointer for the callback. * @return < 0 on failure, >= 0 on success. */ typedef int (MDB_msg_func)(const char *msg, void *ctx); /** @brief Dump the entries in the reader lock table. * * @param[in] env An environment handle returned by #mdb_env_create() * @param[in] func A #MDB_msg_func function * @param[in] ctx Anything the message function needs * @return < 0 on failure, >= 0 on success. */ int mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx); /** @brief Check for stale entries in the reader lock table. * * @param[in] env An environment handle returned by #mdb_env_create() * @param[out] dead Number of stale slots that were cleared * @return 0 on success, non-zero on failure. */ int mdb_reader_check(MDB_env *env, int *dead); /** @} */ #ifdef __cplusplus } #endif /** @page tools LMDB Command Line Tools The following describes the command line tools that are available for LMDB. \li \ref mdb_copy_1 \li \ref mdb_dump_1 \li \ref mdb_load_1 \li \ref mdb_stat_1 */ #endif /* _LMDB_H_ */ py-lmdb-py-lmdb_1.0.0/lib/mdb.c000066400000000000000000010700071372223456500161720ustar00rootroot00000000000000/** @file mdb.c * @brief Lightning memory-mapped database library * * A Btree-based database management library modeled loosely on the * BerkeleyDB API, but much simplified. */ /* * Copyright 2011-2019 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted only as authorized by the OpenLDAP * Public License. * * A copy of this license is available in the file LICENSE in the * top-level directory of the distribution or, alternatively, at * . * * This code is derived from btree.c written by Martin Hedenfalk. * * Copyright (c) 2009, 2010 Martin Hedenfalk * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _GNU_SOURCE #define _GNU_SOURCE 1 #endif #if defined(__WIN64__) #define _FILE_OFFSET_BITS 64 #endif #ifdef _WIN32 #include #include #include /* get wcscpy() */ /** getpid() returns int; MinGW defines pid_t but MinGW64 typedefs it * as int64 which is wrong. MSVC doesn't define it at all, so just * don't use it. */ #define MDB_PID_T int #define MDB_THR_T DWORD #include #include #ifdef __GNUC__ # include #else # define LITTLE_ENDIAN 1234 # define BIG_ENDIAN 4321 # define BYTE_ORDER LITTLE_ENDIAN # ifndef SSIZE_MAX # define SSIZE_MAX INT_MAX # endif #endif #else #include #include #define MDB_PID_T pid_t #define MDB_THR_T pthread_t #include #include #include #ifdef HAVE_SYS_FILE_H #include #endif #include #endif #if defined(__mips) && defined(__linux) /* MIPS has cache coherency issues, requires explicit cache control */ #include extern int cacheflush(char *addr, int nbytes, int cache); #define CACHEFLUSH(addr, bytes, cache) cacheflush(addr, bytes, cache) #else #define CACHEFLUSH(addr, bytes, cache) #endif #if defined(__linux) && !defined(MDB_FDATASYNC_WORKS) /** fdatasync is broken on ext3/ext4fs on older kernels, see * description in #mdb_env_open2 comments. You can safely * define MDB_FDATASYNC_WORKS if this code will only be run * on kernels 3.6 and newer. */ #define BROKEN_FDATASYNC #endif #include #include #include #include #include #include #include #include #ifdef _MSC_VER #include typedef SSIZE_T ssize_t; #else #include #endif #if defined(__sun) || defined(ANDROID) /* Most platforms have posix_memalign, older may only have memalign */ #define HAVE_MEMALIGN 1 #include /* On Solaris, we need the POSIX sigwait function */ #if defined (__sun) # define _POSIX_PTHREAD_SEMANTICS 1 #endif #endif #if !(defined(BYTE_ORDER) || defined(__BYTE_ORDER)) #include #include /* defines BYTE_ORDER on HPUX and Solaris */ #endif #if defined(__APPLE__) || defined (BSD) || defined(__FreeBSD_kernel__) # define MDB_USE_POSIX_SEM 1 # define MDB_FDATASYNC fsync #elif defined(ANDROID) # define MDB_FDATASYNC fsync #endif #ifndef _WIN32 #include #include #ifdef MDB_USE_POSIX_SEM # define MDB_USE_HASH 1 #include #else #define MDB_USE_POSIX_MUTEX 1 #endif #endif #if defined(_WIN32) + defined(MDB_USE_POSIX_SEM) \ + defined(MDB_USE_POSIX_MUTEX) != 1 # error "Ambiguous shared-lock implementation" #endif #ifdef USE_VALGRIND #include #define VGMEMP_CREATE(h,r,z) VALGRIND_CREATE_MEMPOOL(h,r,z) #define VGMEMP_ALLOC(h,a,s) VALGRIND_MEMPOOL_ALLOC(h,a,s) #define VGMEMP_FREE(h,a) VALGRIND_MEMPOOL_FREE(h,a) #define VGMEMP_DESTROY(h) VALGRIND_DESTROY_MEMPOOL(h) #define VGMEMP_DEFINED(a,s) VALGRIND_MAKE_MEM_DEFINED(a,s) #else #define VGMEMP_CREATE(h,r,z) #define VGMEMP_ALLOC(h,a,s) #define VGMEMP_FREE(h,a) #define VGMEMP_DESTROY(h) #define VGMEMP_DEFINED(a,s) #endif #ifndef BYTE_ORDER # if (defined(_LITTLE_ENDIAN) || defined(_BIG_ENDIAN)) && !(defined(_LITTLE_ENDIAN) && defined(_BIG_ENDIAN)) /* Solaris just defines one or the other */ # define LITTLE_ENDIAN 1234 # define BIG_ENDIAN 4321 # ifdef _LITTLE_ENDIAN # define BYTE_ORDER LITTLE_ENDIAN # else # define BYTE_ORDER BIG_ENDIAN # endif # else # define BYTE_ORDER __BYTE_ORDER # endif #endif #ifndef LITTLE_ENDIAN #define LITTLE_ENDIAN __LITTLE_ENDIAN #endif #ifndef BIG_ENDIAN #define BIG_ENDIAN __BIG_ENDIAN #endif #if defined(__i386) || defined(__x86_64) || defined(_M_IX86) #define MISALIGNED_OK 1 #endif #include "lmdb.h" #include "midl.h" #if (BYTE_ORDER == LITTLE_ENDIAN) == (BYTE_ORDER == BIG_ENDIAN) # error "Unknown or unsupported endianness (BYTE_ORDER)" #elif (-6 & 5) || CHAR_BIT != 8 || UINT_MAX < 0xffffffff || ULONG_MAX % 0xFFFF # error "Two's complement, reasonably sized integer types, please" #endif #ifdef __GNUC__ /** Put infrequently used env functions in separate section */ # ifdef __APPLE__ # define ESECT __attribute__ ((section("__TEXT,text_env"))) # else # define ESECT __attribute__ ((section("text_env"))) # endif #else #define ESECT #endif #ifdef _WIN32 #define CALL_CONV WINAPI #else #define CALL_CONV #endif /** @defgroup internal LMDB Internals * @{ */ /** @defgroup compat Compatibility Macros * A bunch of macros to minimize the amount of platform-specific ifdefs * needed throughout the rest of the code. When the features this library * needs are similar enough to POSIX to be hidden in a one-or-two line * replacement, this macro approach is used. * @{ */ /** Features under development */ #ifndef MDB_DEVEL #define MDB_DEVEL 0 #endif /** Wrapper around __func__, which is a C99 feature */ #if __STDC_VERSION__ >= 199901L # define mdb_func_ __func__ #elif __GNUC__ >= 2 || _MSC_VER >= 1300 # define mdb_func_ __FUNCTION__ #else /* If a debug message says (), update the #if statements above */ # define mdb_func_ "" #endif /* Internal error codes, not exposed outside liblmdb */ #define MDB_NO_ROOT (MDB_LAST_ERRCODE + 10) #ifdef _WIN32 #define MDB_OWNERDEAD ((int) WAIT_ABANDONED) #elif defined(MDB_USE_POSIX_MUTEX) && defined(EOWNERDEAD) #define MDB_OWNERDEAD EOWNERDEAD /**< #LOCK_MUTEX0() result if dead owner */ #endif #ifdef __GLIBC__ #define GLIBC_VER ((__GLIBC__ << 16 )| __GLIBC_MINOR__) #endif /** Some platforms define the EOWNERDEAD error code * even though they don't support Robust Mutexes. * Compile with -DMDB_USE_ROBUST=0, or use some other * mechanism like -DMDB_USE_POSIX_SEM instead of * -DMDB_USE_POSIX_MUTEX. * (Posix semaphores are not robust.) */ #ifndef MDB_USE_ROBUST /* Android currently lacks Robust Mutex support. So does glibc < 2.4. */ # if defined(MDB_USE_POSIX_MUTEX) && (defined(ANDROID) || \ (defined(__GLIBC__) && GLIBC_VER < 0x020004)) # define MDB_USE_ROBUST 0 # else # define MDB_USE_ROBUST 1 # endif #endif /* !MDB_USE_ROBUST */ #if defined(MDB_USE_POSIX_MUTEX) && (MDB_USE_ROBUST) /* glibc < 2.12 only provided _np API */ # if (defined(__GLIBC__) && GLIBC_VER < 0x02000c) || \ (defined(PTHREAD_MUTEX_ROBUST_NP) && !defined(PTHREAD_MUTEX_ROBUST)) # define PTHREAD_MUTEX_ROBUST PTHREAD_MUTEX_ROBUST_NP # define pthread_mutexattr_setrobust(attr, flag) pthread_mutexattr_setrobust_np(attr, flag) # define pthread_mutex_consistent(mutex) pthread_mutex_consistent_np(mutex) # endif #endif /* MDB_USE_POSIX_MUTEX && MDB_USE_ROBUST */ #if defined(MDB_OWNERDEAD) && (MDB_USE_ROBUST) #define MDB_ROBUST_SUPPORTED 1 #endif #ifdef _WIN32 #define MDB_USE_HASH 1 #define MDB_PIDLOCK 0 #define THREAD_RET DWORD #define pthread_t HANDLE #define pthread_mutex_t HANDLE #define pthread_cond_t HANDLE typedef HANDLE mdb_mutex_t, mdb_mutexref_t; #define pthread_key_t DWORD #define pthread_self() GetCurrentThreadId() #define pthread_key_create(x,y) \ ((*(x) = TlsAlloc()) == TLS_OUT_OF_INDEXES ? ErrCode() : 0) #define pthread_key_delete(x) TlsFree(x) #define pthread_getspecific(x) TlsGetValue(x) #define pthread_setspecific(x,y) (TlsSetValue(x,y) ? 0 : ErrCode()) #define pthread_mutex_unlock(x) ReleaseMutex(*x) #define pthread_mutex_lock(x) WaitForSingleObject(*x, INFINITE) #define pthread_cond_signal(x) SetEvent(*x) #define pthread_cond_wait(cond,mutex) do{SignalObjectAndWait(*mutex, *cond, INFINITE, FALSE); WaitForSingleObject(*mutex, INFINITE);}while(0) #define THREAD_CREATE(thr,start,arg) \ (((thr) = CreateThread(NULL, 0, start, arg, 0, NULL)) ? 0 : ErrCode()) #define THREAD_FINISH(thr) \ (WaitForSingleObject(thr, INFINITE) ? ErrCode() : 0) #define LOCK_MUTEX0(mutex) WaitForSingleObject(mutex, INFINITE) #define UNLOCK_MUTEX(mutex) ReleaseMutex(mutex) #define mdb_mutex_consistent(mutex) 0 #define getpid() GetCurrentProcessId() #define MDB_FDATASYNC(fd) (!FlushFileBuffers(fd)) #define MDB_MSYNC(addr,len,flags) (!FlushViewOfFile(addr,len)) #define ErrCode() GetLastError() #define GET_PAGESIZE(x) {SYSTEM_INFO si; GetSystemInfo(&si); (x) = si.dwPageSize;} #define close(fd) (CloseHandle(fd) ? 0 : -1) #define munmap(ptr,len) UnmapViewOfFile(ptr) #ifdef PROCESS_QUERY_LIMITED_INFORMATION #define MDB_PROCESS_QUERY_LIMITED_INFORMATION PROCESS_QUERY_LIMITED_INFORMATION #else #define MDB_PROCESS_QUERY_LIMITED_INFORMATION 0x1000 #endif #define Z "I" #else #define THREAD_RET void * #define THREAD_CREATE(thr,start,arg) pthread_create(&thr,NULL,start,arg) #define THREAD_FINISH(thr) pthread_join(thr,NULL) #define Z "z" /**< printf format modifier for size_t */ /** For MDB_LOCK_FORMAT: True if readers take a pid lock in the lockfile */ #define MDB_PIDLOCK 1 #ifdef MDB_USE_POSIX_SEM typedef sem_t *mdb_mutex_t, *mdb_mutexref_t; #define LOCK_MUTEX0(mutex) mdb_sem_wait(mutex) #define UNLOCK_MUTEX(mutex) sem_post(mutex) static int mdb_sem_wait(sem_t *sem) { int rc; while ((rc = sem_wait(sem)) && (rc = errno) == EINTR) ; return rc; } #else /* MDB_USE_POSIX_MUTEX: */ /** Shared mutex/semaphore as the original is stored. * * Not for copies. Instead it can be assigned to an #mdb_mutexref_t. * When mdb_mutexref_t is a pointer and mdb_mutex_t is not, then it * is array[size 1] so it can be assigned to the pointer. */ typedef pthread_mutex_t mdb_mutex_t[1]; /** Reference to an #mdb_mutex_t */ typedef pthread_mutex_t *mdb_mutexref_t; /** Lock the reader or writer mutex. * Returns 0 or a code to give #mdb_mutex_failed(), as in #LOCK_MUTEX(). */ #define LOCK_MUTEX0(mutex) pthread_mutex_lock(mutex) /** Unlock the reader or writer mutex. */ #define UNLOCK_MUTEX(mutex) pthread_mutex_unlock(mutex) /** Mark mutex-protected data as repaired, after death of previous owner. */ #define mdb_mutex_consistent(mutex) pthread_mutex_consistent(mutex) #endif /* MDB_USE_POSIX_SEM */ /** Get the error code for the last failed system function. */ #define ErrCode() errno /** An abstraction for a file handle. * On POSIX systems file handles are small integers. On Windows * they're opaque pointers. */ #define HANDLE int /** A value for an invalid file handle. * Mainly used to initialize file variables and signify that they are * unused. */ #define INVALID_HANDLE_VALUE (-1) /** Get the size of a memory page for the system. * This is the basic size that the platform's memory manager uses, and is * fundamental to the use of memory-mapped files. */ #define GET_PAGESIZE(x) ((x) = sysconf(_SC_PAGE_SIZE)) #endif #if defined(_WIN32) || defined(MDB_USE_POSIX_SEM) #define MNAME_LEN 32 #else #define MNAME_LEN (sizeof(pthread_mutex_t)) #endif /** @} */ #ifdef MDB_ROBUST_SUPPORTED /** Lock mutex, handle any error, set rc = result. * Return 0 on success, nonzero (not rc) on error. */ #define LOCK_MUTEX(rc, env, mutex) \ (((rc) = LOCK_MUTEX0(mutex)) && \ ((rc) = mdb_mutex_failed(env, mutex, rc))) static int mdb_mutex_failed(MDB_env *env, mdb_mutexref_t mutex, int rc); #else #define LOCK_MUTEX(rc, env, mutex) ((rc) = LOCK_MUTEX0(mutex)) #define mdb_mutex_failed(env, mutex, rc) (rc) #endif #ifndef _WIN32 /** A flag for opening a file and requesting synchronous data writes. * This is only used when writing a meta page. It's not strictly needed; * we could just do a normal write and then immediately perform a flush. * But if this flag is available it saves us an extra system call. * * @note If O_DSYNC is undefined but exists in /usr/include, * preferably set some compiler flag to get the definition. */ #ifndef MDB_DSYNC # ifdef O_DSYNC # define MDB_DSYNC O_DSYNC # else # define MDB_DSYNC O_SYNC # endif #endif #endif /** Function for flushing the data of a file. Define this to fsync * if fdatasync() is not supported. */ #ifndef MDB_FDATASYNC # define MDB_FDATASYNC fdatasync #endif #ifndef MDB_MSYNC # define MDB_MSYNC(addr,len,flags) msync(addr,len,flags) #endif #ifndef MS_SYNC #define MS_SYNC 1 #endif #ifndef MS_ASYNC #define MS_ASYNC 0 #endif /** A page number in the database. * Note that 64 bit page numbers are overkill, since pages themselves * already represent 12-13 bits of addressable memory, and the OS will * always limit applications to a maximum of 63 bits of address space. * * @note In the #MDB_node structure, we only store 48 bits of this value, * which thus limits us to only 60 bits of addressable data. */ typedef MDB_ID pgno_t; /** A transaction ID. * See struct MDB_txn.mt_txnid for details. */ typedef MDB_ID txnid_t; /** @defgroup debug Debug Macros * @{ */ #ifndef MDB_DEBUG /** Enable debug output. Needs variable argument macros (a C99 feature). * Set this to 1 for copious tracing. Set to 2 to add dumps of all IDLs * read from and written to the database (used for free space management). */ #define MDB_DEBUG 0 #endif #if MDB_DEBUG static int mdb_debug; static txnid_t mdb_debug_start; /** Print a debug message with printf formatting. * Requires double parenthesis around 2 or more args. */ # define DPRINTF(args) ((void) ((mdb_debug) && DPRINTF0 args)) # define DPRINTF0(fmt, ...) \ fprintf(stderr, "%s:%d " fmt "\n", mdb_func_, __LINE__, __VA_ARGS__) #else # define DPRINTF(args) ((void) 0) #endif /** Print a debug string. * The string is printed literally, with no format processing. */ #define DPUTS(arg) DPRINTF(("%s", arg)) /** Debuging output value of a cursor DBI: Negative in a sub-cursor. */ #define DDBI(mc) \ (((mc)->mc_flags & C_SUB) ? -(int)(mc)->mc_dbi : (int)(mc)->mc_dbi) /** @} */ /** @brief The maximum size of a database page. * * It is 32k or 64k, since value-PAGEBASE must fit in * #MDB_page.%mp_upper. * * LMDB will use database pages < OS pages if needed. * That causes more I/O in write transactions: The OS must * know (read) the whole page before writing a partial page. * * Note that we don't currently support Huge pages. On Linux, * regular data files cannot use Huge pages, and in general * Huge pages aren't actually pageable. We rely on the OS * demand-pager to read our data and page it out when memory * pressure from other processes is high. So until OSs have * actual paging support for Huge pages, they're not viable. */ #define MAX_PAGESIZE (PAGEBASE ? 0x10000 : 0x8000) /** The minimum number of keys required in a database page. * Setting this to a larger value will place a smaller bound on the * maximum size of a data item. Data items larger than this size will * be pushed into overflow pages instead of being stored directly in * the B-tree node. This value used to default to 4. With a page size * of 4096 bytes that meant that any item larger than 1024 bytes would * go into an overflow page. That also meant that on average 2-3KB of * each overflow page was wasted space. The value cannot be lower than * 2 because then there would no longer be a tree structure. With this * value, items larger than 2KB will go into overflow pages, and on * average only 1KB will be wasted. */ #define MDB_MINKEYS 2 /** A stamp that identifies a file as an LMDB file. * There's nothing special about this value other than that it is easily * recognizable, and it will reflect any byte order mismatches. */ #define MDB_MAGIC 0xBEEFC0DE /** The version number for a database's datafile format. */ #define MDB_DATA_VERSION ((MDB_DEVEL) ? 999 : 1) /** The version number for a database's lockfile format. */ #define MDB_LOCK_VERSION 1 /** @brief The max size of a key we can write, or 0 for computed max. * * This macro should normally be left alone or set to 0. * Note that a database with big keys or dupsort data cannot be * reliably modified by a liblmdb which uses a smaller max. * The default is 511 for backwards compat, or 0 when #MDB_DEVEL. * * Other values are allowed, for backwards compat. However: * A value bigger than the computed max can break if you do not * know what you are doing, and liblmdb <= 0.9.10 can break when * modifying a DB with keys/dupsort data bigger than its max. * * Data items in an #MDB_DUPSORT database are also limited to * this size, since they're actually keys of a sub-DB. Keys and * #MDB_DUPSORT data items must fit on a node in a regular page. */ #ifndef MDB_MAXKEYSIZE #define MDB_MAXKEYSIZE ((MDB_DEVEL) ? 0 : 511) #endif /** The maximum size of a key we can write to the environment. */ #if MDB_MAXKEYSIZE #define ENV_MAXKEY(env) (MDB_MAXKEYSIZE) #else #define ENV_MAXKEY(env) ((env)->me_maxkey) #endif /** @brief The maximum size of a data item. * * We only store a 32 bit value for node sizes. */ #define MAXDATASIZE 0xffffffffUL #if MDB_DEBUG /** Key size which fits in a #DKBUF. * @ingroup debug */ #define DKBUF_MAXKEYSIZE ((MDB_MAXKEYSIZE) > 0 ? (MDB_MAXKEYSIZE) : 511) /** A key buffer. * @ingroup debug * This is used for printing a hex dump of a key's contents. */ #define DKBUF char kbuf[DKBUF_MAXKEYSIZE*2+1] /** Display a key in hex. * @ingroup debug * Invoke a function to display a key in hex. */ #define DKEY(x) mdb_dkey(x, kbuf) #else #define DKBUF #define DKEY(x) 0 #endif /** An invalid page number. * Mainly used to denote an empty tree. */ #define P_INVALID (~(pgno_t)0) /** Test if the flags \b f are set in a flag word \b w. */ #define F_ISSET(w, f) (((w) & (f)) == (f)) /** Round \b n up to an even number. */ #define EVEN(n) (((n) + 1U) & -2) /* sign-extending -2 to match n+1U */ /** Used for offsets within a single page. * Since memory pages are typically 4 or 8KB in size, 12-13 bits, * this is plenty. */ typedef uint16_t indx_t; /** Default size of memory map. * This is certainly too small for any actual applications. Apps should always set * the size explicitly using #mdb_env_set_mapsize(). */ #define DEFAULT_MAPSIZE 1048576 /** @defgroup readers Reader Lock Table * Readers don't acquire any locks for their data access. Instead, they * simply record their transaction ID in the reader table. The reader * mutex is needed just to find an empty slot in the reader table. The * slot's address is saved in thread-specific data so that subsequent read * transactions started by the same thread need no further locking to proceed. * * If #MDB_NOTLS is set, the slot address is not saved in thread-specific data. * * No reader table is used if the database is on a read-only filesystem, or * if #MDB_NOLOCK is set. * * Since the database uses multi-version concurrency control, readers don't * actually need any locking. This table is used to keep track of which * readers are using data from which old transactions, so that we'll know * when a particular old transaction is no longer in use. Old transactions * that have discarded any data pages can then have those pages reclaimed * for use by a later write transaction. * * The lock table is constructed such that reader slots are aligned with the * processor's cache line size. Any slot is only ever used by one thread. * This alignment guarantees that there will be no contention or cache * thrashing as threads update their own slot info, and also eliminates * any need for locking when accessing a slot. * * A writer thread will scan every slot in the table to determine the oldest * outstanding reader transaction. Any freed pages older than this will be * reclaimed by the writer. The writer doesn't use any locks when scanning * this table. This means that there's no guarantee that the writer will * see the most up-to-date reader info, but that's not required for correct * operation - all we need is to know the upper bound on the oldest reader, * we don't care at all about the newest reader. So the only consequence of * reading stale information here is that old pages might hang around a * while longer before being reclaimed. That's actually good anyway, because * the longer we delay reclaiming old pages, the more likely it is that a * string of contiguous pages can be found after coalescing old pages from * many old transactions together. * @{ */ /** Number of slots in the reader table. * This value was chosen somewhat arbitrarily. 126 readers plus a * couple mutexes fit exactly into 8KB on my development machine. * Applications should set the table size using #mdb_env_set_maxreaders(). */ #define DEFAULT_READERS 126 /** The size of a CPU cache line in bytes. We want our lock structures * aligned to this size to avoid false cache line sharing in the * lock table. * This value works for most CPUs. For Itanium this should be 128. */ #ifndef CACHELINE #define CACHELINE 64 #endif /** The information we store in a single slot of the reader table. * In addition to a transaction ID, we also record the process and * thread ID that owns a slot, so that we can detect stale information, * e.g. threads or processes that went away without cleaning up. * @note We currently don't check for stale records. We simply re-init * the table when we know that we're the only process opening the * lock file. */ typedef struct MDB_rxbody { /** Current Transaction ID when this transaction began, or (txnid_t)-1. * Multiple readers that start at the same time will probably have the * same ID here. Again, it's not important to exclude them from * anything; all we need to know is which version of the DB they * started from so we can avoid overwriting any data used in that * particular version. */ volatile txnid_t mrb_txnid; /** The process ID of the process owning this reader txn. */ volatile MDB_PID_T mrb_pid; /** The thread ID of the thread owning this txn. */ volatile MDB_THR_T mrb_tid; } MDB_rxbody; /** The actual reader record, with cacheline padding. */ typedef struct MDB_reader { union { MDB_rxbody mrx; /** shorthand for mrb_txnid */ #define mr_txnid mru.mrx.mrb_txnid #define mr_pid mru.mrx.mrb_pid #define mr_tid mru.mrx.mrb_tid /** cache line alignment */ char pad[(sizeof(MDB_rxbody)+CACHELINE-1) & ~(CACHELINE-1)]; } mru; } MDB_reader; /** The header for the reader table. * The table resides in a memory-mapped file. (This is a different file * than is used for the main database.) * * For POSIX the actual mutexes reside in the shared memory of this * mapped file. On Windows, mutexes are named objects allocated by the * kernel; we store the mutex names in this mapped file so that other * processes can grab them. This same approach is also used on * MacOSX/Darwin (using named semaphores) since MacOSX doesn't support * process-shared POSIX mutexes. For these cases where a named object * is used, the object name is derived from a 64 bit FNV hash of the * environment pathname. As such, naming collisions are extremely * unlikely. If a collision occurs, the results are unpredictable. */ typedef struct MDB_txbody { /** Stamp identifying this as an LMDB file. It must be set * to #MDB_MAGIC. */ uint32_t mtb_magic; /** Format of this lock file. Must be set to #MDB_LOCK_FORMAT. */ uint32_t mtb_format; #if defined(_WIN32) || defined(MDB_USE_POSIX_SEM) char mtb_rmname[MNAME_LEN]; #else /** Mutex protecting access to this table. * This is the reader table lock used with LOCK_MUTEX(). */ mdb_mutex_t mtb_rmutex; #endif /** The ID of the last transaction committed to the database. * This is recorded here only for convenience; the value can always * be determined by reading the main database meta pages. */ volatile txnid_t mtb_txnid; /** The number of slots that have been used in the reader table. * This always records the maximum count, it is not decremented * when readers release their slots. */ volatile unsigned mtb_numreaders; } MDB_txbody; /** The actual reader table definition. */ typedef struct MDB_txninfo { union { MDB_txbody mtb; #define mti_magic mt1.mtb.mtb_magic #define mti_format mt1.mtb.mtb_format #define mti_rmutex mt1.mtb.mtb_rmutex #define mti_rmname mt1.mtb.mtb_rmname #define mti_txnid mt1.mtb.mtb_txnid #define mti_numreaders mt1.mtb.mtb_numreaders char pad[(sizeof(MDB_txbody)+CACHELINE-1) & ~(CACHELINE-1)]; } mt1; union { #if defined(_WIN32) || defined(MDB_USE_POSIX_SEM) char mt2_wmname[MNAME_LEN]; #define mti_wmname mt2.mt2_wmname #else mdb_mutex_t mt2_wmutex; #define mti_wmutex mt2.mt2_wmutex #endif char pad[(MNAME_LEN+CACHELINE-1) & ~(CACHELINE-1)]; } mt2; MDB_reader mti_readers[1]; } MDB_txninfo; /** Lockfile format signature: version, features and field layout */ #define MDB_LOCK_FORMAT \ ((uint32_t) \ ((MDB_LOCK_VERSION) \ /* Flags which describe functionality */ \ + (((MDB_PIDLOCK) != 0) << 16))) /** @} */ /** Common header for all page types. The page type depends on #mp_flags. * * #P_BRANCH and #P_LEAF pages have unsorted '#MDB_node's at the end, with * sorted #mp_ptrs[] entries referring to them. Exception: #P_LEAF2 pages * omit mp_ptrs and pack sorted #MDB_DUPFIXED values after the page header. * * #P_OVERFLOW records occupy one or more contiguous pages where only the * first has a page header. They hold the real data of #F_BIGDATA nodes. * * #P_SUBP sub-pages are small leaf "pages" with duplicate data. * A node with flag #F_DUPDATA but not #F_SUBDATA contains a sub-page. * (Duplicate data can also go in sub-databases, which use normal pages.) * * #P_META pages contain #MDB_meta, the start point of an LMDB snapshot. * * Each non-metapage up to #MDB_meta.%mm_last_pg is reachable exactly once * in the snapshot: Either used by a database or listed in a freeDB record. */ typedef struct MDB_page { #define mp_pgno mp_p.p_pgno #define mp_next mp_p.p_next union { pgno_t p_pgno; /**< page number */ struct MDB_page *p_next; /**< for in-memory list of freed pages */ } mp_p; uint16_t mp_pad; /**< key size if this is a LEAF2 page */ /** @defgroup mdb_page Page Flags * @ingroup internal * Flags for the page headers. * @{ */ #define P_BRANCH 0x01 /**< branch page */ #define P_LEAF 0x02 /**< leaf page */ #define P_OVERFLOW 0x04 /**< overflow page */ #define P_META 0x08 /**< meta page */ #define P_DIRTY 0x10 /**< dirty page, also set for #P_SUBP pages */ #define P_LEAF2 0x20 /**< for #MDB_DUPFIXED records */ #define P_SUBP 0x40 /**< for #MDB_DUPSORT sub-pages */ #define P_LOOSE 0x4000 /**< page was dirtied then freed, can be reused */ #define P_KEEP 0x8000 /**< leave this page alone during spill */ /** @} */ uint16_t mp_flags; /**< @ref mdb_page */ #define mp_lower mp_pb.pb.pb_lower #define mp_upper mp_pb.pb.pb_upper #define mp_pages mp_pb.pb_pages union { struct { indx_t pb_lower; /**< lower bound of free space */ indx_t pb_upper; /**< upper bound of free space */ } pb; uint32_t pb_pages; /**< number of overflow pages */ } mp_pb; indx_t mp_ptrs[1]; /**< dynamic size */ } MDB_page; /** Size of the page header, excluding dynamic data at the end */ #define PAGEHDRSZ ((unsigned) offsetof(MDB_page, mp_ptrs)) /** Address of first usable data byte in a page, after the header */ #define METADATA(p) ((void *)((char *)(p) + PAGEHDRSZ)) /** ITS#7713, change PAGEBASE to handle 65536 byte pages */ #define PAGEBASE ((MDB_DEVEL) ? PAGEHDRSZ : 0) /** Number of nodes on a page */ #define NUMKEYS(p) (((p)->mp_lower - (PAGEHDRSZ-PAGEBASE)) >> 1) /** The amount of space remaining in the page */ #define SIZELEFT(p) (indx_t)((p)->mp_upper - (p)->mp_lower) /** The percentage of space used in the page, in tenths of a percent. */ #define PAGEFILL(env, p) (1000L * ((env)->me_psize - PAGEHDRSZ - SIZELEFT(p)) / \ ((env)->me_psize - PAGEHDRSZ)) /** The minimum page fill factor, in tenths of a percent. * Pages emptier than this are candidates for merging. */ #define FILL_THRESHOLD 250 /** Test if a page is a leaf page */ #define IS_LEAF(p) F_ISSET((p)->mp_flags, P_LEAF) /** Test if a page is a LEAF2 page */ #define IS_LEAF2(p) F_ISSET((p)->mp_flags, P_LEAF2) /** Test if a page is a branch page */ #define IS_BRANCH(p) F_ISSET((p)->mp_flags, P_BRANCH) /** Test if a page is an overflow page */ #define IS_OVERFLOW(p) F_ISSET((p)->mp_flags, P_OVERFLOW) /** Test if a page is a sub page */ #define IS_SUBP(p) F_ISSET((p)->mp_flags, P_SUBP) /** The number of overflow pages needed to store the given size. */ #define OVPAGES(size, psize) ((PAGEHDRSZ-1 + (size)) / (psize) + 1) /** Link in #MDB_txn.%mt_loose_pgs list. * Kept outside the page header, which is needed when reusing the page. */ #define NEXT_LOOSE_PAGE(p) (*(MDB_page **)((p) + 2)) /** Header for a single key/data pair within a page. * Used in pages of type #P_BRANCH and #P_LEAF without #P_LEAF2. * We guarantee 2-byte alignment for 'MDB_node's. * * #mn_lo and #mn_hi are used for data size on leaf nodes, and for child * pgno on branch nodes. On 64 bit platforms, #mn_flags is also used * for pgno. (Branch nodes have no flags). Lo and hi are in host byte * order in case some accesses can be optimized to 32-bit word access. * * Leaf node flags describe node contents. #F_BIGDATA says the node's * data part is the page number of an overflow page with actual data. * #F_DUPDATA and #F_SUBDATA can be combined giving duplicate data in * a sub-page/sub-database, and named databases (just #F_SUBDATA). */ typedef struct MDB_node { /** part of data size or pgno * @{ */ #if BYTE_ORDER == LITTLE_ENDIAN unsigned short mn_lo, mn_hi; #else unsigned short mn_hi, mn_lo; #endif /** @} */ /** @defgroup mdb_node Node Flags * @ingroup internal * Flags for node headers. * @{ */ #define F_BIGDATA 0x01 /**< data put on overflow page */ #define F_SUBDATA 0x02 /**< data is a sub-database */ #define F_DUPDATA 0x04 /**< data has duplicates */ /** valid flags for #mdb_node_add() */ #define NODE_ADD_FLAGS (F_DUPDATA|F_SUBDATA|MDB_RESERVE|MDB_APPEND) /** @} */ unsigned short mn_flags; /**< @ref mdb_node */ unsigned short mn_ksize; /**< key size */ char mn_data[1]; /**< key and data are appended here */ } MDB_node; /** Size of the node header, excluding dynamic data at the end */ #define NODESIZE offsetof(MDB_node, mn_data) /** Bit position of top word in page number, for shifting mn_flags */ #define PGNO_TOPWORD ((pgno_t)-1 > 0xffffffffu ? 32 : 0) /** Size of a node in a branch page with a given key. * This is just the node header plus the key, there is no data. */ #define INDXSIZE(k) (NODESIZE + ((k) == NULL ? 0 : (k)->mv_size)) /** Size of a node in a leaf page with a given key and data. * This is node header plus key plus data size. */ #define LEAFSIZE(k, d) (NODESIZE + (k)->mv_size + (d)->mv_size) /** Address of node \b i in page \b p */ #define NODEPTR(p, i) ((MDB_node *)((char *)(p) + (p)->mp_ptrs[i] + PAGEBASE)) /** Address of the key for the node */ #define NODEKEY(node) (void *)((node)->mn_data) /** Address of the data for a node */ #define NODEDATA(node) (void *)((char *)(node)->mn_data + (node)->mn_ksize) /** Get the page number pointed to by a branch node */ #define NODEPGNO(node) \ ((node)->mn_lo | ((pgno_t) (node)->mn_hi << 16) | \ (PGNO_TOPWORD ? ((pgno_t) (node)->mn_flags << PGNO_TOPWORD) : 0)) /** Set the page number in a branch node */ #define SETPGNO(node,pgno) do { \ (node)->mn_lo = (pgno) & 0xffff; (node)->mn_hi = (pgno) >> 16; \ if (PGNO_TOPWORD) (node)->mn_flags = (pgno) >> PGNO_TOPWORD; } while(0) /** Get the size of the data in a leaf node */ #define NODEDSZ(node) ((node)->mn_lo | ((unsigned)(node)->mn_hi << 16)) /** Set the size of the data for a leaf node */ #define SETDSZ(node,size) do { \ (node)->mn_lo = (size) & 0xffff; (node)->mn_hi = (size) >> 16;} while(0) /** The size of a key in a node */ #define NODEKSZ(node) ((node)->mn_ksize) /** Copy a page number from src to dst */ #ifdef MISALIGNED_OK #define COPY_PGNO(dst,src) dst = src #else #if SIZE_MAX > 4294967295UL #define COPY_PGNO(dst,src) do { \ unsigned short *s, *d; \ s = (unsigned short *)&(src); \ d = (unsigned short *)&(dst); \ *d++ = *s++; \ *d++ = *s++; \ *d++ = *s++; \ *d = *s; \ } while (0) #else #define COPY_PGNO(dst,src) do { \ unsigned short *s, *d; \ s = (unsigned short *)&(src); \ d = (unsigned short *)&(dst); \ *d++ = *s++; \ *d = *s; \ } while (0) #endif #endif /** The address of a key in a LEAF2 page. * LEAF2 pages are used for #MDB_DUPFIXED sorted-duplicate sub-DBs. * There are no node headers, keys are stored contiguously. */ #define LEAF2KEY(p, i, ks) ((char *)(p) + PAGEHDRSZ + ((i)*(ks))) /** Set the \b node's key into \b keyptr, if requested. */ #define MDB_GET_KEY(node, keyptr) { if ((keyptr) != NULL) { \ (keyptr)->mv_size = NODEKSZ(node); (keyptr)->mv_data = NODEKEY(node); } } /** Set the \b node's key into \b key. */ #define MDB_GET_KEY2(node, key) { key.mv_size = NODEKSZ(node); key.mv_data = NODEKEY(node); } /** Information about a single database in the environment. */ typedef struct MDB_db { uint32_t md_pad; /**< also ksize for LEAF2 pages */ uint16_t md_flags; /**< @ref mdb_dbi_open */ uint16_t md_depth; /**< depth of this tree */ pgno_t md_branch_pages; /**< number of internal pages */ pgno_t md_leaf_pages; /**< number of leaf pages */ pgno_t md_overflow_pages; /**< number of overflow pages */ size_t md_entries; /**< number of data items */ pgno_t md_root; /**< the root page of this tree */ } MDB_db; #define MDB_VALID 0x8000 /**< DB handle is valid, for me_dbflags */ #define PERSISTENT_FLAGS (0xffff & ~(MDB_VALID)) /** #mdb_dbi_open() flags */ #define VALID_FLAGS (MDB_REVERSEKEY|MDB_DUPSORT|MDB_INTEGERKEY|MDB_DUPFIXED|\ MDB_INTEGERDUP|MDB_REVERSEDUP|MDB_CREATE) /** Handle for the DB used to track free pages. */ #define FREE_DBI 0 /** Handle for the default DB. */ #define MAIN_DBI 1 /** Number of DBs in metapage (free and main) - also hardcoded elsewhere */ #define CORE_DBS 2 /** Number of meta pages - also hardcoded elsewhere */ #define NUM_METAS 2 /** Meta page content. * A meta page is the start point for accessing a database snapshot. * Pages 0-1 are meta pages. Transaction N writes meta page #(N % 2). */ typedef struct MDB_meta { /** Stamp identifying this as an LMDB file. It must be set * to #MDB_MAGIC. */ uint32_t mm_magic; /** Version number of this file. Must be set to #MDB_DATA_VERSION. */ uint32_t mm_version; void *mm_address; /**< address for fixed mapping */ size_t mm_mapsize; /**< size of mmap region */ MDB_db mm_dbs[CORE_DBS]; /**< first is free space, 2nd is main db */ /** The size of pages used in this DB */ #define mm_psize mm_dbs[FREE_DBI].md_pad /** Any persistent environment flags. @ref mdb_env */ #define mm_flags mm_dbs[FREE_DBI].md_flags /** Last used page in the datafile. * Actually the file may be shorter if the freeDB lists the final pages. */ pgno_t mm_last_pg; volatile txnid_t mm_txnid; /**< txnid that committed this page */ } MDB_meta; /** Buffer for a stack-allocated meta page. * The members define size and alignment, and silence type * aliasing warnings. They are not used directly; that could * mean incorrectly using several union members in parallel. */ typedef union MDB_metabuf { MDB_page mb_page; struct { char mm_pad[PAGEHDRSZ]; MDB_meta mm_meta; } mb_metabuf; } MDB_metabuf; /** Auxiliary DB info. * The information here is mostly static/read-only. There is * only a single copy of this record in the environment. */ typedef struct MDB_dbx { MDB_val md_name; /**< name of the database */ MDB_cmp_func *md_cmp; /**< function for comparing keys */ MDB_cmp_func *md_dcmp; /**< function for comparing data items */ MDB_rel_func *md_rel; /**< user relocate function */ void *md_relctx; /**< user-provided context for md_rel */ } MDB_dbx; /** A database transaction. * Every operation requires a transaction handle. */ struct MDB_txn { MDB_txn *mt_parent; /**< parent of a nested txn */ /** Nested txn under this txn, set together with flag #MDB_TXN_HAS_CHILD */ MDB_txn *mt_child; pgno_t mt_next_pgno; /**< next unallocated page */ /** The ID of this transaction. IDs are integers incrementing from 1. * Only committed write transactions increment the ID. If a transaction * aborts, the ID may be re-used by the next writer. */ txnid_t mt_txnid; MDB_env *mt_env; /**< the DB environment */ /** The list of pages that became unused during this transaction. */ MDB_IDL mt_free_pgs; /** The list of loose pages that became unused and may be reused * in this transaction, linked through #NEXT_LOOSE_PAGE(page). */ MDB_page *mt_loose_pgs; /** Number of loose pages (#mt_loose_pgs) */ int mt_loose_count; /** The sorted list of dirty pages we temporarily wrote to disk * because the dirty list was full. page numbers in here are * shifted left by 1, deleted slots have the LSB set. */ MDB_IDL mt_spill_pgs; union { /** For write txns: Modified pages. Sorted when not MDB_WRITEMAP. */ MDB_ID2L dirty_list; /** For read txns: This thread/txn's reader table slot, or NULL. */ MDB_reader *reader; } mt_u; /** Array of records for each DB known in the environment. */ MDB_dbx *mt_dbxs; /** Array of MDB_db records for each known DB */ MDB_db *mt_dbs; /** Array of sequence numbers for each DB handle */ unsigned int *mt_dbiseqs; /** @defgroup mt_dbflag Transaction DB Flags * @ingroup internal * @{ */ #define DB_DIRTY 0x01 /**< DB was written in this txn */ #define DB_STALE 0x02 /**< Named-DB record is older than txnID */ #define DB_NEW 0x04 /**< Named-DB handle opened in this txn */ #define DB_VALID 0x08 /**< DB handle is valid, see also #MDB_VALID */ #define DB_USRVALID 0x10 /**< As #DB_VALID, but not set for #FREE_DBI */ #define DB_DUPDATA 0x20 /**< DB is #MDB_DUPSORT data */ /** @} */ /** In write txns, array of cursors for each DB */ MDB_cursor **mt_cursors; /** Array of flags for each DB */ unsigned char *mt_dbflags; /** Number of DB records in use, or 0 when the txn is finished. * This number only ever increments until the txn finishes; we * don't decrement it when individual DB handles are closed. */ MDB_dbi mt_numdbs; /** @defgroup mdb_txn Transaction Flags * @ingroup internal * @{ */ /** #mdb_txn_begin() flags */ #define MDB_TXN_BEGIN_FLAGS MDB_RDONLY #define MDB_TXN_RDONLY MDB_RDONLY /**< read-only transaction */ /* internal txn flags */ #define MDB_TXN_WRITEMAP MDB_WRITEMAP /**< copy of #MDB_env flag in writers */ #define MDB_TXN_FINISHED 0x01 /**< txn is finished or never began */ #define MDB_TXN_ERROR 0x02 /**< txn is unusable after an error */ #define MDB_TXN_DIRTY 0x04 /**< must write, even if dirty list is empty */ #define MDB_TXN_SPILLS 0x08 /**< txn or a parent has spilled pages */ #define MDB_TXN_HAS_CHILD 0x10 /**< txn has an #MDB_txn.%mt_child */ /** most operations on the txn are currently illegal */ #define MDB_TXN_BLOCKED (MDB_TXN_FINISHED|MDB_TXN_ERROR|MDB_TXN_HAS_CHILD) /** @} */ unsigned int mt_flags; /**< @ref mdb_txn */ /** #dirty_list room: Array size - \#dirty pages visible to this txn. * Includes ancestor txns' dirty pages not hidden by other txns' * dirty/spilled pages. Thus commit(nested txn) has room to merge * dirty_list into mt_parent after freeing hidden mt_parent pages. */ unsigned int mt_dirty_room; }; /** Enough space for 2^32 nodes with minimum of 2 keys per node. I.e., plenty. * At 4 keys per node, enough for 2^64 nodes, so there's probably no need to * raise this on a 64 bit machine. */ #define CURSOR_STACK 32 struct MDB_xcursor; /** Cursors are used for all DB operations. * A cursor holds a path of (page pointer, key index) from the DB * root to a position in the DB, plus other state. #MDB_DUPSORT * cursors include an xcursor to the current data item. Write txns * track their cursors and keep them up to date when data moves. * Exception: An xcursor's pointer to a #P_SUBP page can be stale. * (A node with #F_DUPDATA but no #F_SUBDATA contains a subpage). */ struct MDB_cursor { /** Next cursor on this DB in this txn */ MDB_cursor *mc_next; /** Backup of the original cursor if this cursor is a shadow */ MDB_cursor *mc_backup; /** Context used for databases with #MDB_DUPSORT, otherwise NULL */ struct MDB_xcursor *mc_xcursor; /** The transaction that owns this cursor */ MDB_txn *mc_txn; /** The database handle this cursor operates on */ MDB_dbi mc_dbi; /** The database record for this cursor */ MDB_db *mc_db; /** The database auxiliary record for this cursor */ MDB_dbx *mc_dbx; /** The @ref mt_dbflag for this database */ unsigned char *mc_dbflag; unsigned short mc_snum; /**< number of pushed pages */ unsigned short mc_top; /**< index of top page, normally mc_snum-1 */ /** @defgroup mdb_cursor Cursor Flags * @ingroup internal * Cursor state flags. * @{ */ #define C_INITIALIZED 0x01 /**< cursor has been initialized and is valid */ #define C_EOF 0x02 /**< No more data */ #define C_SUB 0x04 /**< Cursor is a sub-cursor */ #define C_DEL 0x08 /**< last op was a cursor_del */ #define C_UNTRACK 0x40 /**< Un-track cursor when closing */ /** @} */ unsigned int mc_flags; /**< @ref mdb_cursor */ MDB_page *mc_pg[CURSOR_STACK]; /**< stack of pushed pages */ indx_t mc_ki[CURSOR_STACK]; /**< stack of page indices */ }; /** Context for sorted-dup records. * We could have gone to a fully recursive design, with arbitrarily * deep nesting of sub-databases. But for now we only handle these * levels - main DB, optional sub-DB, sorted-duplicate DB. */ typedef struct MDB_xcursor { /** A sub-cursor for traversing the Dup DB */ MDB_cursor mx_cursor; /** The database record for this Dup DB */ MDB_db mx_db; /** The auxiliary DB record for this Dup DB */ MDB_dbx mx_dbx; /** The @ref mt_dbflag for this Dup DB */ unsigned char mx_dbflag; } MDB_xcursor; /** Check if there is an inited xcursor */ #define XCURSOR_INITED(mc) \ ((mc)->mc_xcursor && ((mc)->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED)) /** Update the xcursor's sub-page pointer, if any, in \b mc. Needed * when the node which contains the sub-page may have moved. Called * with leaf page \b mp = mc->mc_pg[\b top]. */ #define XCURSOR_REFRESH(mc, top, mp) do { \ MDB_page *xr_pg = (mp); \ MDB_node *xr_node; \ if (!XCURSOR_INITED(mc) || (mc)->mc_ki[top] >= NUMKEYS(xr_pg)) break; \ xr_node = NODEPTR(xr_pg, (mc)->mc_ki[top]); \ if ((xr_node->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) \ (mc)->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(xr_node); \ } while (0) /** State of FreeDB old pages, stored in the MDB_env */ typedef struct MDB_pgstate { pgno_t *mf_pghead; /**< Reclaimed freeDB pages, or NULL before use */ txnid_t mf_pglast; /**< ID of last used record, or 0 if !mf_pghead */ } MDB_pgstate; /** The database environment. */ struct MDB_env { HANDLE me_fd; /**< The main data file */ HANDLE me_lfd; /**< The lock file */ HANDLE me_mfd; /**< For writing and syncing the meta pages */ /** Failed to update the meta page. Probably an I/O error. */ #define MDB_FATAL_ERROR 0x80000000U /** Some fields are initialized. */ #define MDB_ENV_ACTIVE 0x20000000U /** me_txkey is set */ #define MDB_ENV_TXKEY 0x10000000U /** fdatasync is unreliable */ #define MDB_FSYNCONLY 0x08000000U uint32_t me_flags; /**< @ref mdb_env */ unsigned int me_psize; /**< DB page size, inited from me_os_psize */ unsigned int me_os_psize; /**< OS page size, from #GET_PAGESIZE */ unsigned int me_maxreaders; /**< size of the reader table */ /** Max #MDB_txninfo.%mti_numreaders of interest to #mdb_env_close() */ volatile int me_close_readers; MDB_dbi me_numdbs; /**< number of DBs opened */ MDB_dbi me_maxdbs; /**< size of the DB table */ MDB_PID_T me_pid; /**< process ID of this env */ char *me_path; /**< path to the DB files */ char *me_map; /**< the memory map of the data file */ MDB_txninfo *me_txns; /**< the memory map of the lock file or NULL */ MDB_meta *me_metas[NUM_METAS]; /**< pointers to the two meta pages */ void *me_pbuf; /**< scratch area for DUPSORT put() */ MDB_txn *me_txn; /**< current write transaction */ MDB_txn *me_txn0; /**< prealloc'd write transaction */ size_t me_mapsize; /**< size of the data memory map */ off_t me_size; /**< current file size */ pgno_t me_maxpg; /**< me_mapsize / me_psize */ MDB_dbx *me_dbxs; /**< array of static DB info */ uint16_t *me_dbflags; /**< array of flags from MDB_db.md_flags */ unsigned int *me_dbiseqs; /**< array of dbi sequence numbers */ pthread_key_t me_txkey; /**< thread-key for readers */ txnid_t me_pgoldest; /**< ID of oldest reader last time we looked */ MDB_pgstate me_pgstate; /**< state of old pages from freeDB */ # define me_pglast me_pgstate.mf_pglast # define me_pghead me_pgstate.mf_pghead MDB_page *me_dpages; /**< list of malloc'd blocks for re-use */ /** IDL of pages that became unused in a write txn */ MDB_IDL me_free_pgs; /** ID2L of pages written during a write txn. Length MDB_IDL_UM_SIZE. */ MDB_ID2L me_dirty_list; /** Max number of freelist items that can fit in a single overflow page */ int me_maxfree_1pg; /** Max size of a node on a page */ unsigned int me_nodemax; #if !(MDB_MAXKEYSIZE) unsigned int me_maxkey; /**< max size of a key */ #endif int me_live_reader; /**< have liveness lock in reader table */ #ifdef _WIN32 int me_pidquery; /**< Used in OpenProcess */ #endif #ifdef MDB_USE_POSIX_MUTEX /* Posix mutexes reside in shared mem */ # define me_rmutex me_txns->mti_rmutex /**< Shared reader lock */ # define me_wmutex me_txns->mti_wmutex /**< Shared writer lock */ #else mdb_mutex_t me_rmutex; mdb_mutex_t me_wmutex; #endif void *me_userctx; /**< User-settable context */ MDB_assert_func *me_assert_func; /**< Callback for assertion failures */ }; /** Nested transaction */ typedef struct MDB_ntxn { MDB_txn mnt_txn; /**< the transaction */ MDB_pgstate mnt_pgstate; /**< parent transaction's saved freestate */ } MDB_ntxn; /** max number of pages to commit in one writev() call */ #define MDB_COMMIT_PAGES 64 #if defined(IOV_MAX) && IOV_MAX < MDB_COMMIT_PAGES #undef MDB_COMMIT_PAGES #define MDB_COMMIT_PAGES IOV_MAX #endif /** max bytes to write in one call */ #define MAX_WRITE (0x40000000U >> (sizeof(ssize_t) == 4)) /** Check \b txn and \b dbi arguments to a function */ #define TXN_DBI_EXIST(txn, dbi, validity) \ ((txn) && (dbi)<(txn)->mt_numdbs && ((txn)->mt_dbflags[dbi] & (validity))) /** Check for misused \b dbi handles */ #define TXN_DBI_CHANGED(txn, dbi) \ ((txn)->mt_dbiseqs[dbi] != (txn)->mt_env->me_dbiseqs[dbi]) static int mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp); static int mdb_page_new(MDB_cursor *mc, uint32_t flags, int num, MDB_page **mp); static int mdb_page_touch(MDB_cursor *mc); #define MDB_END_NAMES {"committed", "empty-commit", "abort", "reset", \ "reset-tmp", "fail-begin", "fail-beginchild"} enum { /* mdb_txn_end operation number, for logging */ MDB_END_COMMITTED, MDB_END_EMPTY_COMMIT, MDB_END_ABORT, MDB_END_RESET, MDB_END_RESET_TMP, MDB_END_FAIL_BEGIN, MDB_END_FAIL_BEGINCHILD }; #define MDB_END_OPMASK 0x0F /**< mask for #mdb_txn_end() operation number */ #define MDB_END_UPDATE 0x10 /**< update env state (DBIs) */ #define MDB_END_FREE 0x20 /**< free txn unless it is #MDB_env.%me_txn0 */ #define MDB_END_SLOT MDB_NOTLS /**< release any reader slot if #MDB_NOTLS */ static void mdb_txn_end(MDB_txn *txn, unsigned mode); static int mdb_page_get(MDB_cursor *mc, pgno_t pgno, MDB_page **mp, int *lvl); static int mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int modify); #define MDB_PS_MODIFY 1 #define MDB_PS_ROOTONLY 2 #define MDB_PS_FIRST 4 #define MDB_PS_LAST 8 static int mdb_page_search(MDB_cursor *mc, MDB_val *key, int flags); static int mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst); #define MDB_SPLIT_REPLACE MDB_APPENDDUP /**< newkey is not new */ static int mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno, unsigned int nflags); static int mdb_env_read_header(MDB_env *env, MDB_meta *meta); static MDB_meta *mdb_env_pick_meta(const MDB_env *env); static int mdb_env_write_meta(MDB_txn *txn); #ifdef MDB_USE_POSIX_MUTEX /* Drop unused excl arg */ # define mdb_env_close0(env, excl) mdb_env_close1(env) #endif static void mdb_env_close0(MDB_env *env, int excl); static MDB_node *mdb_node_search(MDB_cursor *mc, MDB_val *key, int *exactp); static int mdb_node_add(MDB_cursor *mc, indx_t indx, MDB_val *key, MDB_val *data, pgno_t pgno, unsigned int flags); static void mdb_node_del(MDB_cursor *mc, int ksize); static void mdb_node_shrink(MDB_page *mp, indx_t indx); static int mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft); static int mdb_node_read(MDB_cursor *mc, MDB_node *leaf, MDB_val *data); static size_t mdb_leaf_size(MDB_env *env, MDB_val *key, MDB_val *data); static size_t mdb_branch_size(MDB_env *env, MDB_val *key); static int mdb_rebalance(MDB_cursor *mc); static int mdb_update_key(MDB_cursor *mc, MDB_val *key); static void mdb_cursor_pop(MDB_cursor *mc); static int mdb_cursor_push(MDB_cursor *mc, MDB_page *mp); static int mdb_cursor_del0(MDB_cursor *mc); static int mdb_del0(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data, unsigned flags); static int mdb_cursor_sibling(MDB_cursor *mc, int move_right); static int mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op); static int mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op); static int mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op, int *exactp); static int mdb_cursor_first(MDB_cursor *mc, MDB_val *key, MDB_val *data); static int mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data); static void mdb_cursor_init(MDB_cursor *mc, MDB_txn *txn, MDB_dbi dbi, MDB_xcursor *mx); static void mdb_xcursor_init0(MDB_cursor *mc); static void mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node); static void mdb_xcursor_init2(MDB_cursor *mc, MDB_xcursor *src_mx, int force); static int mdb_drop0(MDB_cursor *mc, int subs); static void mdb_default_cmp(MDB_txn *txn, MDB_dbi dbi); static int mdb_reader_check0(MDB_env *env, int rlocked, int *dead); /** @cond */ static MDB_cmp_func mdb_cmp_memn, mdb_cmp_memnr, mdb_cmp_int, mdb_cmp_cint, mdb_cmp_long; /** @endcond */ /** Compare two items pointing at size_t's of unknown alignment. */ #ifdef MISALIGNED_OK # define mdb_cmp_clong mdb_cmp_long #else # define mdb_cmp_clong mdb_cmp_cint #endif #ifdef _WIN32 static SECURITY_DESCRIPTOR mdb_null_sd; static SECURITY_ATTRIBUTES mdb_all_sa; static int mdb_sec_inited; struct MDB_name; static int utf8_to_utf16(const char *src, struct MDB_name *dst, int xtra); #endif /** Return the library version info. */ char * ESECT mdb_version(int *major, int *minor, int *patch) { if (major) *major = MDB_VERSION_MAJOR; if (minor) *minor = MDB_VERSION_MINOR; if (patch) *patch = MDB_VERSION_PATCH; return MDB_VERSION_STRING; } /** Table of descriptions for LMDB @ref errors */ static char *const mdb_errstr[] = { "MDB_KEYEXIST: Key/data pair already exists", "MDB_NOTFOUND: No matching key/data pair found", "MDB_PAGE_NOTFOUND: Requested page not found", "MDB_CORRUPTED: Located page was wrong type", "MDB_PANIC: Update of meta page failed or environment had fatal error", "MDB_VERSION_MISMATCH: Database environment version mismatch", "MDB_INVALID: File is not an LMDB file", "MDB_MAP_FULL: Environment mapsize limit reached", "MDB_DBS_FULL: Environment maxdbs limit reached", "MDB_READERS_FULL: Environment maxreaders limit reached", "MDB_TLS_FULL: Thread-local storage keys full - too many environments open", "MDB_TXN_FULL: Transaction has too many dirty pages - transaction too big", "MDB_CURSOR_FULL: Internal error - cursor stack limit reached", "MDB_PAGE_FULL: Internal error - page has no more space", "MDB_MAP_RESIZED: Database contents grew beyond environment mapsize", "MDB_INCOMPATIBLE: Operation and DB incompatible, or DB flags changed", "MDB_BAD_RSLOT: Invalid reuse of reader locktable slot", "MDB_BAD_TXN: Transaction must abort, has a child, or is invalid", "MDB_BAD_VALSIZE: Unsupported size of key/DB name/data, or wrong DUPFIXED size", "MDB_BAD_DBI: The specified DBI handle was closed/changed unexpectedly", }; char * mdb_strerror(int err) { #ifdef _WIN32 /** HACK: pad 4KB on stack over the buf. Return system msgs in buf. * This works as long as no function between the call to mdb_strerror * and the actual use of the message uses more than 4K of stack. */ #define MSGSIZE 1024 #define PADSIZE 4096 char buf[MSGSIZE+PADSIZE], *ptr = buf; #endif int i; if (!err) return ("Successful return: 0"); if (err >= MDB_KEYEXIST && err <= MDB_LAST_ERRCODE) { i = err - MDB_KEYEXIST; return mdb_errstr[i]; } #ifdef _WIN32 /* These are the C-runtime error codes we use. The comment indicates * their numeric value, and the Win32 error they would correspond to * if the error actually came from a Win32 API. A major mess, we should * have used LMDB-specific error codes for everything. */ switch(err) { case ENOENT: /* 2, FILE_NOT_FOUND */ case EIO: /* 5, ACCESS_DENIED */ case ENOMEM: /* 12, INVALID_ACCESS */ case EACCES: /* 13, INVALID_DATA */ case EBUSY: /* 16, CURRENT_DIRECTORY */ case EINVAL: /* 22, BAD_COMMAND */ case ENOSPC: /* 28, OUT_OF_PAPER */ return strerror(err); default: ; } buf[0] = 0; FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, err, 0, ptr, MSGSIZE, (va_list *)buf+MSGSIZE); return ptr; #else return strerror(err); #endif } /** assert(3) variant in cursor context */ #define mdb_cassert(mc, expr) mdb_assert0((mc)->mc_txn->mt_env, expr, #expr) /** assert(3) variant in transaction context */ #define mdb_tassert(txn, expr) mdb_assert0((txn)->mt_env, expr, #expr) /** assert(3) variant in environment context */ #define mdb_eassert(env, expr) mdb_assert0(env, expr, #expr) #ifndef NDEBUG # define mdb_assert0(env, expr, expr_txt) ((expr) ? (void)0 : \ mdb_assert_fail(env, expr_txt, mdb_func_, __FILE__, __LINE__)) static void ESECT mdb_assert_fail(MDB_env *env, const char *expr_txt, const char *func, const char *file, int line) { char buf[400]; sprintf(buf, "%.100s:%d: Assertion '%.200s' failed in %.40s()", file, line, expr_txt, func); if (env->me_assert_func) env->me_assert_func(env, buf); fprintf(stderr, "%s\n", buf); abort(); } #else # define mdb_assert0(env, expr, expr_txt) ((void) 0) #endif /* NDEBUG */ #if MDB_DEBUG /** Return the page number of \b mp which may be sub-page, for debug output */ static pgno_t mdb_dbg_pgno(MDB_page *mp) { pgno_t ret; COPY_PGNO(ret, mp->mp_pgno); return ret; } /** Display a key in hexadecimal and return the address of the result. * @param[in] key the key to display * @param[in] buf the buffer to write into. Should always be #DKBUF. * @return The key in hexadecimal form. */ char * mdb_dkey(MDB_val *key, char *buf) { char *ptr = buf; unsigned char *c = key->mv_data; unsigned int i; if (!key) return ""; if (key->mv_size > DKBUF_MAXKEYSIZE) return "MDB_MAXKEYSIZE"; /* may want to make this a dynamic check: if the key is mostly * printable characters, print it as-is instead of converting to hex. */ #if 1 buf[0] = '\0'; for (i=0; imv_size; i++) ptr += sprintf(ptr, "%02x", *c++); #else sprintf(buf, "%.*s", key->mv_size, key->mv_data); #endif return buf; } static const char * mdb_leafnode_type(MDB_node *n) { static char *const tp[2][2] = {{"", ": DB"}, {": sub-page", ": sub-DB"}}; return F_ISSET(n->mn_flags, F_BIGDATA) ? ": overflow page" : tp[F_ISSET(n->mn_flags, F_DUPDATA)][F_ISSET(n->mn_flags, F_SUBDATA)]; } /** Display all the keys in the page. */ void mdb_page_list(MDB_page *mp) { pgno_t pgno = mdb_dbg_pgno(mp); const char *type, *state = (mp->mp_flags & P_DIRTY) ? ", dirty" : ""; MDB_node *node; unsigned int i, nkeys, nsize, total = 0; MDB_val key; DKBUF; switch (mp->mp_flags & (P_BRANCH|P_LEAF|P_LEAF2|P_META|P_OVERFLOW|P_SUBP)) { case P_BRANCH: type = "Branch page"; break; case P_LEAF: type = "Leaf page"; break; case P_LEAF|P_SUBP: type = "Sub-page"; break; case P_LEAF|P_LEAF2: type = "LEAF2 page"; break; case P_LEAF|P_LEAF2|P_SUBP: type = "LEAF2 sub-page"; break; case P_OVERFLOW: fprintf(stderr, "Overflow page %"Z"u pages %u%s\n", pgno, mp->mp_pages, state); return; case P_META: fprintf(stderr, "Meta-page %"Z"u txnid %"Z"u\n", pgno, ((MDB_meta *)METADATA(mp))->mm_txnid); return; default: fprintf(stderr, "Bad page %"Z"u flags 0x%X\n", pgno, mp->mp_flags); return; } nkeys = NUMKEYS(mp); fprintf(stderr, "%s %"Z"u numkeys %d%s\n", type, pgno, nkeys, state); for (i=0; imp_pad; key.mv_data = LEAF2KEY(mp, i, nsize); total += nsize; fprintf(stderr, "key %d: nsize %d, %s\n", i, nsize, DKEY(&key)); continue; } node = NODEPTR(mp, i); key.mv_size = node->mn_ksize; key.mv_data = node->mn_data; nsize = NODESIZE + key.mv_size; if (IS_BRANCH(mp)) { fprintf(stderr, "key %d: page %"Z"u, %s\n", i, NODEPGNO(node), DKEY(&key)); total += nsize; } else { if (F_ISSET(node->mn_flags, F_BIGDATA)) nsize += sizeof(pgno_t); else nsize += NODEDSZ(node); total += nsize; nsize += sizeof(indx_t); fprintf(stderr, "key %d: nsize %d, %s%s\n", i, nsize, DKEY(&key), mdb_leafnode_type(node)); } total = EVEN(total); } fprintf(stderr, "Total: header %d + contents %d + unused %d\n", IS_LEAF2(mp) ? PAGEHDRSZ : PAGEBASE + mp->mp_lower, total, SIZELEFT(mp)); } void mdb_cursor_chk(MDB_cursor *mc) { unsigned int i; MDB_node *node; MDB_page *mp; if (!mc->mc_snum || !(mc->mc_flags & C_INITIALIZED)) return; for (i=0; imc_top; i++) { mp = mc->mc_pg[i]; node = NODEPTR(mp, mc->mc_ki[i]); if (NODEPGNO(node) != mc->mc_pg[i+1]->mp_pgno) printf("oops!\n"); } if (mc->mc_ki[i] >= NUMKEYS(mc->mc_pg[i])) printf("ack!\n"); if (XCURSOR_INITED(mc)) { node = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); if (((node->mn_flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA) && mc->mc_xcursor->mx_cursor.mc_pg[0] != NODEDATA(node)) { printf("blah!\n"); } } } #endif #if (MDB_DEBUG) > 2 /** Count all the pages in each DB and in the freelist * and make sure it matches the actual number of pages * being used. * All named DBs must be open for a correct count. */ static void mdb_audit(MDB_txn *txn) { MDB_cursor mc; MDB_val key, data; MDB_ID freecount, count; MDB_dbi i; int rc; freecount = 0; mdb_cursor_init(&mc, txn, FREE_DBI, NULL); while ((rc = mdb_cursor_get(&mc, &key, &data, MDB_NEXT)) == 0) freecount += *(MDB_ID *)data.mv_data; mdb_tassert(txn, rc == MDB_NOTFOUND); count = 0; for (i = 0; imt_numdbs; i++) { MDB_xcursor mx; if (!(txn->mt_dbflags[i] & DB_VALID)) continue; mdb_cursor_init(&mc, txn, i, &mx); if (txn->mt_dbs[i].md_root == P_INVALID) continue; count += txn->mt_dbs[i].md_branch_pages + txn->mt_dbs[i].md_leaf_pages + txn->mt_dbs[i].md_overflow_pages; if (txn->mt_dbs[i].md_flags & MDB_DUPSORT) { rc = mdb_page_search(&mc, NULL, MDB_PS_FIRST); for (; rc == MDB_SUCCESS; rc = mdb_cursor_sibling(&mc, 1)) { unsigned j; MDB_page *mp; mp = mc.mc_pg[mc.mc_top]; for (j=0; jmn_flags & F_SUBDATA) { MDB_db db; memcpy(&db, NODEDATA(leaf), sizeof(db)); count += db.md_branch_pages + db.md_leaf_pages + db.md_overflow_pages; } } } mdb_tassert(txn, rc == MDB_NOTFOUND); } } if (freecount + count + NUM_METAS != txn->mt_next_pgno) { fprintf(stderr, "audit: %"Z"u freecount: %"Z"u count: %"Z"u total: %"Z"u next_pgno: %"Z"u\n", txn->mt_txnid, freecount, count+NUM_METAS, freecount+count+NUM_METAS, txn->mt_next_pgno); } } #endif int mdb_cmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b) { return txn->mt_dbxs[dbi].md_cmp(a, b); } int mdb_dcmp(MDB_txn *txn, MDB_dbi dbi, const MDB_val *a, const MDB_val *b) { MDB_cmp_func *dcmp = txn->mt_dbxs[dbi].md_dcmp; #if UINT_MAX < SIZE_MAX if (dcmp == mdb_cmp_int && a->mv_size == sizeof(size_t)) dcmp = mdb_cmp_clong; #endif return dcmp(a, b); } /** Allocate memory for a page. * Re-use old malloc'd pages first for singletons, otherwise just malloc. * Set #MDB_TXN_ERROR on failure. */ static MDB_page * mdb_page_malloc(MDB_txn *txn, unsigned num) { MDB_env *env = txn->mt_env; MDB_page *ret = env->me_dpages; size_t psize = env->me_psize, sz = psize, off; /* For ! #MDB_NOMEMINIT, psize counts how much to init. * For a single page alloc, we init everything after the page header. * For multi-page, we init the final page; if the caller needed that * many pages they will be filling in at least up to the last page. */ if (num == 1) { if (ret) { VGMEMP_ALLOC(env, ret, sz); VGMEMP_DEFINED(ret, sizeof(ret->mp_next)); env->me_dpages = ret->mp_next; return ret; } psize -= off = PAGEHDRSZ; } else { sz *= num; off = sz - psize; } if ((ret = malloc(sz)) != NULL) { VGMEMP_ALLOC(env, ret, sz); if (!(env->me_flags & MDB_NOMEMINIT)) { memset((char *)ret + off, 0, psize); ret->mp_pad = 0; } } else { txn->mt_flags |= MDB_TXN_ERROR; } return ret; } /** Free a single page. * Saves single pages to a list, for future reuse. * (This is not used for multi-page overflow pages.) */ static void mdb_page_free(MDB_env *env, MDB_page *mp) { mp->mp_next = env->me_dpages; VGMEMP_FREE(env, mp); env->me_dpages = mp; } /** Free a dirty page */ static void mdb_dpage_free(MDB_env *env, MDB_page *dp) { if (!IS_OVERFLOW(dp) || dp->mp_pages == 1) { mdb_page_free(env, dp); } else { /* large pages just get freed directly */ VGMEMP_FREE(env, dp); free(dp); } } /** Return all dirty pages to dpage list */ static void mdb_dlist_free(MDB_txn *txn) { MDB_env *env = txn->mt_env; MDB_ID2L dl = txn->mt_u.dirty_list; unsigned i, n = dl[0].mid; for (i = 1; i <= n; i++) { mdb_dpage_free(env, dl[i].mptr); } dl[0].mid = 0; } /** Loosen or free a single page. * Saves single pages to a list for future reuse * in this same txn. It has been pulled from the freeDB * and already resides on the dirty list, but has been * deleted. Use these pages first before pulling again * from the freeDB. * * If the page wasn't dirtied in this txn, just add it * to this txn's free list. */ static int mdb_page_loose(MDB_cursor *mc, MDB_page *mp) { int loose = 0; pgno_t pgno = mp->mp_pgno; MDB_txn *txn = mc->mc_txn; if ((mp->mp_flags & P_DIRTY) && mc->mc_dbi != FREE_DBI) { if (txn->mt_parent) { MDB_ID2 *dl = txn->mt_u.dirty_list; /* If txn has a parent, make sure the page is in our * dirty list. */ if (dl[0].mid) { unsigned x = mdb_mid2l_search(dl, pgno); if (x <= dl[0].mid && dl[x].mid == pgno) { if (mp != dl[x].mptr) { /* bad cursor? */ mc->mc_flags &= ~(C_INITIALIZED|C_EOF); txn->mt_flags |= MDB_TXN_ERROR; return MDB_CORRUPTED; } /* ok, it's ours */ loose = 1; } } } else { /* no parent txn, so it's just ours */ loose = 1; } } if (loose) { DPRINTF(("loosen db %d page %"Z"u", DDBI(mc), mp->mp_pgno)); NEXT_LOOSE_PAGE(mp) = txn->mt_loose_pgs; txn->mt_loose_pgs = mp; txn->mt_loose_count++; mp->mp_flags |= P_LOOSE; } else { int rc = mdb_midl_append(&txn->mt_free_pgs, pgno); if (rc) return rc; } return MDB_SUCCESS; } /** Set or clear P_KEEP in dirty, non-overflow, non-sub pages watched by txn. * @param[in] mc A cursor handle for the current operation. * @param[in] pflags Flags of the pages to update: * P_DIRTY to set P_KEEP, P_DIRTY|P_KEEP to clear it. * @param[in] all No shortcuts. Needed except after a full #mdb_page_flush(). * @return 0 on success, non-zero on failure. */ static int mdb_pages_xkeep(MDB_cursor *mc, unsigned pflags, int all) { enum { Mask = P_SUBP|P_DIRTY|P_LOOSE|P_KEEP }; MDB_txn *txn = mc->mc_txn; MDB_cursor *m3, *m0 = mc; MDB_xcursor *mx; MDB_page *dp, *mp; MDB_node *leaf; unsigned i, j; int rc = MDB_SUCCESS, level; /* Mark pages seen by cursors */ if (mc->mc_flags & C_UNTRACK) mc = NULL; /* will find mc in mt_cursors */ for (i = txn->mt_numdbs;; mc = txn->mt_cursors[--i]) { for (; mc; mc=mc->mc_next) { if (!(mc->mc_flags & C_INITIALIZED)) continue; for (m3 = mc;; m3 = &mx->mx_cursor) { mp = NULL; for (j=0; jmc_snum; j++) { mp = m3->mc_pg[j]; if ((mp->mp_flags & Mask) == pflags) mp->mp_flags ^= P_KEEP; } mx = m3->mc_xcursor; /* Proceed to mx if it is at a sub-database */ if (! (mx && (mx->mx_cursor.mc_flags & C_INITIALIZED))) break; if (! (mp && (mp->mp_flags & P_LEAF))) break; leaf = NODEPTR(mp, m3->mc_ki[j-1]); if (!(leaf->mn_flags & F_SUBDATA)) break; } } if (i == 0) break; } if (all) { /* Mark dirty root pages */ for (i=0; imt_numdbs; i++) { if (txn->mt_dbflags[i] & DB_DIRTY) { pgno_t pgno = txn->mt_dbs[i].md_root; if (pgno == P_INVALID) continue; if ((rc = mdb_page_get(m0, pgno, &dp, &level)) != MDB_SUCCESS) break; if ((dp->mp_flags & Mask) == pflags && level <= 1) dp->mp_flags ^= P_KEEP; } } } return rc; } static int mdb_page_flush(MDB_txn *txn, int keep); /** Spill pages from the dirty list back to disk. * This is intended to prevent running into #MDB_TXN_FULL situations, * but note that they may still occur in a few cases: * 1) our estimate of the txn size could be too small. Currently this * seems unlikely, except with a large number of #MDB_MULTIPLE items. * 2) child txns may run out of space if their parents dirtied a * lot of pages and never spilled them. TODO: we probably should do * a preemptive spill during #mdb_txn_begin() of a child txn, if * the parent's dirty_room is below a given threshold. * * Otherwise, if not using nested txns, it is expected that apps will * not run into #MDB_TXN_FULL any more. The pages are flushed to disk * the same way as for a txn commit, e.g. their P_DIRTY flag is cleared. * If the txn never references them again, they can be left alone. * If the txn only reads them, they can be used without any fuss. * If the txn writes them again, they can be dirtied immediately without * going thru all of the work of #mdb_page_touch(). Such references are * handled by #mdb_page_unspill(). * * Also note, we never spill DB root pages, nor pages of active cursors, * because we'll need these back again soon anyway. And in nested txns, * we can't spill a page in a child txn if it was already spilled in a * parent txn. That would alter the parent txns' data even though * the child hasn't committed yet, and we'd have no way to undo it if * the child aborted. * * @param[in] m0 cursor A cursor handle identifying the transaction and * database for which we are checking space. * @param[in] key For a put operation, the key being stored. * @param[in] data For a put operation, the data being stored. * @return 0 on success, non-zero on failure. */ static int mdb_page_spill(MDB_cursor *m0, MDB_val *key, MDB_val *data) { MDB_txn *txn = m0->mc_txn; MDB_page *dp; MDB_ID2L dl = txn->mt_u.dirty_list; unsigned int i, j, need; int rc; if (m0->mc_flags & C_SUB) return MDB_SUCCESS; /* Estimate how much space this op will take */ i = m0->mc_db->md_depth; /* Named DBs also dirty the main DB */ if (m0->mc_dbi >= CORE_DBS) i += txn->mt_dbs[MAIN_DBI].md_depth; /* For puts, roughly factor in the key+data size */ if (key) i += (LEAFSIZE(key, data) + txn->mt_env->me_psize) / txn->mt_env->me_psize; i += i; /* double it for good measure */ need = i; if (txn->mt_dirty_room > i) return MDB_SUCCESS; if (!txn->mt_spill_pgs) { txn->mt_spill_pgs = mdb_midl_alloc(MDB_IDL_UM_MAX); if (!txn->mt_spill_pgs) return ENOMEM; } else { /* purge deleted slots */ MDB_IDL sl = txn->mt_spill_pgs; unsigned int num = sl[0]; j=0; for (i=1; i<=num; i++) { if (!(sl[i] & 1)) sl[++j] = sl[i]; } sl[0] = j; } /* Preserve pages which may soon be dirtied again */ if ((rc = mdb_pages_xkeep(m0, P_DIRTY, 1)) != MDB_SUCCESS) goto done; /* Less aggressive spill - we originally spilled the entire dirty list, * with a few exceptions for cursor pages and DB root pages. But this * turns out to be a lot of wasted effort because in a large txn many * of those pages will need to be used again. So now we spill only 1/8th * of the dirty pages. Testing revealed this to be a good tradeoff, * better than 1/2, 1/4, or 1/10. */ if (need < MDB_IDL_UM_MAX / 8) need = MDB_IDL_UM_MAX / 8; /* Save the page IDs of all the pages we're flushing */ /* flush from the tail forward, this saves a lot of shifting later on. */ for (i=dl[0].mid; i && need; i--) { MDB_ID pn = dl[i].mid << 1; dp = dl[i].mptr; if (dp->mp_flags & (P_LOOSE|P_KEEP)) continue; /* Can't spill twice, make sure it's not already in a parent's * spill list. */ if (txn->mt_parent) { MDB_txn *tx2; for (tx2 = txn->mt_parent; tx2; tx2 = tx2->mt_parent) { if (tx2->mt_spill_pgs) { j = mdb_midl_search(tx2->mt_spill_pgs, pn); if (j <= tx2->mt_spill_pgs[0] && tx2->mt_spill_pgs[j] == pn) { dp->mp_flags |= P_KEEP; break; } } } if (tx2) continue; } if ((rc = mdb_midl_append(&txn->mt_spill_pgs, pn))) goto done; need--; } mdb_midl_sort(txn->mt_spill_pgs); /* Flush the spilled part of dirty list */ if ((rc = mdb_page_flush(txn, i)) != MDB_SUCCESS) goto done; /* Reset any dirty pages we kept that page_flush didn't see */ rc = mdb_pages_xkeep(m0, P_DIRTY|P_KEEP, i); done: txn->mt_flags |= rc ? MDB_TXN_ERROR : MDB_TXN_SPILLS; return rc; } /** Find oldest txnid still referenced. Expects txn->mt_txnid > 0. */ static txnid_t mdb_find_oldest(MDB_txn *txn) { int i; txnid_t mr, oldest = txn->mt_txnid - 1; if (txn->mt_env->me_txns) { MDB_reader *r = txn->mt_env->me_txns->mti_readers; for (i = txn->mt_env->me_txns->mti_numreaders; --i >= 0; ) { if (r[i].mr_pid) { mr = r[i].mr_txnid; if (oldest > mr) oldest = mr; } } } return oldest; } /** Add a page to the txn's dirty list */ static void mdb_page_dirty(MDB_txn *txn, MDB_page *mp) { MDB_ID2 mid; int rc, (*insert)(MDB_ID2L, MDB_ID2 *); if (txn->mt_flags & MDB_TXN_WRITEMAP) { insert = mdb_mid2l_append; } else { insert = mdb_mid2l_insert; } mid.mid = mp->mp_pgno; mid.mptr = mp; rc = insert(txn->mt_u.dirty_list, &mid); mdb_tassert(txn, rc == 0); txn->mt_dirty_room--; } /** Allocate page numbers and memory for writing. Maintain me_pglast, * me_pghead and mt_next_pgno. Set #MDB_TXN_ERROR on failure. * * If there are free pages available from older transactions, they * are re-used first. Otherwise allocate a new page at mt_next_pgno. * Do not modify the freedB, just merge freeDB records into me_pghead[] * and move me_pglast to say which records were consumed. Only this * function can create me_pghead and move me_pglast/mt_next_pgno. * @param[in] mc cursor A cursor handle identifying the transaction and * database for which we are allocating. * @param[in] num the number of pages to allocate. * @param[out] mp Address of the allocated page(s). Requests for multiple pages * will always be satisfied by a single contiguous chunk of memory. * @return 0 on success, non-zero on failure. */ static int mdb_page_alloc(MDB_cursor *mc, int num, MDB_page **mp) { #ifdef MDB_PARANOID /* Seems like we can ignore this now */ /* Get at most more freeDB records once me_pghead * has enough pages. If not enough, use new pages from the map. * If and mc is updating the freeDB, only get new * records if me_pghead is empty. Then the freelist cannot play * catch-up with itself by growing while trying to save it. */ enum { Paranoid = 1, Max_retries = 500 }; #else enum { Paranoid = 0, Max_retries = INT_MAX /*infinite*/ }; #endif int rc, retry = num * 60; MDB_txn *txn = mc->mc_txn; MDB_env *env = txn->mt_env; pgno_t pgno, *mop = env->me_pghead; unsigned i, j, mop_len = mop ? mop[0] : 0, n2 = num-1; MDB_page *np; txnid_t oldest = 0, last; MDB_cursor_op op; MDB_cursor m2; int found_old = 0; /* If there are any loose pages, just use them */ if (num == 1 && txn->mt_loose_pgs) { np = txn->mt_loose_pgs; txn->mt_loose_pgs = NEXT_LOOSE_PAGE(np); txn->mt_loose_count--; DPRINTF(("db %d use loose page %"Z"u", DDBI(mc), np->mp_pgno)); *mp = np; return MDB_SUCCESS; } *mp = NULL; /* If our dirty list is already full, we can't do anything */ if (txn->mt_dirty_room == 0) { rc = MDB_TXN_FULL; goto fail; } for (op = MDB_FIRST;; op = MDB_NEXT) { MDB_val key, data; MDB_node *leaf; pgno_t *idl; /* Seek a big enough contiguous page range. Prefer * pages at the tail, just truncating the list. */ if (mop_len > n2) { i = mop_len; do { pgno = mop[i]; if (mop[i-n2] == pgno+n2) goto search_done; } while (--i > n2); if (--retry < 0) break; } if (op == MDB_FIRST) { /* 1st iteration */ /* Prepare to fetch more and coalesce */ last = env->me_pglast; oldest = env->me_pgoldest; mdb_cursor_init(&m2, txn, FREE_DBI, NULL); if (last) { op = MDB_SET_RANGE; key.mv_data = &last; /* will look up last+1 */ key.mv_size = sizeof(last); } if (Paranoid && mc->mc_dbi == FREE_DBI) retry = -1; } if (Paranoid && retry < 0 && mop_len) break; last++; /* Do not fetch more if the record will be too recent */ if (oldest <= last) { if (!found_old) { oldest = mdb_find_oldest(txn); env->me_pgoldest = oldest; found_old = 1; } if (oldest <= last) break; } rc = mdb_cursor_get(&m2, &key, NULL, op); if (rc) { if (rc == MDB_NOTFOUND) break; goto fail; } last = *(txnid_t*)key.mv_data; if (oldest <= last) { if (!found_old) { oldest = mdb_find_oldest(txn); env->me_pgoldest = oldest; found_old = 1; } if (oldest <= last) break; } np = m2.mc_pg[m2.mc_top]; leaf = NODEPTR(np, m2.mc_ki[m2.mc_top]); if ((rc = mdb_node_read(&m2, leaf, &data)) != MDB_SUCCESS) goto fail; idl = (MDB_ID *) data.mv_data; i = idl[0]; if (!mop) { if (!(env->me_pghead = mop = mdb_midl_alloc(i))) { rc = ENOMEM; goto fail; } } else { if ((rc = mdb_midl_need(&env->me_pghead, i)) != 0) goto fail; mop = env->me_pghead; } env->me_pglast = last; #if (MDB_DEBUG) > 1 DPRINTF(("IDL read txn %"Z"u root %"Z"u num %u", last, txn->mt_dbs[FREE_DBI].md_root, i)); for (j = i; j; j--) DPRINTF(("IDL %"Z"u", idl[j])); #endif /* Merge in descending sorted order */ mdb_midl_xmerge(mop, idl); mop_len = mop[0]; } /* Use new pages from the map when nothing suitable in the freeDB */ i = 0; pgno = txn->mt_next_pgno; if (pgno + num >= env->me_maxpg) { DPUTS("DB size maxed out"); rc = MDB_MAP_FULL; goto fail; } search_done: if (env->me_flags & MDB_WRITEMAP) { np = (MDB_page *)(env->me_map + env->me_psize * pgno); } else { if (!(np = mdb_page_malloc(txn, num))) { rc = ENOMEM; goto fail; } } if (i) { mop[0] = mop_len -= num; /* Move any stragglers down */ for (j = i-num; j < mop_len; ) mop[++j] = mop[++i]; } else { txn->mt_next_pgno = pgno + num; } np->mp_pgno = pgno; mdb_page_dirty(txn, np); *mp = np; return MDB_SUCCESS; fail: txn->mt_flags |= MDB_TXN_ERROR; return rc; } /** Copy the used portions of a non-overflow page. * @param[in] dst page to copy into * @param[in] src page to copy from * @param[in] psize size of a page */ static void mdb_page_copy(MDB_page *dst, MDB_page *src, unsigned int psize) { enum { Align = sizeof(pgno_t) }; indx_t upper = src->mp_upper, lower = src->mp_lower, unused = upper-lower; /* If page isn't full, just copy the used portion. Adjust * alignment so memcpy may copy words instead of bytes. */ if ((unused &= -Align) && !IS_LEAF2(src)) { upper = (upper + PAGEBASE) & -Align; memcpy(dst, src, (lower + PAGEBASE + (Align-1)) & -Align); memcpy((pgno_t *)((char *)dst+upper), (pgno_t *)((char *)src+upper), psize - upper); } else { memcpy(dst, src, psize - unused); } } /** Pull a page off the txn's spill list, if present. * If a page being referenced was spilled to disk in this txn, bring * it back and make it dirty/writable again. * @param[in] txn the transaction handle. * @param[in] mp the page being referenced. It must not be dirty. * @param[out] ret the writable page, if any. ret is unchanged if * mp wasn't spilled. */ static int mdb_page_unspill(MDB_txn *txn, MDB_page *mp, MDB_page **ret) { MDB_env *env = txn->mt_env; const MDB_txn *tx2; unsigned x; pgno_t pgno = mp->mp_pgno, pn = pgno << 1; for (tx2 = txn; tx2; tx2=tx2->mt_parent) { if (!tx2->mt_spill_pgs) continue; x = mdb_midl_search(tx2->mt_spill_pgs, pn); if (x <= tx2->mt_spill_pgs[0] && tx2->mt_spill_pgs[x] == pn) { MDB_page *np; int num; if (txn->mt_dirty_room == 0) return MDB_TXN_FULL; if (IS_OVERFLOW(mp)) num = mp->mp_pages; else num = 1; if (env->me_flags & MDB_WRITEMAP) { np = mp; } else { np = mdb_page_malloc(txn, num); if (!np) return ENOMEM; if (num > 1) memcpy(np, mp, num * env->me_psize); else mdb_page_copy(np, mp, env->me_psize); } if (tx2 == txn) { /* If in current txn, this page is no longer spilled. * If it happens to be the last page, truncate the spill list. * Otherwise mark it as deleted by setting the LSB. */ if (x == txn->mt_spill_pgs[0]) txn->mt_spill_pgs[0]--; else txn->mt_spill_pgs[x] |= 1; } /* otherwise, if belonging to a parent txn, the * page remains spilled until child commits */ mdb_page_dirty(txn, np); np->mp_flags |= P_DIRTY; *ret = np; break; } } return MDB_SUCCESS; } /** Touch a page: make it dirty and re-insert into tree with updated pgno. * Set #MDB_TXN_ERROR on failure. * @param[in] mc cursor pointing to the page to be touched * @return 0 on success, non-zero on failure. */ static int mdb_page_touch(MDB_cursor *mc) { MDB_page *mp = mc->mc_pg[mc->mc_top], *np; MDB_txn *txn = mc->mc_txn; MDB_cursor *m2, *m3; pgno_t pgno; int rc; if (!F_ISSET(mp->mp_flags, P_DIRTY)) { if (txn->mt_flags & MDB_TXN_SPILLS) { np = NULL; rc = mdb_page_unspill(txn, mp, &np); if (rc) goto fail; if (np) goto done; } if ((rc = mdb_midl_need(&txn->mt_free_pgs, 1)) || (rc = mdb_page_alloc(mc, 1, &np))) goto fail; pgno = np->mp_pgno; DPRINTF(("touched db %d page %"Z"u -> %"Z"u", DDBI(mc), mp->mp_pgno, pgno)); mdb_cassert(mc, mp->mp_pgno != pgno); mdb_midl_xappend(txn->mt_free_pgs, mp->mp_pgno); /* Update the parent page, if any, to point to the new page */ if (mc->mc_top) { MDB_page *parent = mc->mc_pg[mc->mc_top-1]; MDB_node *node = NODEPTR(parent, mc->mc_ki[mc->mc_top-1]); SETPGNO(node, pgno); } else { mc->mc_db->md_root = pgno; } } else if (txn->mt_parent && !IS_SUBP(mp)) { MDB_ID2 mid, *dl = txn->mt_u.dirty_list; pgno = mp->mp_pgno; /* If txn has a parent, make sure the page is in our * dirty list. */ if (dl[0].mid) { unsigned x = mdb_mid2l_search(dl, pgno); if (x <= dl[0].mid && dl[x].mid == pgno) { if (mp != dl[x].mptr) { /* bad cursor? */ mc->mc_flags &= ~(C_INITIALIZED|C_EOF); txn->mt_flags |= MDB_TXN_ERROR; return MDB_CORRUPTED; } return 0; } } mdb_cassert(mc, dl[0].mid < MDB_IDL_UM_MAX); /* No - copy it */ np = mdb_page_malloc(txn, 1); if (!np) return ENOMEM; mid.mid = pgno; mid.mptr = np; rc = mdb_mid2l_insert(dl, &mid); mdb_cassert(mc, rc == 0); } else { return 0; } mdb_page_copy(np, mp, txn->mt_env->me_psize); np->mp_pgno = pgno; np->mp_flags |= P_DIRTY; done: /* Adjust cursors pointing to mp */ mc->mc_pg[mc->mc_top] = np; m2 = txn->mt_cursors[mc->mc_dbi]; if (mc->mc_flags & C_SUB) { for (; m2; m2=m2->mc_next) { m3 = &m2->mc_xcursor->mx_cursor; if (m3->mc_snum < mc->mc_snum) continue; if (m3->mc_pg[mc->mc_top] == mp) m3->mc_pg[mc->mc_top] = np; } } else { for (; m2; m2=m2->mc_next) { if (m2->mc_snum < mc->mc_snum) continue; if (m2 == mc) continue; if (m2->mc_pg[mc->mc_top] == mp) { m2->mc_pg[mc->mc_top] = np; if (IS_LEAF(np)) XCURSOR_REFRESH(m2, mc->mc_top, np); } } } return 0; fail: txn->mt_flags |= MDB_TXN_ERROR; return rc; } int mdb_env_sync(MDB_env *env, int force) { int rc = 0; if (env->me_flags & MDB_RDONLY) return EACCES; if (force || !F_ISSET(env->me_flags, MDB_NOSYNC)) { if (env->me_flags & MDB_WRITEMAP) { int flags = ((env->me_flags & MDB_MAPASYNC) && !force) ? MS_ASYNC : MS_SYNC; if (MDB_MSYNC(env->me_map, env->me_mapsize, flags)) rc = ErrCode(); #ifdef _WIN32 else if (flags == MS_SYNC && MDB_FDATASYNC(env->me_fd)) rc = ErrCode(); #endif } else { #ifdef BROKEN_FDATASYNC if (env->me_flags & MDB_FSYNCONLY) { if (fsync(env->me_fd)) rc = ErrCode(); } else #endif if (MDB_FDATASYNC(env->me_fd)) rc = ErrCode(); } } return rc; } /** Back up parent txn's cursors, then grab the originals for tracking */ static int mdb_cursor_shadow(MDB_txn *src, MDB_txn *dst) { MDB_cursor *mc, *bk; MDB_xcursor *mx; size_t size; int i; for (i = src->mt_numdbs; --i >= 0; ) { if ((mc = src->mt_cursors[i]) != NULL) { size = sizeof(MDB_cursor); if (mc->mc_xcursor) size += sizeof(MDB_xcursor); for (; mc; mc = bk->mc_next) { bk = malloc(size); if (!bk) return ENOMEM; *bk = *mc; mc->mc_backup = bk; mc->mc_db = &dst->mt_dbs[i]; /* Kill pointers into src to reduce abuse: The * user may not use mc until dst ends. But we need a valid * txn pointer here for cursor fixups to keep working. */ mc->mc_txn = dst; mc->mc_dbflag = &dst->mt_dbflags[i]; if ((mx = mc->mc_xcursor) != NULL) { *(MDB_xcursor *)(bk+1) = *mx; mx->mx_cursor.mc_txn = dst; } mc->mc_next = dst->mt_cursors[i]; dst->mt_cursors[i] = mc; } } } return MDB_SUCCESS; } /** Close this write txn's cursors, give parent txn's cursors back to parent. * @param[in] txn the transaction handle. * @param[in] merge true to keep changes to parent cursors, false to revert. * @return 0 on success, non-zero on failure. */ static void mdb_cursors_close(MDB_txn *txn, unsigned merge) { MDB_cursor **cursors = txn->mt_cursors, *mc, *next, *bk; MDB_xcursor *mx; int i; for (i = txn->mt_numdbs; --i >= 0; ) { for (mc = cursors[i]; mc; mc = next) { next = mc->mc_next; if ((bk = mc->mc_backup) != NULL) { if (merge) { /* Commit changes to parent txn */ mc->mc_next = bk->mc_next; mc->mc_backup = bk->mc_backup; mc->mc_txn = bk->mc_txn; mc->mc_db = bk->mc_db; mc->mc_dbflag = bk->mc_dbflag; if ((mx = mc->mc_xcursor) != NULL) mx->mx_cursor.mc_txn = bk->mc_txn; } else { /* Abort nested txn */ *mc = *bk; if ((mx = mc->mc_xcursor) != NULL) *mx = *(MDB_xcursor *)(bk+1); } mc = bk; } /* Only malloced cursors are permanently tracked. */ free(mc); } cursors[i] = NULL; } } #if !(MDB_PIDLOCK) /* Currently the same as defined(_WIN32) */ enum Pidlock_op { Pidset, Pidcheck }; #else enum Pidlock_op { Pidset = F_SETLK, Pidcheck = F_GETLK }; #endif /** Set or check a pid lock. Set returns 0 on success. * Check returns 0 if the process is certainly dead, nonzero if it may * be alive (the lock exists or an error happened so we do not know). * * On Windows Pidset is a no-op, we merely check for the existence * of the process with the given pid. On POSIX we use a single byte * lock on the lockfile, set at an offset equal to the pid. */ static int mdb_reader_pid(MDB_env *env, enum Pidlock_op op, MDB_PID_T pid) { #if !(MDB_PIDLOCK) /* Currently the same as defined(_WIN32) */ int ret = 0; HANDLE h; if (op == Pidcheck) { h = OpenProcess(env->me_pidquery, FALSE, pid); /* No documented "no such process" code, but other program use this: */ if (!h) return ErrCode() != ERROR_INVALID_PARAMETER; /* A process exists until all handles to it close. Has it exited? */ ret = WaitForSingleObject(h, 0) != 0; CloseHandle(h); } return ret; #else for (;;) { int rc; struct flock lock_info; memset(&lock_info, 0, sizeof(lock_info)); lock_info.l_type = F_WRLCK; lock_info.l_whence = SEEK_SET; lock_info.l_start = pid; lock_info.l_len = 1; if ((rc = fcntl(env->me_lfd, op, &lock_info)) == 0) { if (op == F_GETLK && lock_info.l_type != F_UNLCK) rc = -1; } else if ((rc = ErrCode()) == EINTR) { continue; } return rc; } #endif } /** Common code for #mdb_txn_begin() and #mdb_txn_renew(). * @param[in] txn the transaction handle to initialize * @return 0 on success, non-zero on failure. */ static int mdb_txn_renew0(MDB_txn *txn) { MDB_env *env = txn->mt_env; MDB_txninfo *ti = env->me_txns; MDB_meta *meta; unsigned int i, nr, flags = txn->mt_flags; uint16_t x; int rc, new_notls = 0; if ((flags &= MDB_TXN_RDONLY) != 0) { if (!ti) { meta = mdb_env_pick_meta(env); txn->mt_txnid = meta->mm_txnid; txn->mt_u.reader = NULL; } else { MDB_reader *r = (env->me_flags & MDB_NOTLS) ? txn->mt_u.reader : pthread_getspecific(env->me_txkey); if (r) { if (r->mr_pid != env->me_pid || r->mr_txnid != (txnid_t)-1) return MDB_BAD_RSLOT; } else { MDB_PID_T pid = env->me_pid; MDB_THR_T tid = pthread_self(); mdb_mutexref_t rmutex = env->me_rmutex; if (!env->me_live_reader) { rc = mdb_reader_pid(env, Pidset, pid); if (rc) return rc; env->me_live_reader = 1; } if (LOCK_MUTEX(rc, env, rmutex)) return rc; nr = ti->mti_numreaders; for (i=0; imti_readers[i].mr_pid == 0) break; if (i == env->me_maxreaders) { UNLOCK_MUTEX(rmutex); return MDB_READERS_FULL; } r = &ti->mti_readers[i]; /* Claim the reader slot, carefully since other code * uses the reader table un-mutexed: First reset the * slot, next publish it in mti_numreaders. After * that, it is safe for mdb_env_close() to touch it. * When it will be closed, we can finally claim it. */ r->mr_pid = 0; r->mr_txnid = (txnid_t)-1; r->mr_tid = tid; if (i == nr) ti->mti_numreaders = ++nr; env->me_close_readers = nr; r->mr_pid = pid; UNLOCK_MUTEX(rmutex); new_notls = (env->me_flags & MDB_NOTLS); if (!new_notls && (rc=pthread_setspecific(env->me_txkey, r))) { r->mr_pid = 0; return rc; } } do /* LY: Retry on a race, ITS#7970. */ r->mr_txnid = ti->mti_txnid; while(r->mr_txnid != ti->mti_txnid); txn->mt_txnid = r->mr_txnid; txn->mt_u.reader = r; meta = env->me_metas[txn->mt_txnid & 1]; } } else { /* Not yet touching txn == env->me_txn0, it may be active */ if (ti) { if (LOCK_MUTEX(rc, env, env->me_wmutex)) return rc; txn->mt_txnid = ti->mti_txnid; meta = env->me_metas[txn->mt_txnid & 1]; } else { meta = mdb_env_pick_meta(env); txn->mt_txnid = meta->mm_txnid; } txn->mt_txnid++; #if MDB_DEBUG if (txn->mt_txnid == mdb_debug_start) mdb_debug = 1; #endif txn->mt_child = NULL; txn->mt_loose_pgs = NULL; txn->mt_loose_count = 0; txn->mt_dirty_room = MDB_IDL_UM_MAX; txn->mt_u.dirty_list = env->me_dirty_list; txn->mt_u.dirty_list[0].mid = 0; txn->mt_free_pgs = env->me_free_pgs; txn->mt_free_pgs[0] = 0; txn->mt_spill_pgs = NULL; env->me_txn = txn; memcpy(txn->mt_dbiseqs, env->me_dbiseqs, env->me_maxdbs * sizeof(unsigned int)); } /* Copy the DB info and flags */ memcpy(txn->mt_dbs, meta->mm_dbs, CORE_DBS * sizeof(MDB_db)); /* Moved to here to avoid a data race in read TXNs */ txn->mt_next_pgno = meta->mm_last_pg+1; txn->mt_flags = flags; /* Setup db info */ txn->mt_numdbs = env->me_numdbs; for (i=CORE_DBS; imt_numdbs; i++) { x = env->me_dbflags[i]; txn->mt_dbs[i].md_flags = x & PERSISTENT_FLAGS; txn->mt_dbflags[i] = (x & MDB_VALID) ? DB_VALID|DB_USRVALID|DB_STALE : 0; } txn->mt_dbflags[MAIN_DBI] = DB_VALID|DB_USRVALID; txn->mt_dbflags[FREE_DBI] = DB_VALID; if (env->me_flags & MDB_FATAL_ERROR) { DPUTS("environment had fatal error, must shutdown!"); rc = MDB_PANIC; } else if (env->me_maxpg < txn->mt_next_pgno) { rc = MDB_MAP_RESIZED; } else { return MDB_SUCCESS; } mdb_txn_end(txn, new_notls /*0 or MDB_END_SLOT*/ | MDB_END_FAIL_BEGIN); return rc; } int mdb_txn_renew(MDB_txn *txn) { int rc; if (!txn || !F_ISSET(txn->mt_flags, MDB_TXN_RDONLY|MDB_TXN_FINISHED)) return EINVAL; rc = mdb_txn_renew0(txn); if (rc == MDB_SUCCESS) { DPRINTF(("renew txn %"Z"u%c %p on mdbenv %p, root page %"Z"u", txn->mt_txnid, (txn->mt_flags & MDB_TXN_RDONLY) ? 'r' : 'w', (void *)txn, (void *)txn->mt_env, txn->mt_dbs[MAIN_DBI].md_root)); } return rc; } int mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **ret) { MDB_txn *txn; MDB_ntxn *ntxn; int rc, size, tsize; flags &= MDB_TXN_BEGIN_FLAGS; flags |= env->me_flags & MDB_WRITEMAP; if (env->me_flags & MDB_RDONLY & ~flags) /* write txn in RDONLY env */ return EACCES; if (parent) { /* Nested transactions: Max 1 child, write txns only, no writemap */ flags |= parent->mt_flags; if (flags & (MDB_RDONLY|MDB_WRITEMAP|MDB_TXN_BLOCKED)) { return (parent->mt_flags & MDB_TXN_RDONLY) ? EINVAL : MDB_BAD_TXN; } /* Child txns save MDB_pgstate and use own copy of cursors */ size = env->me_maxdbs * (sizeof(MDB_db)+sizeof(MDB_cursor *)+1); size += tsize = sizeof(MDB_ntxn); } else if (flags & MDB_RDONLY) { size = env->me_maxdbs * (sizeof(MDB_db)+1); size += tsize = sizeof(MDB_txn); } else { /* Reuse preallocated write txn. However, do not touch it until * mdb_txn_renew0() succeeds, since it currently may be active. */ txn = env->me_txn0; goto renew; } if ((txn = calloc(1, size)) == NULL) { DPRINTF(("calloc: %s", strerror(errno))); return ENOMEM; } txn->mt_dbxs = env->me_dbxs; /* static */ txn->mt_dbs = (MDB_db *) ((char *)txn + tsize); txn->mt_dbflags = (unsigned char *)txn + size - env->me_maxdbs; txn->mt_flags = flags; txn->mt_env = env; if (parent) { unsigned int i; txn->mt_cursors = (MDB_cursor **)(txn->mt_dbs + env->me_maxdbs); txn->mt_dbiseqs = parent->mt_dbiseqs; txn->mt_u.dirty_list = malloc(sizeof(MDB_ID2)*MDB_IDL_UM_SIZE); if (!txn->mt_u.dirty_list || !(txn->mt_free_pgs = mdb_midl_alloc(MDB_IDL_UM_MAX))) { free(txn->mt_u.dirty_list); free(txn); return ENOMEM; } txn->mt_txnid = parent->mt_txnid; txn->mt_dirty_room = parent->mt_dirty_room; txn->mt_u.dirty_list[0].mid = 0; txn->mt_spill_pgs = NULL; txn->mt_next_pgno = parent->mt_next_pgno; parent->mt_flags |= MDB_TXN_HAS_CHILD; parent->mt_child = txn; txn->mt_parent = parent; txn->mt_numdbs = parent->mt_numdbs; memcpy(txn->mt_dbs, parent->mt_dbs, txn->mt_numdbs * sizeof(MDB_db)); /* Copy parent's mt_dbflags, but clear DB_NEW */ for (i=0; imt_numdbs; i++) txn->mt_dbflags[i] = parent->mt_dbflags[i] & ~DB_NEW; rc = 0; ntxn = (MDB_ntxn *)txn; ntxn->mnt_pgstate = env->me_pgstate; /* save parent me_pghead & co */ if (env->me_pghead) { size = MDB_IDL_SIZEOF(env->me_pghead); env->me_pghead = mdb_midl_alloc(env->me_pghead[0]); if (env->me_pghead) memcpy(env->me_pghead, ntxn->mnt_pgstate.mf_pghead, size); else rc = ENOMEM; } if (!rc) rc = mdb_cursor_shadow(parent, txn); if (rc) mdb_txn_end(txn, MDB_END_FAIL_BEGINCHILD); } else { /* MDB_RDONLY */ txn->mt_dbiseqs = env->me_dbiseqs; renew: rc = mdb_txn_renew0(txn); } if (rc) { if (txn != env->me_txn0) free(txn); } else { txn->mt_flags |= flags; /* could not change txn=me_txn0 earlier */ *ret = txn; DPRINTF(("begin txn %"Z"u%c %p on mdbenv %p, root page %"Z"u", txn->mt_txnid, (flags & MDB_RDONLY) ? 'r' : 'w', (void *) txn, (void *) env, txn->mt_dbs[MAIN_DBI].md_root)); } return rc; } MDB_env * mdb_txn_env(MDB_txn *txn) { if(!txn) return NULL; return txn->mt_env; } size_t mdb_txn_id(MDB_txn *txn) { if(!txn) return 0; return txn->mt_txnid; } /** Export or close DBI handles opened in this txn. */ static void mdb_dbis_update(MDB_txn *txn, int keep) { int i; MDB_dbi n = txn->mt_numdbs; MDB_env *env = txn->mt_env; unsigned char *tdbflags = txn->mt_dbflags; for (i = n; --i >= CORE_DBS;) { if (tdbflags[i] & DB_NEW) { if (keep) { env->me_dbflags[i] = txn->mt_dbs[i].md_flags | MDB_VALID; } else { char *ptr = env->me_dbxs[i].md_name.mv_data; if (ptr) { env->me_dbxs[i].md_name.mv_data = NULL; env->me_dbxs[i].md_name.mv_size = 0; env->me_dbflags[i] = 0; env->me_dbiseqs[i]++; free(ptr); } } } } if (keep && env->me_numdbs < n) env->me_numdbs = n; } /** End a transaction, except successful commit of a nested transaction. * May be called twice for readonly txns: First reset it, then abort. * @param[in] txn the transaction handle to end * @param[in] mode why and how to end the transaction */ static void mdb_txn_end(MDB_txn *txn, unsigned mode) { MDB_env *env = txn->mt_env; #if MDB_DEBUG static const char *const names[] = MDB_END_NAMES; #endif /* Export or close DBI handles opened in this txn */ mdb_dbis_update(txn, mode & MDB_END_UPDATE); DPRINTF(("%s txn %"Z"u%c %p on mdbenv %p, root page %"Z"u", names[mode & MDB_END_OPMASK], txn->mt_txnid, (txn->mt_flags & MDB_TXN_RDONLY) ? 'r' : 'w', (void *) txn, (void *)env, txn->mt_dbs[MAIN_DBI].md_root)); if (F_ISSET(txn->mt_flags, MDB_TXN_RDONLY)) { if (txn->mt_u.reader) { txn->mt_u.reader->mr_txnid = (txnid_t)-1; if (!(env->me_flags & MDB_NOTLS)) { txn->mt_u.reader = NULL; /* txn does not own reader */ } else if (mode & MDB_END_SLOT) { txn->mt_u.reader->mr_pid = 0; txn->mt_u.reader = NULL; } /* else txn owns the slot until it does MDB_END_SLOT */ } txn->mt_numdbs = 0; /* prevent further DBI activity */ txn->mt_flags |= MDB_TXN_FINISHED; } else if (!F_ISSET(txn->mt_flags, MDB_TXN_FINISHED)) { pgno_t *pghead = env->me_pghead; if (!(mode & MDB_END_UPDATE)) /* !(already closed cursors) */ mdb_cursors_close(txn, 0); if (!(env->me_flags & MDB_WRITEMAP)) { mdb_dlist_free(txn); } txn->mt_numdbs = 0; txn->mt_flags = MDB_TXN_FINISHED; if (!txn->mt_parent) { mdb_midl_shrink(&txn->mt_free_pgs); env->me_free_pgs = txn->mt_free_pgs; /* me_pgstate: */ env->me_pghead = NULL; env->me_pglast = 0; env->me_txn = NULL; mode = 0; /* txn == env->me_txn0, do not free() it */ /* The writer mutex was locked in mdb_txn_begin. */ if (env->me_txns) UNLOCK_MUTEX(env->me_wmutex); } else { txn->mt_parent->mt_child = NULL; txn->mt_parent->mt_flags &= ~MDB_TXN_HAS_CHILD; env->me_pgstate = ((MDB_ntxn *)txn)->mnt_pgstate; mdb_midl_free(txn->mt_free_pgs); mdb_midl_free(txn->mt_spill_pgs); free(txn->mt_u.dirty_list); } mdb_midl_free(pghead); } if (mode & MDB_END_FREE) free(txn); } void mdb_txn_reset(MDB_txn *txn) { if (txn == NULL) return; /* This call is only valid for read-only txns */ if (!(txn->mt_flags & MDB_TXN_RDONLY)) return; mdb_txn_end(txn, MDB_END_RESET); } void mdb_txn_abort(MDB_txn *txn) { if (txn == NULL) return; if (txn->mt_child) mdb_txn_abort(txn->mt_child); mdb_txn_end(txn, MDB_END_ABORT|MDB_END_SLOT|MDB_END_FREE); } /** Save the freelist as of this transaction to the freeDB. * This changes the freelist. Keep trying until it stabilizes. */ static int mdb_freelist_save(MDB_txn *txn) { /* env->me_pghead[] can grow and shrink during this call. * env->me_pglast and txn->mt_free_pgs[] can only grow. * Page numbers cannot disappear from txn->mt_free_pgs[]. */ MDB_cursor mc; MDB_env *env = txn->mt_env; int rc, maxfree_1pg = env->me_maxfree_1pg, more = 1; txnid_t pglast = 0, head_id = 0; pgno_t freecnt = 0, *free_pgs, *mop; ssize_t head_room = 0, total_room = 0, mop_len, clean_limit; mdb_cursor_init(&mc, txn, FREE_DBI, NULL); if (env->me_pghead) { /* Make sure first page of freeDB is touched and on freelist */ rc = mdb_page_search(&mc, NULL, MDB_PS_FIRST|MDB_PS_MODIFY); if (rc && rc != MDB_NOTFOUND) return rc; } if (!env->me_pghead && txn->mt_loose_pgs) { /* Put loose page numbers in mt_free_pgs, since * we may be unable to return them to me_pghead. */ MDB_page *mp = txn->mt_loose_pgs; MDB_ID2 *dl = txn->mt_u.dirty_list; unsigned x; if ((rc = mdb_midl_need(&txn->mt_free_pgs, txn->mt_loose_count)) != 0) return rc; for (; mp; mp = NEXT_LOOSE_PAGE(mp)) { mdb_midl_xappend(txn->mt_free_pgs, mp->mp_pgno); /* must also remove from dirty list */ if (txn->mt_flags & MDB_TXN_WRITEMAP) { for (x=1; x<=dl[0].mid; x++) if (dl[x].mid == mp->mp_pgno) break; mdb_tassert(txn, x <= dl[0].mid); } else { x = mdb_mid2l_search(dl, mp->mp_pgno); mdb_tassert(txn, dl[x].mid == mp->mp_pgno); mdb_dpage_free(env, mp); } dl[x].mptr = NULL; } { /* squash freed slots out of the dirty list */ unsigned y; for (y=1; dl[y].mptr && y <= dl[0].mid; y++); if (y <= dl[0].mid) { for(x=y, y++;;) { while (!dl[y].mptr && y <= dl[0].mid) y++; if (y > dl[0].mid) break; dl[x++] = dl[y++]; } dl[0].mid = x-1; } else { /* all slots freed */ dl[0].mid = 0; } } txn->mt_loose_pgs = NULL; txn->mt_loose_count = 0; } /* MDB_RESERVE cancels meminit in ovpage malloc (when no WRITEMAP) */ clean_limit = (env->me_flags & (MDB_NOMEMINIT|MDB_WRITEMAP)) ? SSIZE_MAX : maxfree_1pg; for (;;) { /* Come back here after each Put() in case freelist changed */ MDB_val key, data; pgno_t *pgs; ssize_t j; /* If using records from freeDB which we have not yet * deleted, delete them and any we reserved for me_pghead. */ while (pglast < env->me_pglast) { rc = mdb_cursor_first(&mc, &key, NULL); if (rc) return rc; pglast = head_id = *(txnid_t *)key.mv_data; total_room = head_room = 0; mdb_tassert(txn, pglast <= env->me_pglast); rc = mdb_cursor_del(&mc, 0); if (rc) return rc; } /* Save the IDL of pages freed by this txn, to a single record */ if (freecnt < txn->mt_free_pgs[0]) { if (!freecnt) { /* Make sure last page of freeDB is touched and on freelist */ rc = mdb_page_search(&mc, NULL, MDB_PS_LAST|MDB_PS_MODIFY); if (rc && rc != MDB_NOTFOUND) return rc; } free_pgs = txn->mt_free_pgs; /* Write to last page of freeDB */ key.mv_size = sizeof(txn->mt_txnid); key.mv_data = &txn->mt_txnid; do { freecnt = free_pgs[0]; data.mv_size = MDB_IDL_SIZEOF(free_pgs); rc = mdb_cursor_put(&mc, &key, &data, MDB_RESERVE); if (rc) return rc; /* Retry if mt_free_pgs[] grew during the Put() */ free_pgs = txn->mt_free_pgs; } while (freecnt < free_pgs[0]); mdb_midl_sort(free_pgs); memcpy(data.mv_data, free_pgs, data.mv_size); #if (MDB_DEBUG) > 1 { unsigned int i = free_pgs[0]; DPRINTF(("IDL write txn %"Z"u root %"Z"u num %u", txn->mt_txnid, txn->mt_dbs[FREE_DBI].md_root, i)); for (; i; i--) DPRINTF(("IDL %"Z"u", free_pgs[i])); } #endif continue; } mop = env->me_pghead; mop_len = (mop ? mop[0] : 0) + txn->mt_loose_count; /* Reserve records for me_pghead[]. Split it if multi-page, * to avoid searching freeDB for a page range. Use keys in * range [1,me_pglast]: Smaller than txnid of oldest reader. */ if (total_room >= mop_len) { if (total_room == mop_len || --more < 0) break; } else if (head_room >= maxfree_1pg && head_id > 1) { /* Keep current record (overflow page), add a new one */ head_id--; head_room = 0; } /* (Re)write {key = head_id, IDL length = head_room} */ total_room -= head_room; head_room = mop_len - total_room; if (head_room > maxfree_1pg && head_id > 1) { /* Overflow multi-page for part of me_pghead */ head_room /= head_id; /* amortize page sizes */ head_room += maxfree_1pg - head_room % (maxfree_1pg + 1); } else if (head_room < 0) { /* Rare case, not bothering to delete this record */ head_room = 0; } key.mv_size = sizeof(head_id); key.mv_data = &head_id; data.mv_size = (head_room + 1) * sizeof(pgno_t); rc = mdb_cursor_put(&mc, &key, &data, MDB_RESERVE); if (rc) return rc; /* IDL is initially empty, zero out at least the length */ pgs = (pgno_t *)data.mv_data; j = head_room > clean_limit ? head_room : 0; do { pgs[j] = 0; } while (--j >= 0); total_room += head_room; } /* Return loose page numbers to me_pghead, though usually none are * left at this point. The pages themselves remain in dirty_list. */ if (txn->mt_loose_pgs) { MDB_page *mp = txn->mt_loose_pgs; unsigned count = txn->mt_loose_count; MDB_IDL loose; /* Room for loose pages + temp IDL with same */ if ((rc = mdb_midl_need(&env->me_pghead, 2*count+1)) != 0) return rc; mop = env->me_pghead; loose = mop + MDB_IDL_ALLOCLEN(mop) - count; for (count = 0; mp; mp = NEXT_LOOSE_PAGE(mp)) loose[ ++count ] = mp->mp_pgno; loose[0] = count; mdb_midl_sort(loose); mdb_midl_xmerge(mop, loose); txn->mt_loose_pgs = NULL; txn->mt_loose_count = 0; mop_len = mop[0]; } /* Fill in the reserved me_pghead records */ rc = MDB_SUCCESS; if (mop_len) { MDB_val key, data; mop += mop_len; rc = mdb_cursor_first(&mc, &key, &data); for (; !rc; rc = mdb_cursor_next(&mc, &key, &data, MDB_NEXT)) { txnid_t id = *(txnid_t *)key.mv_data; ssize_t len = (ssize_t)(data.mv_size / sizeof(MDB_ID)) - 1; MDB_ID save; mdb_tassert(txn, len >= 0 && id <= env->me_pglast); key.mv_data = &id; if (len > mop_len) { len = mop_len; data.mv_size = (len + 1) * sizeof(MDB_ID); } data.mv_data = mop -= len; save = mop[0]; mop[0] = len; rc = mdb_cursor_put(&mc, &key, &data, MDB_CURRENT); mop[0] = save; if (rc || !(mop_len -= len)) break; } } return rc; } /** Flush (some) dirty pages to the map, after clearing their dirty flag. * @param[in] txn the transaction that's being committed * @param[in] keep number of initial pages in dirty_list to keep dirty. * @return 0 on success, non-zero on failure. */ static int mdb_page_flush(MDB_txn *txn, int keep) { MDB_env *env = txn->mt_env; MDB_ID2L dl = txn->mt_u.dirty_list; unsigned psize = env->me_psize, j; int i, pagecount = dl[0].mid, rc; size_t size = 0, pos = 0; pgno_t pgno = 0; MDB_page *dp = NULL; #ifdef _WIN32 OVERLAPPED ov; #else struct iovec iov[MDB_COMMIT_PAGES]; ssize_t wpos = 0, wsize = 0, wres; size_t next_pos = 1; /* impossible pos, so pos != next_pos */ int n = 0; #endif j = i = keep; if (env->me_flags & MDB_WRITEMAP) { /* Clear dirty flags */ while (++i <= pagecount) { dp = dl[i].mptr; /* Don't flush this page yet */ if (dp->mp_flags & (P_LOOSE|P_KEEP)) { dp->mp_flags &= ~P_KEEP; dl[++j] = dl[i]; continue; } dp->mp_flags &= ~P_DIRTY; } goto done; } /* Write the pages */ for (;;) { if (++i <= pagecount) { dp = dl[i].mptr; /* Don't flush this page yet */ if (dp->mp_flags & (P_LOOSE|P_KEEP)) { dp->mp_flags &= ~P_KEEP; dl[i].mid = 0; continue; } pgno = dl[i].mid; /* clear dirty flag */ dp->mp_flags &= ~P_DIRTY; pos = pgno * psize; size = psize; if (IS_OVERFLOW(dp)) size *= dp->mp_pages; } #ifdef _WIN32 else break; /* Windows actually supports scatter/gather I/O, but only on * unbuffered file handles. Since we're relying on the OS page * cache for all our data, that's self-defeating. So we just * write pages one at a time. We use the ov structure to set * the write offset, to at least save the overhead of a Seek * system call. */ DPRINTF(("committing page %"Z"u", pgno)); memset(&ov, 0, sizeof(ov)); ov.Offset = pos & 0xffffffff; ov.OffsetHigh = pos >> 16 >> 16; if (!WriteFile(env->me_fd, dp, size, NULL, &ov)) { rc = ErrCode(); DPRINTF(("WriteFile: %d", rc)); return rc; } #else /* Write up to MDB_COMMIT_PAGES dirty pages at a time. */ if (pos!=next_pos || n==MDB_COMMIT_PAGES || wsize+size>MAX_WRITE) { if (n) { retry_write: /* Write previous page(s) */ #ifdef MDB_USE_PWRITEV wres = pwritev(env->me_fd, iov, n, wpos); #else if (n == 1) { wres = pwrite(env->me_fd, iov[0].iov_base, wsize, wpos); } else { retry_seek: if (lseek(env->me_fd, wpos, SEEK_SET) == -1) { rc = ErrCode(); if (rc == EINTR) goto retry_seek; DPRINTF(("lseek: %s", strerror(rc))); return rc; } wres = writev(env->me_fd, iov, n); } #endif if (wres != wsize) { if (wres < 0) { rc = ErrCode(); if (rc == EINTR) goto retry_write; DPRINTF(("Write error: %s", strerror(rc))); } else { rc = EIO; /* TODO: Use which error code? */ DPUTS("short write, filesystem full?"); } return rc; } n = 0; } if (i > pagecount) break; wpos = pos; wsize = 0; } DPRINTF(("committing page %"Z"u", pgno)); next_pos = pos + size; iov[n].iov_len = size; iov[n].iov_base = (char *)dp; wsize += size; n++; #endif /* _WIN32 */ } /* MIPS has cache coherency issues, this is a no-op everywhere else * Note: for any size >= on-chip cache size, entire on-chip cache is * flushed. */ CACHEFLUSH(env->me_map, txn->mt_next_pgno * env->me_psize, DCACHE); for (i = keep; ++i <= pagecount; ) { dp = dl[i].mptr; /* This is a page we skipped above */ if (!dl[i].mid) { dl[++j] = dl[i]; dl[j].mid = dp->mp_pgno; continue; } mdb_dpage_free(env, dp); } done: i--; txn->mt_dirty_room += i - j; dl[0].mid = j; return MDB_SUCCESS; } int mdb_txn_commit(MDB_txn *txn) { int rc; unsigned int i, end_mode; MDB_env *env; if (txn == NULL) return EINVAL; /* mdb_txn_end() mode for a commit which writes nothing */ end_mode = MDB_END_EMPTY_COMMIT|MDB_END_UPDATE|MDB_END_SLOT|MDB_END_FREE; if (txn->mt_child) { rc = mdb_txn_commit(txn->mt_child); if (rc) goto fail; } env = txn->mt_env; if (F_ISSET(txn->mt_flags, MDB_TXN_RDONLY)) { goto done; } if (txn->mt_flags & (MDB_TXN_FINISHED|MDB_TXN_ERROR)) { DPUTS("txn has failed/finished, can't commit"); if (txn->mt_parent) txn->mt_parent->mt_flags |= MDB_TXN_ERROR; rc = MDB_BAD_TXN; goto fail; } if (txn->mt_parent) { MDB_txn *parent = txn->mt_parent; MDB_page **lp; MDB_ID2L dst, src; MDB_IDL pspill; unsigned x, y, len, ps_len; /* Append our free list to parent's */ rc = mdb_midl_append_list(&parent->mt_free_pgs, txn->mt_free_pgs); if (rc) goto fail; mdb_midl_free(txn->mt_free_pgs); /* Failures after this must either undo the changes * to the parent or set MDB_TXN_ERROR in the parent. */ parent->mt_next_pgno = txn->mt_next_pgno; parent->mt_flags = txn->mt_flags; /* Merge our cursors into parent's and close them */ mdb_cursors_close(txn, 1); /* Update parent's DB table. */ memcpy(parent->mt_dbs, txn->mt_dbs, txn->mt_numdbs * sizeof(MDB_db)); parent->mt_numdbs = txn->mt_numdbs; parent->mt_dbflags[FREE_DBI] = txn->mt_dbflags[FREE_DBI]; parent->mt_dbflags[MAIN_DBI] = txn->mt_dbflags[MAIN_DBI]; for (i=CORE_DBS; imt_numdbs; i++) { /* preserve parent's DB_NEW status */ x = parent->mt_dbflags[i] & DB_NEW; parent->mt_dbflags[i] = txn->mt_dbflags[i] | x; } dst = parent->mt_u.dirty_list; src = txn->mt_u.dirty_list; /* Remove anything in our dirty list from parent's spill list */ if ((pspill = parent->mt_spill_pgs) && (ps_len = pspill[0])) { x = y = ps_len; pspill[0] = (pgno_t)-1; /* Mark our dirty pages as deleted in parent spill list */ for (i=0, len=src[0].mid; ++i <= len; ) { MDB_ID pn = src[i].mid << 1; while (pn > pspill[x]) x--; if (pn == pspill[x]) { pspill[x] = 1; y = --x; } } /* Squash deleted pagenums if we deleted any */ for (x=y; ++x <= ps_len; ) if (!(pspill[x] & 1)) pspill[++y] = pspill[x]; pspill[0] = y; } /* Remove anything in our spill list from parent's dirty list */ if (txn->mt_spill_pgs && txn->mt_spill_pgs[0]) { for (i=1; i<=txn->mt_spill_pgs[0]; i++) { MDB_ID pn = txn->mt_spill_pgs[i]; if (pn & 1) continue; /* deleted spillpg */ pn >>= 1; y = mdb_mid2l_search(dst, pn); if (y <= dst[0].mid && dst[y].mid == pn) { free(dst[y].mptr); while (y < dst[0].mid) { dst[y] = dst[y+1]; y++; } dst[0].mid--; } } } /* Find len = length of merging our dirty list with parent's */ x = dst[0].mid; dst[0].mid = 0; /* simplify loops */ if (parent->mt_parent) { len = x + src[0].mid; y = mdb_mid2l_search(src, dst[x].mid + 1) - 1; for (i = x; y && i; y--) { pgno_t yp = src[y].mid; while (yp < dst[i].mid) i--; if (yp == dst[i].mid) { i--; len--; } } } else { /* Simplify the above for single-ancestor case */ len = MDB_IDL_UM_MAX - txn->mt_dirty_room; } /* Merge our dirty list with parent's */ y = src[0].mid; for (i = len; y; dst[i--] = src[y--]) { pgno_t yp = src[y].mid; while (yp < dst[x].mid) dst[i--] = dst[x--]; if (yp == dst[x].mid) free(dst[x--].mptr); } mdb_tassert(txn, i == x); dst[0].mid = len; free(txn->mt_u.dirty_list); parent->mt_dirty_room = txn->mt_dirty_room; if (txn->mt_spill_pgs) { if (parent->mt_spill_pgs) { /* TODO: Prevent failure here, so parent does not fail */ rc = mdb_midl_append_list(&parent->mt_spill_pgs, txn->mt_spill_pgs); if (rc) parent->mt_flags |= MDB_TXN_ERROR; mdb_midl_free(txn->mt_spill_pgs); mdb_midl_sort(parent->mt_spill_pgs); } else { parent->mt_spill_pgs = txn->mt_spill_pgs; } } /* Append our loose page list to parent's */ for (lp = &parent->mt_loose_pgs; *lp; lp = &NEXT_LOOSE_PAGE(*lp)) ; *lp = txn->mt_loose_pgs; parent->mt_loose_count += txn->mt_loose_count; parent->mt_child = NULL; mdb_midl_free(((MDB_ntxn *)txn)->mnt_pgstate.mf_pghead); free(txn); return rc; } if (txn != env->me_txn) { DPUTS("attempt to commit unknown transaction"); rc = EINVAL; goto fail; } mdb_cursors_close(txn, 0); if (!txn->mt_u.dirty_list[0].mid && !(txn->mt_flags & (MDB_TXN_DIRTY|MDB_TXN_SPILLS))) goto done; DPRINTF(("committing txn %"Z"u %p on mdbenv %p, root page %"Z"u", txn->mt_txnid, (void*)txn, (void*)env, txn->mt_dbs[MAIN_DBI].md_root)); /* Update DB root pointers */ if (txn->mt_numdbs > CORE_DBS) { MDB_cursor mc; MDB_dbi i; MDB_val data; data.mv_size = sizeof(MDB_db); mdb_cursor_init(&mc, txn, MAIN_DBI, NULL); for (i = CORE_DBS; i < txn->mt_numdbs; i++) { if (txn->mt_dbflags[i] & DB_DIRTY) { if (TXN_DBI_CHANGED(txn, i)) { rc = MDB_BAD_DBI; goto fail; } data.mv_data = &txn->mt_dbs[i]; rc = mdb_cursor_put(&mc, &txn->mt_dbxs[i].md_name, &data, F_SUBDATA); if (rc) goto fail; } } } rc = mdb_freelist_save(txn); if (rc) goto fail; mdb_midl_free(env->me_pghead); env->me_pghead = NULL; mdb_midl_shrink(&txn->mt_free_pgs); #if (MDB_DEBUG) > 2 mdb_audit(txn); #endif if ((rc = mdb_page_flush(txn, 0)) || (rc = mdb_env_sync(env, 0)) || (rc = mdb_env_write_meta(txn))) goto fail; end_mode = MDB_END_COMMITTED|MDB_END_UPDATE; done: mdb_txn_end(txn, end_mode); return MDB_SUCCESS; fail: mdb_txn_abort(txn); return rc; } /** Read the environment parameters of a DB environment before * mapping it into memory. * @param[in] env the environment handle * @param[out] meta address of where to store the meta information * @return 0 on success, non-zero on failure. */ static int ESECT mdb_env_read_header(MDB_env *env, MDB_meta *meta) { MDB_metabuf pbuf; MDB_page *p; MDB_meta *m; int i, rc, off; enum { Size = sizeof(pbuf) }; /* We don't know the page size yet, so use a minimum value. * Read both meta pages so we can use the latest one. */ for (i=off=0; imm_psize) { #ifdef _WIN32 DWORD len; OVERLAPPED ov; memset(&ov, 0, sizeof(ov)); ov.Offset = off; rc = ReadFile(env->me_fd, &pbuf, Size, &len, &ov) ? (int)len : -1; if (rc == -1 && ErrCode() == ERROR_HANDLE_EOF) rc = 0; #else rc = pread(env->me_fd, &pbuf, Size, off); #endif if (rc != Size) { if (rc == 0 && off == 0) return ENOENT; rc = rc < 0 ? (int) ErrCode() : MDB_INVALID; DPRINTF(("read: %s", mdb_strerror(rc))); return rc; } p = (MDB_page *)&pbuf; if (!F_ISSET(p->mp_flags, P_META)) { DPRINTF(("page %"Z"u not a meta page", p->mp_pgno)); return MDB_INVALID; } m = METADATA(p); if (m->mm_magic != MDB_MAGIC) { DPUTS("meta has invalid magic"); return MDB_INVALID; } if (m->mm_version != MDB_DATA_VERSION) { DPRINTF(("database is version %u, expected version %u", m->mm_version, MDB_DATA_VERSION)); return MDB_VERSION_MISMATCH; } if (off == 0 || m->mm_txnid > meta->mm_txnid) *meta = *m; } return 0; } /** Fill in most of the zeroed #MDB_meta for an empty database environment */ static void ESECT mdb_env_init_meta0(MDB_env *env, MDB_meta *meta) { meta->mm_magic = MDB_MAGIC; meta->mm_version = MDB_DATA_VERSION; meta->mm_mapsize = env->me_mapsize; meta->mm_psize = env->me_psize; meta->mm_last_pg = NUM_METAS-1; meta->mm_flags = env->me_flags & 0xffff; meta->mm_flags |= MDB_INTEGERKEY; /* this is mm_dbs[FREE_DBI].md_flags */ meta->mm_dbs[FREE_DBI].md_root = P_INVALID; meta->mm_dbs[MAIN_DBI].md_root = P_INVALID; } /** Write the environment parameters of a freshly created DB environment. * @param[in] env the environment handle * @param[in] meta the #MDB_meta to write * @return 0 on success, non-zero on failure. */ static int ESECT mdb_env_init_meta(MDB_env *env, MDB_meta *meta) { MDB_page *p, *q; int rc; unsigned int psize; #ifdef _WIN32 DWORD len; OVERLAPPED ov; memset(&ov, 0, sizeof(ov)); #define DO_PWRITE(rc, fd, ptr, size, len, pos) do { \ ov.Offset = pos; \ rc = WriteFile(fd, ptr, size, &len, &ov); } while(0) #else int len; #define DO_PWRITE(rc, fd, ptr, size, len, pos) do { \ len = pwrite(fd, ptr, size, pos); \ if (len == -1 && ErrCode() == EINTR) continue; \ rc = (len >= 0); break; } while(1) #endif DPUTS("writing new meta page"); psize = env->me_psize; p = calloc(NUM_METAS, psize); if (!p) return ENOMEM; p->mp_pgno = 0; p->mp_flags = P_META; *(MDB_meta *)METADATA(p) = *meta; q = (MDB_page *)((char *)p + psize); q->mp_pgno = 1; q->mp_flags = P_META; *(MDB_meta *)METADATA(q) = *meta; DO_PWRITE(rc, env->me_fd, p, psize * NUM_METAS, len, 0); if (!rc) rc = ErrCode(); else if ((unsigned) len == psize * NUM_METAS) rc = MDB_SUCCESS; else rc = ENOSPC; free(p); return rc; } /** Update the environment info to commit a transaction. * @param[in] txn the transaction that's being committed * @return 0 on success, non-zero on failure. */ static int mdb_env_write_meta(MDB_txn *txn) { MDB_env *env; MDB_meta meta, metab, *mp; unsigned flags; size_t mapsize; off_t off; int rc, len, toggle; char *ptr; HANDLE mfd; #ifdef _WIN32 OVERLAPPED ov; #else int r2; #endif toggle = txn->mt_txnid & 1; DPRINTF(("writing meta page %d for root page %"Z"u", toggle, txn->mt_dbs[MAIN_DBI].md_root)); env = txn->mt_env; flags = env->me_flags; mp = env->me_metas[toggle]; mapsize = env->me_metas[toggle ^ 1]->mm_mapsize; /* Persist any increases of mapsize config */ if (mapsize < env->me_mapsize) mapsize = env->me_mapsize; if (flags & MDB_WRITEMAP) { mp->mm_mapsize = mapsize; mp->mm_dbs[FREE_DBI] = txn->mt_dbs[FREE_DBI]; mp->mm_dbs[MAIN_DBI] = txn->mt_dbs[MAIN_DBI]; mp->mm_last_pg = txn->mt_next_pgno - 1; #if (__GNUC__ * 100 + __GNUC_MINOR__ >= 404) && /* TODO: portability */ \ !(defined(__i386__) || defined(__x86_64__)) /* LY: issue a memory barrier, if not x86. ITS#7969 */ __sync_synchronize(); #endif mp->mm_txnid = txn->mt_txnid; if (!(flags & (MDB_NOMETASYNC|MDB_NOSYNC))) { unsigned meta_size = env->me_psize; rc = (env->me_flags & MDB_MAPASYNC) ? MS_ASYNC : MS_SYNC; ptr = (char *)mp - PAGEHDRSZ; #ifndef _WIN32 /* POSIX msync() requires ptr = start of OS page */ r2 = (ptr - env->me_map) & (env->me_os_psize - 1); ptr -= r2; meta_size += r2; #endif if (MDB_MSYNC(ptr, meta_size, rc)) { rc = ErrCode(); goto fail; } } goto done; } metab.mm_txnid = mp->mm_txnid; metab.mm_last_pg = mp->mm_last_pg; meta.mm_mapsize = mapsize; meta.mm_dbs[FREE_DBI] = txn->mt_dbs[FREE_DBI]; meta.mm_dbs[MAIN_DBI] = txn->mt_dbs[MAIN_DBI]; meta.mm_last_pg = txn->mt_next_pgno - 1; meta.mm_txnid = txn->mt_txnid; off = offsetof(MDB_meta, mm_mapsize); ptr = (char *)&meta + off; len = sizeof(MDB_meta) - off; off += (char *)mp - env->me_map; /* Write to the SYNC fd unless MDB_NOSYNC/MDB_NOMETASYNC. * (me_mfd goes to the same file as me_fd, but writing to it * also syncs to disk. Avoids a separate fdatasync() call.) */ mfd = (flags & (MDB_NOSYNC|MDB_NOMETASYNC)) ? env->me_fd : env->me_mfd; #ifdef _WIN32 { memset(&ov, 0, sizeof(ov)); ov.Offset = off; if (!WriteFile(mfd, ptr, len, (DWORD *)&rc, &ov)) rc = -1; } #else retry_write: rc = pwrite(mfd, ptr, len, off); #endif if (rc != len) { rc = rc < 0 ? ErrCode() : EIO; #ifndef _WIN32 if (rc == EINTR) goto retry_write; #endif DPUTS("write failed, disk error?"); /* On a failure, the pagecache still contains the new data. * Write some old data back, to prevent it from being used. * Use the non-SYNC fd; we know it will fail anyway. */ meta.mm_last_pg = metab.mm_last_pg; meta.mm_txnid = metab.mm_txnid; #ifdef _WIN32 memset(&ov, 0, sizeof(ov)); ov.Offset = off; WriteFile(env->me_fd, ptr, len, NULL, &ov); #else r2 = pwrite(env->me_fd, ptr, len, off); (void)r2; /* Silence warnings. We don't care about pwrite's return value */ #endif fail: env->me_flags |= MDB_FATAL_ERROR; return rc; } /* MIPS has cache coherency issues, this is a no-op everywhere else */ CACHEFLUSH(env->me_map + off, len, DCACHE); done: /* Memory ordering issues are irrelevant; since the entire writer * is wrapped by wmutex, all of these changes will become visible * after the wmutex is unlocked. Since the DB is multi-version, * readers will get consistent data regardless of how fresh or * how stale their view of these values is. */ if (env->me_txns) env->me_txns->mti_txnid = txn->mt_txnid; return MDB_SUCCESS; } /** Check both meta pages to see which one is newer. * @param[in] env the environment handle * @return newest #MDB_meta. */ static MDB_meta * mdb_env_pick_meta(const MDB_env *env) { MDB_meta *const *metas = env->me_metas; return metas[ metas[0]->mm_txnid < metas[1]->mm_txnid ]; } int ESECT mdb_env_create(MDB_env **env) { MDB_env *e; e = calloc(1, sizeof(MDB_env)); if (!e) return ENOMEM; e->me_maxreaders = DEFAULT_READERS; e->me_maxdbs = e->me_numdbs = CORE_DBS; e->me_fd = INVALID_HANDLE_VALUE; e->me_lfd = INVALID_HANDLE_VALUE; e->me_mfd = INVALID_HANDLE_VALUE; #ifdef MDB_USE_POSIX_SEM e->me_rmutex = SEM_FAILED; e->me_wmutex = SEM_FAILED; #endif e->me_pid = getpid(); GET_PAGESIZE(e->me_os_psize); VGMEMP_CREATE(e,0,0); *env = e; return MDB_SUCCESS; } static int ESECT mdb_env_map(MDB_env *env, void *addr) { MDB_page *p; unsigned int flags = env->me_flags; #ifdef _WIN32 int rc; HANDLE mh; LONG sizelo, sizehi; size_t msize; if (flags & MDB_RDONLY) { /* Don't set explicit map size, use whatever exists */ msize = 0; sizelo = 0; sizehi = 0; } else { msize = env->me_mapsize; sizelo = msize & 0xffffffff; sizehi = msize >> 16 >> 16; /* only needed on Win64 */ /* Windows won't create mappings for zero length files. * and won't map more than the file size. * Just set the maxsize right now. */ if (!(flags & MDB_WRITEMAP) && (SetFilePointer(env->me_fd, sizelo, &sizehi, 0) != (DWORD)sizelo || !SetEndOfFile(env->me_fd) || SetFilePointer(env->me_fd, 0, NULL, 0) != 0)) return ErrCode(); } mh = CreateFileMapping(env->me_fd, NULL, flags & MDB_WRITEMAP ? PAGE_READWRITE : PAGE_READONLY, sizehi, sizelo, NULL); if (!mh) return ErrCode(); env->me_map = MapViewOfFileEx(mh, flags & MDB_WRITEMAP ? FILE_MAP_WRITE : FILE_MAP_READ, 0, 0, msize, addr); rc = env->me_map ? 0 : ErrCode(); CloseHandle(mh); if (rc) return rc; #else int prot = PROT_READ; if (flags & MDB_WRITEMAP) { prot |= PROT_WRITE; if (ftruncate(env->me_fd, env->me_mapsize) < 0) return ErrCode(); } env->me_map = mmap(addr, env->me_mapsize, prot, MAP_SHARED, env->me_fd, 0); if (env->me_map == MAP_FAILED) { env->me_map = NULL; return ErrCode(); } if (flags & MDB_NORDAHEAD) { /* Turn off readahead. It's harmful when the DB is larger than RAM. */ #ifdef MADV_RANDOM madvise(env->me_map, env->me_mapsize, MADV_RANDOM); #else #ifdef POSIX_MADV_RANDOM posix_madvise(env->me_map, env->me_mapsize, POSIX_MADV_RANDOM); #endif /* POSIX_MADV_RANDOM */ #endif /* MADV_RANDOM */ } #endif /* _WIN32 */ /* Can happen because the address argument to mmap() is just a * hint. mmap() can pick another, e.g. if the range is in use. * The MAP_FIXED flag would prevent that, but then mmap could * instead unmap existing pages to make room for the new map. */ if (addr && env->me_map != addr) return EBUSY; /* TODO: Make a new MDB_* error code? */ p = (MDB_page *)env->me_map; env->me_metas[0] = METADATA(p); env->me_metas[1] = (MDB_meta *)((char *)env->me_metas[0] + env->me_psize); return MDB_SUCCESS; } int ESECT mdb_env_set_mapsize(MDB_env *env, size_t size) { /* If env is already open, caller is responsible for making * sure there are no active txns. */ if (env->me_map) { int rc; MDB_meta *meta; void *old; if (env->me_txn) return EINVAL; meta = mdb_env_pick_meta(env); if (!size) size = meta->mm_mapsize; { /* Silently round up to minimum if the size is too small */ size_t minsize = (meta->mm_last_pg + 1) * env->me_psize; if (size < minsize) size = minsize; } munmap(env->me_map, env->me_mapsize); env->me_mapsize = size; old = (env->me_flags & MDB_FIXEDMAP) ? env->me_map : NULL; rc = mdb_env_map(env, old); if (rc) return rc; } env->me_mapsize = size; if (env->me_psize) env->me_maxpg = env->me_mapsize / env->me_psize; return MDB_SUCCESS; } int ESECT mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs) { if (env->me_map) return EINVAL; env->me_maxdbs = dbs + CORE_DBS; return MDB_SUCCESS; } int ESECT mdb_env_set_maxreaders(MDB_env *env, unsigned int readers) { if (env->me_map || readers < 1) return EINVAL; env->me_maxreaders = readers; return MDB_SUCCESS; } int ESECT mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers) { if (!env || !readers) return EINVAL; *readers = env->me_maxreaders; return MDB_SUCCESS; } static int ESECT mdb_fsize(HANDLE fd, size_t *size) { #ifdef _WIN32 LARGE_INTEGER fsize; if (!GetFileSizeEx(fd, &fsize)) return ErrCode(); *size = fsize.QuadPart; #else struct stat st; if (fstat(fd, &st)) return ErrCode(); *size = st.st_size; #endif return MDB_SUCCESS; } #ifdef _WIN32 typedef wchar_t mdb_nchar_t; # define MDB_NAME(str) L##str # define mdb_name_cpy wcscpy #else /** Character type for file names: char on Unix, wchar_t on Windows */ typedef char mdb_nchar_t; # define MDB_NAME(str) str /**< #mdb_nchar_t[] string literal */ # define mdb_name_cpy strcpy /**< Copy name (#mdb_nchar_t string) */ #endif /** Filename - string of #mdb_nchar_t[] */ typedef struct MDB_name { int mn_len; /**< Length */ int mn_alloced; /**< True if #mn_val was malloced */ mdb_nchar_t *mn_val; /**< Contents */ } MDB_name; /** Filename suffixes [datafile,lockfile][without,with MDB_NOSUBDIR] */ static const mdb_nchar_t *const mdb_suffixes[2][2] = { { MDB_NAME("/data.mdb"), MDB_NAME("") }, { MDB_NAME("/lock.mdb"), MDB_NAME("-lock") } }; #define MDB_SUFFLEN 9 /**< Max string length in #mdb_suffixes[] */ /** Set up filename + scratch area for filename suffix, for opening files. * It should be freed with #mdb_fname_destroy(). * On Windows, paths are converted from char *UTF-8 to wchar_t *UTF-16. * * @param[in] path Pathname for #mdb_env_open(). * @param[in] envflags Whether a subdir and/or lockfile will be used. * @param[out] fname Resulting filename, with room for a suffix if necessary. */ static int ESECT mdb_fname_init(const char *path, unsigned envflags, MDB_name *fname) { int no_suffix = F_ISSET(envflags, MDB_NOSUBDIR|MDB_NOLOCK); fname->mn_alloced = 0; #ifdef _WIN32 return utf8_to_utf16(path, fname, no_suffix ? 0 : MDB_SUFFLEN); #else fname->mn_len = strlen(path); if (no_suffix) fname->mn_val = (char *) path; else if ((fname->mn_val = malloc(fname->mn_len + MDB_SUFFLEN+1)) != NULL) { fname->mn_alloced = 1; strcpy(fname->mn_val, path); } else return ENOMEM; return MDB_SUCCESS; #endif } /** Destroy \b fname from #mdb_fname_init() */ #define mdb_fname_destroy(fname) \ do { if ((fname).mn_alloced) free((fname).mn_val); } while (0) #ifdef O_CLOEXEC /* POSIX.1-2008: Set FD_CLOEXEC atomically at open() */ # define MDB_CLOEXEC O_CLOEXEC #else # define MDB_CLOEXEC 0 #endif /** File type, access mode etc. for #mdb_fopen() */ enum mdb_fopen_type { #ifdef _WIN32 MDB_O_RDONLY, MDB_O_RDWR, MDB_O_META, MDB_O_COPY, MDB_O_LOCKS #else /* A comment in mdb_fopen() explains some O_* flag choices. */ MDB_O_RDONLY= O_RDONLY, /**< for RDONLY me_fd */ MDB_O_RDWR = O_RDWR |O_CREAT, /**< for me_fd */ MDB_O_META = O_WRONLY|MDB_DSYNC |MDB_CLOEXEC, /**< for me_mfd */ MDB_O_COPY = O_WRONLY|O_CREAT|O_EXCL|MDB_CLOEXEC, /**< for #mdb_env_copy() */ /** Bitmask for open() flags in enum #mdb_fopen_type. The other bits * distinguish otherwise-equal MDB_O_* constants from each other. */ MDB_O_MASK = MDB_O_RDWR|MDB_CLOEXEC | MDB_O_RDONLY|MDB_O_META|MDB_O_COPY, MDB_O_LOCKS = MDB_O_RDWR|MDB_CLOEXEC | ((MDB_O_MASK+1) & ~MDB_O_MASK) /**< for me_lfd */ #endif }; /** Open an LMDB file. * @param[in] env The LMDB environment. * @param[in,out] fname Path from from #mdb_fname_init(). A suffix is * appended if necessary to create the filename, without changing mn_len. * @param[in] which Determines file type, access mode, etc. * @param[in] mode The Unix permissions for the file, if we create it. * @param[out] res Resulting file handle. * @return 0 on success, non-zero on failure. */ static int ESECT mdb_fopen(const MDB_env *env, MDB_name *fname, enum mdb_fopen_type which, mdb_mode_t mode, HANDLE *res) { int rc = MDB_SUCCESS; HANDLE fd; #ifdef _WIN32 DWORD acc, share, disp, attrs; #else int flags; #endif if (fname->mn_alloced) /* modifiable copy */ mdb_name_cpy(fname->mn_val + fname->mn_len, mdb_suffixes[which==MDB_O_LOCKS][F_ISSET(env->me_flags, MDB_NOSUBDIR)]); /* The directory must already exist. Usually the file need not. * MDB_O_META requires the file because we already created it using * MDB_O_RDWR. MDB_O_COPY must not overwrite an existing file. * * With MDB_O_COPY we do not want the OS to cache the writes, since * the source data is already in the OS cache. * * The lockfile needs FD_CLOEXEC (close file descriptor on exec*()) * to avoid the flock() issues noted under Caveats in lmdb.h. * Also set it for other filehandles which the user cannot get at * and close himself, which he may need after fork(). I.e. all but * me_fd, which programs do use via mdb_env_get_fd(). */ #ifdef _WIN32 acc = GENERIC_READ|GENERIC_WRITE; share = FILE_SHARE_READ|FILE_SHARE_WRITE; disp = OPEN_ALWAYS; attrs = FILE_ATTRIBUTE_NORMAL; switch (which) { case MDB_O_RDONLY: /* read-only datafile */ acc = GENERIC_READ; disp = OPEN_EXISTING; break; case MDB_O_META: /* for writing metapages */ acc = GENERIC_WRITE; disp = OPEN_EXISTING; attrs = FILE_ATTRIBUTE_NORMAL|FILE_FLAG_WRITE_THROUGH; break; case MDB_O_COPY: /* mdb_env_copy() & co */ acc = GENERIC_WRITE; share = 0; disp = CREATE_NEW; attrs = FILE_FLAG_NO_BUFFERING|FILE_FLAG_WRITE_THROUGH; break; default: break; /* silence gcc -Wswitch (not all enum values handled) */ } fd = CreateFileW(fname->mn_val, acc, share, NULL, disp, attrs, NULL); #else fd = open(fname->mn_val, which & MDB_O_MASK, mode); #endif if (fd == INVALID_HANDLE_VALUE) rc = ErrCode(); #ifndef _WIN32 else { if (which != MDB_O_RDONLY && which != MDB_O_RDWR) { /* Set CLOEXEC if we could not pass it to open() */ if (!MDB_CLOEXEC && (flags = fcntl(fd, F_GETFD)) != -1) (void) fcntl(fd, F_SETFD, flags | FD_CLOEXEC); } if (which == MDB_O_COPY && env->me_psize >= env->me_os_psize) { /* This may require buffer alignment. There is no portable * way to ask how much, so we require OS pagesize alignment. */ # ifdef F_NOCACHE /* __APPLE__ */ (void) fcntl(fd, F_NOCACHE, 1); # elif defined O_DIRECT /* open(...O_DIRECT...) would break on filesystems without * O_DIRECT support (ITS#7682). Try to set it here instead. */ if ((flags = fcntl(fd, F_GETFL)) != -1) (void) fcntl(fd, F_SETFL, flags | O_DIRECT); # endif } } #endif /* !_WIN32 */ *res = fd; return rc; } #ifdef BROKEN_FDATASYNC #include #include #endif /** Further setup required for opening an LMDB environment */ static int ESECT mdb_env_open2(MDB_env *env) { unsigned int flags = env->me_flags; int i, newenv = 0, rc; MDB_meta meta; #ifdef _WIN32 /* See if we should use QueryLimited */ rc = GetVersion(); if ((rc & 0xff) > 5) env->me_pidquery = MDB_PROCESS_QUERY_LIMITED_INFORMATION; else env->me_pidquery = PROCESS_QUERY_INFORMATION; #endif /* _WIN32 */ #ifdef BROKEN_FDATASYNC /* ext3/ext4 fdatasync is broken on some older Linux kernels. * https://lkml.org/lkml/2012/9/3/83 * Kernels after 3.6-rc6 are known good. * https://lkml.org/lkml/2012/9/10/556 * See if the DB is on ext3/ext4, then check for new enough kernel * Kernels 2.6.32.60, 2.6.34.15, 3.2.30, and 3.5.4 are also known * to be patched. */ { struct statfs st; fstatfs(env->me_fd, &st); while (st.f_type == 0xEF53) { struct utsname uts; int i; uname(&uts); if (uts.release[0] < '3') { if (!strncmp(uts.release, "2.6.32.", 7)) { i = atoi(uts.release+7); if (i >= 60) break; /* 2.6.32.60 and newer is OK */ } else if (!strncmp(uts.release, "2.6.34.", 7)) { i = atoi(uts.release+7); if (i >= 15) break; /* 2.6.34.15 and newer is OK */ } } else if (uts.release[0] == '3') { i = atoi(uts.release+2); if (i > 5) break; /* 3.6 and newer is OK */ if (i == 5) { i = atoi(uts.release+4); if (i >= 4) break; /* 3.5.4 and newer is OK */ } else if (i == 2) { i = atoi(uts.release+4); if (i >= 30) break; /* 3.2.30 and newer is OK */ } } else { /* 4.x and newer is OK */ break; } env->me_flags |= MDB_FSYNCONLY; break; } } #endif if ((i = mdb_env_read_header(env, &meta)) != 0) { if (i != ENOENT) return i; DPUTS("new mdbenv"); newenv = 1; env->me_psize = env->me_os_psize; if (env->me_psize > MAX_PAGESIZE) env->me_psize = MAX_PAGESIZE; memset(&meta, 0, sizeof(meta)); mdb_env_init_meta0(env, &meta); meta.mm_mapsize = DEFAULT_MAPSIZE; } else { env->me_psize = meta.mm_psize; } /* Was a mapsize configured? */ if (!env->me_mapsize) { env->me_mapsize = meta.mm_mapsize; } { /* Make sure mapsize >= committed data size. Even when using * mm_mapsize, which could be broken in old files (ITS#7789). */ size_t minsize = (meta.mm_last_pg + 1) * meta.mm_psize; if (env->me_mapsize < minsize) env->me_mapsize = minsize; } meta.mm_mapsize = env->me_mapsize; if (newenv && !(flags & MDB_FIXEDMAP)) { /* mdb_env_map() may grow the datafile. Write the metapages * first, so the file will be valid if initialization fails. * Except with FIXEDMAP, since we do not yet know mm_address. * We could fill in mm_address later, but then a different * program might end up doing that - one with a memory layout * and map address which does not suit the main program. */ rc = mdb_env_init_meta(env, &meta); if (rc) return rc; newenv = 0; } rc = mdb_env_map(env, (flags & MDB_FIXEDMAP) ? meta.mm_address : NULL); if (rc) return rc; if (newenv) { if (flags & MDB_FIXEDMAP) meta.mm_address = env->me_map; i = mdb_env_init_meta(env, &meta); if (i != MDB_SUCCESS) { return i; } } env->me_maxfree_1pg = (env->me_psize - PAGEHDRSZ) / sizeof(pgno_t) - 1; env->me_nodemax = (((env->me_psize - PAGEHDRSZ) / MDB_MINKEYS) & -2) - sizeof(indx_t); #if !(MDB_MAXKEYSIZE) env->me_maxkey = env->me_nodemax - (NODESIZE + sizeof(MDB_db)); #endif env->me_maxpg = env->me_mapsize / env->me_psize; #if MDB_DEBUG { MDB_meta *meta = mdb_env_pick_meta(env); MDB_db *db = &meta->mm_dbs[MAIN_DBI]; DPRINTF(("opened database version %u, pagesize %u", meta->mm_version, env->me_psize)); DPRINTF(("using meta page %d", (int) (meta->mm_txnid & 1))); DPRINTF(("depth: %u", db->md_depth)); DPRINTF(("entries: %"Z"u", db->md_entries)); DPRINTF(("branch pages: %"Z"u", db->md_branch_pages)); DPRINTF(("leaf pages: %"Z"u", db->md_leaf_pages)); DPRINTF(("overflow pages: %"Z"u", db->md_overflow_pages)); DPRINTF(("root: %"Z"u", db->md_root)); } #endif return MDB_SUCCESS; } /** Release a reader thread's slot in the reader lock table. * This function is called automatically when a thread exits. * @param[in] ptr This points to the slot in the reader lock table. */ static void mdb_env_reader_dest(void *ptr) { MDB_reader *reader = ptr; #ifndef _WIN32 if (reader->mr_pid == getpid()) /* catch pthread_exit() in child process */ #endif /* We omit the mutex, so do this atomically (i.e. skip mr_txnid) */ reader->mr_pid = 0; } #ifdef _WIN32 /** Junk for arranging thread-specific callbacks on Windows. This is * necessarily platform and compiler-specific. Windows supports up * to 1088 keys. Let's assume nobody opens more than 64 environments * in a single process, for now. They can override this if needed. */ #ifndef MAX_TLS_KEYS #define MAX_TLS_KEYS 64 #endif static pthread_key_t mdb_tls_keys[MAX_TLS_KEYS]; static int mdb_tls_nkeys; static void NTAPI mdb_tls_callback(PVOID module, DWORD reason, PVOID ptr) { int i; switch(reason) { case DLL_PROCESS_ATTACH: break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: for (i=0; ime_txns->mti_txnid = meta->mm_txnid; #ifdef _WIN32 { OVERLAPPED ov; /* First acquire a shared lock. The Unlock will * then release the existing exclusive lock. */ memset(&ov, 0, sizeof(ov)); if (!LockFileEx(env->me_lfd, 0, 0, 1, 0, &ov)) { rc = ErrCode(); } else { UnlockFile(env->me_lfd, 0, 0, 1, 0); *excl = 0; } } #else { struct flock lock_info; /* The shared lock replaces the existing lock */ memset((void *)&lock_info, 0, sizeof(lock_info)); lock_info.l_type = F_RDLCK; lock_info.l_whence = SEEK_SET; lock_info.l_start = 0; lock_info.l_len = 1; while ((rc = fcntl(env->me_lfd, F_SETLK, &lock_info)) && (rc = ErrCode()) == EINTR) ; *excl = rc ? -1 : 0; /* error may mean we lost the lock */ } #endif return rc; } /** Try to get exclusive lock, otherwise shared. * Maintain *excl = -1: no/unknown lock, 0: shared, 1: exclusive. */ static int ESECT mdb_env_excl_lock(MDB_env *env, int *excl) { int rc = 0; #ifdef _WIN32 if (LockFile(env->me_lfd, 0, 0, 1, 0)) { *excl = 1; } else { OVERLAPPED ov; memset(&ov, 0, sizeof(ov)); if (LockFileEx(env->me_lfd, 0, 0, 1, 0, &ov)) { *excl = 0; } else { rc = ErrCode(); } } #else struct flock lock_info; memset((void *)&lock_info, 0, sizeof(lock_info)); lock_info.l_type = F_WRLCK; lock_info.l_whence = SEEK_SET; lock_info.l_start = 0; lock_info.l_len = 1; while ((rc = fcntl(env->me_lfd, F_SETLK, &lock_info)) && (rc = ErrCode()) == EINTR) ; if (!rc) { *excl = 1; } else # ifndef MDB_USE_POSIX_MUTEX if (*excl < 0) /* always true when MDB_USE_POSIX_MUTEX */ # endif { lock_info.l_type = F_RDLCK; while ((rc = fcntl(env->me_lfd, F_SETLKW, &lock_info)) && (rc = ErrCode()) == EINTR) ; if (rc == 0) *excl = 0; } #endif return rc; } #ifdef MDB_USE_HASH /* * hash_64 - 64 bit Fowler/Noll/Vo-0 FNV-1a hash code * * @(#) $Revision: 5.1 $ * @(#) $Id: hash_64a.c,v 5.1 2009/06/30 09:01:38 chongo Exp $ * @(#) $Source: /usr/local/src/cmd/fnv/RCS/hash_64a.c,v $ * * http://www.isthe.com/chongo/tech/comp/fnv/index.html * *** * * Please do not copyright this code. This code is in the public domain. * * LANDON CURT NOLL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO * EVENT SHALL LANDON CURT NOLL BE LIABLE FOR ANY SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF * USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. * * By: * chongo /\oo/\ * http://www.isthe.com/chongo/ * * Share and Enjoy! :-) */ typedef unsigned long long mdb_hash_t; #define MDB_HASH_INIT ((mdb_hash_t)0xcbf29ce484222325ULL) /** perform a 64 bit Fowler/Noll/Vo FNV-1a hash on a buffer * @param[in] val value to hash * @param[in] hval initial value for hash * @return 64 bit hash * * NOTE: To use the recommended 64 bit FNV-1a hash, use MDB_HASH_INIT as the * hval arg on the first call. */ static mdb_hash_t mdb_hash_val(MDB_val *val, mdb_hash_t hval) { unsigned char *s = (unsigned char *)val->mv_data; /* unsigned string */ unsigned char *end = s + val->mv_size; /* * FNV-1a hash each octet of the string */ while (s < end) { /* xor the bottom with the current octet */ hval ^= (mdb_hash_t)*s++; /* multiply by the 64 bit FNV magic prime mod 2^64 */ hval += (hval << 1) + (hval << 4) + (hval << 5) + (hval << 7) + (hval << 8) + (hval << 40); } /* return our new hash value */ return hval; } /** Hash the string and output the encoded hash. * This uses modified RFC1924 Ascii85 encoding to accommodate systems with * very short name limits. We don't care about the encoding being reversible, * we just want to preserve as many bits of the input as possible in a * small printable string. * @param[in] str string to hash * @param[out] encbuf an array of 11 chars to hold the hash */ static const char mdb_a85[]= "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz!#$%&()*+-;<=>?@^_`{|}~"; static void ESECT mdb_pack85(unsigned long l, char *out) { int i; for (i=0; i<5; i++) { *out++ = mdb_a85[l % 85]; l /= 85; } } static void ESECT mdb_hash_enc(MDB_val *val, char *encbuf) { mdb_hash_t h = mdb_hash_val(val, MDB_HASH_INIT); mdb_pack85(h, encbuf); mdb_pack85(h>>32, encbuf+5); encbuf[10] = '\0'; } #endif /** Open and/or initialize the lock region for the environment. * @param[in] env The LMDB environment. * @param[in] fname Filename + scratch area, from #mdb_fname_init(). * @param[in] mode The Unix permissions for the file, if we create it. * @param[in,out] excl In -1, out lock type: -1 none, 0 shared, 1 exclusive * @return 0 on success, non-zero on failure. */ static int ESECT mdb_env_setup_locks(MDB_env *env, MDB_name *fname, int mode, int *excl) { #ifdef _WIN32 # define MDB_ERRCODE_ROFS ERROR_WRITE_PROTECT #else # define MDB_ERRCODE_ROFS EROFS #endif int rc; off_t size, rsize; rc = mdb_fopen(env, fname, MDB_O_LOCKS, mode, &env->me_lfd); if (rc) { /* Omit lockfile if read-only env on read-only filesystem */ if (rc == MDB_ERRCODE_ROFS && (env->me_flags & MDB_RDONLY)) { return MDB_SUCCESS; } goto fail; } if (!(env->me_flags & MDB_NOTLS)) { rc = pthread_key_create(&env->me_txkey, mdb_env_reader_dest); if (rc) goto fail; env->me_flags |= MDB_ENV_TXKEY; #ifdef _WIN32 /* Windows TLS callbacks need help finding their TLS info. */ if (mdb_tls_nkeys >= MAX_TLS_KEYS) { rc = MDB_TLS_FULL; goto fail; } mdb_tls_keys[mdb_tls_nkeys++] = env->me_txkey; #endif } /* Try to get exclusive lock. If we succeed, then * nobody is using the lock region and we should initialize it. */ if ((rc = mdb_env_excl_lock(env, excl))) goto fail; #ifdef _WIN32 size = GetFileSize(env->me_lfd, NULL); #else size = lseek(env->me_lfd, 0, SEEK_END); if (size == -1) goto fail_errno; #endif rsize = (env->me_maxreaders-1) * sizeof(MDB_reader) + sizeof(MDB_txninfo); if (size < rsize && *excl > 0) { #ifdef _WIN32 if (SetFilePointer(env->me_lfd, rsize, NULL, FILE_BEGIN) != (DWORD)rsize || !SetEndOfFile(env->me_lfd)) goto fail_errno; #else if (ftruncate(env->me_lfd, rsize) != 0) goto fail_errno; #endif } else { rsize = size; size = rsize - sizeof(MDB_txninfo); env->me_maxreaders = size/sizeof(MDB_reader) + 1; } { #ifdef _WIN32 HANDLE mh; mh = CreateFileMapping(env->me_lfd, NULL, PAGE_READWRITE, 0, 0, NULL); if (!mh) goto fail_errno; env->me_txns = MapViewOfFileEx(mh, FILE_MAP_WRITE, 0, 0, rsize, NULL); CloseHandle(mh); if (!env->me_txns) goto fail_errno; #else void *m = mmap(NULL, rsize, PROT_READ|PROT_WRITE, MAP_SHARED, env->me_lfd, 0); if (m == MAP_FAILED) goto fail_errno; env->me_txns = m; #endif } if (*excl > 0) { #ifdef _WIN32 BY_HANDLE_FILE_INFORMATION stbuf; struct { DWORD volume; DWORD nhigh; DWORD nlow; } idbuf; MDB_val val; char encbuf[11]; if (!mdb_sec_inited) { InitializeSecurityDescriptor(&mdb_null_sd, SECURITY_DESCRIPTOR_REVISION); SetSecurityDescriptorDacl(&mdb_null_sd, TRUE, 0, FALSE); mdb_all_sa.nLength = sizeof(SECURITY_ATTRIBUTES); mdb_all_sa.bInheritHandle = FALSE; mdb_all_sa.lpSecurityDescriptor = &mdb_null_sd; mdb_sec_inited = 1; } if (!GetFileInformationByHandle(env->me_lfd, &stbuf)) goto fail_errno; idbuf.volume = stbuf.dwVolumeSerialNumber; idbuf.nhigh = stbuf.nFileIndexHigh; idbuf.nlow = stbuf.nFileIndexLow; val.mv_data = &idbuf; val.mv_size = sizeof(idbuf); mdb_hash_enc(&val, encbuf); sprintf(env->me_txns->mti_rmname, "Global\\MDBr%s", encbuf); sprintf(env->me_txns->mti_wmname, "Global\\MDBw%s", encbuf); env->me_rmutex = CreateMutexA(&mdb_all_sa, FALSE, env->me_txns->mti_rmname); if (!env->me_rmutex) goto fail_errno; env->me_wmutex = CreateMutexA(&mdb_all_sa, FALSE, env->me_txns->mti_wmname); if (!env->me_wmutex) goto fail_errno; #elif defined(MDB_USE_POSIX_SEM) struct stat stbuf; struct { dev_t dev; ino_t ino; } idbuf; MDB_val val; char encbuf[11]; #if defined(__NetBSD__) #define MDB_SHORT_SEMNAMES 1 /* limited to 14 chars */ #endif if (fstat(env->me_lfd, &stbuf)) goto fail_errno; idbuf.dev = stbuf.st_dev; idbuf.ino = stbuf.st_ino; val.mv_data = &idbuf; val.mv_size = sizeof(idbuf); mdb_hash_enc(&val, encbuf); #ifdef MDB_SHORT_SEMNAMES encbuf[9] = '\0'; /* drop name from 15 chars to 14 chars */ #endif sprintf(env->me_txns->mti_rmname, "/MDBr%s", encbuf); sprintf(env->me_txns->mti_wmname, "/MDBw%s", encbuf); /* Clean up after a previous run, if needed: Try to * remove both semaphores before doing anything else. */ sem_unlink(env->me_txns->mti_rmname); sem_unlink(env->me_txns->mti_wmname); env->me_rmutex = sem_open(env->me_txns->mti_rmname, O_CREAT|O_EXCL, mode, 1); if (env->me_rmutex == SEM_FAILED) goto fail_errno; env->me_wmutex = sem_open(env->me_txns->mti_wmname, O_CREAT|O_EXCL, mode, 1); if (env->me_wmutex == SEM_FAILED) goto fail_errno; #else /* MDB_USE_POSIX_MUTEX: */ pthread_mutexattr_t mattr; /* Solaris needs this before initing a robust mutex. Otherwise * it may skip the init and return EBUSY "seems someone already * inited" or EINVAL "it was inited differently". */ memset(env->me_txns->mti_rmutex, 0, sizeof(*env->me_txns->mti_rmutex)); memset(env->me_txns->mti_wmutex, 0, sizeof(*env->me_txns->mti_wmutex)); if ((rc = pthread_mutexattr_init(&mattr))) goto fail; rc = pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED); #ifdef MDB_ROBUST_SUPPORTED if (!rc) rc = pthread_mutexattr_setrobust(&mattr, PTHREAD_MUTEX_ROBUST); #endif if (!rc) rc = pthread_mutex_init(env->me_txns->mti_rmutex, &mattr); if (!rc) rc = pthread_mutex_init(env->me_txns->mti_wmutex, &mattr); pthread_mutexattr_destroy(&mattr); if (rc) goto fail; #endif /* _WIN32 || MDB_USE_POSIX_SEM */ env->me_txns->mti_magic = MDB_MAGIC; env->me_txns->mti_format = MDB_LOCK_FORMAT; env->me_txns->mti_txnid = 0; env->me_txns->mti_numreaders = 0; } else { if (env->me_txns->mti_magic != MDB_MAGIC) { DPUTS("lock region has invalid magic"); rc = MDB_INVALID; goto fail; } if (env->me_txns->mti_format != MDB_LOCK_FORMAT) { DPRINTF(("lock region has format+version 0x%x, expected 0x%x", env->me_txns->mti_format, MDB_LOCK_FORMAT)); rc = MDB_VERSION_MISMATCH; goto fail; } rc = ErrCode(); if (rc && rc != EACCES && rc != EAGAIN) { goto fail; } #ifdef _WIN32 env->me_rmutex = OpenMutexA(SYNCHRONIZE, FALSE, env->me_txns->mti_rmname); if (!env->me_rmutex) goto fail_errno; env->me_wmutex = OpenMutexA(SYNCHRONIZE, FALSE, env->me_txns->mti_wmname); if (!env->me_wmutex) goto fail_errno; #elif defined(MDB_USE_POSIX_SEM) env->me_rmutex = sem_open(env->me_txns->mti_rmname, 0); if (env->me_rmutex == SEM_FAILED) goto fail_errno; env->me_wmutex = sem_open(env->me_txns->mti_wmname, 0); if (env->me_wmutex == SEM_FAILED) goto fail_errno; #endif } return MDB_SUCCESS; fail_errno: rc = ErrCode(); fail: return rc; } /** Only a subset of the @ref mdb_env flags can be changed * at runtime. Changing other flags requires closing the * environment and re-opening it with the new flags. */ #define CHANGEABLE (MDB_NOSYNC|MDB_NOMETASYNC|MDB_MAPASYNC|MDB_NOMEMINIT) #define CHANGELESS (MDB_FIXEDMAP|MDB_NOSUBDIR|MDB_RDONLY| \ MDB_WRITEMAP|MDB_NOTLS|MDB_NOLOCK|MDB_NORDAHEAD) #if VALID_FLAGS & PERSISTENT_FLAGS & (CHANGEABLE|CHANGELESS) # error "Persistent DB flags & env flags overlap, but both go in mm_flags" #endif int ESECT mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mdb_mode_t mode) { int rc, excl = -1; MDB_name fname; if (env->me_fd!=INVALID_HANDLE_VALUE || (flags & ~(CHANGEABLE|CHANGELESS))) return EINVAL; flags |= env->me_flags; rc = mdb_fname_init(path, flags, &fname); if (rc) return rc; if (flags & MDB_RDONLY) { /* silently ignore WRITEMAP when we're only getting read access */ flags &= ~MDB_WRITEMAP; } else { if (!((env->me_free_pgs = mdb_midl_alloc(MDB_IDL_UM_MAX)) && (env->me_dirty_list = calloc(MDB_IDL_UM_SIZE, sizeof(MDB_ID2))))) rc = ENOMEM; } env->me_flags = flags |= MDB_ENV_ACTIVE; if (rc) goto leave; env->me_path = strdup(path); env->me_dbxs = calloc(env->me_maxdbs, sizeof(MDB_dbx)); env->me_dbflags = calloc(env->me_maxdbs, sizeof(uint16_t)); env->me_dbiseqs = calloc(env->me_maxdbs, sizeof(unsigned int)); if (!(env->me_dbxs && env->me_path && env->me_dbflags && env->me_dbiseqs)) { rc = ENOMEM; goto leave; } env->me_dbxs[FREE_DBI].md_cmp = mdb_cmp_long; /* aligned MDB_INTEGERKEY */ /* For RDONLY, get lockfile after we know datafile exists */ if (!(flags & (MDB_RDONLY|MDB_NOLOCK))) { rc = mdb_env_setup_locks(env, &fname, mode, &excl); if (rc) goto leave; } rc = mdb_fopen(env, &fname, (flags & MDB_RDONLY) ? MDB_O_RDONLY : MDB_O_RDWR, mode, &env->me_fd); if (rc) goto leave; if ((flags & (MDB_RDONLY|MDB_NOLOCK)) == MDB_RDONLY) { rc = mdb_env_setup_locks(env, &fname, mode, &excl); if (rc) goto leave; } if ((rc = mdb_env_open2(env)) == MDB_SUCCESS) { if (!(flags & (MDB_RDONLY|MDB_WRITEMAP))) { /* Synchronous fd for meta writes. Needed even with * MDB_NOSYNC/MDB_NOMETASYNC, in case these get reset. */ rc = mdb_fopen(env, &fname, MDB_O_META, mode, &env->me_mfd); if (rc) goto leave; } DPRINTF(("opened dbenv %p", (void *) env)); if (excl > 0) { rc = mdb_env_share_locks(env, &excl); if (rc) goto leave; } if (!(flags & MDB_RDONLY)) { MDB_txn *txn; int tsize = sizeof(MDB_txn), size = tsize + env->me_maxdbs * (sizeof(MDB_db)+sizeof(MDB_cursor *)+sizeof(unsigned int)+1); if ((env->me_pbuf = calloc(1, env->me_psize)) && (txn = calloc(1, size))) { txn->mt_dbs = (MDB_db *)((char *)txn + tsize); txn->mt_cursors = (MDB_cursor **)(txn->mt_dbs + env->me_maxdbs); txn->mt_dbiseqs = (unsigned int *)(txn->mt_cursors + env->me_maxdbs); txn->mt_dbflags = (unsigned char *)(txn->mt_dbiseqs + env->me_maxdbs); txn->mt_env = env; txn->mt_dbxs = env->me_dbxs; txn->mt_flags = MDB_TXN_FINISHED; env->me_txn0 = txn; } else { rc = ENOMEM; } } } leave: if (rc) { mdb_env_close0(env, excl); } mdb_fname_destroy(fname); return rc; } /** Destroy resources from mdb_env_open(), clear our readers & DBIs */ static void ESECT mdb_env_close0(MDB_env *env, int excl) { int i; if (!(env->me_flags & MDB_ENV_ACTIVE)) return; /* Doing this here since me_dbxs may not exist during mdb_env_close */ if (env->me_dbxs) { for (i = env->me_maxdbs; --i >= CORE_DBS; ) free(env->me_dbxs[i].md_name.mv_data); free(env->me_dbxs); } free(env->me_pbuf); free(env->me_dbiseqs); free(env->me_dbflags); free(env->me_path); free(env->me_dirty_list); free(env->me_txn0); mdb_midl_free(env->me_free_pgs); if (env->me_flags & MDB_ENV_TXKEY) { pthread_key_delete(env->me_txkey); #ifdef _WIN32 /* Delete our key from the global list */ for (i=0; ime_txkey) { mdb_tls_keys[i] = mdb_tls_keys[mdb_tls_nkeys-1]; mdb_tls_nkeys--; break; } #endif } if (env->me_map) { munmap(env->me_map, env->me_mapsize); } if (env->me_mfd != INVALID_HANDLE_VALUE) (void) close(env->me_mfd); if (env->me_fd != INVALID_HANDLE_VALUE) (void) close(env->me_fd); if (env->me_txns) { MDB_PID_T pid = getpid(); /* Clearing readers is done in this function because * me_txkey with its destructor must be disabled first. * * We skip the the reader mutex, so we touch only * data owned by this process (me_close_readers and * our readers), and clear each reader atomically. */ for (i = env->me_close_readers; --i >= 0; ) if (env->me_txns->mti_readers[i].mr_pid == pid) env->me_txns->mti_readers[i].mr_pid = 0; #ifdef _WIN32 if (env->me_rmutex) { CloseHandle(env->me_rmutex); if (env->me_wmutex) CloseHandle(env->me_wmutex); } /* Windows automatically destroys the mutexes when * the last handle closes. */ #elif defined(MDB_USE_POSIX_SEM) if (env->me_rmutex != SEM_FAILED) { sem_close(env->me_rmutex); if (env->me_wmutex != SEM_FAILED) sem_close(env->me_wmutex); /* If we have the filelock: If we are the * only remaining user, clean up semaphores. */ if (excl == 0) mdb_env_excl_lock(env, &excl); if (excl > 0) { sem_unlink(env->me_txns->mti_rmname); sem_unlink(env->me_txns->mti_wmname); } } #endif munmap((void *)env->me_txns, (env->me_maxreaders-1)*sizeof(MDB_reader)+sizeof(MDB_txninfo)); } if (env->me_lfd != INVALID_HANDLE_VALUE) { #ifdef _WIN32 if (excl >= 0) { /* Unlock the lockfile. Windows would have unlocked it * after closing anyway, but not necessarily at once. */ UnlockFile(env->me_lfd, 0, 0, 1, 0); } #endif (void) close(env->me_lfd); } env->me_flags &= ~(MDB_ENV_ACTIVE|MDB_ENV_TXKEY); } void ESECT mdb_env_close(MDB_env *env) { MDB_page *dp; if (env == NULL) return; VGMEMP_DESTROY(env); while ((dp = env->me_dpages) != NULL) { VGMEMP_DEFINED(&dp->mp_next, sizeof(dp->mp_next)); env->me_dpages = dp->mp_next; free(dp); } mdb_env_close0(env, 0); free(env); } /** Compare two items pointing at aligned size_t's */ static int mdb_cmp_long(const MDB_val *a, const MDB_val *b) { return (*(size_t *)a->mv_data < *(size_t *)b->mv_data) ? -1 : *(size_t *)a->mv_data > *(size_t *)b->mv_data; } /** Compare two items pointing at aligned unsigned int's. * * This is also set as #MDB_INTEGERDUP|#MDB_DUPFIXED's #MDB_dbx.%md_dcmp, * but #mdb_cmp_clong() is called instead if the data type is size_t. */ static int mdb_cmp_int(const MDB_val *a, const MDB_val *b) { return (*(unsigned int *)a->mv_data < *(unsigned int *)b->mv_data) ? -1 : *(unsigned int *)a->mv_data > *(unsigned int *)b->mv_data; } /** Compare two items pointing at unsigned ints of unknown alignment. * Nodes and keys are guaranteed to be 2-byte aligned. */ static int mdb_cmp_cint(const MDB_val *a, const MDB_val *b) { #if BYTE_ORDER == LITTLE_ENDIAN unsigned short *u, *c; int x; u = (unsigned short *) ((char *) a->mv_data + a->mv_size); c = (unsigned short *) ((char *) b->mv_data + a->mv_size); do { x = *--u - *--c; } while(!x && u > (unsigned short *)a->mv_data); return x; #else unsigned short *u, *c, *end; int x; end = (unsigned short *) ((char *) a->mv_data + a->mv_size); u = (unsigned short *)a->mv_data; c = (unsigned short *)b->mv_data; do { x = *u++ - *c++; } while(!x && u < end); return x; #endif } /** Compare two items lexically */ static int mdb_cmp_memn(const MDB_val *a, const MDB_val *b) { int diff; ssize_t len_diff; unsigned int len; len = a->mv_size; len_diff = (ssize_t) a->mv_size - (ssize_t) b->mv_size; if (len_diff > 0) { len = b->mv_size; len_diff = 1; } diff = memcmp(a->mv_data, b->mv_data, len); return diff ? diff : len_diff<0 ? -1 : len_diff; } /** Compare two items in reverse byte order */ static int mdb_cmp_memnr(const MDB_val *a, const MDB_val *b) { const unsigned char *p1, *p2, *p1_lim; ssize_t len_diff; int diff; p1_lim = (const unsigned char *)a->mv_data; p1 = (const unsigned char *)a->mv_data + a->mv_size; p2 = (const unsigned char *)b->mv_data + b->mv_size; len_diff = (ssize_t) a->mv_size - (ssize_t) b->mv_size; if (len_diff > 0) { p1_lim += len_diff; len_diff = 1; } while (p1 > p1_lim) { diff = *--p1 - *--p2; if (diff) return diff; } return len_diff<0 ? -1 : len_diff; } /** Search for key within a page, using binary search. * Returns the smallest entry larger or equal to the key. * If exactp is non-null, stores whether the found entry was an exact match * in *exactp (1 or 0). * Updates the cursor index with the index of the found entry. * If no entry larger or equal to the key is found, returns NULL. */ static MDB_node * mdb_node_search(MDB_cursor *mc, MDB_val *key, int *exactp) { unsigned int i = 0, nkeys; int low, high; int rc = 0; MDB_page *mp = mc->mc_pg[mc->mc_top]; MDB_node *node = NULL; MDB_val nodekey; MDB_cmp_func *cmp; DKBUF; nkeys = NUMKEYS(mp); DPRINTF(("searching %u keys in %s %spage %"Z"u", nkeys, IS_LEAF(mp) ? "leaf" : "branch", IS_SUBP(mp) ? "sub-" : "", mdb_dbg_pgno(mp))); low = IS_LEAF(mp) ? 0 : 1; high = nkeys - 1; cmp = mc->mc_dbx->md_cmp; /* Branch pages have no data, so if using integer keys, * alignment is guaranteed. Use faster mdb_cmp_int. */ if (cmp == mdb_cmp_cint && IS_BRANCH(mp)) { if (NODEPTR(mp, 1)->mn_ksize == sizeof(size_t)) cmp = mdb_cmp_long; else cmp = mdb_cmp_int; } if (IS_LEAF2(mp)) { nodekey.mv_size = mc->mc_db->md_pad; node = NODEPTR(mp, 0); /* fake */ while (low <= high) { i = (low + high) >> 1; nodekey.mv_data = LEAF2KEY(mp, i, nodekey.mv_size); rc = cmp(key, &nodekey); DPRINTF(("found leaf index %u [%s], rc = %i", i, DKEY(&nodekey), rc)); if (rc == 0) break; if (rc > 0) low = i + 1; else high = i - 1; } } else { while (low <= high) { i = (low + high) >> 1; node = NODEPTR(mp, i); nodekey.mv_size = NODEKSZ(node); nodekey.mv_data = NODEKEY(node); rc = cmp(key, &nodekey); #if MDB_DEBUG if (IS_LEAF(mp)) DPRINTF(("found leaf index %u [%s], rc = %i", i, DKEY(&nodekey), rc)); else DPRINTF(("found branch index %u [%s -> %"Z"u], rc = %i", i, DKEY(&nodekey), NODEPGNO(node), rc)); #endif if (rc == 0) break; if (rc > 0) low = i + 1; else high = i - 1; } } if (rc > 0) { /* Found entry is less than the key. */ i++; /* Skip to get the smallest entry larger than key. */ if (!IS_LEAF2(mp)) node = NODEPTR(mp, i); } if (exactp) *exactp = (rc == 0 && nkeys > 0); /* store the key index */ mc->mc_ki[mc->mc_top] = i; if (i >= nkeys) /* There is no entry larger or equal to the key. */ return NULL; /* nodeptr is fake for LEAF2 */ return node; } #if 0 static void mdb_cursor_adjust(MDB_cursor *mc, func) { MDB_cursor *m2; for (m2 = mc->mc_txn->mt_cursors[mc->mc_dbi]; m2; m2=m2->mc_next) { if (m2->mc_pg[m2->mc_top] == mc->mc_pg[mc->mc_top]) { func(mc, m2); } } } #endif /** Pop a page off the top of the cursor's stack. */ static void mdb_cursor_pop(MDB_cursor *mc) { if (mc->mc_snum) { DPRINTF(("popping page %"Z"u off db %d cursor %p", mc->mc_pg[mc->mc_top]->mp_pgno, DDBI(mc), (void *) mc)); mc->mc_snum--; if (mc->mc_snum) { mc->mc_top--; } else { mc->mc_flags &= ~C_INITIALIZED; } } } /** Push a page onto the top of the cursor's stack. * Set #MDB_TXN_ERROR on failure. */ static int mdb_cursor_push(MDB_cursor *mc, MDB_page *mp) { DPRINTF(("pushing page %"Z"u on db %d cursor %p", mp->mp_pgno, DDBI(mc), (void *) mc)); if (mc->mc_snum >= CURSOR_STACK) { mc->mc_txn->mt_flags |= MDB_TXN_ERROR; return MDB_CURSOR_FULL; } mc->mc_top = mc->mc_snum++; mc->mc_pg[mc->mc_top] = mp; mc->mc_ki[mc->mc_top] = 0; return MDB_SUCCESS; } /** Find the address of the page corresponding to a given page number. * Set #MDB_TXN_ERROR on failure. * @param[in] mc the cursor accessing the page. * @param[in] pgno the page number for the page to retrieve. * @param[out] ret address of a pointer where the page's address will be stored. * @param[out] lvl dirty_list inheritance level of found page. 1=current txn, 0=mapped page. * @return 0 on success, non-zero on failure. */ static int mdb_page_get(MDB_cursor *mc, pgno_t pgno, MDB_page **ret, int *lvl) { MDB_txn *txn = mc->mc_txn; MDB_env *env = txn->mt_env; MDB_page *p = NULL; int level; if (! (txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_WRITEMAP))) { MDB_txn *tx2 = txn; level = 1; do { MDB_ID2L dl = tx2->mt_u.dirty_list; unsigned x; /* Spilled pages were dirtied in this txn and flushed * because the dirty list got full. Bring this page * back in from the map (but don't unspill it here, * leave that unless page_touch happens again). */ if (tx2->mt_spill_pgs) { MDB_ID pn = pgno << 1; x = mdb_midl_search(tx2->mt_spill_pgs, pn); if (x <= tx2->mt_spill_pgs[0] && tx2->mt_spill_pgs[x] == pn) { p = (MDB_page *)(env->me_map + env->me_psize * pgno); goto done; } } if (dl[0].mid) { unsigned x = mdb_mid2l_search(dl, pgno); if (x <= dl[0].mid && dl[x].mid == pgno) { p = dl[x].mptr; goto done; } } level++; } while ((tx2 = tx2->mt_parent) != NULL); } if (pgno < txn->mt_next_pgno) { level = 0; p = (MDB_page *)(env->me_map + env->me_psize * pgno); } else { DPRINTF(("page %"Z"u not found", pgno)); txn->mt_flags |= MDB_TXN_ERROR; return MDB_PAGE_NOTFOUND; } done: *ret = p; if (lvl) *lvl = level; return MDB_SUCCESS; } /** Finish #mdb_page_search() / #mdb_page_search_lowest(). * The cursor is at the root page, set up the rest of it. */ static int mdb_page_search_root(MDB_cursor *mc, MDB_val *key, int flags) { MDB_page *mp = mc->mc_pg[mc->mc_top]; int rc; DKBUF; while (IS_BRANCH(mp)) { MDB_node *node; indx_t i; DPRINTF(("branch page %"Z"u has %u keys", mp->mp_pgno, NUMKEYS(mp))); /* Don't assert on branch pages in the FreeDB. We can get here * while in the process of rebalancing a FreeDB branch page; we must * let that proceed. ITS#8336 */ mdb_cassert(mc, !mc->mc_dbi || NUMKEYS(mp) > 1); DPRINTF(("found index 0 to page %"Z"u", NODEPGNO(NODEPTR(mp, 0)))); if (flags & (MDB_PS_FIRST|MDB_PS_LAST)) { i = 0; if (flags & MDB_PS_LAST) { i = NUMKEYS(mp) - 1; /* if already init'd, see if we're already in right place */ if (mc->mc_flags & C_INITIALIZED) { if (mc->mc_ki[mc->mc_top] == i) { mc->mc_top = mc->mc_snum++; mp = mc->mc_pg[mc->mc_top]; goto ready; } } } } else { int exact; node = mdb_node_search(mc, key, &exact); if (node == NULL) i = NUMKEYS(mp) - 1; else { i = mc->mc_ki[mc->mc_top]; if (!exact) { mdb_cassert(mc, i > 0); i--; } } DPRINTF(("following index %u for key [%s]", i, DKEY(key))); } mdb_cassert(mc, i < NUMKEYS(mp)); node = NODEPTR(mp, i); if ((rc = mdb_page_get(mc, NODEPGNO(node), &mp, NULL)) != 0) return rc; mc->mc_ki[mc->mc_top] = i; if ((rc = mdb_cursor_push(mc, mp))) return rc; ready: if (flags & MDB_PS_MODIFY) { if ((rc = mdb_page_touch(mc)) != 0) return rc; mp = mc->mc_pg[mc->mc_top]; } } if (!IS_LEAF(mp)) { DPRINTF(("internal error, index points to a %02X page!?", mp->mp_flags)); mc->mc_txn->mt_flags |= MDB_TXN_ERROR; return MDB_CORRUPTED; } DPRINTF(("found leaf page %"Z"u for key [%s]", mp->mp_pgno, key ? DKEY(key) : "null")); mc->mc_flags |= C_INITIALIZED; mc->mc_flags &= ~C_EOF; return MDB_SUCCESS; } /** Search for the lowest key under the current branch page. * This just bypasses a NUMKEYS check in the current page * before calling mdb_page_search_root(), because the callers * are all in situations where the current page is known to * be underfilled. */ static int mdb_page_search_lowest(MDB_cursor *mc) { MDB_page *mp = mc->mc_pg[mc->mc_top]; MDB_node *node = NODEPTR(mp, 0); int rc; if ((rc = mdb_page_get(mc, NODEPGNO(node), &mp, NULL)) != 0) return rc; mc->mc_ki[mc->mc_top] = 0; if ((rc = mdb_cursor_push(mc, mp))) return rc; return mdb_page_search_root(mc, NULL, MDB_PS_FIRST); } /** Search for the page a given key should be in. * Push it and its parent pages on the cursor stack. * @param[in,out] mc the cursor for this operation. * @param[in] key the key to search for, or NULL for first/last page. * @param[in] flags If MDB_PS_MODIFY is set, visited pages in the DB * are touched (updated with new page numbers). * If MDB_PS_FIRST or MDB_PS_LAST is set, find first or last leaf. * This is used by #mdb_cursor_first() and #mdb_cursor_last(). * If MDB_PS_ROOTONLY set, just fetch root node, no further lookups. * @return 0 on success, non-zero on failure. */ static int mdb_page_search(MDB_cursor *mc, MDB_val *key, int flags) { int rc; pgno_t root; /* Make sure the txn is still viable, then find the root from * the txn's db table and set it as the root of the cursor's stack. */ if (mc->mc_txn->mt_flags & MDB_TXN_BLOCKED) { DPUTS("transaction may not be used now"); return MDB_BAD_TXN; } else { /* Make sure we're using an up-to-date root */ if (*mc->mc_dbflag & DB_STALE) { MDB_cursor mc2; if (TXN_DBI_CHANGED(mc->mc_txn, mc->mc_dbi)) return MDB_BAD_DBI; mdb_cursor_init(&mc2, mc->mc_txn, MAIN_DBI, NULL); rc = mdb_page_search(&mc2, &mc->mc_dbx->md_name, 0); if (rc) return rc; { MDB_val data; int exact = 0; uint16_t flags; MDB_node *leaf = mdb_node_search(&mc2, &mc->mc_dbx->md_name, &exact); if (!exact) return MDB_NOTFOUND; if ((leaf->mn_flags & (F_DUPDATA|F_SUBDATA)) != F_SUBDATA) return MDB_INCOMPATIBLE; /* not a named DB */ rc = mdb_node_read(&mc2, leaf, &data); if (rc) return rc; memcpy(&flags, ((char *) data.mv_data + offsetof(MDB_db, md_flags)), sizeof(uint16_t)); /* The txn may not know this DBI, or another process may * have dropped and recreated the DB with other flags. */ if ((mc->mc_db->md_flags & PERSISTENT_FLAGS) != flags) return MDB_INCOMPATIBLE; memcpy(mc->mc_db, data.mv_data, sizeof(MDB_db)); } *mc->mc_dbflag &= ~DB_STALE; } root = mc->mc_db->md_root; if (root == P_INVALID) { /* Tree is empty. */ DPUTS("tree is empty"); return MDB_NOTFOUND; } } mdb_cassert(mc, root > 1); if (!mc->mc_pg[0] || mc->mc_pg[0]->mp_pgno != root) if ((rc = mdb_page_get(mc, root, &mc->mc_pg[0], NULL)) != 0) return rc; mc->mc_snum = 1; mc->mc_top = 0; DPRINTF(("db %d root page %"Z"u has flags 0x%X", DDBI(mc), root, mc->mc_pg[0]->mp_flags)); if (flags & MDB_PS_MODIFY) { if ((rc = mdb_page_touch(mc))) return rc; } if (flags & MDB_PS_ROOTONLY) return MDB_SUCCESS; return mdb_page_search_root(mc, key, flags); } static int mdb_ovpage_free(MDB_cursor *mc, MDB_page *mp) { MDB_txn *txn = mc->mc_txn; pgno_t pg = mp->mp_pgno; unsigned x = 0, ovpages = mp->mp_pages; MDB_env *env = txn->mt_env; MDB_IDL sl = txn->mt_spill_pgs; MDB_ID pn = pg << 1; int rc; DPRINTF(("free ov page %"Z"u (%d)", pg, ovpages)); /* If the page is dirty or on the spill list we just acquired it, * so we should give it back to our current free list, if any. * Otherwise put it onto the list of pages we freed in this txn. * * Won't create me_pghead: me_pglast must be inited along with it. * Unsupported in nested txns: They would need to hide the page * range in ancestor txns' dirty and spilled lists. */ if (env->me_pghead && !txn->mt_parent && ((mp->mp_flags & P_DIRTY) || (sl && (x = mdb_midl_search(sl, pn)) <= sl[0] && sl[x] == pn))) { unsigned i, j; pgno_t *mop; MDB_ID2 *dl, ix, iy; rc = mdb_midl_need(&env->me_pghead, ovpages); if (rc) return rc; if (!(mp->mp_flags & P_DIRTY)) { /* This page is no longer spilled */ if (x == sl[0]) sl[0]--; else sl[x] |= 1; goto release; } /* Remove from dirty list */ dl = txn->mt_u.dirty_list; x = dl[0].mid--; for (ix = dl[x]; ix.mptr != mp; ix = iy) { if (x > 1) { x--; iy = dl[x]; dl[x] = ix; } else { mdb_cassert(mc, x > 1); j = ++(dl[0].mid); dl[j] = ix; /* Unsorted. OK when MDB_TXN_ERROR. */ txn->mt_flags |= MDB_TXN_ERROR; return MDB_CORRUPTED; } } txn->mt_dirty_room++; if (!(env->me_flags & MDB_WRITEMAP)) mdb_dpage_free(env, mp); release: /* Insert in me_pghead */ mop = env->me_pghead; j = mop[0] + ovpages; for (i = mop[0]; i && mop[i] < pg; i--) mop[j--] = mop[i]; while (j>i) mop[j--] = pg++; mop[0] += ovpages; } else { rc = mdb_midl_append_range(&txn->mt_free_pgs, pg, ovpages); if (rc) return rc; } mc->mc_db->md_overflow_pages -= ovpages; return 0; } /** Return the data associated with a given node. * @param[in] mc The cursor for this operation. * @param[in] leaf The node being read. * @param[out] data Updated to point to the node's data. * @return 0 on success, non-zero on failure. */ static int mdb_node_read(MDB_cursor *mc, MDB_node *leaf, MDB_val *data) { MDB_page *omp; /* overflow page */ pgno_t pgno; int rc; if (!F_ISSET(leaf->mn_flags, F_BIGDATA)) { data->mv_size = NODEDSZ(leaf); data->mv_data = NODEDATA(leaf); return MDB_SUCCESS; } /* Read overflow data. */ data->mv_size = NODEDSZ(leaf); memcpy(&pgno, NODEDATA(leaf), sizeof(pgno)); if ((rc = mdb_page_get(mc, pgno, &omp, NULL)) != 0) { DPRINTF(("read overflow page %"Z"u failed", pgno)); return rc; } data->mv_data = METADATA(omp); return MDB_SUCCESS; } int mdb_get(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data) { MDB_cursor mc; MDB_xcursor mx; int exact = 0; DKBUF; DPRINTF(("===> get db %u key [%s]", dbi, DKEY(key))); if (!key || !data || !TXN_DBI_EXIST(txn, dbi, DB_USRVALID)) return EINVAL; if (txn->mt_flags & MDB_TXN_BLOCKED) return MDB_BAD_TXN; mdb_cursor_init(&mc, txn, dbi, &mx); return mdb_cursor_set(&mc, key, data, MDB_SET, &exact); } /** Find a sibling for a page. * Replaces the page at the top of the cursor's stack with the * specified sibling, if one exists. * @param[in] mc The cursor for this operation. * @param[in] move_right Non-zero if the right sibling is requested, * otherwise the left sibling. * @return 0 on success, non-zero on failure. */ static int mdb_cursor_sibling(MDB_cursor *mc, int move_right) { int rc; MDB_node *indx; MDB_page *mp; if (mc->mc_snum < 2) { return MDB_NOTFOUND; /* root has no siblings */ } mdb_cursor_pop(mc); DPRINTF(("parent page is page %"Z"u, index %u", mc->mc_pg[mc->mc_top]->mp_pgno, mc->mc_ki[mc->mc_top])); if (move_right ? (mc->mc_ki[mc->mc_top] + 1u >= NUMKEYS(mc->mc_pg[mc->mc_top])) : (mc->mc_ki[mc->mc_top] == 0)) { DPRINTF(("no more keys left, moving to %s sibling", move_right ? "right" : "left")); if ((rc = mdb_cursor_sibling(mc, move_right)) != MDB_SUCCESS) { /* undo cursor_pop before returning */ mc->mc_top++; mc->mc_snum++; return rc; } } else { if (move_right) mc->mc_ki[mc->mc_top]++; else mc->mc_ki[mc->mc_top]--; DPRINTF(("just moving to %s index key %u", move_right ? "right" : "left", mc->mc_ki[mc->mc_top])); } mdb_cassert(mc, IS_BRANCH(mc->mc_pg[mc->mc_top])); indx = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); if ((rc = mdb_page_get(mc, NODEPGNO(indx), &mp, NULL)) != 0) { /* mc will be inconsistent if caller does mc_snum++ as above */ mc->mc_flags &= ~(C_INITIALIZED|C_EOF); return rc; } mdb_cursor_push(mc, mp); if (!move_right) mc->mc_ki[mc->mc_top] = NUMKEYS(mp)-1; return MDB_SUCCESS; } /** Move the cursor to the next data item. */ static int mdb_cursor_next(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) { MDB_page *mp; MDB_node *leaf; int rc; if ((mc->mc_flags & C_DEL && op == MDB_NEXT_DUP)) return MDB_NOTFOUND; if (!(mc->mc_flags & C_INITIALIZED)) return mdb_cursor_first(mc, key, data); mp = mc->mc_pg[mc->mc_top]; if (mc->mc_flags & C_EOF) { if (mc->mc_ki[mc->mc_top] >= NUMKEYS(mp)-1) return MDB_NOTFOUND; mc->mc_flags ^= C_EOF; } if (mc->mc_db->md_flags & MDB_DUPSORT) { leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (op == MDB_NEXT || op == MDB_NEXT_DUP) { rc = mdb_cursor_next(&mc->mc_xcursor->mx_cursor, data, NULL, MDB_NEXT); if (op != MDB_NEXT || rc != MDB_NOTFOUND) { if (rc == MDB_SUCCESS) MDB_GET_KEY(leaf, key); return rc; } } } else { mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); if (op == MDB_NEXT_DUP) return MDB_NOTFOUND; } } DPRINTF(("cursor_next: top page is %"Z"u in cursor %p", mdb_dbg_pgno(mp), (void *) mc)); if (mc->mc_flags & C_DEL) { mc->mc_flags ^= C_DEL; goto skip; } if (mc->mc_ki[mc->mc_top] + 1u >= NUMKEYS(mp)) { DPUTS("=====> move to next sibling page"); if ((rc = mdb_cursor_sibling(mc, 1)) != MDB_SUCCESS) { mc->mc_flags |= C_EOF; return rc; } mp = mc->mc_pg[mc->mc_top]; DPRINTF(("next page is %"Z"u, key index %u", mp->mp_pgno, mc->mc_ki[mc->mc_top])); } else mc->mc_ki[mc->mc_top]++; skip: DPRINTF(("==> cursor points to page %"Z"u with %u keys, key index %u", mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top])); if (IS_LEAF2(mp)) { key->mv_size = mc->mc_db->md_pad; key->mv_data = LEAF2KEY(mp, mc->mc_ki[mc->mc_top], key->mv_size); return MDB_SUCCESS; } mdb_cassert(mc, IS_LEAF(mp)); leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { mdb_xcursor_init1(mc, leaf); } if (data) { if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) return rc; if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { rc = mdb_cursor_first(&mc->mc_xcursor->mx_cursor, data, NULL); if (rc != MDB_SUCCESS) return rc; } } MDB_GET_KEY(leaf, key); return MDB_SUCCESS; } /** Move the cursor to the previous data item. */ static int mdb_cursor_prev(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) { MDB_page *mp; MDB_node *leaf; int rc; if (!(mc->mc_flags & C_INITIALIZED)) { rc = mdb_cursor_last(mc, key, data); if (rc) return rc; mc->mc_ki[mc->mc_top]++; } mp = mc->mc_pg[mc->mc_top]; if (mc->mc_db->md_flags & MDB_DUPSORT) { leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (op == MDB_PREV || op == MDB_PREV_DUP) { rc = mdb_cursor_prev(&mc->mc_xcursor->mx_cursor, data, NULL, MDB_PREV); if (op != MDB_PREV || rc != MDB_NOTFOUND) { if (rc == MDB_SUCCESS) { MDB_GET_KEY(leaf, key); mc->mc_flags &= ~C_EOF; } return rc; } } } else { mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); if (op == MDB_PREV_DUP) return MDB_NOTFOUND; } } DPRINTF(("cursor_prev: top page is %"Z"u in cursor %p", mdb_dbg_pgno(mp), (void *) mc)); mc->mc_flags &= ~(C_EOF|C_DEL); if (mc->mc_ki[mc->mc_top] == 0) { DPUTS("=====> move to prev sibling page"); if ((rc = mdb_cursor_sibling(mc, 0)) != MDB_SUCCESS) { return rc; } mp = mc->mc_pg[mc->mc_top]; mc->mc_ki[mc->mc_top] = NUMKEYS(mp) - 1; DPRINTF(("prev page is %"Z"u, key index %u", mp->mp_pgno, mc->mc_ki[mc->mc_top])); } else mc->mc_ki[mc->mc_top]--; DPRINTF(("==> cursor points to page %"Z"u with %u keys, key index %u", mdb_dbg_pgno(mp), NUMKEYS(mp), mc->mc_ki[mc->mc_top])); if (IS_LEAF2(mp)) { key->mv_size = mc->mc_db->md_pad; key->mv_data = LEAF2KEY(mp, mc->mc_ki[mc->mc_top], key->mv_size); return MDB_SUCCESS; } mdb_cassert(mc, IS_LEAF(mp)); leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { mdb_xcursor_init1(mc, leaf); } if (data) { if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) return rc; if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { rc = mdb_cursor_last(&mc->mc_xcursor->mx_cursor, data, NULL); if (rc != MDB_SUCCESS) return rc; } } MDB_GET_KEY(leaf, key); return MDB_SUCCESS; } /** Set the cursor on a specific data item. */ static int mdb_cursor_set(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op, int *exactp) { int rc; MDB_page *mp; MDB_node *leaf = NULL; DKBUF; if (key->mv_size == 0) return MDB_BAD_VALSIZE; if (mc->mc_xcursor) mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); /* See if we're already on the right page */ if (mc->mc_flags & C_INITIALIZED) { MDB_val nodekey; mp = mc->mc_pg[mc->mc_top]; if (!NUMKEYS(mp)) { mc->mc_ki[mc->mc_top] = 0; return MDB_NOTFOUND; } if (mp->mp_flags & P_LEAF2) { nodekey.mv_size = mc->mc_db->md_pad; nodekey.mv_data = LEAF2KEY(mp, 0, nodekey.mv_size); } else { leaf = NODEPTR(mp, 0); MDB_GET_KEY2(leaf, nodekey); } rc = mc->mc_dbx->md_cmp(key, &nodekey); if (rc == 0) { /* Probably happens rarely, but first node on the page * was the one we wanted. */ mc->mc_ki[mc->mc_top] = 0; if (exactp) *exactp = 1; goto set1; } if (rc > 0) { unsigned int i; unsigned int nkeys = NUMKEYS(mp); if (nkeys > 1) { if (mp->mp_flags & P_LEAF2) { nodekey.mv_data = LEAF2KEY(mp, nkeys-1, nodekey.mv_size); } else { leaf = NODEPTR(mp, nkeys-1); MDB_GET_KEY2(leaf, nodekey); } rc = mc->mc_dbx->md_cmp(key, &nodekey); if (rc == 0) { /* last node was the one we wanted */ mc->mc_ki[mc->mc_top] = nkeys-1; if (exactp) *exactp = 1; goto set1; } if (rc < 0) { if (mc->mc_ki[mc->mc_top] < NUMKEYS(mp)) { /* This is definitely the right page, skip search_page */ if (mp->mp_flags & P_LEAF2) { nodekey.mv_data = LEAF2KEY(mp, mc->mc_ki[mc->mc_top], nodekey.mv_size); } else { leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); MDB_GET_KEY2(leaf, nodekey); } rc = mc->mc_dbx->md_cmp(key, &nodekey); if (rc == 0) { /* current node was the one we wanted */ if (exactp) *exactp = 1; goto set1; } } rc = 0; mc->mc_flags &= ~C_EOF; goto set2; } } /* If any parents have right-sibs, search. * Otherwise, there's nothing further. */ for (i=0; imc_top; i++) if (mc->mc_ki[i] < NUMKEYS(mc->mc_pg[i])-1) break; if (i == mc->mc_top) { /* There are no other pages */ mc->mc_ki[mc->mc_top] = nkeys; return MDB_NOTFOUND; } } if (!mc->mc_top) { /* There are no other pages */ mc->mc_ki[mc->mc_top] = 0; if (op == MDB_SET_RANGE && !exactp) { rc = 0; goto set1; } else return MDB_NOTFOUND; } } else { mc->mc_pg[0] = 0; } rc = mdb_page_search(mc, key, 0); if (rc != MDB_SUCCESS) return rc; mp = mc->mc_pg[mc->mc_top]; mdb_cassert(mc, IS_LEAF(mp)); set2: leaf = mdb_node_search(mc, key, exactp); if (exactp != NULL && !*exactp) { /* MDB_SET specified and not an exact match. */ return MDB_NOTFOUND; } if (leaf == NULL) { DPUTS("===> inexact leaf not found, goto sibling"); if ((rc = mdb_cursor_sibling(mc, 1)) != MDB_SUCCESS) { mc->mc_flags |= C_EOF; return rc; /* no entries matched */ } mp = mc->mc_pg[mc->mc_top]; mdb_cassert(mc, IS_LEAF(mp)); leaf = NODEPTR(mp, 0); } set1: mc->mc_flags |= C_INITIALIZED; mc->mc_flags &= ~C_EOF; if (IS_LEAF2(mp)) { if (op == MDB_SET_RANGE || op == MDB_SET_KEY) { key->mv_size = mc->mc_db->md_pad; key->mv_data = LEAF2KEY(mp, mc->mc_ki[mc->mc_top], key->mv_size); } return MDB_SUCCESS; } if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { mdb_xcursor_init1(mc, leaf); } if (data) { if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (op == MDB_SET || op == MDB_SET_KEY || op == MDB_SET_RANGE) { rc = mdb_cursor_first(&mc->mc_xcursor->mx_cursor, data, NULL); } else { int ex2, *ex2p; if (op == MDB_GET_BOTH) { ex2p = &ex2; ex2 = 0; } else { ex2p = NULL; } rc = mdb_cursor_set(&mc->mc_xcursor->mx_cursor, data, NULL, MDB_SET_RANGE, ex2p); if (rc != MDB_SUCCESS) return rc; } } else if (op == MDB_GET_BOTH || op == MDB_GET_BOTH_RANGE) { MDB_val olddata; MDB_cmp_func *dcmp; if ((rc = mdb_node_read(mc, leaf, &olddata)) != MDB_SUCCESS) return rc; dcmp = mc->mc_dbx->md_dcmp; #if UINT_MAX < SIZE_MAX if (dcmp == mdb_cmp_int && olddata.mv_size == sizeof(size_t)) dcmp = mdb_cmp_clong; #endif rc = dcmp(data, &olddata); if (rc) { if (op == MDB_GET_BOTH || rc > 0) return MDB_NOTFOUND; rc = 0; } *data = olddata; } else { if (mc->mc_xcursor) mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) return rc; } } /* The key already matches in all other cases */ if (op == MDB_SET_RANGE || op == MDB_SET_KEY) MDB_GET_KEY(leaf, key); DPRINTF(("==> cursor placed on key [%s]", DKEY(key))); return rc; } /** Move the cursor to the first item in the database. */ static int mdb_cursor_first(MDB_cursor *mc, MDB_val *key, MDB_val *data) { int rc; MDB_node *leaf; if (mc->mc_xcursor) mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); if (!(mc->mc_flags & C_INITIALIZED) || mc->mc_top) { rc = mdb_page_search(mc, NULL, MDB_PS_FIRST); if (rc != MDB_SUCCESS) return rc; } mdb_cassert(mc, IS_LEAF(mc->mc_pg[mc->mc_top])); leaf = NODEPTR(mc->mc_pg[mc->mc_top], 0); mc->mc_flags |= C_INITIALIZED; mc->mc_flags &= ~C_EOF; mc->mc_ki[mc->mc_top] = 0; if (IS_LEAF2(mc->mc_pg[mc->mc_top])) { key->mv_size = mc->mc_db->md_pad; key->mv_data = LEAF2KEY(mc->mc_pg[mc->mc_top], 0, key->mv_size); return MDB_SUCCESS; } if (data) { if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { mdb_xcursor_init1(mc, leaf); rc = mdb_cursor_first(&mc->mc_xcursor->mx_cursor, data, NULL); if (rc) return rc; } else { if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) return rc; } } MDB_GET_KEY(leaf, key); return MDB_SUCCESS; } /** Move the cursor to the last item in the database. */ static int mdb_cursor_last(MDB_cursor *mc, MDB_val *key, MDB_val *data) { int rc; MDB_node *leaf; if (mc->mc_xcursor) mc->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); if (!(mc->mc_flags & C_INITIALIZED) || mc->mc_top) { rc = mdb_page_search(mc, NULL, MDB_PS_LAST); if (rc != MDB_SUCCESS) return rc; } mdb_cassert(mc, IS_LEAF(mc->mc_pg[mc->mc_top])); mc->mc_ki[mc->mc_top] = NUMKEYS(mc->mc_pg[mc->mc_top]) - 1; mc->mc_flags |= C_INITIALIZED|C_EOF; leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); if (IS_LEAF2(mc->mc_pg[mc->mc_top])) { key->mv_size = mc->mc_db->md_pad; key->mv_data = LEAF2KEY(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top], key->mv_size); return MDB_SUCCESS; } if (data) { if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { mdb_xcursor_init1(mc, leaf); rc = mdb_cursor_last(&mc->mc_xcursor->mx_cursor, data, NULL); if (rc) return rc; } else { if ((rc = mdb_node_read(mc, leaf, data)) != MDB_SUCCESS) return rc; } } MDB_GET_KEY(leaf, key); return MDB_SUCCESS; } int mdb_cursor_get(MDB_cursor *mc, MDB_val *key, MDB_val *data, MDB_cursor_op op) { int rc; int exact = 0; int (*mfunc)(MDB_cursor *mc, MDB_val *key, MDB_val *data); if (mc == NULL) return EINVAL; if (mc->mc_txn->mt_flags & MDB_TXN_BLOCKED) return MDB_BAD_TXN; switch (op) { case MDB_GET_CURRENT: if (!(mc->mc_flags & C_INITIALIZED)) { rc = EINVAL; } else { MDB_page *mp = mc->mc_pg[mc->mc_top]; int nkeys = NUMKEYS(mp); if (!nkeys || mc->mc_ki[mc->mc_top] >= nkeys) { mc->mc_ki[mc->mc_top] = nkeys; rc = MDB_NOTFOUND; break; } rc = MDB_SUCCESS; if (IS_LEAF2(mp)) { key->mv_size = mc->mc_db->md_pad; key->mv_data = LEAF2KEY(mp, mc->mc_ki[mc->mc_top], key->mv_size); } else { MDB_node *leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); MDB_GET_KEY(leaf, key); if (data) { if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { rc = mdb_cursor_get(&mc->mc_xcursor->mx_cursor, data, NULL, MDB_GET_CURRENT); } else { rc = mdb_node_read(mc, leaf, data); } } } } break; case MDB_GET_BOTH: case MDB_GET_BOTH_RANGE: if (data == NULL) { rc = EINVAL; break; } if (mc->mc_xcursor == NULL) { rc = MDB_INCOMPATIBLE; break; } /* FALLTHRU */ case MDB_SET: case MDB_SET_KEY: case MDB_SET_RANGE: if (key == NULL) { rc = EINVAL; } else { rc = mdb_cursor_set(mc, key, data, op, op == MDB_SET_RANGE ? NULL : &exact); } break; case MDB_GET_MULTIPLE: if (data == NULL || !(mc->mc_flags & C_INITIALIZED)) { rc = EINVAL; break; } if (!(mc->mc_db->md_flags & MDB_DUPFIXED)) { rc = MDB_INCOMPATIBLE; break; } rc = MDB_SUCCESS; if (!(mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) || (mc->mc_xcursor->mx_cursor.mc_flags & C_EOF)) break; goto fetchm; case MDB_NEXT_MULTIPLE: if (data == NULL) { rc = EINVAL; break; } if (!(mc->mc_db->md_flags & MDB_DUPFIXED)) { rc = MDB_INCOMPATIBLE; break; } rc = mdb_cursor_next(mc, key, data, MDB_NEXT_DUP); if (rc == MDB_SUCCESS) { if (mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) { MDB_cursor *mx; fetchm: mx = &mc->mc_xcursor->mx_cursor; data->mv_size = NUMKEYS(mx->mc_pg[mx->mc_top]) * mx->mc_db->md_pad; data->mv_data = METADATA(mx->mc_pg[mx->mc_top]); mx->mc_ki[mx->mc_top] = NUMKEYS(mx->mc_pg[mx->mc_top])-1; } else { rc = MDB_NOTFOUND; } } break; case MDB_PREV_MULTIPLE: if (data == NULL) { rc = EINVAL; break; } if (!(mc->mc_db->md_flags & MDB_DUPFIXED)) { rc = MDB_INCOMPATIBLE; break; } if (!(mc->mc_flags & C_INITIALIZED)) rc = mdb_cursor_last(mc, key, data); else rc = MDB_SUCCESS; if (rc == MDB_SUCCESS) { MDB_cursor *mx = &mc->mc_xcursor->mx_cursor; if (mx->mc_flags & C_INITIALIZED) { rc = mdb_cursor_sibling(mx, 0); if (rc == MDB_SUCCESS) goto fetchm; } else { rc = MDB_NOTFOUND; } } break; case MDB_NEXT: case MDB_NEXT_DUP: case MDB_NEXT_NODUP: rc = mdb_cursor_next(mc, key, data, op); break; case MDB_PREV: case MDB_PREV_DUP: case MDB_PREV_NODUP: rc = mdb_cursor_prev(mc, key, data, op); break; case MDB_FIRST: rc = mdb_cursor_first(mc, key, data); break; case MDB_FIRST_DUP: mfunc = mdb_cursor_first; mmove: if (data == NULL || !(mc->mc_flags & C_INITIALIZED)) { rc = EINVAL; break; } if (mc->mc_xcursor == NULL) { rc = MDB_INCOMPATIBLE; break; } if (mc->mc_ki[mc->mc_top] >= NUMKEYS(mc->mc_pg[mc->mc_top])) { mc->mc_ki[mc->mc_top] = NUMKEYS(mc->mc_pg[mc->mc_top]); rc = MDB_NOTFOUND; break; } { MDB_node *leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) { MDB_GET_KEY(leaf, key); rc = mdb_node_read(mc, leaf, data); break; } } if (!(mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED)) { rc = EINVAL; break; } rc = mfunc(&mc->mc_xcursor->mx_cursor, data, NULL); break; case MDB_LAST: rc = mdb_cursor_last(mc, key, data); break; case MDB_LAST_DUP: mfunc = mdb_cursor_last; goto mmove; default: DPRINTF(("unhandled/unimplemented cursor operation %u", op)); rc = EINVAL; break; } if (mc->mc_flags & C_DEL) mc->mc_flags ^= C_DEL; return rc; } /** Touch all the pages in the cursor stack. Set mc_top. * Makes sure all the pages are writable, before attempting a write operation. * @param[in] mc The cursor to operate on. */ static int mdb_cursor_touch(MDB_cursor *mc) { int rc = MDB_SUCCESS; if (mc->mc_dbi >= CORE_DBS && !(*mc->mc_dbflag & (DB_DIRTY|DB_DUPDATA))) { /* Touch DB record of named DB */ MDB_cursor mc2; MDB_xcursor mcx; if (TXN_DBI_CHANGED(mc->mc_txn, mc->mc_dbi)) return MDB_BAD_DBI; mdb_cursor_init(&mc2, mc->mc_txn, MAIN_DBI, &mcx); rc = mdb_page_search(&mc2, &mc->mc_dbx->md_name, MDB_PS_MODIFY); if (rc) return rc; *mc->mc_dbflag |= DB_DIRTY; } mc->mc_top = 0; if (mc->mc_snum) { do { rc = mdb_page_touch(mc); } while (!rc && ++(mc->mc_top) < mc->mc_snum); mc->mc_top = mc->mc_snum-1; } return rc; } /** Do not spill pages to disk if txn is getting full, may fail instead */ #define MDB_NOSPILL 0x8000 int mdb_cursor_put(MDB_cursor *mc, MDB_val *key, MDB_val *data, unsigned int flags) { MDB_env *env; MDB_node *leaf = NULL; MDB_page *fp, *mp, *sub_root = NULL; uint16_t fp_flags; MDB_val xdata, *rdata, dkey, olddata; MDB_db dummy; int do_sub = 0, insert_key, insert_data; unsigned int mcount = 0, dcount = 0, nospill; size_t nsize; int rc, rc2; unsigned int nflags; DKBUF; if (mc == NULL || key == NULL) return EINVAL; env = mc->mc_txn->mt_env; /* Check this first so counter will always be zero on any * early failures. */ if (flags & MDB_MULTIPLE) { dcount = data[1].mv_size; data[1].mv_size = 0; if (!F_ISSET(mc->mc_db->md_flags, MDB_DUPFIXED)) return MDB_INCOMPATIBLE; } nospill = flags & MDB_NOSPILL; flags &= ~MDB_NOSPILL; if (mc->mc_txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_BLOCKED)) return (mc->mc_txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN; if (key->mv_size-1 >= ENV_MAXKEY(env)) return MDB_BAD_VALSIZE; #if SIZE_MAX > MAXDATASIZE if (data->mv_size > ((mc->mc_db->md_flags & MDB_DUPSORT) ? ENV_MAXKEY(env) : MAXDATASIZE)) return MDB_BAD_VALSIZE; #else if ((mc->mc_db->md_flags & MDB_DUPSORT) && data->mv_size > ENV_MAXKEY(env)) return MDB_BAD_VALSIZE; #endif DPRINTF(("==> put db %d key [%s], size %"Z"u, data size %"Z"u", DDBI(mc), DKEY(key), key ? key->mv_size : 0, data->mv_size)); dkey.mv_size = 0; if (flags == MDB_CURRENT) { if (!(mc->mc_flags & C_INITIALIZED)) return EINVAL; rc = MDB_SUCCESS; } else if (mc->mc_db->md_root == P_INVALID) { /* new database, cursor has nothing to point to */ mc->mc_snum = 0; mc->mc_top = 0; mc->mc_flags &= ~C_INITIALIZED; rc = MDB_NO_ROOT; } else { int exact = 0; MDB_val d2; if (flags & MDB_APPEND) { MDB_val k2; rc = mdb_cursor_last(mc, &k2, &d2); if (rc == 0) { rc = mc->mc_dbx->md_cmp(key, &k2); if (rc > 0) { rc = MDB_NOTFOUND; mc->mc_ki[mc->mc_top]++; } else { /* new key is <= last key */ rc = MDB_KEYEXIST; } } } else { rc = mdb_cursor_set(mc, key, &d2, MDB_SET, &exact); } if ((flags & MDB_NOOVERWRITE) && rc == 0) { DPRINTF(("duplicate key [%s]", DKEY(key))); *data = d2; return MDB_KEYEXIST; } if (rc && rc != MDB_NOTFOUND) return rc; } if (mc->mc_flags & C_DEL) mc->mc_flags ^= C_DEL; /* Cursor is positioned, check for room in the dirty list */ if (!nospill) { if (flags & MDB_MULTIPLE) { rdata = &xdata; xdata.mv_size = data->mv_size * dcount; } else { rdata = data; } if ((rc2 = mdb_page_spill(mc, key, rdata))) return rc2; } if (rc == MDB_NO_ROOT) { MDB_page *np; /* new database, write a root leaf page */ DPUTS("allocating new root leaf page"); if ((rc2 = mdb_page_new(mc, P_LEAF, 1, &np))) { return rc2; } mdb_cursor_push(mc, np); mc->mc_db->md_root = np->mp_pgno; mc->mc_db->md_depth++; *mc->mc_dbflag |= DB_DIRTY; if ((mc->mc_db->md_flags & (MDB_DUPSORT|MDB_DUPFIXED)) == MDB_DUPFIXED) np->mp_flags |= P_LEAF2; mc->mc_flags |= C_INITIALIZED; } else { /* make sure all cursor pages are writable */ rc2 = mdb_cursor_touch(mc); if (rc2) return rc2; } insert_key = insert_data = rc; if (insert_key) { /* The key does not exist */ DPRINTF(("inserting key at index %i", mc->mc_ki[mc->mc_top])); if ((mc->mc_db->md_flags & MDB_DUPSORT) && LEAFSIZE(key, data) > env->me_nodemax) { /* Too big for a node, insert in sub-DB. Set up an empty * "old sub-page" for prep_subDB to expand to a full page. */ fp_flags = P_LEAF|P_DIRTY; fp = env->me_pbuf; fp->mp_pad = data->mv_size; /* used if MDB_DUPFIXED */ fp->mp_lower = fp->mp_upper = (PAGEHDRSZ-PAGEBASE); olddata.mv_size = PAGEHDRSZ; goto prep_subDB; } } else { /* there's only a key anyway, so this is a no-op */ if (IS_LEAF2(mc->mc_pg[mc->mc_top])) { char *ptr; unsigned int ksize = mc->mc_db->md_pad; if (key->mv_size != ksize) return MDB_BAD_VALSIZE; ptr = LEAF2KEY(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top], ksize); memcpy(ptr, key->mv_data, ksize); fix_parent: /* if overwriting slot 0 of leaf, need to * update branch key if there is a parent page */ if (mc->mc_top && !mc->mc_ki[mc->mc_top]) { unsigned short dtop = 1; mc->mc_top--; /* slot 0 is always an empty key, find real slot */ while (mc->mc_top && !mc->mc_ki[mc->mc_top]) { mc->mc_top--; dtop++; } if (mc->mc_ki[mc->mc_top]) rc2 = mdb_update_key(mc, key); else rc2 = MDB_SUCCESS; mc->mc_top += dtop; if (rc2) return rc2; } return MDB_SUCCESS; } more: leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); olddata.mv_size = NODEDSZ(leaf); olddata.mv_data = NODEDATA(leaf); /* DB has dups? */ if (F_ISSET(mc->mc_db->md_flags, MDB_DUPSORT)) { /* Prepare (sub-)page/sub-DB to accept the new item, * if needed. fp: old sub-page or a header faking * it. mp: new (sub-)page. offset: growth in page * size. xdata: node data with new page or DB. */ unsigned i, offset = 0; mp = fp = xdata.mv_data = env->me_pbuf; mp->mp_pgno = mc->mc_pg[mc->mc_top]->mp_pgno; /* Was a single item before, must convert now */ if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) { MDB_cmp_func *dcmp; /* Just overwrite the current item */ if (flags == MDB_CURRENT) goto current; dcmp = mc->mc_dbx->md_dcmp; #if UINT_MAX < SIZE_MAX if (dcmp == mdb_cmp_int && olddata.mv_size == sizeof(size_t)) dcmp = mdb_cmp_clong; #endif /* does data match? */ if (!dcmp(data, &olddata)) { if (flags & (MDB_NODUPDATA|MDB_APPENDDUP)) return MDB_KEYEXIST; /* overwrite it */ goto current; } /* Back up original data item */ dkey.mv_size = olddata.mv_size; dkey.mv_data = memcpy(fp+1, olddata.mv_data, olddata.mv_size); /* Make sub-page header for the dup items, with dummy body */ fp->mp_flags = P_LEAF|P_DIRTY|P_SUBP; fp->mp_lower = (PAGEHDRSZ-PAGEBASE); xdata.mv_size = PAGEHDRSZ + dkey.mv_size + data->mv_size; if (mc->mc_db->md_flags & MDB_DUPFIXED) { fp->mp_flags |= P_LEAF2; fp->mp_pad = data->mv_size; xdata.mv_size += 2 * data->mv_size; /* leave space for 2 more */ } else { xdata.mv_size += 2 * (sizeof(indx_t) + NODESIZE) + (dkey.mv_size & 1) + (data->mv_size & 1); } fp->mp_upper = xdata.mv_size - PAGEBASE; olddata.mv_size = xdata.mv_size; /* pretend olddata is fp */ } else if (leaf->mn_flags & F_SUBDATA) { /* Data is on sub-DB, just store it */ flags |= F_DUPDATA|F_SUBDATA; goto put_sub; } else { /* Data is on sub-page */ fp = olddata.mv_data; switch (flags) { default: if (!(mc->mc_db->md_flags & MDB_DUPFIXED)) { offset = EVEN(NODESIZE + sizeof(indx_t) + data->mv_size); break; } offset = fp->mp_pad; if (SIZELEFT(fp) < offset) { offset *= 4; /* space for 4 more */ break; } /* FALLTHRU: Big enough MDB_DUPFIXED sub-page */ case MDB_CURRENT: fp->mp_flags |= P_DIRTY; COPY_PGNO(fp->mp_pgno, mp->mp_pgno); mc->mc_xcursor->mx_cursor.mc_pg[0] = fp; flags |= F_DUPDATA; goto put_sub; } xdata.mv_size = olddata.mv_size + offset; } fp_flags = fp->mp_flags; if (NODESIZE + NODEKSZ(leaf) + xdata.mv_size > env->me_nodemax) { /* Too big for a sub-page, convert to sub-DB */ fp_flags &= ~P_SUBP; prep_subDB: if (mc->mc_db->md_flags & MDB_DUPFIXED) { fp_flags |= P_LEAF2; dummy.md_pad = fp->mp_pad; dummy.md_flags = MDB_DUPFIXED; if (mc->mc_db->md_flags & MDB_INTEGERDUP) dummy.md_flags |= MDB_INTEGERKEY; } else { dummy.md_pad = 0; dummy.md_flags = 0; } dummy.md_depth = 1; dummy.md_branch_pages = 0; dummy.md_leaf_pages = 1; dummy.md_overflow_pages = 0; dummy.md_entries = NUMKEYS(fp); xdata.mv_size = sizeof(MDB_db); xdata.mv_data = &dummy; if ((rc = mdb_page_alloc(mc, 1, &mp))) return rc; offset = env->me_psize - olddata.mv_size; flags |= F_DUPDATA|F_SUBDATA; dummy.md_root = mp->mp_pgno; sub_root = mp; } if (mp != fp) { mp->mp_flags = fp_flags | P_DIRTY; mp->mp_pad = fp->mp_pad; mp->mp_lower = fp->mp_lower; mp->mp_upper = fp->mp_upper + offset; if (fp_flags & P_LEAF2) { memcpy(METADATA(mp), METADATA(fp), NUMKEYS(fp) * fp->mp_pad); } else { memcpy((char *)mp + mp->mp_upper + PAGEBASE, (char *)fp + fp->mp_upper + PAGEBASE, olddata.mv_size - fp->mp_upper - PAGEBASE); memcpy((char *)(&mp->mp_ptrs), (char *)(&fp->mp_ptrs), NUMKEYS(fp) * sizeof(mp->mp_ptrs[0])); for (i=0; imp_ptrs[i] += offset; } } rdata = &xdata; flags |= F_DUPDATA; do_sub = 1; if (!insert_key) mdb_node_del(mc, 0); goto new_sub; } current: /* LMDB passes F_SUBDATA in 'flags' to write a DB record */ if ((leaf->mn_flags ^ flags) & F_SUBDATA) return MDB_INCOMPATIBLE; /* overflow page overwrites need special handling */ if (F_ISSET(leaf->mn_flags, F_BIGDATA)) { MDB_page *omp; pgno_t pg; int level, ovpages, dpages = OVPAGES(data->mv_size, env->me_psize); memcpy(&pg, olddata.mv_data, sizeof(pg)); if ((rc2 = mdb_page_get(mc, pg, &omp, &level)) != 0) return rc2; ovpages = omp->mp_pages; /* Is the ov page large enough? */ if (ovpages >= dpages) { if (!(omp->mp_flags & P_DIRTY) && (level || (env->me_flags & MDB_WRITEMAP))) { rc = mdb_page_unspill(mc->mc_txn, omp, &omp); if (rc) return rc; level = 0; /* dirty in this txn or clean */ } /* Is it dirty? */ if (omp->mp_flags & P_DIRTY) { /* yes, overwrite it. Note in this case we don't * bother to try shrinking the page if the new data * is smaller than the overflow threshold. */ if (level > 1) { /* It is writable only in a parent txn */ size_t sz = (size_t) env->me_psize * ovpages, off; MDB_page *np = mdb_page_malloc(mc->mc_txn, ovpages); MDB_ID2 id2; if (!np) return ENOMEM; id2.mid = pg; id2.mptr = np; /* Note - this page is already counted in parent's dirty_room */ rc2 = mdb_mid2l_insert(mc->mc_txn->mt_u.dirty_list, &id2); mdb_cassert(mc, rc2 == 0); /* Currently we make the page look as with put() in the * parent txn, in case the user peeks at MDB_RESERVEd * or unused parts. Some users treat ovpages specially. */ if (!(flags & MDB_RESERVE)) { /* Skip the part where LMDB will put *data. * Copy end of page, adjusting alignment so * compiler may copy words instead of bytes. */ off = (PAGEHDRSZ + data->mv_size) & -sizeof(size_t); memcpy((size_t *)((char *)np + off), (size_t *)((char *)omp + off), sz - off); sz = PAGEHDRSZ; } memcpy(np, omp, sz); /* Copy beginning of page */ omp = np; } SETDSZ(leaf, data->mv_size); if (F_ISSET(flags, MDB_RESERVE)) data->mv_data = METADATA(omp); else memcpy(METADATA(omp), data->mv_data, data->mv_size); return MDB_SUCCESS; } } if ((rc2 = mdb_ovpage_free(mc, omp)) != MDB_SUCCESS) return rc2; } else if (data->mv_size == olddata.mv_size) { /* same size, just replace it. Note that we could * also reuse this node if the new data is smaller, * but instead we opt to shrink the node in that case. */ if (F_ISSET(flags, MDB_RESERVE)) data->mv_data = olddata.mv_data; else if (!(mc->mc_flags & C_SUB)) memcpy(olddata.mv_data, data->mv_data, data->mv_size); else { memcpy(NODEKEY(leaf), key->mv_data, key->mv_size); goto fix_parent; } return MDB_SUCCESS; } mdb_node_del(mc, 0); } rdata = data; new_sub: nflags = flags & NODE_ADD_FLAGS; nsize = IS_LEAF2(mc->mc_pg[mc->mc_top]) ? key->mv_size : mdb_leaf_size(env, key, rdata); if (SIZELEFT(mc->mc_pg[mc->mc_top]) < nsize) { if (( flags & (F_DUPDATA|F_SUBDATA)) == F_DUPDATA ) nflags &= ~MDB_APPEND; /* sub-page may need room to grow */ if (!insert_key) nflags |= MDB_SPLIT_REPLACE; rc = mdb_page_split(mc, key, rdata, P_INVALID, nflags); } else { /* There is room already in this leaf page. */ rc = mdb_node_add(mc, mc->mc_ki[mc->mc_top], key, rdata, 0, nflags); if (rc == 0) { /* Adjust other cursors pointing to mp */ MDB_cursor *m2, *m3; MDB_dbi dbi = mc->mc_dbi; unsigned i = mc->mc_top; MDB_page *mp = mc->mc_pg[i]; for (m2 = mc->mc_txn->mt_cursors[dbi]; m2; m2=m2->mc_next) { if (mc->mc_flags & C_SUB) m3 = &m2->mc_xcursor->mx_cursor; else m3 = m2; if (m3 == mc || m3->mc_snum < mc->mc_snum || m3->mc_pg[i] != mp) continue; if (m3->mc_ki[i] >= mc->mc_ki[i] && insert_key) { m3->mc_ki[i]++; } XCURSOR_REFRESH(m3, i, mp); } } } if (rc == MDB_SUCCESS) { /* Now store the actual data in the child DB. Note that we're * storing the user data in the keys field, so there are strict * size limits on dupdata. The actual data fields of the child * DB are all zero size. */ if (do_sub) { int xflags, new_dupdata; size_t ecount; put_sub: xdata.mv_size = 0; xdata.mv_data = ""; leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); if (flags & MDB_CURRENT) { xflags = MDB_CURRENT|MDB_NOSPILL; } else { mdb_xcursor_init1(mc, leaf); xflags = (flags & MDB_NODUPDATA) ? MDB_NOOVERWRITE|MDB_NOSPILL : MDB_NOSPILL; } if (sub_root) mc->mc_xcursor->mx_cursor.mc_pg[0] = sub_root; new_dupdata = (int)dkey.mv_size; /* converted, write the original data first */ if (dkey.mv_size) { rc = mdb_cursor_put(&mc->mc_xcursor->mx_cursor, &dkey, &xdata, xflags); if (rc) goto bad_sub; /* we've done our job */ dkey.mv_size = 0; } if (!(leaf->mn_flags & F_SUBDATA) || sub_root) { /* Adjust other cursors pointing to mp */ MDB_cursor *m2; MDB_xcursor *mx = mc->mc_xcursor; unsigned i = mc->mc_top; MDB_page *mp = mc->mc_pg[i]; for (m2 = mc->mc_txn->mt_cursors[mc->mc_dbi]; m2; m2=m2->mc_next) { if (m2 == mc || m2->mc_snum < mc->mc_snum) continue; if (!(m2->mc_flags & C_INITIALIZED)) continue; if (m2->mc_pg[i] == mp) { if (m2->mc_ki[i] == mc->mc_ki[i]) { mdb_xcursor_init2(m2, mx, new_dupdata); } else if (!insert_key) { XCURSOR_REFRESH(m2, i, mp); } } } } ecount = mc->mc_xcursor->mx_db.md_entries; if (flags & MDB_APPENDDUP) xflags |= MDB_APPEND; rc = mdb_cursor_put(&mc->mc_xcursor->mx_cursor, data, &xdata, xflags); if (flags & F_SUBDATA) { void *db = NODEDATA(leaf); memcpy(db, &mc->mc_xcursor->mx_db, sizeof(MDB_db)); } insert_data = mc->mc_xcursor->mx_db.md_entries - ecount; } /* Increment count unless we just replaced an existing item. */ if (insert_data) mc->mc_db->md_entries++; if (insert_key) { /* Invalidate txn if we created an empty sub-DB */ if (rc) goto bad_sub; /* If we succeeded and the key didn't exist before, * make sure the cursor is marked valid. */ mc->mc_flags |= C_INITIALIZED; } if (flags & MDB_MULTIPLE) { if (!rc) { mcount++; /* let caller know how many succeeded, if any */ data[1].mv_size = mcount; if (mcount < dcount) { data[0].mv_data = (char *)data[0].mv_data + data[0].mv_size; insert_key = insert_data = 0; goto more; } } } return rc; bad_sub: if (rc == MDB_KEYEXIST) /* should not happen, we deleted that item */ rc = MDB_CORRUPTED; } mc->mc_txn->mt_flags |= MDB_TXN_ERROR; return rc; } int mdb_cursor_del(MDB_cursor *mc, unsigned int flags) { MDB_node *leaf; MDB_page *mp; int rc; if (mc->mc_txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_BLOCKED)) return (mc->mc_txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN; if (!(mc->mc_flags & C_INITIALIZED)) return EINVAL; if (mc->mc_ki[mc->mc_top] >= NUMKEYS(mc->mc_pg[mc->mc_top])) return MDB_NOTFOUND; if (!(flags & MDB_NOSPILL) && (rc = mdb_page_spill(mc, NULL, NULL))) return rc; rc = mdb_cursor_touch(mc); if (rc) return rc; mp = mc->mc_pg[mc->mc_top]; if (IS_LEAF2(mp)) goto del_key; leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); if (F_ISSET(leaf->mn_flags, F_DUPDATA)) { if (flags & MDB_NODUPDATA) { /* mdb_cursor_del0() will subtract the final entry */ mc->mc_db->md_entries -= mc->mc_xcursor->mx_db.md_entries - 1; mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; } else { if (!F_ISSET(leaf->mn_flags, F_SUBDATA)) { mc->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(leaf); } rc = mdb_cursor_del(&mc->mc_xcursor->mx_cursor, MDB_NOSPILL); if (rc) return rc; /* If sub-DB still has entries, we're done */ if (mc->mc_xcursor->mx_db.md_entries) { if (leaf->mn_flags & F_SUBDATA) { /* update subDB info */ void *db = NODEDATA(leaf); memcpy(db, &mc->mc_xcursor->mx_db, sizeof(MDB_db)); } else { MDB_cursor *m2; /* shrink fake page */ mdb_node_shrink(mp, mc->mc_ki[mc->mc_top]); leaf = NODEPTR(mp, mc->mc_ki[mc->mc_top]); mc->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(leaf); /* fix other sub-DB cursors pointed at fake pages on this page */ for (m2 = mc->mc_txn->mt_cursors[mc->mc_dbi]; m2; m2=m2->mc_next) { if (m2 == mc || m2->mc_snum < mc->mc_snum) continue; if (!(m2->mc_flags & C_INITIALIZED)) continue; if (m2->mc_pg[mc->mc_top] == mp) { XCURSOR_REFRESH(m2, mc->mc_top, mp); } } } mc->mc_db->md_entries--; return rc; } else { mc->mc_xcursor->mx_cursor.mc_flags &= ~C_INITIALIZED; } /* otherwise fall thru and delete the sub-DB */ } if (leaf->mn_flags & F_SUBDATA) { /* add all the child DB's pages to the free list */ rc = mdb_drop0(&mc->mc_xcursor->mx_cursor, 0); if (rc) goto fail; } } /* LMDB passes F_SUBDATA in 'flags' to delete a DB record */ else if ((leaf->mn_flags ^ flags) & F_SUBDATA) { rc = MDB_INCOMPATIBLE; goto fail; } /* add overflow pages to free list */ if (F_ISSET(leaf->mn_flags, F_BIGDATA)) { MDB_page *omp; pgno_t pg; memcpy(&pg, NODEDATA(leaf), sizeof(pg)); if ((rc = mdb_page_get(mc, pg, &omp, NULL)) || (rc = mdb_ovpage_free(mc, omp))) goto fail; } del_key: return mdb_cursor_del0(mc); fail: mc->mc_txn->mt_flags |= MDB_TXN_ERROR; return rc; } /** Allocate and initialize new pages for a database. * Set #MDB_TXN_ERROR on failure. * @param[in] mc a cursor on the database being added to. * @param[in] flags flags defining what type of page is being allocated. * @param[in] num the number of pages to allocate. This is usually 1, * unless allocating overflow pages for a large record. * @param[out] mp Address of a page, or NULL on failure. * @return 0 on success, non-zero on failure. */ static int mdb_page_new(MDB_cursor *mc, uint32_t flags, int num, MDB_page **mp) { MDB_page *np; int rc; if ((rc = mdb_page_alloc(mc, num, &np))) return rc; DPRINTF(("allocated new mpage %"Z"u, page size %u", np->mp_pgno, mc->mc_txn->mt_env->me_psize)); np->mp_flags = flags | P_DIRTY; np->mp_lower = (PAGEHDRSZ-PAGEBASE); np->mp_upper = mc->mc_txn->mt_env->me_psize - PAGEBASE; if (IS_BRANCH(np)) mc->mc_db->md_branch_pages++; else if (IS_LEAF(np)) mc->mc_db->md_leaf_pages++; else if (IS_OVERFLOW(np)) { mc->mc_db->md_overflow_pages += num; np->mp_pages = num; } *mp = np; return 0; } /** Calculate the size of a leaf node. * The size depends on the environment's page size; if a data item * is too large it will be put onto an overflow page and the node * size will only include the key and not the data. Sizes are always * rounded up to an even number of bytes, to guarantee 2-byte alignment * of the #MDB_node headers. * @param[in] env The environment handle. * @param[in] key The key for the node. * @param[in] data The data for the node. * @return The number of bytes needed to store the node. */ static size_t mdb_leaf_size(MDB_env *env, MDB_val *key, MDB_val *data) { size_t sz; sz = LEAFSIZE(key, data); if (sz > env->me_nodemax) { /* put on overflow page */ sz -= data->mv_size - sizeof(pgno_t); } return EVEN(sz + sizeof(indx_t)); } /** Calculate the size of a branch node. * The size should depend on the environment's page size but since * we currently don't support spilling large keys onto overflow * pages, it's simply the size of the #MDB_node header plus the * size of the key. Sizes are always rounded up to an even number * of bytes, to guarantee 2-byte alignment of the #MDB_node headers. * @param[in] env The environment handle. * @param[in] key The key for the node. * @return The number of bytes needed to store the node. */ static size_t mdb_branch_size(MDB_env *env, MDB_val *key) { size_t sz; sz = INDXSIZE(key); if (sz > env->me_nodemax) { /* put on overflow page */ /* not implemented */ /* sz -= key->size - sizeof(pgno_t); */ } return sz + sizeof(indx_t); } /** Add a node to the page pointed to by the cursor. * Set #MDB_TXN_ERROR on failure. * @param[in] mc The cursor for this operation. * @param[in] indx The index on the page where the new node should be added. * @param[in] key The key for the new node. * @param[in] data The data for the new node, if any. * @param[in] pgno The page number, if adding a branch node. * @param[in] flags Flags for the node. * @return 0 on success, non-zero on failure. Possible errors are: *
        *
      • ENOMEM - failed to allocate overflow pages for the node. *
      • MDB_PAGE_FULL - there is insufficient room in the page. This error * should never happen since all callers already calculate the * page's free space before calling this function. *
      */ static int mdb_node_add(MDB_cursor *mc, indx_t indx, MDB_val *key, MDB_val *data, pgno_t pgno, unsigned int flags) { unsigned int i; size_t node_size = NODESIZE; ssize_t room; indx_t ofs; MDB_node *node; MDB_page *mp = mc->mc_pg[mc->mc_top]; MDB_page *ofp = NULL; /* overflow page */ void *ndata; DKBUF; mdb_cassert(mc, mp->mp_upper >= mp->mp_lower); DPRINTF(("add to %s %spage %"Z"u index %i, data size %"Z"u key size %"Z"u [%s]", IS_LEAF(mp) ? "leaf" : "branch", IS_SUBP(mp) ? "sub-" : "", mdb_dbg_pgno(mp), indx, data ? data->mv_size : 0, key ? key->mv_size : 0, key ? DKEY(key) : "null")); if (IS_LEAF2(mp)) { /* Move higher keys up one slot. */ int ksize = mc->mc_db->md_pad, dif; char *ptr = LEAF2KEY(mp, indx, ksize); dif = NUMKEYS(mp) - indx; if (dif > 0) memmove(ptr+ksize, ptr, dif*ksize); /* insert new key */ memcpy(ptr, key->mv_data, ksize); /* Just using these for counting */ mp->mp_lower += sizeof(indx_t); mp->mp_upper -= ksize - sizeof(indx_t); return MDB_SUCCESS; } room = (ssize_t)SIZELEFT(mp) - (ssize_t)sizeof(indx_t); if (key != NULL) node_size += key->mv_size; if (IS_LEAF(mp)) { mdb_cassert(mc, key && data); if (F_ISSET(flags, F_BIGDATA)) { /* Data already on overflow page. */ node_size += sizeof(pgno_t); } else if (node_size + data->mv_size > mc->mc_txn->mt_env->me_nodemax) { int ovpages = OVPAGES(data->mv_size, mc->mc_txn->mt_env->me_psize); int rc; /* Put data on overflow page. */ DPRINTF(("data size is %"Z"u, node would be %"Z"u, put data on overflow page", data->mv_size, node_size+data->mv_size)); node_size = EVEN(node_size + sizeof(pgno_t)); if ((ssize_t)node_size > room) goto full; if ((rc = mdb_page_new(mc, P_OVERFLOW, ovpages, &ofp))) return rc; DPRINTF(("allocated overflow page %"Z"u", ofp->mp_pgno)); flags |= F_BIGDATA; goto update; } else { node_size += data->mv_size; } } node_size = EVEN(node_size); if ((ssize_t)node_size > room) goto full; update: /* Move higher pointers up one slot. */ for (i = NUMKEYS(mp); i > indx; i--) mp->mp_ptrs[i] = mp->mp_ptrs[i - 1]; /* Adjust free space offsets. */ ofs = mp->mp_upper - node_size; mdb_cassert(mc, ofs >= mp->mp_lower + sizeof(indx_t)); mp->mp_ptrs[indx] = ofs; mp->mp_upper = ofs; mp->mp_lower += sizeof(indx_t); /* Write the node data. */ node = NODEPTR(mp, indx); node->mn_ksize = (key == NULL) ? 0 : key->mv_size; node->mn_flags = flags; if (IS_LEAF(mp)) SETDSZ(node,data->mv_size); else SETPGNO(node,pgno); if (key) memcpy(NODEKEY(node), key->mv_data, key->mv_size); if (IS_LEAF(mp)) { ndata = NODEDATA(node); if (ofp == NULL) { if (F_ISSET(flags, F_BIGDATA)) memcpy(ndata, data->mv_data, sizeof(pgno_t)); else if (F_ISSET(flags, MDB_RESERVE)) data->mv_data = ndata; else memcpy(ndata, data->mv_data, data->mv_size); } else { memcpy(ndata, &ofp->mp_pgno, sizeof(pgno_t)); ndata = METADATA(ofp); if (F_ISSET(flags, MDB_RESERVE)) data->mv_data = ndata; else memcpy(ndata, data->mv_data, data->mv_size); } } return MDB_SUCCESS; full: DPRINTF(("not enough room in page %"Z"u, got %u ptrs", mdb_dbg_pgno(mp), NUMKEYS(mp))); DPRINTF(("upper-lower = %u - %u = %"Z"d", mp->mp_upper,mp->mp_lower,room)); DPRINTF(("node size = %"Z"u", node_size)); mc->mc_txn->mt_flags |= MDB_TXN_ERROR; return MDB_PAGE_FULL; } /** Delete the specified node from a page. * @param[in] mc Cursor pointing to the node to delete. * @param[in] ksize The size of a node. Only used if the page is * part of a #MDB_DUPFIXED database. */ static void mdb_node_del(MDB_cursor *mc, int ksize) { MDB_page *mp = mc->mc_pg[mc->mc_top]; indx_t indx = mc->mc_ki[mc->mc_top]; unsigned int sz; indx_t i, j, numkeys, ptr; MDB_node *node; char *base; DPRINTF(("delete node %u on %s page %"Z"u", indx, IS_LEAF(mp) ? "leaf" : "branch", mdb_dbg_pgno(mp))); numkeys = NUMKEYS(mp); mdb_cassert(mc, indx < numkeys); if (IS_LEAF2(mp)) { int x = numkeys - 1 - indx; base = LEAF2KEY(mp, indx, ksize); if (x) memmove(base, base + ksize, x * ksize); mp->mp_lower -= sizeof(indx_t); mp->mp_upper += ksize - sizeof(indx_t); return; } node = NODEPTR(mp, indx); sz = NODESIZE + node->mn_ksize; if (IS_LEAF(mp)) { if (F_ISSET(node->mn_flags, F_BIGDATA)) sz += sizeof(pgno_t); else sz += NODEDSZ(node); } sz = EVEN(sz); ptr = mp->mp_ptrs[indx]; for (i = j = 0; i < numkeys; i++) { if (i != indx) { mp->mp_ptrs[j] = mp->mp_ptrs[i]; if (mp->mp_ptrs[i] < ptr) mp->mp_ptrs[j] += sz; j++; } } base = (char *)mp + mp->mp_upper + PAGEBASE; memmove(base + sz, base, ptr - mp->mp_upper); mp->mp_lower -= sizeof(indx_t); mp->mp_upper += sz; } /** Compact the main page after deleting a node on a subpage. * @param[in] mp The main page to operate on. * @param[in] indx The index of the subpage on the main page. */ static void mdb_node_shrink(MDB_page *mp, indx_t indx) { MDB_node *node; MDB_page *sp, *xp; char *base; indx_t delta, nsize, len, ptr; int i; node = NODEPTR(mp, indx); sp = (MDB_page *)NODEDATA(node); delta = SIZELEFT(sp); nsize = NODEDSZ(node) - delta; /* Prepare to shift upward, set len = length(subpage part to shift) */ if (IS_LEAF2(sp)) { len = nsize; if (nsize & 1) return; /* do not make the node uneven-sized */ } else { xp = (MDB_page *)((char *)sp + delta); /* destination subpage */ for (i = NUMKEYS(sp); --i >= 0; ) xp->mp_ptrs[i] = sp->mp_ptrs[i] - delta; len = PAGEHDRSZ; } sp->mp_upper = sp->mp_lower; COPY_PGNO(sp->mp_pgno, mp->mp_pgno); SETDSZ(node, nsize); /* Shift upward */ base = (char *)mp + mp->mp_upper + PAGEBASE; memmove(base + delta, base, (char *)sp + len - base); ptr = mp->mp_ptrs[indx]; for (i = NUMKEYS(mp); --i >= 0; ) { if (mp->mp_ptrs[i] <= ptr) mp->mp_ptrs[i] += delta; } mp->mp_upper += delta; } /** Initial setup of a sorted-dups cursor. * Sorted duplicates are implemented as a sub-database for the given key. * The duplicate data items are actually keys of the sub-database. * Operations on the duplicate data items are performed using a sub-cursor * initialized when the sub-database is first accessed. This function does * the preliminary setup of the sub-cursor, filling in the fields that * depend only on the parent DB. * @param[in] mc The main cursor whose sorted-dups cursor is to be initialized. */ static void mdb_xcursor_init0(MDB_cursor *mc) { MDB_xcursor *mx = mc->mc_xcursor; mx->mx_cursor.mc_xcursor = NULL; mx->mx_cursor.mc_txn = mc->mc_txn; mx->mx_cursor.mc_db = &mx->mx_db; mx->mx_cursor.mc_dbx = &mx->mx_dbx; mx->mx_cursor.mc_dbi = mc->mc_dbi; mx->mx_cursor.mc_dbflag = &mx->mx_dbflag; mx->mx_cursor.mc_snum = 0; mx->mx_cursor.mc_top = 0; mx->mx_cursor.mc_flags = C_SUB; mx->mx_dbx.md_name.mv_size = 0; mx->mx_dbx.md_name.mv_data = NULL; mx->mx_dbx.md_cmp = mc->mc_dbx->md_dcmp; mx->mx_dbx.md_dcmp = NULL; mx->mx_dbx.md_rel = mc->mc_dbx->md_rel; } /** Final setup of a sorted-dups cursor. * Sets up the fields that depend on the data from the main cursor. * @param[in] mc The main cursor whose sorted-dups cursor is to be initialized. * @param[in] node The data containing the #MDB_db record for the * sorted-dup database. */ static void mdb_xcursor_init1(MDB_cursor *mc, MDB_node *node) { MDB_xcursor *mx = mc->mc_xcursor; if (node->mn_flags & F_SUBDATA) { memcpy(&mx->mx_db, NODEDATA(node), sizeof(MDB_db)); mx->mx_cursor.mc_pg[0] = 0; mx->mx_cursor.mc_snum = 0; mx->mx_cursor.mc_top = 0; mx->mx_cursor.mc_flags = C_SUB; } else { MDB_page *fp = NODEDATA(node); mx->mx_db.md_pad = 0; mx->mx_db.md_flags = 0; mx->mx_db.md_depth = 1; mx->mx_db.md_branch_pages = 0; mx->mx_db.md_leaf_pages = 1; mx->mx_db.md_overflow_pages = 0; mx->mx_db.md_entries = NUMKEYS(fp); COPY_PGNO(mx->mx_db.md_root, fp->mp_pgno); mx->mx_cursor.mc_snum = 1; mx->mx_cursor.mc_top = 0; mx->mx_cursor.mc_flags = C_INITIALIZED|C_SUB; mx->mx_cursor.mc_pg[0] = fp; mx->mx_cursor.mc_ki[0] = 0; if (mc->mc_db->md_flags & MDB_DUPFIXED) { mx->mx_db.md_flags = MDB_DUPFIXED; mx->mx_db.md_pad = fp->mp_pad; if (mc->mc_db->md_flags & MDB_INTEGERDUP) mx->mx_db.md_flags |= MDB_INTEGERKEY; } } DPRINTF(("Sub-db -%u root page %"Z"u", mx->mx_cursor.mc_dbi, mx->mx_db.md_root)); mx->mx_dbflag = DB_VALID|DB_USRVALID|DB_DUPDATA; #if UINT_MAX < SIZE_MAX if (mx->mx_dbx.md_cmp == mdb_cmp_int && mx->mx_db.md_pad == sizeof(size_t)) mx->mx_dbx.md_cmp = mdb_cmp_clong; #endif } /** Fixup a sorted-dups cursor due to underlying update. * Sets up some fields that depend on the data from the main cursor. * Almost the same as init1, but skips initialization steps if the * xcursor had already been used. * @param[in] mc The main cursor whose sorted-dups cursor is to be fixed up. * @param[in] src_mx The xcursor of an up-to-date cursor. * @param[in] new_dupdata True if converting from a non-#F_DUPDATA item. */ static void mdb_xcursor_init2(MDB_cursor *mc, MDB_xcursor *src_mx, int new_dupdata) { MDB_xcursor *mx = mc->mc_xcursor; if (new_dupdata) { mx->mx_cursor.mc_snum = 1; mx->mx_cursor.mc_top = 0; mx->mx_cursor.mc_flags |= C_INITIALIZED; mx->mx_cursor.mc_ki[0] = 0; mx->mx_dbflag = DB_VALID|DB_USRVALID|DB_DUPDATA; #if UINT_MAX < SIZE_MAX mx->mx_dbx.md_cmp = src_mx->mx_dbx.md_cmp; #endif } else if (!(mx->mx_cursor.mc_flags & C_INITIALIZED)) { return; } mx->mx_db = src_mx->mx_db; mx->mx_cursor.mc_pg[0] = src_mx->mx_cursor.mc_pg[0]; DPRINTF(("Sub-db -%u root page %"Z"u", mx->mx_cursor.mc_dbi, mx->mx_db.md_root)); } /** Initialize a cursor for a given transaction and database. */ static void mdb_cursor_init(MDB_cursor *mc, MDB_txn *txn, MDB_dbi dbi, MDB_xcursor *mx) { mc->mc_next = NULL; mc->mc_backup = NULL; mc->mc_dbi = dbi; mc->mc_txn = txn; mc->mc_db = &txn->mt_dbs[dbi]; mc->mc_dbx = &txn->mt_dbxs[dbi]; mc->mc_dbflag = &txn->mt_dbflags[dbi]; mc->mc_snum = 0; mc->mc_top = 0; mc->mc_pg[0] = 0; mc->mc_ki[0] = 0; mc->mc_flags = 0; if (txn->mt_dbs[dbi].md_flags & MDB_DUPSORT) { mdb_tassert(txn, mx != NULL); mc->mc_xcursor = mx; mdb_xcursor_init0(mc); } else { mc->mc_xcursor = NULL; } if (*mc->mc_dbflag & DB_STALE) { mdb_page_search(mc, NULL, MDB_PS_ROOTONLY); } } int mdb_cursor_open(MDB_txn *txn, MDB_dbi dbi, MDB_cursor **ret) { MDB_cursor *mc; size_t size = sizeof(MDB_cursor); if (!ret || !TXN_DBI_EXIST(txn, dbi, DB_VALID)) return EINVAL; if (txn->mt_flags & MDB_TXN_BLOCKED) return MDB_BAD_TXN; if (dbi == FREE_DBI && !F_ISSET(txn->mt_flags, MDB_TXN_RDONLY)) return EINVAL; if (txn->mt_dbs[dbi].md_flags & MDB_DUPSORT) size += sizeof(MDB_xcursor); if ((mc = malloc(size)) != NULL) { mdb_cursor_init(mc, txn, dbi, (MDB_xcursor *)(mc + 1)); if (txn->mt_cursors) { mc->mc_next = txn->mt_cursors[dbi]; txn->mt_cursors[dbi] = mc; mc->mc_flags |= C_UNTRACK; } } else { return ENOMEM; } *ret = mc; return MDB_SUCCESS; } int mdb_cursor_renew(MDB_txn *txn, MDB_cursor *mc) { if (!mc || !TXN_DBI_EXIST(txn, mc->mc_dbi, DB_VALID)) return EINVAL; if ((mc->mc_flags & C_UNTRACK) || txn->mt_cursors) return EINVAL; if (txn->mt_flags & MDB_TXN_BLOCKED) return MDB_BAD_TXN; mdb_cursor_init(mc, txn, mc->mc_dbi, mc->mc_xcursor); return MDB_SUCCESS; } /* Return the count of duplicate data items for the current key */ int mdb_cursor_count(MDB_cursor *mc, size_t *countp) { MDB_node *leaf; if (mc == NULL || countp == NULL) return EINVAL; if (mc->mc_xcursor == NULL) return MDB_INCOMPATIBLE; if (mc->mc_txn->mt_flags & MDB_TXN_BLOCKED) return MDB_BAD_TXN; if (!(mc->mc_flags & C_INITIALIZED)) return EINVAL; if (!mc->mc_snum) return MDB_NOTFOUND; if (mc->mc_flags & C_EOF) { if (mc->mc_ki[mc->mc_top] >= NUMKEYS(mc->mc_pg[mc->mc_top])) return MDB_NOTFOUND; mc->mc_flags ^= C_EOF; } leaf = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); if (!F_ISSET(leaf->mn_flags, F_DUPDATA)) { *countp = 1; } else { if (!(mc->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED)) return EINVAL; *countp = mc->mc_xcursor->mx_db.md_entries; } return MDB_SUCCESS; } void mdb_cursor_close(MDB_cursor *mc) { if (mc && !mc->mc_backup) { /* remove from txn, if tracked */ if ((mc->mc_flags & C_UNTRACK) && mc->mc_txn->mt_cursors) { MDB_cursor **prev = &mc->mc_txn->mt_cursors[mc->mc_dbi]; while (*prev && *prev != mc) prev = &(*prev)->mc_next; if (*prev == mc) *prev = mc->mc_next; } free(mc); } } MDB_txn * mdb_cursor_txn(MDB_cursor *mc) { if (!mc) return NULL; return mc->mc_txn; } MDB_dbi mdb_cursor_dbi(MDB_cursor *mc) { return mc->mc_dbi; } /** Replace the key for a branch node with a new key. * Set #MDB_TXN_ERROR on failure. * @param[in] mc Cursor pointing to the node to operate on. * @param[in] key The new key to use. * @return 0 on success, non-zero on failure. */ static int mdb_update_key(MDB_cursor *mc, MDB_val *key) { MDB_page *mp; MDB_node *node; char *base; size_t len; int delta, ksize, oksize; indx_t ptr, i, numkeys, indx; DKBUF; indx = mc->mc_ki[mc->mc_top]; mp = mc->mc_pg[mc->mc_top]; node = NODEPTR(mp, indx); ptr = mp->mp_ptrs[indx]; #if MDB_DEBUG { MDB_val k2; char kbuf2[DKBUF_MAXKEYSIZE*2+1]; k2.mv_data = NODEKEY(node); k2.mv_size = node->mn_ksize; DPRINTF(("update key %u (ofs %u) [%s] to [%s] on page %"Z"u", indx, ptr, mdb_dkey(&k2, kbuf2), DKEY(key), mp->mp_pgno)); } #endif /* Sizes must be 2-byte aligned. */ ksize = EVEN(key->mv_size); oksize = EVEN(node->mn_ksize); delta = ksize - oksize; /* Shift node contents if EVEN(key length) changed. */ if (delta) { if (delta > 0 && SIZELEFT(mp) < delta) { pgno_t pgno; /* not enough space left, do a delete and split */ DPRINTF(("Not enough room, delta = %d, splitting...", delta)); pgno = NODEPGNO(node); mdb_node_del(mc, 0); return mdb_page_split(mc, key, NULL, pgno, MDB_SPLIT_REPLACE); } numkeys = NUMKEYS(mp); for (i = 0; i < numkeys; i++) { if (mp->mp_ptrs[i] <= ptr) mp->mp_ptrs[i] -= delta; } base = (char *)mp + mp->mp_upper + PAGEBASE; len = ptr - mp->mp_upper + NODESIZE; memmove(base - delta, base, len); mp->mp_upper -= delta; node = NODEPTR(mp, indx); } /* But even if no shift was needed, update ksize */ if (node->mn_ksize != key->mv_size) node->mn_ksize = key->mv_size; if (key->mv_size) memcpy(NODEKEY(node), key->mv_data, key->mv_size); return MDB_SUCCESS; } static void mdb_cursor_copy(const MDB_cursor *csrc, MDB_cursor *cdst); /** Perform \b act while tracking temporary cursor \b mn */ #define WITH_CURSOR_TRACKING(mn, act) do { \ MDB_cursor dummy, *tracked, **tp = &(mn).mc_txn->mt_cursors[mn.mc_dbi]; \ if ((mn).mc_flags & C_SUB) { \ dummy.mc_flags = C_INITIALIZED; \ dummy.mc_xcursor = (MDB_xcursor *)&(mn); \ tracked = &dummy; \ } else { \ tracked = &(mn); \ } \ tracked->mc_next = *tp; \ *tp = tracked; \ { act; } \ *tp = tracked->mc_next; \ } while (0) /** Move a node from csrc to cdst. */ static int mdb_node_move(MDB_cursor *csrc, MDB_cursor *cdst, int fromleft) { MDB_node *srcnode; MDB_val key, data; pgno_t srcpg; MDB_cursor mn; int rc; unsigned short flags; DKBUF; /* Mark src and dst as dirty. */ if ((rc = mdb_page_touch(csrc)) || (rc = mdb_page_touch(cdst))) return rc; if (IS_LEAF2(csrc->mc_pg[csrc->mc_top])) { key.mv_size = csrc->mc_db->md_pad; key.mv_data = LEAF2KEY(csrc->mc_pg[csrc->mc_top], csrc->mc_ki[csrc->mc_top], key.mv_size); data.mv_size = 0; data.mv_data = NULL; srcpg = 0; flags = 0; } else { srcnode = NODEPTR(csrc->mc_pg[csrc->mc_top], csrc->mc_ki[csrc->mc_top]); mdb_cassert(csrc, !((size_t)srcnode & 1)); srcpg = NODEPGNO(srcnode); flags = srcnode->mn_flags; if (csrc->mc_ki[csrc->mc_top] == 0 && IS_BRANCH(csrc->mc_pg[csrc->mc_top])) { unsigned int snum = csrc->mc_snum; MDB_node *s2; /* must find the lowest key below src */ rc = mdb_page_search_lowest(csrc); if (rc) return rc; if (IS_LEAF2(csrc->mc_pg[csrc->mc_top])) { key.mv_size = csrc->mc_db->md_pad; key.mv_data = LEAF2KEY(csrc->mc_pg[csrc->mc_top], 0, key.mv_size); } else { s2 = NODEPTR(csrc->mc_pg[csrc->mc_top], 0); key.mv_size = NODEKSZ(s2); key.mv_data = NODEKEY(s2); } csrc->mc_snum = snum--; csrc->mc_top = snum; } else { key.mv_size = NODEKSZ(srcnode); key.mv_data = NODEKEY(srcnode); } data.mv_size = NODEDSZ(srcnode); data.mv_data = NODEDATA(srcnode); } mn.mc_xcursor = NULL; if (IS_BRANCH(cdst->mc_pg[cdst->mc_top]) && cdst->mc_ki[cdst->mc_top] == 0) { unsigned int snum = cdst->mc_snum; MDB_node *s2; MDB_val bkey; /* must find the lowest key below dst */ mdb_cursor_copy(cdst, &mn); rc = mdb_page_search_lowest(&mn); if (rc) return rc; if (IS_LEAF2(mn.mc_pg[mn.mc_top])) { bkey.mv_size = mn.mc_db->md_pad; bkey.mv_data = LEAF2KEY(mn.mc_pg[mn.mc_top], 0, bkey.mv_size); } else { s2 = NODEPTR(mn.mc_pg[mn.mc_top], 0); bkey.mv_size = NODEKSZ(s2); bkey.mv_data = NODEKEY(s2); } mn.mc_snum = snum--; mn.mc_top = snum; mn.mc_ki[snum] = 0; rc = mdb_update_key(&mn, &bkey); if (rc) return rc; } DPRINTF(("moving %s node %u [%s] on page %"Z"u to node %u on page %"Z"u", IS_LEAF(csrc->mc_pg[csrc->mc_top]) ? "leaf" : "branch", csrc->mc_ki[csrc->mc_top], DKEY(&key), csrc->mc_pg[csrc->mc_top]->mp_pgno, cdst->mc_ki[cdst->mc_top], cdst->mc_pg[cdst->mc_top]->mp_pgno)); /* Add the node to the destination page. */ rc = mdb_node_add(cdst, cdst->mc_ki[cdst->mc_top], &key, &data, srcpg, flags); if (rc != MDB_SUCCESS) return rc; /* Delete the node from the source page. */ mdb_node_del(csrc, key.mv_size); { /* Adjust other cursors pointing to mp */ MDB_cursor *m2, *m3; MDB_dbi dbi = csrc->mc_dbi; MDB_page *mpd, *mps; mps = csrc->mc_pg[csrc->mc_top]; /* If we're adding on the left, bump others up */ if (fromleft) { mpd = cdst->mc_pg[csrc->mc_top]; for (m2 = csrc->mc_txn->mt_cursors[dbi]; m2; m2=m2->mc_next) { if (csrc->mc_flags & C_SUB) m3 = &m2->mc_xcursor->mx_cursor; else m3 = m2; if (!(m3->mc_flags & C_INITIALIZED) || m3->mc_top < csrc->mc_top) continue; if (m3 != cdst && m3->mc_pg[csrc->mc_top] == mpd && m3->mc_ki[csrc->mc_top] >= cdst->mc_ki[csrc->mc_top]) { m3->mc_ki[csrc->mc_top]++; } if (m3 !=csrc && m3->mc_pg[csrc->mc_top] == mps && m3->mc_ki[csrc->mc_top] == csrc->mc_ki[csrc->mc_top]) { m3->mc_pg[csrc->mc_top] = cdst->mc_pg[cdst->mc_top]; m3->mc_ki[csrc->mc_top] = cdst->mc_ki[cdst->mc_top]; m3->mc_ki[csrc->mc_top-1]++; } if (IS_LEAF(mps)) XCURSOR_REFRESH(m3, csrc->mc_top, m3->mc_pg[csrc->mc_top]); } } else /* Adding on the right, bump others down */ { for (m2 = csrc->mc_txn->mt_cursors[dbi]; m2; m2=m2->mc_next) { if (csrc->mc_flags & C_SUB) m3 = &m2->mc_xcursor->mx_cursor; else m3 = m2; if (m3 == csrc) continue; if (!(m3->mc_flags & C_INITIALIZED) || m3->mc_top < csrc->mc_top) continue; if (m3->mc_pg[csrc->mc_top] == mps) { if (!m3->mc_ki[csrc->mc_top]) { m3->mc_pg[csrc->mc_top] = cdst->mc_pg[cdst->mc_top]; m3->mc_ki[csrc->mc_top] = cdst->mc_ki[cdst->mc_top]; m3->mc_ki[csrc->mc_top-1]--; } else { m3->mc_ki[csrc->mc_top]--; } if (IS_LEAF(mps)) XCURSOR_REFRESH(m3, csrc->mc_top, m3->mc_pg[csrc->mc_top]); } } } } /* Update the parent separators. */ if (csrc->mc_ki[csrc->mc_top] == 0) { if (csrc->mc_ki[csrc->mc_top-1] != 0) { if (IS_LEAF2(csrc->mc_pg[csrc->mc_top])) { key.mv_data = LEAF2KEY(csrc->mc_pg[csrc->mc_top], 0, key.mv_size); } else { srcnode = NODEPTR(csrc->mc_pg[csrc->mc_top], 0); key.mv_size = NODEKSZ(srcnode); key.mv_data = NODEKEY(srcnode); } DPRINTF(("update separator for source page %"Z"u to [%s]", csrc->mc_pg[csrc->mc_top]->mp_pgno, DKEY(&key))); mdb_cursor_copy(csrc, &mn); mn.mc_snum--; mn.mc_top--; /* We want mdb_rebalance to find mn when doing fixups */ WITH_CURSOR_TRACKING(mn, rc = mdb_update_key(&mn, &key)); if (rc) return rc; } if (IS_BRANCH(csrc->mc_pg[csrc->mc_top])) { MDB_val nullkey; indx_t ix = csrc->mc_ki[csrc->mc_top]; nullkey.mv_size = 0; csrc->mc_ki[csrc->mc_top] = 0; rc = mdb_update_key(csrc, &nullkey); csrc->mc_ki[csrc->mc_top] = ix; mdb_cassert(csrc, rc == MDB_SUCCESS); } } if (cdst->mc_ki[cdst->mc_top] == 0) { if (cdst->mc_ki[cdst->mc_top-1] != 0) { if (IS_LEAF2(csrc->mc_pg[csrc->mc_top])) { key.mv_data = LEAF2KEY(cdst->mc_pg[cdst->mc_top], 0, key.mv_size); } else { srcnode = NODEPTR(cdst->mc_pg[cdst->mc_top], 0); key.mv_size = NODEKSZ(srcnode); key.mv_data = NODEKEY(srcnode); } DPRINTF(("update separator for destination page %"Z"u to [%s]", cdst->mc_pg[cdst->mc_top]->mp_pgno, DKEY(&key))); mdb_cursor_copy(cdst, &mn); mn.mc_snum--; mn.mc_top--; /* We want mdb_rebalance to find mn when doing fixups */ WITH_CURSOR_TRACKING(mn, rc = mdb_update_key(&mn, &key)); if (rc) return rc; } if (IS_BRANCH(cdst->mc_pg[cdst->mc_top])) { MDB_val nullkey; indx_t ix = cdst->mc_ki[cdst->mc_top]; nullkey.mv_size = 0; cdst->mc_ki[cdst->mc_top] = 0; rc = mdb_update_key(cdst, &nullkey); cdst->mc_ki[cdst->mc_top] = ix; mdb_cassert(cdst, rc == MDB_SUCCESS); } } return MDB_SUCCESS; } /** Merge one page into another. * The nodes from the page pointed to by \b csrc will * be copied to the page pointed to by \b cdst and then * the \b csrc page will be freed. * @param[in] csrc Cursor pointing to the source page. * @param[in] cdst Cursor pointing to the destination page. * @return 0 on success, non-zero on failure. */ static int mdb_page_merge(MDB_cursor *csrc, MDB_cursor *cdst) { MDB_page *psrc, *pdst; MDB_node *srcnode; MDB_val key, data; unsigned nkeys; int rc; indx_t i, j; psrc = csrc->mc_pg[csrc->mc_top]; pdst = cdst->mc_pg[cdst->mc_top]; DPRINTF(("merging page %"Z"u into %"Z"u", psrc->mp_pgno, pdst->mp_pgno)); mdb_cassert(csrc, csrc->mc_snum > 1); /* can't merge root page */ mdb_cassert(csrc, cdst->mc_snum > 1); /* Mark dst as dirty. */ if ((rc = mdb_page_touch(cdst))) return rc; /* get dst page again now that we've touched it. */ pdst = cdst->mc_pg[cdst->mc_top]; /* Move all nodes from src to dst. */ j = nkeys = NUMKEYS(pdst); if (IS_LEAF2(psrc)) { key.mv_size = csrc->mc_db->md_pad; key.mv_data = METADATA(psrc); for (i = 0; i < NUMKEYS(psrc); i++, j++) { rc = mdb_node_add(cdst, j, &key, NULL, 0, 0); if (rc != MDB_SUCCESS) return rc; key.mv_data = (char *)key.mv_data + key.mv_size; } } else { for (i = 0; i < NUMKEYS(psrc); i++, j++) { srcnode = NODEPTR(psrc, i); if (i == 0 && IS_BRANCH(psrc)) { MDB_cursor mn; MDB_node *s2; mdb_cursor_copy(csrc, &mn); mn.mc_xcursor = NULL; /* must find the lowest key below src */ rc = mdb_page_search_lowest(&mn); if (rc) return rc; if (IS_LEAF2(mn.mc_pg[mn.mc_top])) { key.mv_size = mn.mc_db->md_pad; key.mv_data = LEAF2KEY(mn.mc_pg[mn.mc_top], 0, key.mv_size); } else { s2 = NODEPTR(mn.mc_pg[mn.mc_top], 0); key.mv_size = NODEKSZ(s2); key.mv_data = NODEKEY(s2); } } else { key.mv_size = srcnode->mn_ksize; key.mv_data = NODEKEY(srcnode); } data.mv_size = NODEDSZ(srcnode); data.mv_data = NODEDATA(srcnode); rc = mdb_node_add(cdst, j, &key, &data, NODEPGNO(srcnode), srcnode->mn_flags); if (rc != MDB_SUCCESS) return rc; } } DPRINTF(("dst page %"Z"u now has %u keys (%.1f%% filled)", pdst->mp_pgno, NUMKEYS(pdst), (float)PAGEFILL(cdst->mc_txn->mt_env, pdst) / 10)); /* Unlink the src page from parent and add to free list. */ csrc->mc_top--; mdb_node_del(csrc, 0); if (csrc->mc_ki[csrc->mc_top] == 0) { key.mv_size = 0; rc = mdb_update_key(csrc, &key); if (rc) { csrc->mc_top++; return rc; } } csrc->mc_top++; psrc = csrc->mc_pg[csrc->mc_top]; /* If not operating on FreeDB, allow this page to be reused * in this txn. Otherwise just add to free list. */ rc = mdb_page_loose(csrc, psrc); if (rc) return rc; if (IS_LEAF(psrc)) csrc->mc_db->md_leaf_pages--; else csrc->mc_db->md_branch_pages--; { /* Adjust other cursors pointing to mp */ MDB_cursor *m2, *m3; MDB_dbi dbi = csrc->mc_dbi; unsigned int top = csrc->mc_top; for (m2 = csrc->mc_txn->mt_cursors[dbi]; m2; m2=m2->mc_next) { if (csrc->mc_flags & C_SUB) m3 = &m2->mc_xcursor->mx_cursor; else m3 = m2; if (m3 == csrc) continue; if (m3->mc_snum < csrc->mc_snum) continue; if (m3->mc_pg[top] == psrc) { m3->mc_pg[top] = pdst; m3->mc_ki[top] += nkeys; m3->mc_ki[top-1] = cdst->mc_ki[top-1]; } else if (m3->mc_pg[top-1] == csrc->mc_pg[top-1] && m3->mc_ki[top-1] > csrc->mc_ki[top-1]) { m3->mc_ki[top-1]--; } if (IS_LEAF(psrc)) XCURSOR_REFRESH(m3, top, m3->mc_pg[top]); } } { unsigned int snum = cdst->mc_snum; uint16_t depth = cdst->mc_db->md_depth; mdb_cursor_pop(cdst); rc = mdb_rebalance(cdst); /* Did the tree height change? */ if (depth != cdst->mc_db->md_depth) snum += cdst->mc_db->md_depth - depth; cdst->mc_snum = snum; cdst->mc_top = snum-1; } return rc; } /** Copy the contents of a cursor. * @param[in] csrc The cursor to copy from. * @param[out] cdst The cursor to copy to. */ static void mdb_cursor_copy(const MDB_cursor *csrc, MDB_cursor *cdst) { unsigned int i; cdst->mc_txn = csrc->mc_txn; cdst->mc_dbi = csrc->mc_dbi; cdst->mc_db = csrc->mc_db; cdst->mc_dbx = csrc->mc_dbx; cdst->mc_snum = csrc->mc_snum; cdst->mc_top = csrc->mc_top; cdst->mc_flags = csrc->mc_flags; for (i=0; imc_snum; i++) { cdst->mc_pg[i] = csrc->mc_pg[i]; cdst->mc_ki[i] = csrc->mc_ki[i]; } } /** Rebalance the tree after a delete operation. * @param[in] mc Cursor pointing to the page where rebalancing * should begin. * @return 0 on success, non-zero on failure. */ static int mdb_rebalance(MDB_cursor *mc) { MDB_node *node; int rc, fromleft; unsigned int ptop, minkeys, thresh; MDB_cursor mn; indx_t oldki; if (IS_BRANCH(mc->mc_pg[mc->mc_top])) { minkeys = 2; thresh = 1; } else { minkeys = 1; thresh = FILL_THRESHOLD; } DPRINTF(("rebalancing %s page %"Z"u (has %u keys, %.1f%% full)", IS_LEAF(mc->mc_pg[mc->mc_top]) ? "leaf" : "branch", mdb_dbg_pgno(mc->mc_pg[mc->mc_top]), NUMKEYS(mc->mc_pg[mc->mc_top]), (float)PAGEFILL(mc->mc_txn->mt_env, mc->mc_pg[mc->mc_top]) / 10)); if (PAGEFILL(mc->mc_txn->mt_env, mc->mc_pg[mc->mc_top]) >= thresh && NUMKEYS(mc->mc_pg[mc->mc_top]) >= minkeys) { DPRINTF(("no need to rebalance page %"Z"u, above fill threshold", mdb_dbg_pgno(mc->mc_pg[mc->mc_top]))); return MDB_SUCCESS; } if (mc->mc_snum < 2) { MDB_page *mp = mc->mc_pg[0]; if (IS_SUBP(mp)) { DPUTS("Can't rebalance a subpage, ignoring"); return MDB_SUCCESS; } if (NUMKEYS(mp) == 0) { DPUTS("tree is completely empty"); mc->mc_db->md_root = P_INVALID; mc->mc_db->md_depth = 0; mc->mc_db->md_leaf_pages = 0; rc = mdb_midl_append(&mc->mc_txn->mt_free_pgs, mp->mp_pgno); if (rc) return rc; /* Adjust cursors pointing to mp */ mc->mc_snum = 0; mc->mc_top = 0; mc->mc_flags &= ~C_INITIALIZED; { MDB_cursor *m2, *m3; MDB_dbi dbi = mc->mc_dbi; for (m2 = mc->mc_txn->mt_cursors[dbi]; m2; m2=m2->mc_next) { if (mc->mc_flags & C_SUB) m3 = &m2->mc_xcursor->mx_cursor; else m3 = m2; if (!(m3->mc_flags & C_INITIALIZED) || (m3->mc_snum < mc->mc_snum)) continue; if (m3->mc_pg[0] == mp) { m3->mc_snum = 0; m3->mc_top = 0; m3->mc_flags &= ~C_INITIALIZED; } } } } else if (IS_BRANCH(mp) && NUMKEYS(mp) == 1) { int i; DPUTS("collapsing root page!"); rc = mdb_midl_append(&mc->mc_txn->mt_free_pgs, mp->mp_pgno); if (rc) return rc; mc->mc_db->md_root = NODEPGNO(NODEPTR(mp, 0)); rc = mdb_page_get(mc, mc->mc_db->md_root, &mc->mc_pg[0], NULL); if (rc) return rc; mc->mc_db->md_depth--; mc->mc_db->md_branch_pages--; mc->mc_ki[0] = mc->mc_ki[1]; for (i = 1; imc_db->md_depth; i++) { mc->mc_pg[i] = mc->mc_pg[i+1]; mc->mc_ki[i] = mc->mc_ki[i+1]; } { /* Adjust other cursors pointing to mp */ MDB_cursor *m2, *m3; MDB_dbi dbi = mc->mc_dbi; for (m2 = mc->mc_txn->mt_cursors[dbi]; m2; m2=m2->mc_next) { if (mc->mc_flags & C_SUB) m3 = &m2->mc_xcursor->mx_cursor; else m3 = m2; if (m3 == mc) continue; if (!(m3->mc_flags & C_INITIALIZED)) continue; if (m3->mc_pg[0] == mp) { for (i=0; imc_db->md_depth; i++) { m3->mc_pg[i] = m3->mc_pg[i+1]; m3->mc_ki[i] = m3->mc_ki[i+1]; } m3->mc_snum--; m3->mc_top--; } } } } else DPUTS("root page doesn't need rebalancing"); return MDB_SUCCESS; } /* The parent (branch page) must have at least 2 pointers, * otherwise the tree is invalid. */ ptop = mc->mc_top-1; mdb_cassert(mc, NUMKEYS(mc->mc_pg[ptop]) > 1); /* Leaf page fill factor is below the threshold. * Try to move keys from left or right neighbor, or * merge with a neighbor page. */ /* Find neighbors. */ mdb_cursor_copy(mc, &mn); mn.mc_xcursor = NULL; oldki = mc->mc_ki[mc->mc_top]; if (mc->mc_ki[ptop] == 0) { /* We're the leftmost leaf in our parent. */ DPUTS("reading right neighbor"); mn.mc_ki[ptop]++; node = NODEPTR(mc->mc_pg[ptop], mn.mc_ki[ptop]); rc = mdb_page_get(mc, NODEPGNO(node), &mn.mc_pg[mn.mc_top], NULL); if (rc) return rc; mn.mc_ki[mn.mc_top] = 0; mc->mc_ki[mc->mc_top] = NUMKEYS(mc->mc_pg[mc->mc_top]); fromleft = 0; } else { /* There is at least one neighbor to the left. */ DPUTS("reading left neighbor"); mn.mc_ki[ptop]--; node = NODEPTR(mc->mc_pg[ptop], mn.mc_ki[ptop]); rc = mdb_page_get(mc, NODEPGNO(node), &mn.mc_pg[mn.mc_top], NULL); if (rc) return rc; mn.mc_ki[mn.mc_top] = NUMKEYS(mn.mc_pg[mn.mc_top]) - 1; mc->mc_ki[mc->mc_top] = 0; fromleft = 1; } DPRINTF(("found neighbor page %"Z"u (%u keys, %.1f%% full)", mn.mc_pg[mn.mc_top]->mp_pgno, NUMKEYS(mn.mc_pg[mn.mc_top]), (float)PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) / 10)); /* If the neighbor page is above threshold and has enough keys, * move one key from it. Otherwise we should try to merge them. * (A branch page must never have less than 2 keys.) */ if (PAGEFILL(mc->mc_txn->mt_env, mn.mc_pg[mn.mc_top]) >= thresh && NUMKEYS(mn.mc_pg[mn.mc_top]) > minkeys) { rc = mdb_node_move(&mn, mc, fromleft); if (fromleft) { /* if we inserted on left, bump position up */ oldki++; } } else { if (!fromleft) { rc = mdb_page_merge(&mn, mc); } else { oldki += NUMKEYS(mn.mc_pg[mn.mc_top]); mn.mc_ki[mn.mc_top] += mc->mc_ki[mn.mc_top] + 1; /* We want mdb_rebalance to find mn when doing fixups */ WITH_CURSOR_TRACKING(mn, rc = mdb_page_merge(mc, &mn)); mdb_cursor_copy(&mn, mc); } mc->mc_flags &= ~C_EOF; } mc->mc_ki[mc->mc_top] = oldki; return rc; } /** Complete a delete operation started by #mdb_cursor_del(). */ static int mdb_cursor_del0(MDB_cursor *mc) { int rc; MDB_page *mp; indx_t ki; unsigned int nkeys; MDB_cursor *m2, *m3; MDB_dbi dbi = mc->mc_dbi; ki = mc->mc_ki[mc->mc_top]; mp = mc->mc_pg[mc->mc_top]; mdb_node_del(mc, mc->mc_db->md_pad); mc->mc_db->md_entries--; { /* Adjust other cursors pointing to mp */ for (m2 = mc->mc_txn->mt_cursors[dbi]; m2; m2=m2->mc_next) { m3 = (mc->mc_flags & C_SUB) ? &m2->mc_xcursor->mx_cursor : m2; if (! (m2->mc_flags & m3->mc_flags & C_INITIALIZED)) continue; if (m3 == mc || m3->mc_snum < mc->mc_snum) continue; if (m3->mc_pg[mc->mc_top] == mp) { if (m3->mc_ki[mc->mc_top] == ki) { m3->mc_flags |= C_DEL; if (mc->mc_db->md_flags & MDB_DUPSORT) { /* Sub-cursor referred into dataset which is gone */ m3->mc_xcursor->mx_cursor.mc_flags &= ~(C_INITIALIZED|C_EOF); } continue; } else if (m3->mc_ki[mc->mc_top] > ki) { m3->mc_ki[mc->mc_top]--; } XCURSOR_REFRESH(m3, mc->mc_top, mp); } } } rc = mdb_rebalance(mc); if (rc == MDB_SUCCESS) { /* DB is totally empty now, just bail out. * Other cursors adjustments were already done * by mdb_rebalance and aren't needed here. */ if (!mc->mc_snum) return rc; mp = mc->mc_pg[mc->mc_top]; nkeys = NUMKEYS(mp); /* Adjust other cursors pointing to mp */ for (m2 = mc->mc_txn->mt_cursors[dbi]; !rc && m2; m2=m2->mc_next) { m3 = (mc->mc_flags & C_SUB) ? &m2->mc_xcursor->mx_cursor : m2; if (! (m2->mc_flags & m3->mc_flags & C_INITIALIZED)) continue; if (m3->mc_snum < mc->mc_snum) continue; if (m3->mc_pg[mc->mc_top] == mp) { /* if m3 points past last node in page, find next sibling */ if (m3->mc_ki[mc->mc_top] >= mc->mc_ki[mc->mc_top]) { if (m3->mc_ki[mc->mc_top] >= nkeys) { rc = mdb_cursor_sibling(m3, 1); if (rc == MDB_NOTFOUND) { m3->mc_flags |= C_EOF; rc = MDB_SUCCESS; continue; } } if (mc->mc_db->md_flags & MDB_DUPSORT) { MDB_node *node = NODEPTR(m3->mc_pg[m3->mc_top], m3->mc_ki[m3->mc_top]); /* If this node has dupdata, it may need to be reinited * because its data has moved. * If the xcursor was not initd it must be reinited. * Else if node points to a subDB, nothing is needed. * Else (xcursor was initd, not a subDB) needs mc_pg[0] reset. */ if (node->mn_flags & F_DUPDATA) { if (m3->mc_xcursor->mx_cursor.mc_flags & C_INITIALIZED) { if (!(node->mn_flags & F_SUBDATA)) m3->mc_xcursor->mx_cursor.mc_pg[0] = NODEDATA(node); } else { mdb_xcursor_init1(m3, node); m3->mc_xcursor->mx_cursor.mc_flags |= C_DEL; } } } } } } mc->mc_flags |= C_DEL; } if (rc) mc->mc_txn->mt_flags |= MDB_TXN_ERROR; return rc; } int mdb_del(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data) { if (!key || !TXN_DBI_EXIST(txn, dbi, DB_USRVALID)) return EINVAL; if (txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_BLOCKED)) return (txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN; if (!F_ISSET(txn->mt_dbs[dbi].md_flags, MDB_DUPSORT)) { /* must ignore any data */ data = NULL; } return mdb_del0(txn, dbi, key, data, 0); } static int mdb_del0(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data, unsigned flags) { MDB_cursor mc; MDB_xcursor mx; MDB_cursor_op op; MDB_val rdata, *xdata; int rc, exact = 0; DKBUF; DPRINTF(("====> delete db %u key [%s]", dbi, DKEY(key))); mdb_cursor_init(&mc, txn, dbi, &mx); if (data) { op = MDB_GET_BOTH; rdata = *data; xdata = &rdata; } else { op = MDB_SET; xdata = NULL; flags |= MDB_NODUPDATA; } rc = mdb_cursor_set(&mc, key, xdata, op, &exact); if (rc == 0) { /* let mdb_page_split know about this cursor if needed: * delete will trigger a rebalance; if it needs to move * a node from one page to another, it will have to * update the parent's separator key(s). If the new sepkey * is larger than the current one, the parent page may * run out of space, triggering a split. We need this * cursor to be consistent until the end of the rebalance. */ mc.mc_flags |= C_UNTRACK; mc.mc_next = txn->mt_cursors[dbi]; txn->mt_cursors[dbi] = &mc; rc = mdb_cursor_del(&mc, flags); txn->mt_cursors[dbi] = mc.mc_next; } return rc; } /** Split a page and insert a new node. * Set #MDB_TXN_ERROR on failure. * @param[in,out] mc Cursor pointing to the page and desired insertion index. * The cursor will be updated to point to the actual page and index where * the node got inserted after the split. * @param[in] newkey The key for the newly inserted node. * @param[in] newdata The data for the newly inserted node. * @param[in] newpgno The page number, if the new node is a branch node. * @param[in] nflags The #NODE_ADD_FLAGS for the new node. * @return 0 on success, non-zero on failure. */ static int mdb_page_split(MDB_cursor *mc, MDB_val *newkey, MDB_val *newdata, pgno_t newpgno, unsigned int nflags) { unsigned int flags; int rc = MDB_SUCCESS, new_root = 0, did_split = 0; indx_t newindx; pgno_t pgno = 0; int i, j, split_indx, nkeys, pmax; MDB_env *env = mc->mc_txn->mt_env; MDB_node *node; MDB_val sepkey, rkey, xdata, *rdata = &xdata; MDB_page *copy = NULL; MDB_page *mp, *rp, *pp; int ptop; MDB_cursor mn; DKBUF; mp = mc->mc_pg[mc->mc_top]; newindx = mc->mc_ki[mc->mc_top]; nkeys = NUMKEYS(mp); DPRINTF(("-----> splitting %s page %"Z"u and adding [%s] at index %i/%i", IS_LEAF(mp) ? "leaf" : "branch", mp->mp_pgno, DKEY(newkey), mc->mc_ki[mc->mc_top], nkeys)); /* Create a right sibling. */ if ((rc = mdb_page_new(mc, mp->mp_flags, 1, &rp))) return rc; rp->mp_pad = mp->mp_pad; DPRINTF(("new right sibling: page %"Z"u", rp->mp_pgno)); /* Usually when splitting the root page, the cursor * height is 1. But when called from mdb_update_key, * the cursor height may be greater because it walks * up the stack while finding the branch slot to update. */ if (mc->mc_top < 1) { if ((rc = mdb_page_new(mc, P_BRANCH, 1, &pp))) goto done; /* shift current top to make room for new parent */ for (i=mc->mc_snum; i>0; i--) { mc->mc_pg[i] = mc->mc_pg[i-1]; mc->mc_ki[i] = mc->mc_ki[i-1]; } mc->mc_pg[0] = pp; mc->mc_ki[0] = 0; mc->mc_db->md_root = pp->mp_pgno; DPRINTF(("root split! new root = %"Z"u", pp->mp_pgno)); new_root = mc->mc_db->md_depth++; /* Add left (implicit) pointer. */ if ((rc = mdb_node_add(mc, 0, NULL, NULL, mp->mp_pgno, 0)) != MDB_SUCCESS) { /* undo the pre-push */ mc->mc_pg[0] = mc->mc_pg[1]; mc->mc_ki[0] = mc->mc_ki[1]; mc->mc_db->md_root = mp->mp_pgno; mc->mc_db->md_depth--; goto done; } mc->mc_snum++; mc->mc_top++; ptop = 0; } else { ptop = mc->mc_top-1; DPRINTF(("parent branch page is %"Z"u", mc->mc_pg[ptop]->mp_pgno)); } mdb_cursor_copy(mc, &mn); mn.mc_xcursor = NULL; mn.mc_pg[mn.mc_top] = rp; mn.mc_ki[ptop] = mc->mc_ki[ptop]+1; if (nflags & MDB_APPEND) { mn.mc_ki[mn.mc_top] = 0; sepkey = *newkey; split_indx = newindx; nkeys = 0; } else { split_indx = (nkeys+1) / 2; if (IS_LEAF2(rp)) { char *split, *ins; int x; unsigned int lsize, rsize, ksize; /* Move half of the keys to the right sibling */ x = mc->mc_ki[mc->mc_top] - split_indx; ksize = mc->mc_db->md_pad; split = LEAF2KEY(mp, split_indx, ksize); rsize = (nkeys - split_indx) * ksize; lsize = (nkeys - split_indx) * sizeof(indx_t); mp->mp_lower -= lsize; rp->mp_lower += lsize; mp->mp_upper += rsize - lsize; rp->mp_upper -= rsize - lsize; sepkey.mv_size = ksize; if (newindx == split_indx) { sepkey.mv_data = newkey->mv_data; } else { sepkey.mv_data = split; } if (x<0) { ins = LEAF2KEY(mp, mc->mc_ki[mc->mc_top], ksize); memcpy(rp->mp_ptrs, split, rsize); sepkey.mv_data = rp->mp_ptrs; memmove(ins+ksize, ins, (split_indx - mc->mc_ki[mc->mc_top]) * ksize); memcpy(ins, newkey->mv_data, ksize); mp->mp_lower += sizeof(indx_t); mp->mp_upper -= ksize - sizeof(indx_t); } else { if (x) memcpy(rp->mp_ptrs, split, x * ksize); ins = LEAF2KEY(rp, x, ksize); memcpy(ins, newkey->mv_data, ksize); memcpy(ins+ksize, split + x * ksize, rsize - x * ksize); rp->mp_lower += sizeof(indx_t); rp->mp_upper -= ksize - sizeof(indx_t); mc->mc_ki[mc->mc_top] = x; } } else { int psize, nsize, k; /* Maximum free space in an empty page */ pmax = env->me_psize - PAGEHDRSZ; if (IS_LEAF(mp)) nsize = mdb_leaf_size(env, newkey, newdata); else nsize = mdb_branch_size(env, newkey); nsize = EVEN(nsize); /* grab a page to hold a temporary copy */ copy = mdb_page_malloc(mc->mc_txn, 1); if (copy == NULL) { rc = ENOMEM; goto done; } copy->mp_pgno = mp->mp_pgno; copy->mp_flags = mp->mp_flags; copy->mp_lower = (PAGEHDRSZ-PAGEBASE); copy->mp_upper = env->me_psize - PAGEBASE; /* prepare to insert */ for (i=0, j=0; imp_ptrs[j++] = 0; } copy->mp_ptrs[j++] = mp->mp_ptrs[i]; } /* When items are relatively large the split point needs * to be checked, because being off-by-one will make the * difference between success or failure in mdb_node_add. * * It's also relevant if a page happens to be laid out * such that one half of its nodes are all "small" and * the other half of its nodes are "large." If the new * item is also "large" and falls on the half with * "large" nodes, it also may not fit. * * As a final tweak, if the new item goes on the last * spot on the page (and thus, onto the new page), bias * the split so the new page is emptier than the old page. * This yields better packing during sequential inserts. */ if (nkeys < 32 || nsize > pmax/16 || newindx >= nkeys) { /* Find split point */ psize = 0; if (newindx <= split_indx || newindx >= nkeys) { i = 0; j = 1; k = newindx >= nkeys ? nkeys : split_indx+1+IS_LEAF(mp); } else { i = nkeys; j = -1; k = split_indx-1; } for (; i!=k; i+=j) { if (i == newindx) { psize += nsize; node = NULL; } else { node = (MDB_node *)((char *)mp + copy->mp_ptrs[i] + PAGEBASE); psize += NODESIZE + NODEKSZ(node) + sizeof(indx_t); if (IS_LEAF(mp)) { if (F_ISSET(node->mn_flags, F_BIGDATA)) psize += sizeof(pgno_t); else psize += NODEDSZ(node); } psize = EVEN(psize); } if (psize > pmax || i == k-j) { split_indx = i + (j<0); break; } } } if (split_indx == newindx) { sepkey.mv_size = newkey->mv_size; sepkey.mv_data = newkey->mv_data; } else { node = (MDB_node *)((char *)mp + copy->mp_ptrs[split_indx] + PAGEBASE); sepkey.mv_size = node->mn_ksize; sepkey.mv_data = NODEKEY(node); } } } DPRINTF(("separator is %d [%s]", split_indx, DKEY(&sepkey))); /* Copy separator key to the parent. */ if (SIZELEFT(mn.mc_pg[ptop]) < mdb_branch_size(env, &sepkey)) { int snum = mc->mc_snum; mn.mc_snum--; mn.mc_top--; did_split = 1; /* We want other splits to find mn when doing fixups */ WITH_CURSOR_TRACKING(mn, rc = mdb_page_split(&mn, &sepkey, NULL, rp->mp_pgno, 0)); if (rc) goto done; /* root split? */ if (mc->mc_snum > snum) { ptop++; } /* Right page might now have changed parent. * Check if left page also changed parent. */ if (mn.mc_pg[ptop] != mc->mc_pg[ptop] && mc->mc_ki[ptop] >= NUMKEYS(mc->mc_pg[ptop])) { for (i=0; imc_pg[i] = mn.mc_pg[i]; mc->mc_ki[i] = mn.mc_ki[i]; } mc->mc_pg[ptop] = mn.mc_pg[ptop]; if (mn.mc_ki[ptop]) { mc->mc_ki[ptop] = mn.mc_ki[ptop] - 1; } else { /* find right page's left sibling */ mc->mc_ki[ptop] = mn.mc_ki[ptop]; mdb_cursor_sibling(mc, 0); } } } else { mn.mc_top--; rc = mdb_node_add(&mn, mn.mc_ki[ptop], &sepkey, NULL, rp->mp_pgno, 0); mn.mc_top++; } if (rc != MDB_SUCCESS) { goto done; } if (nflags & MDB_APPEND) { mc->mc_pg[mc->mc_top] = rp; mc->mc_ki[mc->mc_top] = 0; rc = mdb_node_add(mc, 0, newkey, newdata, newpgno, nflags); if (rc) goto done; for (i=0; imc_top; i++) mc->mc_ki[i] = mn.mc_ki[i]; } else if (!IS_LEAF2(mp)) { /* Move nodes */ mc->mc_pg[mc->mc_top] = rp; i = split_indx; j = 0; do { if (i == newindx) { rkey.mv_data = newkey->mv_data; rkey.mv_size = newkey->mv_size; if (IS_LEAF(mp)) { rdata = newdata; } else pgno = newpgno; flags = nflags; /* Update index for the new key. */ mc->mc_ki[mc->mc_top] = j; } else { node = (MDB_node *)((char *)mp + copy->mp_ptrs[i] + PAGEBASE); rkey.mv_data = NODEKEY(node); rkey.mv_size = node->mn_ksize; if (IS_LEAF(mp)) { xdata.mv_data = NODEDATA(node); xdata.mv_size = NODEDSZ(node); rdata = &xdata; } else pgno = NODEPGNO(node); flags = node->mn_flags; } if (!IS_LEAF(mp) && j == 0) { /* First branch index doesn't need key data. */ rkey.mv_size = 0; } rc = mdb_node_add(mc, j, &rkey, rdata, pgno, flags); if (rc) goto done; if (i == nkeys) { i = 0; j = 0; mc->mc_pg[mc->mc_top] = copy; } else { i++; j++; } } while (i != split_indx); nkeys = NUMKEYS(copy); for (i=0; imp_ptrs[i] = copy->mp_ptrs[i]; mp->mp_lower = copy->mp_lower; mp->mp_upper = copy->mp_upper; memcpy(NODEPTR(mp, nkeys-1), NODEPTR(copy, nkeys-1), env->me_psize - copy->mp_upper - PAGEBASE); /* reset back to original page */ if (newindx < split_indx) { mc->mc_pg[mc->mc_top] = mp; } else { mc->mc_pg[mc->mc_top] = rp; mc->mc_ki[ptop]++; /* Make sure mc_ki is still valid. */ if (mn.mc_pg[ptop] != mc->mc_pg[ptop] && mc->mc_ki[ptop] >= NUMKEYS(mc->mc_pg[ptop])) { for (i=0; i<=ptop; i++) { mc->mc_pg[i] = mn.mc_pg[i]; mc->mc_ki[i] = mn.mc_ki[i]; } } } if (nflags & MDB_RESERVE) { node = NODEPTR(mc->mc_pg[mc->mc_top], mc->mc_ki[mc->mc_top]); if (!(node->mn_flags & F_BIGDATA)) newdata->mv_data = NODEDATA(node); } } else { if (newindx >= split_indx) { mc->mc_pg[mc->mc_top] = rp; mc->mc_ki[ptop]++; /* Make sure mc_ki is still valid. */ if (mn.mc_pg[ptop] != mc->mc_pg[ptop] && mc->mc_ki[ptop] >= NUMKEYS(mc->mc_pg[ptop])) { for (i=0; i<=ptop; i++) { mc->mc_pg[i] = mn.mc_pg[i]; mc->mc_ki[i] = mn.mc_ki[i]; } } } } { /* Adjust other cursors pointing to mp */ MDB_cursor *m2, *m3; MDB_dbi dbi = mc->mc_dbi; nkeys = NUMKEYS(mp); for (m2 = mc->mc_txn->mt_cursors[dbi]; m2; m2=m2->mc_next) { if (mc->mc_flags & C_SUB) m3 = &m2->mc_xcursor->mx_cursor; else m3 = m2; if (m3 == mc) continue; if (!(m2->mc_flags & m3->mc_flags & C_INITIALIZED)) continue; if (new_root) { int k; /* sub cursors may be on different DB */ if (m3->mc_pg[0] != mp) continue; /* root split */ for (k=new_root; k>=0; k--) { m3->mc_ki[k+1] = m3->mc_ki[k]; m3->mc_pg[k+1] = m3->mc_pg[k]; } if (m3->mc_ki[0] >= nkeys) { m3->mc_ki[0] = 1; } else { m3->mc_ki[0] = 0; } m3->mc_pg[0] = mc->mc_pg[0]; m3->mc_snum++; m3->mc_top++; } if (m3->mc_top >= mc->mc_top && m3->mc_pg[mc->mc_top] == mp) { if (m3->mc_ki[mc->mc_top] >= newindx && !(nflags & MDB_SPLIT_REPLACE)) m3->mc_ki[mc->mc_top]++; if (m3->mc_ki[mc->mc_top] >= nkeys) { m3->mc_pg[mc->mc_top] = rp; m3->mc_ki[mc->mc_top] -= nkeys; for (i=0; imc_top; i++) { m3->mc_ki[i] = mn.mc_ki[i]; m3->mc_pg[i] = mn.mc_pg[i]; } } } else if (!did_split && m3->mc_top >= ptop && m3->mc_pg[ptop] == mc->mc_pg[ptop] && m3->mc_ki[ptop] >= mc->mc_ki[ptop]) { m3->mc_ki[ptop]++; } if (IS_LEAF(mp)) XCURSOR_REFRESH(m3, mc->mc_top, m3->mc_pg[mc->mc_top]); } } DPRINTF(("mp left: %d, rp left: %d", SIZELEFT(mp), SIZELEFT(rp))); done: if (copy) /* tmp page */ mdb_page_free(env, copy); if (rc) mc->mc_txn->mt_flags |= MDB_TXN_ERROR; return rc; } int mdb_put(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data, unsigned int flags) { MDB_cursor mc; MDB_xcursor mx; int rc; if (!key || !data || !TXN_DBI_EXIST(txn, dbi, DB_USRVALID)) return EINVAL; if (flags & ~(MDB_NOOVERWRITE|MDB_NODUPDATA|MDB_RESERVE|MDB_APPEND|MDB_APPENDDUP)) return EINVAL; if (txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_BLOCKED)) return (txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN; mdb_cursor_init(&mc, txn, dbi, &mx); mc.mc_next = txn->mt_cursors[dbi]; txn->mt_cursors[dbi] = &mc; rc = mdb_cursor_put(&mc, key, data, flags); txn->mt_cursors[dbi] = mc.mc_next; return rc; } #ifndef MDB_WBUF #define MDB_WBUF (1024*1024) #endif #define MDB_EOF 0x10 /**< #mdb_env_copyfd1() is done reading */ /** State needed for a double-buffering compacting copy. */ typedef struct mdb_copy { MDB_env *mc_env; MDB_txn *mc_txn; pthread_mutex_t mc_mutex; pthread_cond_t mc_cond; /**< Condition variable for #mc_new */ char *mc_wbuf[2]; char *mc_over[2]; int mc_wlen[2]; int mc_olen[2]; pgno_t mc_next_pgno; HANDLE mc_fd; int mc_toggle; /**< Buffer number in provider */ int mc_new; /**< (0-2 buffers to write) | (#MDB_EOF at end) */ /** Error code. Never cleared if set. Both threads can set nonzero * to fail the copy. Not mutex-protected, LMDB expects atomic int. */ volatile int mc_error; } mdb_copy; /** Dedicated writer thread for compacting copy. */ static THREAD_RET ESECT CALL_CONV mdb_env_copythr(void *arg) { mdb_copy *my = arg; char *ptr; int toggle = 0, wsize, rc; #ifdef _WIN32 DWORD len; #define DO_WRITE(rc, fd, ptr, w2, len) rc = WriteFile(fd, ptr, w2, &len, NULL) #else int len; #define DO_WRITE(rc, fd, ptr, w2, len) len = write(fd, ptr, w2); rc = (len >= 0) #ifdef SIGPIPE sigset_t set; sigemptyset(&set); sigaddset(&set, SIGPIPE); if ((rc = pthread_sigmask(SIG_BLOCK, &set, NULL)) != 0) my->mc_error = rc; #endif #endif pthread_mutex_lock(&my->mc_mutex); for(;;) { while (!my->mc_new) pthread_cond_wait(&my->mc_cond, &my->mc_mutex); if (my->mc_new == 0 + MDB_EOF) /* 0 buffers, just EOF */ break; wsize = my->mc_wlen[toggle]; ptr = my->mc_wbuf[toggle]; again: rc = MDB_SUCCESS; while (wsize > 0 && !my->mc_error) { DO_WRITE(rc, my->mc_fd, ptr, wsize, len); if (!rc) { rc = ErrCode(); #if defined(SIGPIPE) && !defined(_WIN32) if (rc == EPIPE) { /* Collect the pending SIGPIPE, otherwise at least OS X * gives it to the process on thread-exit (ITS#8504). */ int tmp; sigwait(&set, &tmp); } #endif break; } else if (len > 0) { rc = MDB_SUCCESS; ptr += len; wsize -= len; continue; } else { rc = EIO; break; } } if (rc) { my->mc_error = rc; } /* If there's an overflow page tail, write it too */ if (my->mc_olen[toggle]) { wsize = my->mc_olen[toggle]; ptr = my->mc_over[toggle]; my->mc_olen[toggle] = 0; goto again; } my->mc_wlen[toggle] = 0; toggle ^= 1; /* Return the empty buffer to provider */ my->mc_new--; pthread_cond_signal(&my->mc_cond); } pthread_mutex_unlock(&my->mc_mutex); return (THREAD_RET)0; #undef DO_WRITE } /** Give buffer and/or #MDB_EOF to writer thread, await unused buffer. * * @param[in] my control structure. * @param[in] adjust (1 to hand off 1 buffer) | (MDB_EOF when ending). */ static int ESECT mdb_env_cthr_toggle(mdb_copy *my, int adjust) { pthread_mutex_lock(&my->mc_mutex); my->mc_new += adjust; pthread_cond_signal(&my->mc_cond); while (my->mc_new & 2) /* both buffers in use */ pthread_cond_wait(&my->mc_cond, &my->mc_mutex); pthread_mutex_unlock(&my->mc_mutex); my->mc_toggle ^= (adjust & 1); /* Both threads reset mc_wlen, to be safe from threading errors */ my->mc_wlen[my->mc_toggle] = 0; return my->mc_error; } /** Depth-first tree traversal for compacting copy. * @param[in] my control structure. * @param[in,out] pg database root. * @param[in] flags includes #F_DUPDATA if it is a sorted-duplicate sub-DB. */ static int ESECT mdb_env_cwalk(mdb_copy *my, pgno_t *pg, int flags) { MDB_cursor mc = {0}; MDB_node *ni; MDB_page *mo, *mp, *leaf; char *buf, *ptr; int rc, toggle; unsigned int i; /* Empty DB, nothing to do */ if (*pg == P_INVALID) return MDB_SUCCESS; mc.mc_snum = 1; mc.mc_txn = my->mc_txn; rc = mdb_page_get(&mc, *pg, &mc.mc_pg[0], NULL); if (rc) return rc; rc = mdb_page_search_root(&mc, NULL, MDB_PS_FIRST); if (rc) return rc; /* Make cursor pages writable */ buf = ptr = malloc(my->mc_env->me_psize * mc.mc_snum); if (buf == NULL) return ENOMEM; for (i=0; imc_env->me_psize); mc.mc_pg[i] = (MDB_page *)ptr; ptr += my->mc_env->me_psize; } /* This is writable space for a leaf page. Usually not needed. */ leaf = (MDB_page *)ptr; toggle = my->mc_toggle; while (mc.mc_snum > 0) { unsigned n; mp = mc.mc_pg[mc.mc_top]; n = NUMKEYS(mp); if (IS_LEAF(mp)) { if (!IS_LEAF2(mp) && !(flags & F_DUPDATA)) { for (i=0; imn_flags & F_BIGDATA) { MDB_page *omp; pgno_t pg; /* Need writable leaf */ if (mp != leaf) { mc.mc_pg[mc.mc_top] = leaf; mdb_page_copy(leaf, mp, my->mc_env->me_psize); mp = leaf; ni = NODEPTR(mp, i); } memcpy(&pg, NODEDATA(ni), sizeof(pg)); memcpy(NODEDATA(ni), &my->mc_next_pgno, sizeof(pgno_t)); rc = mdb_page_get(&mc, pg, &omp, NULL); if (rc) goto done; if (my->mc_wlen[toggle] >= MDB_WBUF) { rc = mdb_env_cthr_toggle(my, 1); if (rc) goto done; toggle = my->mc_toggle; } mo = (MDB_page *)(my->mc_wbuf[toggle] + my->mc_wlen[toggle]); memcpy(mo, omp, my->mc_env->me_psize); mo->mp_pgno = my->mc_next_pgno; my->mc_next_pgno += omp->mp_pages; my->mc_wlen[toggle] += my->mc_env->me_psize; if (omp->mp_pages > 1) { my->mc_olen[toggle] = my->mc_env->me_psize * (omp->mp_pages - 1); my->mc_over[toggle] = (char *)omp + my->mc_env->me_psize; rc = mdb_env_cthr_toggle(my, 1); if (rc) goto done; toggle = my->mc_toggle; } } else if (ni->mn_flags & F_SUBDATA) { MDB_db db; /* Need writable leaf */ if (mp != leaf) { mc.mc_pg[mc.mc_top] = leaf; mdb_page_copy(leaf, mp, my->mc_env->me_psize); mp = leaf; ni = NODEPTR(mp, i); } memcpy(&db, NODEDATA(ni), sizeof(db)); my->mc_toggle = toggle; rc = mdb_env_cwalk(my, &db.md_root, ni->mn_flags & F_DUPDATA); if (rc) goto done; toggle = my->mc_toggle; memcpy(NODEDATA(ni), &db, sizeof(db)); } } } } else { mc.mc_ki[mc.mc_top]++; if (mc.mc_ki[mc.mc_top] < n) { pgno_t pg; again: ni = NODEPTR(mp, mc.mc_ki[mc.mc_top]); pg = NODEPGNO(ni); rc = mdb_page_get(&mc, pg, &mp, NULL); if (rc) goto done; mc.mc_top++; mc.mc_snum++; mc.mc_ki[mc.mc_top] = 0; if (IS_BRANCH(mp)) { /* Whenever we advance to a sibling branch page, * we must proceed all the way down to its first leaf. */ mdb_page_copy(mc.mc_pg[mc.mc_top], mp, my->mc_env->me_psize); goto again; } else mc.mc_pg[mc.mc_top] = mp; continue; } } if (my->mc_wlen[toggle] >= MDB_WBUF) { rc = mdb_env_cthr_toggle(my, 1); if (rc) goto done; toggle = my->mc_toggle; } mo = (MDB_page *)(my->mc_wbuf[toggle] + my->mc_wlen[toggle]); mdb_page_copy(mo, mp, my->mc_env->me_psize); mo->mp_pgno = my->mc_next_pgno++; my->mc_wlen[toggle] += my->mc_env->me_psize; if (mc.mc_top) { /* Update parent if there is one */ ni = NODEPTR(mc.mc_pg[mc.mc_top-1], mc.mc_ki[mc.mc_top-1]); SETPGNO(ni, mo->mp_pgno); mdb_cursor_pop(&mc); } else { /* Otherwise we're done */ *pg = mo->mp_pgno; break; } } done: free(buf); return rc; } /** Copy environment with compaction. */ static int ESECT mdb_env_copyfd1(MDB_env *env, HANDLE fd) { MDB_meta *mm; MDB_page *mp; mdb_copy my = {0}; MDB_txn *txn = NULL; pthread_t thr; pgno_t root, new_root; int rc = MDB_SUCCESS; #ifdef _WIN32 if (!(my.mc_mutex = CreateMutex(NULL, FALSE, NULL)) || !(my.mc_cond = CreateEvent(NULL, FALSE, FALSE, NULL))) { rc = ErrCode(); goto done; } my.mc_wbuf[0] = _aligned_malloc(MDB_WBUF*2, env->me_os_psize); if (my.mc_wbuf[0] == NULL) { /* _aligned_malloc() sets errno, but we use Windows error codes */ rc = ERROR_NOT_ENOUGH_MEMORY; goto done; } #else if ((rc = pthread_mutex_init(&my.mc_mutex, NULL)) != 0) return rc; if ((rc = pthread_cond_init(&my.mc_cond, NULL)) != 0) goto done2; #ifdef HAVE_MEMALIGN my.mc_wbuf[0] = memalign(env->me_os_psize, MDB_WBUF*2); if (my.mc_wbuf[0] == NULL) { rc = errno; goto done; } #else { void *p; if ((rc = posix_memalign(&p, env->me_os_psize, MDB_WBUF*2)) != 0) goto done; my.mc_wbuf[0] = p; } #endif #endif memset(my.mc_wbuf[0], 0, MDB_WBUF*2); my.mc_wbuf[1] = my.mc_wbuf[0] + MDB_WBUF; my.mc_next_pgno = NUM_METAS; my.mc_env = env; my.mc_fd = fd; rc = THREAD_CREATE(thr, mdb_env_copythr, &my); if (rc) goto done; rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn); if (rc) goto finish; mp = (MDB_page *)my.mc_wbuf[0]; memset(mp, 0, NUM_METAS * env->me_psize); mp->mp_pgno = 0; mp->mp_flags = P_META; mm = (MDB_meta *)METADATA(mp); mdb_env_init_meta0(env, mm); mm->mm_address = env->me_metas[0]->mm_address; mp = (MDB_page *)(my.mc_wbuf[0] + env->me_psize); mp->mp_pgno = 1; mp->mp_flags = P_META; *(MDB_meta *)METADATA(mp) = *mm; mm = (MDB_meta *)METADATA(mp); /* Set metapage 1 with current main DB */ root = new_root = txn->mt_dbs[MAIN_DBI].md_root; if (root != P_INVALID) { /* Count free pages + freeDB pages. Subtract from last_pg * to find the new last_pg, which also becomes the new root. */ MDB_ID freecount = 0; MDB_cursor mc; MDB_val key, data; mdb_cursor_init(&mc, txn, FREE_DBI, NULL); while ((rc = mdb_cursor_get(&mc, &key, &data, MDB_NEXT)) == 0) freecount += *(MDB_ID *)data.mv_data; if (rc != MDB_NOTFOUND) goto finish; freecount += txn->mt_dbs[FREE_DBI].md_branch_pages + txn->mt_dbs[FREE_DBI].md_leaf_pages + txn->mt_dbs[FREE_DBI].md_overflow_pages; new_root = txn->mt_next_pgno - 1 - freecount; mm->mm_last_pg = new_root; mm->mm_dbs[MAIN_DBI] = txn->mt_dbs[MAIN_DBI]; mm->mm_dbs[MAIN_DBI].md_root = new_root; } else { /* When the DB is empty, handle it specially to * fix any breakage like page leaks from ITS#8174. */ mm->mm_dbs[MAIN_DBI].md_flags = txn->mt_dbs[MAIN_DBI].md_flags; } if (root != P_INVALID || mm->mm_dbs[MAIN_DBI].md_flags) { mm->mm_txnid = 1; /* use metapage 1 */ } my.mc_wlen[0] = env->me_psize * NUM_METAS; my.mc_txn = txn; rc = mdb_env_cwalk(&my, &root, 0); if (rc == MDB_SUCCESS && root != new_root) { rc = MDB_INCOMPATIBLE; /* page leak or corrupt DB */ } finish: if (rc) my.mc_error = rc; mdb_env_cthr_toggle(&my, 1 | MDB_EOF); rc = THREAD_FINISH(thr); mdb_txn_abort(txn); done: #ifdef _WIN32 if (my.mc_wbuf[0]) _aligned_free(my.mc_wbuf[0]); if (my.mc_cond) CloseHandle(my.mc_cond); if (my.mc_mutex) CloseHandle(my.mc_mutex); #else free(my.mc_wbuf[0]); pthread_cond_destroy(&my.mc_cond); done2: pthread_mutex_destroy(&my.mc_mutex); #endif return rc ? rc : my.mc_error; } /** Copy environment as-is. */ static int ESECT mdb_env_copyfd0(MDB_env *env, HANDLE fd) { MDB_txn *txn = NULL; mdb_mutexref_t wmutex = NULL; int rc; size_t wsize, w3; char *ptr; #ifdef _WIN32 DWORD len, w2; #define DO_WRITE(rc, fd, ptr, w2, len) rc = WriteFile(fd, ptr, w2, &len, NULL) #else ssize_t len; size_t w2; #define DO_WRITE(rc, fd, ptr, w2, len) len = write(fd, ptr, w2); rc = (len >= 0) #endif /* Do the lock/unlock of the reader mutex before starting the * write txn. Otherwise other read txns could block writers. */ rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn); if (rc) return rc; if (env->me_txns) { /* We must start the actual read txn after blocking writers */ mdb_txn_end(txn, MDB_END_RESET_TMP); /* Temporarily block writers until we snapshot the meta pages */ wmutex = env->me_wmutex; if (LOCK_MUTEX(rc, env, wmutex)) goto leave; rc = mdb_txn_renew0(txn); if (rc) { UNLOCK_MUTEX(wmutex); goto leave; } } wsize = env->me_psize * NUM_METAS; ptr = env->me_map; w2 = wsize; while (w2 > 0) { DO_WRITE(rc, fd, ptr, w2, len); if (!rc) { rc = ErrCode(); break; } else if (len > 0) { rc = MDB_SUCCESS; ptr += len; w2 -= len; continue; } else { /* Non-blocking or async handles are not supported */ rc = EIO; break; } } if (wmutex) UNLOCK_MUTEX(wmutex); if (rc) goto leave; w3 = txn->mt_next_pgno * env->me_psize; { size_t fsize = 0; if ((rc = mdb_fsize(env->me_fd, &fsize))) goto leave; if (w3 > fsize) w3 = fsize; } wsize = w3 - wsize; while (wsize > 0) { if (wsize > MAX_WRITE) w2 = MAX_WRITE; else w2 = wsize; DO_WRITE(rc, fd, ptr, w2, len); if (!rc) { rc = ErrCode(); break; } else if (len > 0) { rc = MDB_SUCCESS; ptr += len; wsize -= len; continue; } else { rc = EIO; break; } } leave: mdb_txn_abort(txn); return rc; } int ESECT mdb_env_copyfd2(MDB_env *env, HANDLE fd, unsigned int flags) { if (flags & MDB_CP_COMPACT) return mdb_env_copyfd1(env, fd); else return mdb_env_copyfd0(env, fd); } int ESECT mdb_env_copyfd(MDB_env *env, HANDLE fd) { return mdb_env_copyfd2(env, fd, 0); } int ESECT mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags) { int rc; MDB_name fname; HANDLE newfd = INVALID_HANDLE_VALUE; rc = mdb_fname_init(path, env->me_flags | MDB_NOLOCK, &fname); if (rc == MDB_SUCCESS) { rc = mdb_fopen(env, &fname, MDB_O_COPY, 0666, &newfd); mdb_fname_destroy(fname); } if (rc == MDB_SUCCESS) { rc = mdb_env_copyfd2(env, newfd, flags); if (close(newfd) < 0 && rc == MDB_SUCCESS) rc = ErrCode(); } return rc; } int ESECT mdb_env_copy(MDB_env *env, const char *path) { return mdb_env_copy2(env, path, 0); } int ESECT mdb_env_set_flags(MDB_env *env, unsigned int flag, int onoff) { if (flag & ~CHANGEABLE) return EINVAL; if (onoff) env->me_flags |= flag; else env->me_flags &= ~flag; return MDB_SUCCESS; } int ESECT mdb_env_get_flags(MDB_env *env, unsigned int *arg) { if (!env || !arg) return EINVAL; *arg = env->me_flags & (CHANGEABLE|CHANGELESS); return MDB_SUCCESS; } int ESECT mdb_env_set_userctx(MDB_env *env, void *ctx) { if (!env) return EINVAL; env->me_userctx = ctx; return MDB_SUCCESS; } void * ESECT mdb_env_get_userctx(MDB_env *env) { return env ? env->me_userctx : NULL; } int ESECT mdb_env_set_assert(MDB_env *env, MDB_assert_func *func) { if (!env) return EINVAL; #ifndef NDEBUG env->me_assert_func = func; #endif return MDB_SUCCESS; } int ESECT mdb_env_get_path(MDB_env *env, const char **arg) { if (!env || !arg) return EINVAL; *arg = env->me_path; return MDB_SUCCESS; } int ESECT mdb_env_get_fd(MDB_env *env, mdb_filehandle_t *arg) { if (!env || !arg) return EINVAL; *arg = env->me_fd; return MDB_SUCCESS; } /** Common code for #mdb_stat() and #mdb_env_stat(). * @param[in] env the environment to operate in. * @param[in] db the #MDB_db record containing the stats to return. * @param[out] arg the address of an #MDB_stat structure to receive the stats. * @return 0, this function always succeeds. */ static int ESECT mdb_stat0(MDB_env *env, MDB_db *db, MDB_stat *arg) { arg->ms_psize = env->me_psize; arg->ms_depth = db->md_depth; arg->ms_branch_pages = db->md_branch_pages; arg->ms_leaf_pages = db->md_leaf_pages; arg->ms_overflow_pages = db->md_overflow_pages; arg->ms_entries = db->md_entries; return MDB_SUCCESS; } int ESECT mdb_env_stat(MDB_env *env, MDB_stat *arg) { MDB_meta *meta; if (env == NULL || arg == NULL) return EINVAL; meta = mdb_env_pick_meta(env); return mdb_stat0(env, &meta->mm_dbs[MAIN_DBI], arg); } int ESECT mdb_env_info(MDB_env *env, MDB_envinfo *arg) { MDB_meta *meta; if (env == NULL || arg == NULL) return EINVAL; meta = mdb_env_pick_meta(env); arg->me_mapaddr = meta->mm_address; arg->me_last_pgno = meta->mm_last_pg; arg->me_last_txnid = meta->mm_txnid; arg->me_mapsize = env->me_mapsize; arg->me_maxreaders = env->me_maxreaders; arg->me_numreaders = env->me_txns ? env->me_txns->mti_numreaders : 0; return MDB_SUCCESS; } /** Set the default comparison functions for a database. * Called immediately after a database is opened to set the defaults. * The user can then override them with #mdb_set_compare() or * #mdb_set_dupsort(). * @param[in] txn A transaction handle returned by #mdb_txn_begin() * @param[in] dbi A database handle returned by #mdb_dbi_open() */ static void mdb_default_cmp(MDB_txn *txn, MDB_dbi dbi) { uint16_t f = txn->mt_dbs[dbi].md_flags; txn->mt_dbxs[dbi].md_cmp = (f & MDB_REVERSEKEY) ? mdb_cmp_memnr : (f & MDB_INTEGERKEY) ? mdb_cmp_cint : mdb_cmp_memn; txn->mt_dbxs[dbi].md_dcmp = !(f & MDB_DUPSORT) ? 0 : ((f & MDB_INTEGERDUP) ? ((f & MDB_DUPFIXED) ? mdb_cmp_int : mdb_cmp_cint) : ((f & MDB_REVERSEDUP) ? mdb_cmp_memnr : mdb_cmp_memn)); } int mdb_dbi_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *dbi) { MDB_val key, data; MDB_dbi i; MDB_cursor mc; MDB_db dummy; int rc, dbflag, exact; unsigned int unused = 0, seq; char *namedup; size_t len; if (flags & ~VALID_FLAGS) return EINVAL; if (txn->mt_flags & MDB_TXN_BLOCKED) return MDB_BAD_TXN; /* main DB? */ if (!name) { *dbi = MAIN_DBI; if (flags & PERSISTENT_FLAGS) { uint16_t f2 = flags & PERSISTENT_FLAGS; /* make sure flag changes get committed */ if ((txn->mt_dbs[MAIN_DBI].md_flags | f2) != txn->mt_dbs[MAIN_DBI].md_flags) { txn->mt_dbs[MAIN_DBI].md_flags |= f2; txn->mt_flags |= MDB_TXN_DIRTY; } } mdb_default_cmp(txn, MAIN_DBI); return MDB_SUCCESS; } if (txn->mt_dbxs[MAIN_DBI].md_cmp == NULL) { mdb_default_cmp(txn, MAIN_DBI); } /* Is the DB already open? */ len = strlen(name); for (i=CORE_DBS; imt_numdbs; i++) { if (!txn->mt_dbxs[i].md_name.mv_size) { /* Remember this free slot */ if (!unused) unused = i; continue; } if (len == txn->mt_dbxs[i].md_name.mv_size && !strncmp(name, txn->mt_dbxs[i].md_name.mv_data, len)) { *dbi = i; return MDB_SUCCESS; } } /* If no free slot and max hit, fail */ if (!unused && txn->mt_numdbs >= txn->mt_env->me_maxdbs) return MDB_DBS_FULL; /* Cannot mix named databases with some mainDB flags */ if (txn->mt_dbs[MAIN_DBI].md_flags & (MDB_DUPSORT|MDB_INTEGERKEY)) return (flags & MDB_CREATE) ? MDB_INCOMPATIBLE : MDB_NOTFOUND; /* Find the DB info */ dbflag = DB_NEW|DB_VALID|DB_USRVALID; exact = 0; key.mv_size = len; key.mv_data = (void *)name; mdb_cursor_init(&mc, txn, MAIN_DBI, NULL); rc = mdb_cursor_set(&mc, &key, &data, MDB_SET, &exact); if (rc == MDB_SUCCESS) { /* make sure this is actually a DB */ MDB_node *node = NODEPTR(mc.mc_pg[mc.mc_top], mc.mc_ki[mc.mc_top]); if ((node->mn_flags & (F_DUPDATA|F_SUBDATA)) != F_SUBDATA) return MDB_INCOMPATIBLE; } else { if (rc != MDB_NOTFOUND || !(flags & MDB_CREATE)) return rc; if (F_ISSET(txn->mt_flags, MDB_TXN_RDONLY)) return EACCES; } /* Done here so we cannot fail after creating a new DB */ if ((namedup = strdup(name)) == NULL) return ENOMEM; if (rc) { /* MDB_NOTFOUND and MDB_CREATE: Create new DB */ data.mv_size = sizeof(MDB_db); data.mv_data = &dummy; memset(&dummy, 0, sizeof(dummy)); dummy.md_root = P_INVALID; dummy.md_flags = flags & PERSISTENT_FLAGS; WITH_CURSOR_TRACKING(mc, rc = mdb_cursor_put(&mc, &key, &data, F_SUBDATA)); dbflag |= DB_DIRTY; } if (rc) { free(namedup); } else { /* Got info, register DBI in this txn */ unsigned int slot = unused ? unused : txn->mt_numdbs; txn->mt_dbxs[slot].md_name.mv_data = namedup; txn->mt_dbxs[slot].md_name.mv_size = len; txn->mt_dbxs[slot].md_rel = NULL; txn->mt_dbflags[slot] = dbflag; /* txn-> and env-> are the same in read txns, use * tmp variable to avoid undefined assignment */ seq = ++txn->mt_env->me_dbiseqs[slot]; txn->mt_dbiseqs[slot] = seq; memcpy(&txn->mt_dbs[slot], data.mv_data, sizeof(MDB_db)); *dbi = slot; mdb_default_cmp(txn, slot); if (!unused) { txn->mt_numdbs++; } } return rc; } int ESECT mdb_stat(MDB_txn *txn, MDB_dbi dbi, MDB_stat *arg) { if (!arg || !TXN_DBI_EXIST(txn, dbi, DB_VALID)) return EINVAL; if (txn->mt_flags & MDB_TXN_BLOCKED) return MDB_BAD_TXN; if (txn->mt_dbflags[dbi] & DB_STALE) { MDB_cursor mc; MDB_xcursor mx; /* Stale, must read the DB's root. cursor_init does it for us. */ mdb_cursor_init(&mc, txn, dbi, &mx); } return mdb_stat0(txn->mt_env, &txn->mt_dbs[dbi], arg); } void mdb_dbi_close(MDB_env *env, MDB_dbi dbi) { char *ptr; if (dbi < CORE_DBS || dbi >= env->me_maxdbs) return; ptr = env->me_dbxs[dbi].md_name.mv_data; /* If there was no name, this was already closed */ if (ptr) { env->me_dbxs[dbi].md_name.mv_data = NULL; env->me_dbxs[dbi].md_name.mv_size = 0; env->me_dbflags[dbi] = 0; env->me_dbiseqs[dbi]++; free(ptr); } } int mdb_dbi_flags(MDB_txn *txn, MDB_dbi dbi, unsigned int *flags) { /* We could return the flags for the FREE_DBI too but what's the point? */ if (!TXN_DBI_EXIST(txn, dbi, DB_USRVALID)) return EINVAL; *flags = txn->mt_dbs[dbi].md_flags & PERSISTENT_FLAGS; return MDB_SUCCESS; } /** Add all the DB's pages to the free list. * @param[in] mc Cursor on the DB to free. * @param[in] subs non-Zero to check for sub-DBs in this DB. * @return 0 on success, non-zero on failure. */ static int mdb_drop0(MDB_cursor *mc, int subs) { int rc; rc = mdb_page_search(mc, NULL, MDB_PS_FIRST); if (rc == MDB_SUCCESS) { MDB_txn *txn = mc->mc_txn; MDB_node *ni; MDB_cursor mx; unsigned int i; /* DUPSORT sub-DBs have no ovpages/DBs. Omit scanning leaves. * This also avoids any P_LEAF2 pages, which have no nodes. * Also if the DB doesn't have sub-DBs and has no overflow * pages, omit scanning leaves. */ if ((mc->mc_flags & C_SUB) || (!subs && !mc->mc_db->md_overflow_pages)) mdb_cursor_pop(mc); mdb_cursor_copy(mc, &mx); while (mc->mc_snum > 0) { MDB_page *mp = mc->mc_pg[mc->mc_top]; unsigned n = NUMKEYS(mp); if (IS_LEAF(mp)) { for (i=0; imn_flags & F_BIGDATA) { MDB_page *omp; pgno_t pg; memcpy(&pg, NODEDATA(ni), sizeof(pg)); rc = mdb_page_get(mc, pg, &omp, NULL); if (rc != 0) goto done; mdb_cassert(mc, IS_OVERFLOW(omp)); rc = mdb_midl_append_range(&txn->mt_free_pgs, pg, omp->mp_pages); if (rc) goto done; mc->mc_db->md_overflow_pages -= omp->mp_pages; if (!mc->mc_db->md_overflow_pages && !subs) break; } else if (subs && (ni->mn_flags & F_SUBDATA)) { mdb_xcursor_init1(mc, ni); rc = mdb_drop0(&mc->mc_xcursor->mx_cursor, 0); if (rc) goto done; } } if (!subs && !mc->mc_db->md_overflow_pages) goto pop; } else { if ((rc = mdb_midl_need(&txn->mt_free_pgs, n)) != 0) goto done; for (i=0; imt_free_pgs, pg); } } if (!mc->mc_top) break; mc->mc_ki[mc->mc_top] = i; rc = mdb_cursor_sibling(mc, 1); if (rc) { if (rc != MDB_NOTFOUND) goto done; /* no more siblings, go back to beginning * of previous level. */ pop: mdb_cursor_pop(mc); mc->mc_ki[0] = 0; for (i=1; imc_snum; i++) { mc->mc_ki[i] = 0; mc->mc_pg[i] = mx.mc_pg[i]; } } } /* free it */ rc = mdb_midl_append(&txn->mt_free_pgs, mc->mc_db->md_root); done: if (rc) txn->mt_flags |= MDB_TXN_ERROR; } else if (rc == MDB_NOTFOUND) { rc = MDB_SUCCESS; } mc->mc_flags &= ~C_INITIALIZED; return rc; } int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del) { MDB_cursor *mc, *m2; int rc; if ((unsigned)del > 1 || !TXN_DBI_EXIST(txn, dbi, DB_USRVALID)) return EINVAL; if (F_ISSET(txn->mt_flags, MDB_TXN_RDONLY)) return EACCES; if (TXN_DBI_CHANGED(txn, dbi)) return MDB_BAD_DBI; rc = mdb_cursor_open(txn, dbi, &mc); if (rc) return rc; rc = mdb_drop0(mc, mc->mc_db->md_flags & MDB_DUPSORT); /* Invalidate the dropped DB's cursors */ for (m2 = txn->mt_cursors[dbi]; m2; m2 = m2->mc_next) m2->mc_flags &= ~(C_INITIALIZED|C_EOF); if (rc) goto leave; /* Can't delete the main DB */ if (del && dbi >= CORE_DBS) { rc = mdb_del0(txn, MAIN_DBI, &mc->mc_dbx->md_name, NULL, F_SUBDATA); if (!rc) { txn->mt_dbflags[dbi] = DB_STALE; mdb_dbi_close(txn->mt_env, dbi); } else { txn->mt_flags |= MDB_TXN_ERROR; } } else { /* reset the DB record, mark it dirty */ txn->mt_dbflags[dbi] |= DB_DIRTY; txn->mt_dbs[dbi].md_depth = 0; txn->mt_dbs[dbi].md_branch_pages = 0; txn->mt_dbs[dbi].md_leaf_pages = 0; txn->mt_dbs[dbi].md_overflow_pages = 0; txn->mt_dbs[dbi].md_entries = 0; txn->mt_dbs[dbi].md_root = P_INVALID; txn->mt_flags |= MDB_TXN_DIRTY; } leave: mdb_cursor_close(mc); return rc; } int mdb_set_compare(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp) { if (!TXN_DBI_EXIST(txn, dbi, DB_USRVALID)) return EINVAL; txn->mt_dbxs[dbi].md_cmp = cmp; return MDB_SUCCESS; } int mdb_set_dupsort(MDB_txn *txn, MDB_dbi dbi, MDB_cmp_func *cmp) { if (!TXN_DBI_EXIST(txn, dbi, DB_USRVALID)) return EINVAL; txn->mt_dbxs[dbi].md_dcmp = cmp; return MDB_SUCCESS; } int mdb_set_relfunc(MDB_txn *txn, MDB_dbi dbi, MDB_rel_func *rel) { if (!TXN_DBI_EXIST(txn, dbi, DB_USRVALID)) return EINVAL; txn->mt_dbxs[dbi].md_rel = rel; return MDB_SUCCESS; } int mdb_set_relctx(MDB_txn *txn, MDB_dbi dbi, void *ctx) { if (!TXN_DBI_EXIST(txn, dbi, DB_USRVALID)) return EINVAL; txn->mt_dbxs[dbi].md_relctx = ctx; return MDB_SUCCESS; } int ESECT mdb_env_get_maxkeysize(MDB_env *env) { return ENV_MAXKEY(env); } int ESECT mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx) { unsigned int i, rdrs; MDB_reader *mr; char buf[64]; int rc = 0, first = 1; if (!env || !func) return -1; if (!env->me_txns) { return func("(no reader locks)\n", ctx); } rdrs = env->me_txns->mti_numreaders; mr = env->me_txns->mti_readers; for (i=0; i> 1; cursor = base + pivot + 1; val = pid - ids[cursor]; if( val < 0 ) { n = pivot; } else if ( val > 0 ) { base = cursor; n -= pivot + 1; } else { /* found, so it's a duplicate */ return -1; } } if( val > 0 ) { ++cursor; } ids[0]++; for (n = ids[0]; n > cursor; n--) ids[n] = ids[n-1]; ids[n] = pid; return 0; } int ESECT mdb_reader_check(MDB_env *env, int *dead) { if (!env) return EINVAL; if (dead) *dead = 0; return env->me_txns ? mdb_reader_check0(env, 0, dead) : MDB_SUCCESS; } /** As #mdb_reader_check(). \b rlocked is set if caller locked #me_rmutex. */ static int ESECT mdb_reader_check0(MDB_env *env, int rlocked, int *dead) { mdb_mutexref_t rmutex = rlocked ? NULL : env->me_rmutex; unsigned int i, j, rdrs; MDB_reader *mr; MDB_PID_T *pids, pid; int rc = MDB_SUCCESS, count = 0; rdrs = env->me_txns->mti_numreaders; pids = malloc((rdrs+1) * sizeof(MDB_PID_T)); if (!pids) return ENOMEM; pids[0] = 0; mr = env->me_txns->mti_readers; for (i=0; ime_pid) { if (mdb_pid_insert(pids, pid) == 0) { if (!mdb_reader_pid(env, Pidcheck, pid)) { /* Stale reader found */ j = i; if (rmutex) { if ((rc = LOCK_MUTEX0(rmutex)) != 0) { if ((rc = mdb_mutex_failed(env, rmutex, rc))) break; rdrs = 0; /* the above checked all readers */ } else { /* Recheck, a new process may have reused pid */ if (mdb_reader_pid(env, Pidcheck, pid)) j = rdrs; } } for (; jme_rmutex); if (!rlocked) { /* Keep mti_txnid updated, otherwise next writer can * overwrite data which latest meta page refers to. */ meta = mdb_env_pick_meta(env); env->me_txns->mti_txnid = meta->mm_txnid; /* env is hosed if the dead thread was ours */ if (env->me_txn) { env->me_flags |= MDB_FATAL_ERROR; env->me_txn = NULL; rc = MDB_PANIC; } } DPRINTF(("%cmutex owner died, %s", (rlocked ? 'r' : 'w'), (rc ? "this process' env is hosed" : "recovering"))); rc2 = mdb_reader_check0(env, rlocked, NULL); if (rc2 == 0) rc2 = mdb_mutex_consistent(mutex); if (rc || (rc = rc2)) { DPRINTF(("LOCK_MUTEX recovery failed, %s", mdb_strerror(rc))); UNLOCK_MUTEX(mutex); } } else { #ifdef _WIN32 rc = ErrCode(); #endif DPRINTF(("LOCK_MUTEX failed, %s", mdb_strerror(rc))); } return rc; } #endif /* MDB_ROBUST_SUPPORTED */ #if defined(_WIN32) /** Convert \b src to new wchar_t[] string with room for \b xtra extra chars */ static int ESECT utf8_to_utf16(const char *src, MDB_name *dst, int xtra) { int rc, need = 0; wchar_t *result = NULL; for (;;) { /* malloc result, then fill it in */ need = MultiByteToWideChar(CP_UTF8, 0, src, -1, result, need); if (!need) { rc = ErrCode(); free(result); return rc; } if (!result) { result = malloc(sizeof(wchar_t) * (need + xtra)); if (!result) return ENOMEM; continue; } dst->mn_alloced = 1; dst->mn_len = need - 1; dst->mn_val = result; return MDB_SUCCESS; } } #endif /* defined(_WIN32) */ /** @} */ py-lmdb-py-lmdb_1.0.0/lib/midl.c000066400000000000000000000146741372223456500163640ustar00rootroot00000000000000/** @file midl.c * @brief ldap bdb back-end ID List functions */ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * * Copyright 2000-2019 The OpenLDAP Foundation. * Portions Copyright 2001-2018 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted only as authorized by the OpenLDAP * Public License. * * A copy of this license is available in the file LICENSE in the * top-level directory of the distribution or, alternatively, at * . */ #include #include #include #include #include #include "midl.h" /** @defgroup internal LMDB Internals * @{ */ /** @defgroup idls ID List Management * @{ */ #define CMP(x,y) ( (x) < (y) ? -1 : (x) > (y) ) unsigned mdb_midl_search( MDB_IDL ids, MDB_ID id ) { /* * binary search of id in ids * if found, returns position of id * if not found, returns first position greater than id */ unsigned base = 0; unsigned cursor = 1; int val = 0; unsigned n = ids[0]; while( 0 < n ) { unsigned pivot = n >> 1; cursor = base + pivot + 1; val = CMP( ids[cursor], id ); if( val < 0 ) { n = pivot; } else if ( val > 0 ) { base = cursor; n -= pivot + 1; } else { return cursor; } } if( val > 0 ) { ++cursor; } return cursor; } #if 0 /* superseded by append/sort */ int mdb_midl_insert( MDB_IDL ids, MDB_ID id ) { unsigned x, i; x = mdb_midl_search( ids, id ); assert( x > 0 ); if( x < 1 ) { /* internal error */ return -2; } if ( x <= ids[0] && ids[x] == id ) { /* duplicate */ assert(0); return -1; } if ( ++ids[0] >= MDB_IDL_DB_MAX ) { /* no room */ --ids[0]; return -2; } else { /* insert id */ for (i=ids[0]; i>x; i--) ids[i] = ids[i-1]; ids[x] = id; } return 0; } #endif MDB_IDL mdb_midl_alloc(int num) { MDB_IDL ids = malloc((num+2) * sizeof(MDB_ID)); if (ids) { *ids++ = num; *ids = 0; } return ids; } void mdb_midl_free(MDB_IDL ids) { if (ids) free(ids-1); } void mdb_midl_shrink( MDB_IDL *idp ) { MDB_IDL ids = *idp; if (*(--ids) > MDB_IDL_UM_MAX && (ids = realloc(ids, (MDB_IDL_UM_MAX+2) * sizeof(MDB_ID)))) { *ids++ = MDB_IDL_UM_MAX; *idp = ids; } } static int mdb_midl_grow( MDB_IDL *idp, int num ) { MDB_IDL idn = *idp-1; /* grow it */ idn = realloc(idn, (*idn + num + 2) * sizeof(MDB_ID)); if (!idn) return ENOMEM; *idn++ += num; *idp = idn; return 0; } int mdb_midl_need( MDB_IDL *idp, unsigned num ) { MDB_IDL ids = *idp; num += ids[0]; if (num > ids[-1]) { num = (num + num/4 + (256 + 2)) & -256; if (!(ids = realloc(ids-1, num * sizeof(MDB_ID)))) return ENOMEM; *ids++ = num - 2; *idp = ids; } return 0; } int mdb_midl_append( MDB_IDL *idp, MDB_ID id ) { MDB_IDL ids = *idp; /* Too big? */ if (ids[0] >= ids[-1]) { if (mdb_midl_grow(idp, MDB_IDL_UM_MAX)) return ENOMEM; ids = *idp; } ids[0]++; ids[ids[0]] = id; return 0; } int mdb_midl_append_list( MDB_IDL *idp, MDB_IDL app ) { MDB_IDL ids = *idp; /* Too big? */ if (ids[0] + app[0] >= ids[-1]) { if (mdb_midl_grow(idp, app[0])) return ENOMEM; ids = *idp; } memcpy(&ids[ids[0]+1], &app[1], app[0] * sizeof(MDB_ID)); ids[0] += app[0]; return 0; } int mdb_midl_append_range( MDB_IDL *idp, MDB_ID id, unsigned n ) { MDB_ID *ids = *idp, len = ids[0]; /* Too big? */ if (len + n > ids[-1]) { if (mdb_midl_grow(idp, n | MDB_IDL_UM_MAX)) return ENOMEM; ids = *idp; } ids[0] = len + n; ids += len; while (n) ids[n--] = id++; return 0; } void mdb_midl_xmerge( MDB_IDL idl, MDB_IDL merge ) { MDB_ID old_id, merge_id, i = merge[0], j = idl[0], k = i+j, total = k; idl[0] = (MDB_ID)-1; /* delimiter for idl scan below */ old_id = idl[j]; while (i) { merge_id = merge[i--]; for (; old_id < merge_id; old_id = idl[--j]) idl[k--] = old_id; idl[k--] = merge_id; } idl[0] = total; } /* Quicksort + Insertion sort for small arrays */ #define SMALL 8 #define MIDL_SWAP(a,b) { itmp=(a); (a)=(b); (b)=itmp; } void mdb_midl_sort( MDB_IDL ids ) { /* Max possible depth of int-indexed tree * 2 items/level */ int istack[sizeof(int)*CHAR_BIT * 2]; int i,j,k,l,ir,jstack; MDB_ID a, itmp; ir = (int)ids[0]; l = 1; jstack = 0; for(;;) { if (ir - l < SMALL) { /* Insertion sort */ for (j=l+1;j<=ir;j++) { a = ids[j]; for (i=j-1;i>=1;i--) { if (ids[i] >= a) break; ids[i+1] = ids[i]; } ids[i+1] = a; } if (jstack == 0) break; ir = istack[jstack--]; l = istack[jstack--]; } else { k = (l + ir) >> 1; /* Choose median of left, center, right */ MIDL_SWAP(ids[k], ids[l+1]); if (ids[l] < ids[ir]) { MIDL_SWAP(ids[l], ids[ir]); } if (ids[l+1] < ids[ir]) { MIDL_SWAP(ids[l+1], ids[ir]); } if (ids[l] < ids[l+1]) { MIDL_SWAP(ids[l], ids[l+1]); } i = l+1; j = ir; a = ids[l+1]; for(;;) { do i++; while(ids[i] > a); do j--; while(ids[j] < a); if (j < i) break; MIDL_SWAP(ids[i],ids[j]); } ids[l+1] = ids[j]; ids[j] = a; jstack += 2; if (ir-i+1 >= j-l) { istack[jstack] = ir; istack[jstack-1] = i; ir = j-1; } else { istack[jstack] = j-1; istack[jstack-1] = l; l = i; } } } } unsigned mdb_mid2l_search( MDB_ID2L ids, MDB_ID id ) { /* * binary search of id in ids * if found, returns position of id * if not found, returns first position greater than id */ unsigned base = 0; unsigned cursor = 1; int val = 0; unsigned n = (unsigned)ids[0].mid; while( 0 < n ) { unsigned pivot = n >> 1; cursor = base + pivot + 1; val = CMP( id, ids[cursor].mid ); if( val < 0 ) { n = pivot; } else if ( val > 0 ) { base = cursor; n -= pivot + 1; } else { return cursor; } } if( val > 0 ) { ++cursor; } return cursor; } int mdb_mid2l_insert( MDB_ID2L ids, MDB_ID2 *id ) { unsigned x, i; x = mdb_mid2l_search( ids, id->mid ); if( x < 1 ) { /* internal error */ return -2; } if ( x <= ids[0].mid && ids[x].mid == id->mid ) { /* duplicate */ return -1; } if ( ids[0].mid >= MDB_IDL_UM_MAX ) { /* too big */ return -2; } else { /* insert id */ ids[0].mid++; for (i=(unsigned)ids[0].mid; i>x; i--) ids[i] = ids[i-1]; ids[x] = *id; } return 0; } int mdb_mid2l_append( MDB_ID2L ids, MDB_ID2 *id ) { /* Too big? */ if (ids[0].mid >= MDB_IDL_UM_MAX) { return -2; } ids[0].mid++; ids[ids[0].mid] = *id; return 0; } /** @} */ /** @} */ py-lmdb-py-lmdb_1.0.0/lib/midl.h000066400000000000000000000131171372223456500163600ustar00rootroot00000000000000/** @file midl.h * @brief LMDB ID List header file. * * This file was originally part of back-bdb but has been * modified for use in libmdb. Most of the macros defined * in this file are unused, just left over from the original. * * This file is only used internally in libmdb and its definitions * are not exposed publicly. */ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * * Copyright 2000-2019 The OpenLDAP Foundation. * Portions Copyright 2001-2018 Howard Chu, Symas Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted only as authorized by the OpenLDAP * Public License. * * A copy of this license is available in the file LICENSE in the * top-level directory of the distribution or, alternatively, at * . */ #ifndef _MDB_MIDL_H_ #define _MDB_MIDL_H_ #include #ifdef __cplusplus extern "C" { #endif /** @defgroup internal LMDB Internals * @{ */ /** @defgroup idls ID List Management * @{ */ /** A generic unsigned ID number. These were entryIDs in back-bdb. * Preferably it should have the same size as a pointer. */ typedef size_t MDB_ID; /** An IDL is an ID List, a sorted array of IDs. The first * element of the array is a counter for how many actual * IDs are in the list. In the original back-bdb code, IDLs are * sorted in ascending order. For libmdb IDLs are sorted in * descending order. */ typedef MDB_ID *MDB_IDL; /* IDL sizes - likely should be even bigger * limiting factors: sizeof(ID), thread stack size */ #define MDB_IDL_LOGN 16 /* DB_SIZE is 2^16, UM_SIZE is 2^17 */ #define MDB_IDL_DB_SIZE (1< + * @param[in] txn Transaction used for the copy. If NULL, a temporary + * transaction will be used. This is only valid if the #MDB_CP_COMPACT + * flag is set. + * * @return A non-zero error value on failure and 0 on success. */ int mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags); +int mdb_env_copy3(MDB_env *env, const char *path, unsigned int flags, MDB_txn *txn); /** @brief Copy an LMDB environment to the specified file descriptor, * with options. @@ -701,9 +706,13 @@ int mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags); * have already been opened for Write access. * @param[in] flags Special options for this operation. * See #mdb_env_copy2() for options. + * @param[in] txn Transaction used for the copy. If NULL, a temporary + * transaction will be used. This is only valid if the #MDB_CP_COMPACT + * flag is set. * @return A non-zero error value on failure and 0 on success. */ int mdb_env_copyfd2(MDB_env *env, mdb_filehandle_t fd, unsigned int flags); +int mdb_env_copyfd3(MDB_env *env, mdb_filehandle_t fd, unsigned int flags, MDB_txn *txn); /** @brief Return statistics about the LMDB environment. * diff --git a/libraries/liblmdb/mdb.c b/libraries/liblmdb/mdb.c index 692feaa..5fdabd9 100644 --- a/libraries/liblmdb/mdb.c +++ b/libraries/liblmdb/mdb.c @@ -9309,12 +9309,12 @@ done: /** Copy environment with compaction. */ static int ESECT -mdb_env_copyfd1(MDB_env *env, HANDLE fd) +mdb_env_copyfd1(MDB_env *env, HANDLE fd, MDB_txn *txn) { MDB_meta *mm; MDB_page *mp; mdb_copy my = {0}; - MDB_txn *txn = NULL; + MDB_txn *orig_txn = txn; pthread_t thr; pgno_t root, new_root; int rc = MDB_SUCCESS; @@ -9360,9 +9360,11 @@ mdb_env_copyfd1(MDB_env *env, HANDLE fd) if (rc) goto done; - rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn); - if (rc) - goto finish; + if (!txn) { + rc = mdb_txn_begin(env, NULL, MDB_RDONLY, &txn); + if (rc) + goto finish; + } mp = (MDB_page *)my.mc_wbuf[0]; memset(mp, 0, NUM_METAS * env->me_psize); @@ -9422,7 +9424,8 @@ finish: my.mc_error = rc; mdb_env_cthr_toggle(&my, 1 | MDB_EOF); rc = THREAD_FINISH(thr); - mdb_txn_abort(txn); + if (!orig_txn) + mdb_txn_abort(txn); done: #ifdef _WIN32 @@ -9539,12 +9542,22 @@ leave: } int ESECT -mdb_env_copyfd2(MDB_env *env, HANDLE fd, unsigned int flags) +mdb_env_copyfd3(MDB_env *env, HANDLE fd, unsigned int flags, MDB_txn *txn) { if (flags & MDB_CP_COMPACT) - return mdb_env_copyfd1(env, fd); + return mdb_env_copyfd1(env, fd, txn); else + { + if (txn) /* may only use txn with compact */ + return EINVAL; return mdb_env_copyfd0(env, fd); + } +} + +int ESECT +mdb_env_copyfd2(MDB_env *env, HANDLE fd, unsigned int flags) +{ + return mdb_env_copyfd3(env, fd, flags, NULL); } int ESECT @@ -9555,6 +9568,12 @@ mdb_env_copyfd(MDB_env *env, HANDLE fd) int ESECT mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags) +{ + return mdb_env_copy3(env, path, flags, NULL); +} + +int ESECT +mdb_env_copy3(MDB_env *env, const char *path, unsigned int flags, MDB_txn *txn) { int rc; MDB_name fname; @@ -9566,7 +9585,7 @@ mdb_env_copy2(MDB_env *env, const char *path, unsigned int flags) mdb_fname_destroy(fname); } if (rc == MDB_SUCCESS) { - rc = mdb_env_copyfd2(env, newfd, flags); + rc = mdb_env_copyfd3(env, newfd, flags, txn); if (close(newfd) < 0 && rc == MDB_SUCCESS) rc = ErrCode(); } py-lmdb-py-lmdb_1.0.0/lib/py-lmdb/preload.h000066400000000000000000000032311372223456500204210ustar00rootroot00000000000000/* * Copyright 2015 The py-lmdb authors, all rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted only as authorized by the OpenLDAP * Public License. * * A copy of this license is available in the file LICENSE in the * top-level directory of the distribution or, alternatively, at * . * * OpenLDAP is a registered trademark of the OpenLDAP Foundation. * * Individual files and/or contributed packages may be copyright by * other parties and/or subject to additional restrictions. * * This work also contains materials derived from public sources. * * Additional information about OpenLDAP can be obtained at * . */ #ifndef LMDB_PRELOAD_H #define LMDB_PRELOAD_H #include /** * Touch a byte from every page in `x`, causing any read faults necessary for * copying the value to occur. This should be called with the GIL released, in * order to dramatically decrease the chances of a page fault being taken with * the GIL held. * * We do this since PyMalloc cannot be invoked with the GIL released, and we * cannot know the size of the MDB result value before dropping the GIL. This * seems the simplest and cheapest compromise to ensuring multithreaded Python * apps don't hard stall when dealing with a database larger than RAM. */ static void preload(int rc, void *x, size_t size) { if(rc == 0) { volatile char j; size_t i; for(i = 0; i < size; i += 4096) { j = ((volatile char *)x)[i]; } (void) j; /* -Wunused-variable */ } } #endif /* !LMDB_PRELOAD_H */ py-lmdb-py-lmdb_1.0.0/lib/win32-stdint/000077500000000000000000000000001372223456500175245ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/lib/win32-stdint/stdint.h000066400000000000000000000176341372223456500212150ustar00rootroot00000000000000// ISO C9x compliant stdint.h for Microsoft Visual Studio // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 // // Copyright (c) 2006-2013 Alexander Chemeris // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. Neither the name of the product nor the names of its contributors may // be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////////// #ifndef _MSC_VER // [ #error "Use this header only with Microsoft Visual C++ compilers!" #endif // _MSC_VER ] #ifndef _MSC_STDINT_H_ // [ #define _MSC_STDINT_H_ #if _MSC_VER > 1000 #pragma once #endif #if _MSC_VER >= 1600 // [ #include #else // ] _MSC_VER >= 1600 [ #include // For Visual Studio 6 in C++ mode and for many Visual Studio versions when // compiling for ARM we should wrap include with 'extern "C++" {}' // or compiler give many errors like this: // error C2733: second C linkage of overloaded function 'wmemchr' not allowed #ifdef __cplusplus extern "C" { #endif # include #ifdef __cplusplus } #endif // Define _W64 macros to mark types changing their size, like intptr_t. #ifndef _W64 # if !defined(__midl) && (defined(_X86_) || defined(_M_IX86)) && _MSC_VER >= 1300 # define _W64 __w64 # else # define _W64 # endif #endif // 7.18.1 Integer types // 7.18.1.1 Exact-width integer types // Visual Studio 6 and Embedded Visual C++ 4 doesn't // realize that, e.g. char has the same size as __int8 // so we give up on __intX for them. #if (_MSC_VER < 1300) typedef signed char int8_t; typedef signed short int16_t; typedef signed int int32_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; #else typedef signed __int8 int8_t; typedef signed __int16 int16_t; typedef signed __int32 int32_t; typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; typedef unsigned __int32 uint32_t; #endif typedef signed __int64 int64_t; typedef unsigned __int64 uint64_t; // 7.18.1.2 Minimum-width integer types typedef int8_t int_least8_t; typedef int16_t int_least16_t; typedef int32_t int_least32_t; typedef int64_t int_least64_t; typedef uint8_t uint_least8_t; typedef uint16_t uint_least16_t; typedef uint32_t uint_least32_t; typedef uint64_t uint_least64_t; // 7.18.1.3 Fastest minimum-width integer types typedef int8_t int_fast8_t; typedef int16_t int_fast16_t; typedef int32_t int_fast32_t; typedef int64_t int_fast64_t; typedef uint8_t uint_fast8_t; typedef uint16_t uint_fast16_t; typedef uint32_t uint_fast32_t; typedef uint64_t uint_fast64_t; // 7.18.1.4 Integer types capable of holding object pointers #ifdef _WIN64 // [ typedef signed __int64 intptr_t; typedef unsigned __int64 uintptr_t; #else // _WIN64 ][ typedef _W64 signed int intptr_t; typedef _W64 unsigned int uintptr_t; #endif // _WIN64 ] // 7.18.1.5 Greatest-width integer types typedef int64_t intmax_t; typedef uint64_t uintmax_t; // 7.18.2 Limits of specified-width integer types #if !defined(__cplusplus) || defined(__STDC_LIMIT_MACROS) // [ See footnote 220 at page 257 and footnote 221 at page 259 // 7.18.2.1 Limits of exact-width integer types #define INT8_MIN ((int8_t)_I8_MIN) #define INT8_MAX _I8_MAX #define INT16_MIN ((int16_t)_I16_MIN) #define INT16_MAX _I16_MAX #define INT32_MIN ((int32_t)_I32_MIN) #define INT32_MAX _I32_MAX #define INT64_MIN ((int64_t)_I64_MIN) #define INT64_MAX _I64_MAX #define UINT8_MAX _UI8_MAX #define UINT16_MAX _UI16_MAX #define UINT32_MAX _UI32_MAX #define UINT64_MAX _UI64_MAX // 7.18.2.2 Limits of minimum-width integer types #define INT_LEAST8_MIN INT8_MIN #define INT_LEAST8_MAX INT8_MAX #define INT_LEAST16_MIN INT16_MIN #define INT_LEAST16_MAX INT16_MAX #define INT_LEAST32_MIN INT32_MIN #define INT_LEAST32_MAX INT32_MAX #define INT_LEAST64_MIN INT64_MIN #define INT_LEAST64_MAX INT64_MAX #define UINT_LEAST8_MAX UINT8_MAX #define UINT_LEAST16_MAX UINT16_MAX #define UINT_LEAST32_MAX UINT32_MAX #define UINT_LEAST64_MAX UINT64_MAX // 7.18.2.3 Limits of fastest minimum-width integer types #define INT_FAST8_MIN INT8_MIN #define INT_FAST8_MAX INT8_MAX #define INT_FAST16_MIN INT16_MIN #define INT_FAST16_MAX INT16_MAX #define INT_FAST32_MIN INT32_MIN #define INT_FAST32_MAX INT32_MAX #define INT_FAST64_MIN INT64_MIN #define INT_FAST64_MAX INT64_MAX #define UINT_FAST8_MAX UINT8_MAX #define UINT_FAST16_MAX UINT16_MAX #define UINT_FAST32_MAX UINT32_MAX #define UINT_FAST64_MAX UINT64_MAX // 7.18.2.4 Limits of integer types capable of holding object pointers #ifdef _WIN64 // [ # define INTPTR_MIN INT64_MIN # define INTPTR_MAX INT64_MAX # define UINTPTR_MAX UINT64_MAX #else // _WIN64 ][ # define INTPTR_MIN INT32_MIN # define INTPTR_MAX INT32_MAX # define UINTPTR_MAX UINT32_MAX #endif // _WIN64 ] // 7.18.2.5 Limits of greatest-width integer types #define INTMAX_MIN INT64_MIN #define INTMAX_MAX INT64_MAX #define UINTMAX_MAX UINT64_MAX // 7.18.3 Limits of other integer types #ifdef _WIN64 // [ # define PTRDIFF_MIN _I64_MIN # define PTRDIFF_MAX _I64_MAX #else // _WIN64 ][ # define PTRDIFF_MIN _I32_MIN # define PTRDIFF_MAX _I32_MAX #endif // _WIN64 ] #define SIG_ATOMIC_MIN INT_MIN #define SIG_ATOMIC_MAX INT_MAX #ifndef SIZE_MAX // [ # ifdef _WIN64 // [ # define SIZE_MAX _UI64_MAX # else // _WIN64 ][ # define SIZE_MAX _UI32_MAX # endif // _WIN64 ] #endif // SIZE_MAX ] // WCHAR_MIN and WCHAR_MAX are also defined in #ifndef WCHAR_MIN // [ # define WCHAR_MIN 0 #endif // WCHAR_MIN ] #ifndef WCHAR_MAX // [ # define WCHAR_MAX _UI16_MAX #endif // WCHAR_MAX ] #define WINT_MIN 0 #define WINT_MAX _UI16_MAX #endif // __STDC_LIMIT_MACROS ] // 7.18.4 Limits of other integer types #if !defined(__cplusplus) || defined(__STDC_CONSTANT_MACROS) // [ See footnote 224 at page 260 // 7.18.4.1 Macros for minimum-width integer constants #define INT8_C(val) val##i8 #define INT16_C(val) val##i16 #define INT32_C(val) val##i32 #define INT64_C(val) val##i64 #define UINT8_C(val) val##ui8 #define UINT16_C(val) val##ui16 #define UINT32_C(val) val##ui32 #define UINT64_C(val) val##ui64 // 7.18.4.2 Macros for greatest-width integer constants // These #ifndef's are needed to prevent collisions with . // Check out Issue 9 for the details. #ifndef INTMAX_C // [ # define INTMAX_C INT64_C #endif // INTMAX_C ] #ifndef UINTMAX_C // [ # define UINTMAX_C UINT64_C #endif // UINTMAX_C ] #endif // __STDC_CONSTANT_MACROS ] #endif // _MSC_VER >= 1600 ] #endif // _MSC_STDINT_H_ ] py-lmdb-py-lmdb_1.0.0/lib/win32/000077500000000000000000000000001372223456500162215ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/lib/win32/inttypes.h000066400000000000000000000175631372223456500202650ustar00rootroot00000000000000// ISO C9x compliant inttypes.h for Microsoft Visual Studio // Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 // // Copyright (c) 2006-2013 Alexander Chemeris // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disclaimer. // // 2. Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in the // documentation and/or other materials provided with the distribution. // // 3. Neither the name of the product nor the names of its contributors may // be used to endorse or promote products derived from this software // without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED // WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF // MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO // EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; // OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR // OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF // ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // /////////////////////////////////////////////////////////////////////////////// #ifndef _MSC_VER // [ #error "Use this header only with Microsoft Visual C++ compilers!" #endif // _MSC_VER ] #ifndef _MSC_INTTYPES_H_ // [ #define _MSC_INTTYPES_H_ #if _MSC_VER > 1000 #pragma once #endif #include "stdint.h" // 7.8 Format conversion of integer types typedef struct { intmax_t quot; intmax_t rem; } imaxdiv_t; // 7.8.1 Macros for format specifiers #if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 // The fprintf macros for signed integers are: #define PRId8 "d" #define PRIi8 "i" #define PRIdLEAST8 "d" #define PRIiLEAST8 "i" #define PRIdFAST8 "d" #define PRIiFAST8 "i" #define PRId16 "hd" #define PRIi16 "hi" #define PRIdLEAST16 "hd" #define PRIiLEAST16 "hi" #define PRIdFAST16 "hd" #define PRIiFAST16 "hi" #define PRId32 "I32d" #define PRIi32 "I32i" #define PRIdLEAST32 "I32d" #define PRIiLEAST32 "I32i" #define PRIdFAST32 "I32d" #define PRIiFAST32 "I32i" #define PRId64 "I64d" #define PRIi64 "I64i" #define PRIdLEAST64 "I64d" #define PRIiLEAST64 "I64i" #define PRIdFAST64 "I64d" #define PRIiFAST64 "I64i" #define PRIdMAX "I64d" #define PRIiMAX "I64i" #define PRIdPTR "Id" #define PRIiPTR "Ii" // The fprintf macros for unsigned integers are: #define PRIo8 "o" #define PRIu8 "u" #define PRIx8 "x" #define PRIX8 "X" #define PRIoLEAST8 "o" #define PRIuLEAST8 "u" #define PRIxLEAST8 "x" #define PRIXLEAST8 "X" #define PRIoFAST8 "o" #define PRIuFAST8 "u" #define PRIxFAST8 "x" #define PRIXFAST8 "X" #define PRIo16 "ho" #define PRIu16 "hu" #define PRIx16 "hx" #define PRIX16 "hX" #define PRIoLEAST16 "ho" #define PRIuLEAST16 "hu" #define PRIxLEAST16 "hx" #define PRIXLEAST16 "hX" #define PRIoFAST16 "ho" #define PRIuFAST16 "hu" #define PRIxFAST16 "hx" #define PRIXFAST16 "hX" #define PRIo32 "I32o" #define PRIu32 "I32u" #define PRIx32 "I32x" #define PRIX32 "I32X" #define PRIoLEAST32 "I32o" #define PRIuLEAST32 "I32u" #define PRIxLEAST32 "I32x" #define PRIXLEAST32 "I32X" #define PRIoFAST32 "I32o" #define PRIuFAST32 "I32u" #define PRIxFAST32 "I32x" #define PRIXFAST32 "I32X" #define PRIo64 "I64o" #define PRIu64 "I64u" #define PRIx64 "I64x" #define PRIX64 "I64X" #define PRIoLEAST64 "I64o" #define PRIuLEAST64 "I64u" #define PRIxLEAST64 "I64x" #define PRIXLEAST64 "I64X" #define PRIoFAST64 "I64o" #define PRIuFAST64 "I64u" #define PRIxFAST64 "I64x" #define PRIXFAST64 "I64X" #define PRIoMAX "I64o" #define PRIuMAX "I64u" #define PRIxMAX "I64x" #define PRIXMAX "I64X" #define PRIoPTR "Io" #define PRIuPTR "Iu" #define PRIxPTR "Ix" #define PRIXPTR "IX" // The fscanf macros for signed integers are: #define SCNd8 "d" #define SCNi8 "i" #define SCNdLEAST8 "d" #define SCNiLEAST8 "i" #define SCNdFAST8 "d" #define SCNiFAST8 "i" #define SCNd16 "hd" #define SCNi16 "hi" #define SCNdLEAST16 "hd" #define SCNiLEAST16 "hi" #define SCNdFAST16 "hd" #define SCNiFAST16 "hi" #define SCNd32 "ld" #define SCNi32 "li" #define SCNdLEAST32 "ld" #define SCNiLEAST32 "li" #define SCNdFAST32 "ld" #define SCNiFAST32 "li" #define SCNd64 "I64d" #define SCNi64 "I64i" #define SCNdLEAST64 "I64d" #define SCNiLEAST64 "I64i" #define SCNdFAST64 "I64d" #define SCNiFAST64 "I64i" #define SCNdMAX "I64d" #define SCNiMAX "I64i" #ifdef _WIN64 // [ # define SCNdPTR "I64d" # define SCNiPTR "I64i" #else // _WIN64 ][ # define SCNdPTR "ld" # define SCNiPTR "li" #endif // _WIN64 ] // The fscanf macros for unsigned integers are: #define SCNo8 "o" #define SCNu8 "u" #define SCNx8 "x" #define SCNX8 "X" #define SCNoLEAST8 "o" #define SCNuLEAST8 "u" #define SCNxLEAST8 "x" #define SCNXLEAST8 "X" #define SCNoFAST8 "o" #define SCNuFAST8 "u" #define SCNxFAST8 "x" #define SCNXFAST8 "X" #define SCNo16 "ho" #define SCNu16 "hu" #define SCNx16 "hx" #define SCNX16 "hX" #define SCNoLEAST16 "ho" #define SCNuLEAST16 "hu" #define SCNxLEAST16 "hx" #define SCNXLEAST16 "hX" #define SCNoFAST16 "ho" #define SCNuFAST16 "hu" #define SCNxFAST16 "hx" #define SCNXFAST16 "hX" #define SCNo32 "lo" #define SCNu32 "lu" #define SCNx32 "lx" #define SCNX32 "lX" #define SCNoLEAST32 "lo" #define SCNuLEAST32 "lu" #define SCNxLEAST32 "lx" #define SCNXLEAST32 "lX" #define SCNoFAST32 "lo" #define SCNuFAST32 "lu" #define SCNxFAST32 "lx" #define SCNXFAST32 "lX" #define SCNo64 "I64o" #define SCNu64 "I64u" #define SCNx64 "I64x" #define SCNX64 "I64X" #define SCNoLEAST64 "I64o" #define SCNuLEAST64 "I64u" #define SCNxLEAST64 "I64x" #define SCNXLEAST64 "I64X" #define SCNoFAST64 "I64o" #define SCNuFAST64 "I64u" #define SCNxFAST64 "I64x" #define SCNXFAST64 "I64X" #define SCNoMAX "I64o" #define SCNuMAX "I64u" #define SCNxMAX "I64x" #define SCNXMAX "I64X" #ifdef _WIN64 // [ # define SCNoPTR "I64o" # define SCNuPTR "I64u" # define SCNxPTR "I64x" # define SCNXPTR "I64X" #else // _WIN64 ][ # define SCNoPTR "lo" # define SCNuPTR "lu" # define SCNxPTR "lx" # define SCNXPTR "lX" #endif // _WIN64 ] #endif // __STDC_FORMAT_MACROS ] // 7.8.2 Functions for greatest-width integer types // 7.8.2.1 The imaxabs function #define imaxabs _abs64 // 7.8.2.2 The imaxdiv function // This is modified version of div() function from Microsoft's div.c found // in %MSVC.NET%\crt\src\div.c #ifdef STATIC_IMAXDIV // [ static #else // STATIC_IMAXDIV ][ _inline #endif // STATIC_IMAXDIV ] imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) { imaxdiv_t result; result.quot = numer / denom; result.rem = numer % denom; if (numer < 0 && result.rem > 0) { // did division wrong; must fix up ++result.quot; result.rem -= denom; } return result; } // 7.8.2.3 The strtoimax and strtoumax functions #define strtoimax _strtoi64 #define strtoumax _strtoui64 // 7.8.2.4 The wcstoimax and wcstoumax functions #define wcstoimax _wcstoi64 #define wcstoumax _wcstoui64 #endif // _MSC_INTTYPES_H_ ] py-lmdb-py-lmdb_1.0.0/lib/win32/unistd.h000066400000000000000000000000001372223456500176660ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/lmdb/000077500000000000000000000000001372223456500154275ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/lmdb/__init__.py000066400000000000000000000032511372223456500175410ustar00rootroot00000000000000# Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . """ Python wrapper for OpenLDAP's "Lightning" MDB database. Please see https://lmdb.readthedocs.io/ """ import os import sys def _reading_docs(): # Hack: disable speedups while testing or reading docstrings. Don't check # for basename for embedded python - variable 'argv' does not exists there or is empty. if not(hasattr(sys, 'argv')) or not sys.argv: return False basename = os.path.basename(sys.argv[0]) return any(x in basename for x in ('sphinx-build', 'pydoc')) try: if _reading_docs() or os.getenv('LMDB_FORCE_CFFI') is not None: raise ImportError from lmdb.cpython import * from lmdb.cpython import open from lmdb.cpython import __all__ except ImportError: if (not _reading_docs()) and os.getenv('LMDB_FORCE_CPYTHON') is not None: raise from lmdb.cffi import * from lmdb.cffi import open from lmdb.cffi import __all__ from lmdb.cffi import __doc__ __version__ = '1.0.0' py-lmdb-py-lmdb_1.0.0/lmdb/__main__.py000066400000000000000000000015351372223456500175250ustar00rootroot00000000000000# Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # Hack to support Python >=v2.6 'pythom -mlmdb' from __future__ import absolute_import import lmdb.tool lmdb.tool.main() py-lmdb-py-lmdb_1.0.0/lmdb/cffi.py000066400000000000000000002527731372223456500167300ustar00rootroot00000000000000# # Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # """ CPython/CFFI wrapper for OpenLDAP's "Lightning" MDB database. Please see https://lmdb.readthedocs.io/ """ from __future__ import absolute_import from __future__ import with_statement import errno import inspect import os import sys import threading is_win32 = sys.platform == 'win32' if is_win32: import msvcrt try: import __builtin__ except ImportError: import builtins as __builtin__ import lmdb try: from lmdb import _config except ImportError: _config = None __all__ = [ 'Cursor', 'Environment', 'Transaction', '_Database', 'enable_drop_gil', 'version', ] __all__ += [ 'BadDbiError', 'BadRslotError', 'BadTxnError', 'BadValsizeError', 'CorruptedError', 'CursorFullError', 'DbsFullError', 'DiskError', 'Error', 'IncompatibleError', 'InvalidError', 'InvalidParameterError', 'KeyExistsError', 'LockError', 'MapFullError', 'MapResizedError', 'MemoryError', 'NotFoundError', 'PageFullError', 'PageNotFoundError', 'PanicError', 'ReadersFullError', 'ReadonlyError', 'TlsFullError', 'TxnFullError', 'VersionMismatchError', ] # Handle moronic Python 3 mess. UnicodeType = getattr(__builtin__, 'unicode', str) BytesType = getattr(__builtin__, 'bytes', str) O_0755 = int('0755', 8) O_0111 = int('0111', 8) EMPTY_BYTES = UnicodeType().encode() # Used to track context across CFFI callbacks. _callbacks = threading.local() _CFFI_CDEF = ''' typedef int mode_t; typedef ... MDB_env; typedef struct MDB_txn MDB_txn; typedef struct MDB_cursor MDB_cursor; typedef unsigned int MDB_dbi; enum MDB_cursor_op { MDB_FIRST, MDB_FIRST_DUP, MDB_GET_BOTH, MDB_GET_BOTH_RANGE, MDB_GET_CURRENT, MDB_GET_MULTIPLE, MDB_LAST, MDB_LAST_DUP, MDB_NEXT, MDB_NEXT_DUP, MDB_NEXT_MULTIPLE, MDB_NEXT_NODUP, MDB_PREV, MDB_PREV_DUP, MDB_PREV_NODUP, MDB_SET, MDB_SET_KEY, MDB_SET_RANGE, ... }; typedef enum MDB_cursor_op MDB_cursor_op; struct MDB_val { size_t mv_size; void *mv_data; ...; }; typedef struct MDB_val MDB_val; struct MDB_stat { unsigned int ms_psize; unsigned int ms_depth; size_t ms_branch_pages; size_t ms_leaf_pages; size_t ms_overflow_pages; size_t ms_entries; ...; }; typedef struct MDB_stat MDB_stat; struct MDB_envinfo { void *me_mapaddr; size_t me_mapsize; size_t me_last_pgno; size_t me_last_txnid; unsigned int me_maxreaders; unsigned int me_numreaders; ...; }; typedef struct MDB_envinfo MDB_envinfo; typedef int (*MDB_cmp_func)(const MDB_val *a, const MDB_val *b); typedef void (*MDB_rel_func)(MDB_val *item, void *oldptr, void *newptr, void *relctx); char *mdb_strerror(int err); int mdb_env_create(MDB_env **env); int mdb_env_open(MDB_env *env, const char *path, unsigned int flags, mode_t mode); int mdb_env_copy2(MDB_env *env, const char *path, int flags); int mdb_env_copyfd2(MDB_env *env, int fd, int flags); int mdb_env_stat(MDB_env *env, MDB_stat *stat); int mdb_env_info(MDB_env *env, MDB_envinfo *stat); int mdb_env_get_maxkeysize(MDB_env *env); int mdb_env_sync(MDB_env *env, int force); void mdb_env_close(MDB_env *env); int mdb_env_set_flags(MDB_env *env, unsigned int flags, int onoff); int mdb_env_get_flags(MDB_env *env, unsigned int *flags); int mdb_env_get_path(MDB_env *env, const char **path); int mdb_env_set_mapsize(MDB_env *env, size_t size); int mdb_env_set_maxreaders(MDB_env *env, unsigned int readers); int mdb_env_get_maxreaders(MDB_env *env, unsigned int *readers); int mdb_env_set_maxdbs(MDB_env *env, MDB_dbi dbs); int mdb_txn_begin(MDB_env *env, MDB_txn *parent, unsigned int flags, MDB_txn **txn); int mdb_txn_commit(MDB_txn *txn); void mdb_txn_reset(MDB_txn *txn); int mdb_txn_renew(MDB_txn *txn); void mdb_txn_abort(MDB_txn *txn); size_t mdb_txn_id(MDB_txn *txn); int mdb_dbi_open(MDB_txn *txn, const char *name, unsigned int flags, MDB_dbi *dbi); int mdb_stat(MDB_txn *txn, MDB_dbi dbi, MDB_stat *stat); int mdb_drop(MDB_txn *txn, MDB_dbi dbi, int del_); int mdb_get(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data); int mdb_cursor_open(MDB_txn *txn, MDB_dbi dbi, MDB_cursor **cursor); void mdb_cursor_close(MDB_cursor *cursor); int mdb_cursor_del(MDB_cursor *cursor, unsigned int flags); int mdb_cursor_count(MDB_cursor *cursor, size_t *countp); int mdb_cursor_get(MDB_cursor *cursor, MDB_val *key, MDB_val*data, int op); typedef int (MDB_msg_func)(const char *msg, void *ctx); int mdb_reader_list(MDB_env *env, MDB_msg_func *func, void *ctx); int mdb_reader_check(MDB_env *env, int *dead); int mdb_dbi_flags(MDB_txn *txn, MDB_dbi dbi, unsigned int *flags); #define MDB_VERSION_MAJOR ... #define MDB_VERSION_MINOR ... #define MDB_VERSION_PATCH ... #define EACCES ... #define EAGAIN ... #define EINVAL ... #define ENOMEM ... #define ENOSPC ... #define MDB_BAD_RSLOT ... #define MDB_BAD_DBI ... #define MDB_BAD_TXN ... #define MDB_BAD_VALSIZE ... #define MDB_CORRUPTED ... #define MDB_CURSOR_FULL ... #define MDB_DBS_FULL ... #define MDB_INCOMPATIBLE ... #define MDB_INVALID ... #define MDB_KEYEXIST ... #define MDB_MAP_FULL ... #define MDB_MAP_RESIZED ... #define MDB_NOTFOUND ... #define MDB_PAGE_FULL ... #define MDB_PAGE_NOTFOUND ... #define MDB_PANIC ... #define MDB_READERS_FULL ... #define MDB_TLS_FULL ... #define MDB_TXN_FULL ... #define MDB_VERSION_MISMATCH ... #define MDB_APPEND ... #define MDB_APPENDDUP ... #define MDB_CP_COMPACT ... #define MDB_CREATE ... #define MDB_DUPFIXED ... #define MDB_DUPSORT ... #define MDB_INTEGERDUP ... #define MDB_INTEGERKEY ... #define MDB_MAPASYNC ... #define MDB_NODUPDATA ... #define MDB_NOLOCK ... #define MDB_NOMEMINIT ... #define MDB_NOMETASYNC ... #define MDB_NOOVERWRITE ... #define MDB_NORDAHEAD ... #define MDB_NOSUBDIR ... #define MDB_NOSYNC ... #define MDB_NOTLS ... #define MDB_RDONLY ... #define MDB_REVERSEKEY ... #define MDB_WRITEMAP ... // Helpers below inline MDB_vals. Avoids key alloc/dup on CPython, where // CFFI will use PyString_AS_STRING when passed as an argument. static int pymdb_del(MDB_txn *txn, MDB_dbi dbi, char *key_s, size_t keylen, char *val_s, size_t vallen); static int pymdb_put(MDB_txn *txn, MDB_dbi dbi, char *key_s, size_t keylen, char *val_s, size_t vallen, unsigned int flags); static int pymdb_get(MDB_txn *txn, MDB_dbi dbi, char *key_s, size_t keylen, MDB_val *val_out); static int pymdb_cursor_get(MDB_cursor *cursor, char *key_s, size_t key_len, char *data_s, size_t data_len, MDB_val *key, MDB_val *data, int op); static int pymdb_cursor_put(MDB_cursor *cursor, char *key_s, size_t keylen, char *val_s, size_t vallen, int flags); // Prefaults a range static void preload(int rc, void *x, size_t size); ''' _CFFI_CDEF_PATCHED = ''' int mdb_env_copy3(MDB_env *env, const char *path, unsigned int flags, MDB_txn *txn); int mdb_env_copyfd3(MDB_env *env, int fd, unsigned int flags, MDB_txn *txn); ''' _CFFI_VERIFY = ''' #include #include "lmdb.h" #include "preload.h" // Helpers below inline MDB_vals. Avoids key alloc/dup on CPython, where // CFFI will use PyString_AS_STRING when passed as an argument. static int pymdb_get(MDB_txn *txn, MDB_dbi dbi, char *key_s, size_t keylen, MDB_val *val_out) { MDB_val key = {keylen, key_s}; int rc = mdb_get(txn, dbi, &key, val_out); return rc; } static int pymdb_put(MDB_txn *txn, MDB_dbi dbi, char *key_s, size_t keylen, char *val_s, size_t vallen, unsigned int flags) { MDB_val key = {keylen, key_s}; MDB_val val = {vallen, val_s}; return mdb_put(txn, dbi, &key, &val, flags); } static int pymdb_del(MDB_txn *txn, MDB_dbi dbi, char *key_s, size_t keylen, char *val_s, size_t vallen) { MDB_val key = {keylen, key_s}; MDB_val val = {vallen, val_s}; MDB_val *valptr; if(vallen == 0) { valptr = NULL; } else { valptr = &val; } return mdb_del(txn, dbi, &key, valptr); } static int pymdb_cursor_get(MDB_cursor *cursor, char *key_s, size_t key_len, char *data_s, size_t data_len, MDB_val *key, MDB_val *data, int op) { MDB_val tmp_key = {key_len, key_s}; MDB_val tmp_data = {data_len, data_s}; int rc = mdb_cursor_get(cursor, &tmp_key, &tmp_data, op); if(! rc) { *key = tmp_key; *data = tmp_data; } return rc; } static int pymdb_cursor_put(MDB_cursor *cursor, char *key_s, size_t keylen, char *val_s, size_t vallen, int flags) { MDB_val tmpkey = {keylen, key_s}; MDB_val tmpval = {vallen, val_s}; return mdb_cursor_put(cursor, &tmpkey, &tmpval, flags); } ''' if not lmdb._reading_docs(): import cffi # Try to use distutils-bundled CFFI configuration to avoid a recompile and # potential compile errors during first module import. _config_vars = _config.CONFIG if _config else { 'extra_compile_args': ['-w'], 'extra_sources': ['lib/mdb.c', 'lib/midl.c'], 'extra_include_dirs': ['lib'], 'extra_library_dirs': [], 'libraries': [] } _have_patched_lmdb = '-DHAVE_PATCHED_LMDB=1' in _config.CONFIG['extra_compile_args'] if _have_patched_lmdb: _CFFI_CDEF += _CFFI_CDEF_PATCHED _ffi = cffi.FFI() _ffi.cdef(_CFFI_CDEF) _lib = _ffi.verify(_CFFI_VERIFY, modulename='lmdb_cffi', ext_package='lmdb', sources=_config_vars['extra_sources'], extra_compile_args=_config_vars['extra_compile_args'], include_dirs=_config_vars['extra_include_dirs'], libraries=_config_vars['libraries'], library_dirs=_config_vars['extra_library_dirs']) @_ffi.callback("int(char *, void *)") def _msg_func(s, _): """mdb_msg_func() callback. Appends `s` to _callbacks.msg_func list. """ _callbacks.msg_func.append(_ffi.string(s).decode()) return 0 class Error(Exception): """Raised when an LMDB-related error occurs, and no more specific :py:class:`lmdb.Error` subclass exists.""" def __init__(self, what, code=0): self.what = what self.code = code self.reason = _ffi.string(_lib.mdb_strerror(code)) msg = what if code: msg = '%s: %s' % (what, self.reason) hint = getattr(self, 'MDB_HINT', None) if hint: msg += ' (%s)' % (hint,) Exception.__init__(self, msg) class KeyExistsError(Error): """Key/data pair already exists.""" MDB_NAME = 'MDB_KEYEXIST' class NotFoundError(Error): """No matching key/data pair found. Normally py-lmdb indicates a missing key by returning ``None``, or a user-supplied default value, however LMDB may return this error where py-lmdb does not know to convert it into a non-exceptional return. """ MDB_NAME = 'MDB_NOTFOUND' class PageNotFoundError(Error): """Request page not found.""" MDB_NAME = 'MDB_PAGE_NOTFOUND' class CorruptedError(Error): """Located page was of the wrong type.""" MDB_NAME = 'MDB_CORRUPTED' class PanicError(Error): """Update of meta page failed.""" MDB_NAME = 'MDB_PANIC' class VersionMismatchError(Error): """Database environment version mismatch.""" MDB_NAME = 'MDB_VERSION_MISMATCH' class InvalidError(Error): """File is not an MDB file.""" MDB_NAME = 'MDB_INVALID' class MapFullError(Error): """Environment map_size= limit reached.""" MDB_NAME = 'MDB_MAP_FULL' MDB_HINT = 'Please use a larger Environment(map_size=) parameter' class DbsFullError(Error): """Environment max_dbs= limit reached.""" MDB_NAME = 'MDB_DBS_FULL' MDB_HINT = 'Please use a larger Environment(max_dbs=) parameter' class ReadersFullError(Error): """Environment max_readers= limit reached.""" MDB_NAME = 'MDB_READERS_FULL' MDB_HINT = 'Please use a larger Environment(max_readers=) parameter' class TlsFullError(Error): """Thread-local storage keys full - too many environments open.""" MDB_NAME = 'MDB_TLS_FULL' class TxnFullError(Error): """Transaciton has too many dirty pages - transaction too big.""" MDB_NAME = 'MDB_TXN_FULL' MDB_HINT = 'Please do less work within your transaction' class CursorFullError(Error): """Internal error - cursor stack limit reached.""" MDB_NAME = 'MDB_CURSOR_FULL' class PageFullError(Error): """Internal error - page has no more space.""" MDB_NAME = 'MDB_PAGE_FULL' class MapResizedError(Error): """Database contents grew beyond environment map_size=.""" MDB_NAME = 'MDB_MAP_RESIZED' class IncompatibleError(Error): """Operation and DB incompatible, or DB flags changed.""" MDB_NAME = 'MDB_INCOMPATIBLE' class BadRslotError(Error): """Invalid reuse of reader locktable slot.""" MDB_NAME = 'MDB_BAD_RSLOT' class BadDbiError(Error): """The specified DBI was changed unexpectedly.""" MDB_NAME = 'MDB_BAD_DBI' class BadTxnError(Error): """Transaction cannot recover - it must be aborted.""" MDB_NAME = 'MDB_BAD_TXN' class BadValsizeError(Error): """Too big key/data, key is empty, or wrong DUPFIXED size.""" MDB_NAME = 'MDB_BAD_VALSIZE' class ReadonlyError(Error): """An attempt was made to modify a read-only database.""" MDB_NAME = 'EACCES' class InvalidParameterError(Error): """An invalid parameter was specified.""" MDB_NAME = 'EINVAL' class LockError(Error): """The environment was locked by another process.""" MDB_NAME = 'EAGAIN' class MemoryError(Error): """Out of memory.""" MDB_NAME = 'ENOMEM' class DiskError(Error): """No more disk space.""" MDB_NAME = 'ENOSPC' # Prepare _error_map, a mapping of integer MDB_ERROR_CODE to exception class. if not lmdb._reading_docs(): _error_map = {} for obj in list(globals().values()): if inspect.isclass(obj) and issubclass(obj, Error) and obj is not Error: _error_map[getattr(_lib, obj.MDB_NAME)] = obj del obj def _error(what, rc): """Lookup and instantiate the correct exception class for the error code `rc`, using :py:class:`Error` if no better class exists.""" return _error_map.get(rc, Error)(what, rc) class Some_LMDB_Resource_That_Was_Deleted_Or_Closed(object): """We need this because CFFI on PyPy treats None as cffi.NULL, instead of throwing an exception it feeds LMDB null pointers. That means simply replacing native handles with None during _invalidate() will cause NULL pointer dereferences. Instead use this class, and its weird name to cause a TypeError, with a very obvious string in the exception text. The only alternatives to this are inserting a check around every single use of a native handle to ensure the handle is still valid prior to calling LMDB, or doing no crash-safety checking at all. """ def __nonzero__(self): return 0 def __bool__(self): return False def __repr__(self): return "" _invalid = Some_LMDB_Resource_That_Was_Deleted_Or_Closed() def _mvbuf(mv): """Convert a MDB_val cdata to a CFFI buffer object.""" return _ffi.buffer(mv.mv_data, mv.mv_size) def _mvstr(mv): """Convert a MDB_val cdata to Python bytes.""" return _ffi.buffer(mv.mv_data, mv.mv_size)[:] def preload(mv): _lib.preload(0, mv.mv_data, mv.mv_size) def enable_drop_gil(): """Deprecated.""" def version(subpatch=False): """ Return a tuple of integers `(major, minor, patch)` describing the LMDB library version that the binding is linked against. The version of the binding itself is available from ``lmdb.__version__``. `subpatch`: If true, returns a 4 integer tuple consisting of the same plus an extra integer that represents any patches applied by py-lmdb itself (0 representing no patches). """ if subpatch: return (_lib.MDB_VERSION_MAJOR, _lib.MDB_VERSION_MINOR, _lib.MDB_VERSION_PATCH, 1 if _have_patched_lmdb else 0) return (_lib.MDB_VERSION_MAJOR, _lib.MDB_VERSION_MINOR, _lib.MDB_VERSION_PATCH) class Environment(object): """ Structure for a database environment. An environment may contain multiple databases, all residing in the same shared-memory map and underlying disk file. To write to the environment a :py:class:`Transaction` must be created. One simultaneous write transaction is allowed, however there is no limit on the number of read transactions even when a write transaction exists. This class is aliased to `lmdb.open`. It is a serious error to have open the same LMDB file in the same process at the same time. Failure to heed this may lead to data corruption and interpreter crash. Equivalent to `mdb_env_open() `_ `path`: Location of directory (if `subdir=True`) or file prefix to store the database. `map_size`: Maximum size database may grow to; used to size the memory mapping. If database grows larger than ``map_size``, an exception will be raised and the user must close and reopen :py:class:`Environment`. On 64-bit there is no penalty for making this huge (say 1TB). Must be <2GB on 32-bit. .. note:: **The default map size is set low to encourage a crash**, so users can figure out a good value before learning about this option too late. `subdir`: If ``True``, `path` refers to a subdirectory to store the data and lock files in, otherwise it refers to a filename prefix. `readonly`: If ``True``, disallow any write operations. Note the lock file is still modified. If specified, the ``write`` flag to :py:meth:`begin` or :py:class:`Transaction` is ignored. `metasync`: If ``False``, flush system buffers to disk only once per transaction, omit the metadata flush. Defer that until the system flushes files to disk, or next commit or :py:meth:`sync`. This optimization maintains database integrity, but a system crash may undo the last committed transaction. I.e. it preserves the ACI (atomicity, consistency, isolation) but not D (durability) database property. `sync`: If ``False``, don't flush system buffers to disk when committing a transaction. This optimization means a system crash can corrupt the database or lose the last transactions if buffers are not yet flushed to disk. The risk is governed by how often the system flushes dirty buffers to disk and how often :py:meth:`sync` is called. However, if the filesystem preserves write order and `writemap=False`, transactions exhibit ACI (atomicity, consistency, isolation) properties and only lose D (durability). I.e. database integrity is maintained, but a system crash may undo the final transactions. Note that `sync=False, writemap=True` leaves the system with no hint for when to write transactions to disk, unless :py:meth:`sync` is called. `map_async=True, writemap=True` may be preferable. `mode`: File creation mode. `create`: If ``False``, do not create the directory `path` if it is missing. `readahead`: If ``False``, LMDB will disable the OS filesystem readahead mechanism, which may improve random read performance when a database is larger than RAM. `writemap`: If ``True``, use a writeable memory map unless `readonly=True`. This is faster and uses fewer mallocs, but loses protection from application bugs like wild pointer writes and other bad updates into the database. Incompatible with nested transactions. Processes with and without `writemap` on the same environment do not cooperate well. `meminit`: If ``False`` LMDB will not zero-initialize buffers prior to writing them to disk. This improves performance but may cause old heap data to be written saved in the unused portion of the buffer. Do not use this option if your application manipulates confidential data (e.g. plaintext passwords) in memory. This option is only meaningful when `writemap=False`; new pages are always zero-initialized when `writemap=True`. `map_async`: When ``writemap=True``, use asynchronous flushes to disk. As with ``sync=False``, a system crash can then corrupt the database or lose the last transactions. Calling :py:meth:`sync` ensures on-disk database integrity until next commit. `max_readers`: Maximum number of simultaneous read transactions. Can only be set by the first process to open an environment, as it affects the size of the lock file and shared memory area. Attempts to simultaneously start more than this many *read* transactions will fail. `max_dbs`: Maximum number of databases available. If 0, assume environment will be used as a single database. `max_spare_txns`: Read-only transactions to cache after becoming unused. Caching transactions avoids two allocations, one lock and linear scan of the shared environment per invocation of :py:meth:`begin`, :py:class:`Transaction`, :py:meth:`get`, :py:meth:`gets`, or :py:meth:`cursor`. Should match the process's maximum expected concurrent transactions (e.g. thread count). `lock`: If ``False``, don't do any locking. If concurrent access is anticipated, the caller must manage all concurrency itself. For proper operation the caller must enforce single-writer semantics, and must ensure that no readers are using old transactions while a writer is active. The simplest approach is to use an exclusive lock so that no readers may be active at all when a writer begins. """ def __init__(self, path, map_size=10485760, subdir=True, readonly=False, metasync=True, sync=True, map_async=False, mode=O_0755, create=True, readahead=True, writemap=False, meminit=True, max_readers=126, max_dbs=0, max_spare_txns=1, lock=True): self._max_spare_txns = max_spare_txns self._spare_txns = [] envpp = _ffi.new('MDB_env **') rc = _lib.mdb_env_create(envpp) if rc: raise _error("mdb_env_create", rc) self._env = envpp[0] self._deps = set() self.set_mapsize(map_size) rc = _lib.mdb_env_set_maxreaders(self._env, max_readers) if rc: raise _error("mdb_env_set_maxreaders", rc) rc = _lib.mdb_env_set_maxdbs(self._env, max_dbs) if rc: raise _error("mdb_env_set_maxdbs", rc) if create and subdir and not readonly: try: os.mkdir(path, mode) except EnvironmentError as e: if e.errno != errno.EEXIST: raise flags = _lib.MDB_NOTLS if not subdir: flags |= _lib.MDB_NOSUBDIR if readonly: flags |= _lib.MDB_RDONLY self.readonly = readonly if not metasync: flags |= _lib.MDB_NOMETASYNC if not sync: flags |= _lib.MDB_NOSYNC if map_async: flags |= _lib.MDB_MAPASYNC if not readahead: flags |= _lib.MDB_NORDAHEAD if writemap: flags |= _lib.MDB_WRITEMAP if not meminit: flags |= _lib.MDB_NOMEMINIT if not lock: flags |= _lib.MDB_NOLOCK if isinstance(path, UnicodeType): path = path.encode(sys.getfilesystemencoding()) rc = _lib.mdb_env_open(self._env, path, flags, mode & ~O_0111) if rc: raise _error(path, rc) with self.begin(db=object()) as txn: self._db = _Database( env=self, txn=txn, name=None, reverse_key=False, dupsort=False, create=True, integerkey=False, integerdup=False, dupfixed=False ) self._dbs = {None: self._db} def __enter__(self): return self def __exit__(self, _1, _2, _3): self.close() def __del__(self): self.close() _env = None _deps = None _spare_txns = None _dbs = None def set_mapsize(self, map_size): """Change the maximum size of the map file. This function will fail if any transactions are active in the current process. `map_size`: The new size in bytes. Equivalent to `mdb_env_set_mapsize() `_ """ rc = _lib.mdb_env_set_mapsize(self._env, map_size) if rc: raise _error("mdb_env_set_mapsize", rc) def close(self): """Close the environment, invalidating any open iterators, cursors, and transactions. Repeat calls to :py:meth:`close` have no effect. Equivalent to `mdb_env_close() `_ """ if self._env: if self._deps: while self._deps: self._deps.pop()._invalidate() self._deps = None if self._spare_txns: while self._spare_txns: _lib.mdb_txn_abort(self._spare_txns.pop()) self._spare_txns = None if self._dbs: self._dbs.clear() self._dbs = None self._db = None _lib.mdb_env_close(self._env) self._env = _invalid def path(self): """Directory path or file name prefix where this environment is stored. Equivalent to `mdb_env_get_path() `_ """ path = _ffi.new('char **') rc = _lib.mdb_env_get_path(self._env, path) if rc: raise _error("mdb_env_get_path", rc) return _ffi.string(path[0]).decode(sys.getfilesystemencoding()) def copy(self, path, compact=False, txn=None): """Make a consistent copy of the environment in the given destination directory. `compact`: If ``True``, perform compaction while copying: omit free pages and sequentially renumber all pages in output. This option consumes more CPU and runs more slowly than the default, but may produce a smaller output database. `txn`: If provided, the backup will be taken from the database with respect to that transaction, otherwise a temporary read-only transaction will be created. Note: this parameter being non-None is not available if the module was built with LMDB_PURE. Note: this parameter may be set only if compact=True. Equivalent to `mdb_env_copy2() or mdb_env_copy3() `_ """ flags = _lib.MDB_CP_COMPACT if compact else 0 if txn and not _have_patched_lmdb: raise TypeError("Non-patched LMDB doesn't support transaction with env.copy") if txn and not flags: raise TypeError("txn argument only compatible with compact=True") encoded = path.encode(sys.getfilesystemencoding()) if _have_patched_lmdb: rc = _lib.mdb_env_copy3(self._env, encoded, flags, txn._txn if txn else _ffi.NULL) if rc: raise _error("mdb_env_copy3", rc) else: rc = _lib.mdb_env_copy2(self._env, encoded, flags) if rc: raise _error("mdb_env_copy2", rc) def copyfd(self, fd, compact=False, txn=None): """Copy a consistent version of the environment to file descriptor `fd`. `compact`: If ``True``, perform compaction while copying: omit free pages and sequentially renumber all pages in output. This option consumes more CPU and runs more slowly than the default, but may produce a smaller output database. `txn`: If provided, the backup will be taken from the database with respect to that transaction, otherwise a temporary read-only transaction will be created. Note: this parameter being non-None is not available if the module was built with LMDB_PURE. Equivalent to `mdb_env_copyfd2() or mdb_env_copyfd3 `_ """ if txn and not _have_patched_lmdb: raise TypeError("Non-patched LMDB doesn't support transaction with env.copy") if is_win32: # Convert C library handle to kernel handle. fd = msvcrt.get_osfhandle(fd) flags = _lib.MDB_CP_COMPACT if compact else 0 if txn and not flags: raise TypeError("txn argument only compatible with compact=True") if _have_patched_lmdb: rc = _lib.mdb_env_copyfd3(self._env, fd, flags, txn._txn if txn else _ffi.NULL) if rc: raise _error("mdb_env_copyfd3", rc) else: rc = _lib.mdb_env_copyfd2(self._env, fd, flags) if rc: raise _error("mdb_env_copyfd2", rc) def sync(self, force=False): """Flush the data buffers to disk. Equivalent to `mdb_env_sync() `_ Data is always written to disk when :py:meth:`Transaction.commit` is called, but the operating system may keep it buffered. MDB always flushes the OS buffers upon commit as well, unless the environment was opened with `sync=False` or `metasync=False`. `force`: If ``True``, force a synchronous flush. Otherwise if the environment was opened with `sync=False` the flushes will be omitted, and with `map_async=True` they will be asynchronous. """ rc = _lib.mdb_env_sync(self._env, force) if rc: raise _error("mdb_env_sync", rc) def _convert_stat(self, st): """Convert a MDB_stat to a dict. """ return { "psize": st.ms_psize, "depth": st.ms_depth, "branch_pages": st.ms_branch_pages, "leaf_pages": st.ms_leaf_pages, "overflow_pages": st.ms_overflow_pages, "entries": st.ms_entries } def stat(self): """stat() Return some nice environment statistics as a dict: +--------------------+---------------------------------------+ | ``psize`` | Size of a database page in bytes. | +--------------------+---------------------------------------+ | ``depth`` | Height of the B-tree. | +--------------------+---------------------------------------+ | ``branch_pages`` | Number of internal (non-leaf) pages. | +--------------------+---------------------------------------+ | ``leaf_pages`` | Number of leaf pages. | +--------------------+---------------------------------------+ | ``overflow_pages`` | Number of overflow pages. | +--------------------+---------------------------------------+ | ``entries`` | Number of data items. | +--------------------+---------------------------------------+ Equivalent to `mdb_env_stat() `_ """ st = _ffi.new('MDB_stat *') rc = _lib.mdb_env_stat(self._env, st) if rc: raise _error("mdb_env_stat", rc) return self._convert_stat(st) def info(self): """Return some nice environment information as a dict: +--------------------+---------------------------------------------+ | ``map_addr`` | Address of database map in RAM. | +--------------------+---------------------------------------------+ | ``map_size`` | Size of database map in RAM. | +--------------------+---------------------------------------------+ | ``last_pgno`` | ID of last used page. | +--------------------+---------------------------------------------+ | ``last_txnid`` | ID of last committed transaction. | +--------------------+---------------------------------------------+ | ``max_readers`` | Number of reader slots allocated in the | | | lock file. Equivalent to the value of | | | `maxreaders=` specified by the first | | | process opening the Environment. | +--------------------+---------------------------------------------+ | ``num_readers`` | Maximum number of reader slots in | | | simultaneous use since the lock file was | | | initialized. | +--------------------+---------------------------------------------+ Equivalent to `mdb_env_info() `_ """ info = _ffi.new('MDB_envinfo *') rc = _lib.mdb_env_info(self._env, info) if rc: raise _error("mdb_env_info", rc) return { "map_addr": int(_ffi.cast('long', info.me_mapaddr)), "map_size": info.me_mapsize, "last_pgno": info.me_last_pgno, "last_txnid": info.me_last_txnid, "max_readers": info.me_maxreaders, "num_readers": info.me_numreaders } def flags(self): """Return a dict describing Environment constructor flags used to instantiate this environment.""" flags_ = _ffi.new('unsigned int[]', 1) rc = _lib.mdb_env_get_flags(self._env, flags_) if rc: raise _error("mdb_env_get_flags", rc) flags = flags_[0] return { 'subdir': not (flags & _lib.MDB_NOSUBDIR), 'readonly': bool(flags & _lib.MDB_RDONLY), 'metasync': not (flags & _lib.MDB_NOMETASYNC), 'sync': not (flags & _lib.MDB_NOSYNC), 'map_async': bool(flags & _lib.MDB_MAPASYNC), 'readahead': not (flags & _lib.MDB_NORDAHEAD), 'writemap': bool(flags & _lib.MDB_WRITEMAP), 'meminit': not (flags & _lib.MDB_NOMEMINIT), 'lock': not (flags & _lib.MDB_NOLOCK), } def max_key_size(self): """Return the maximum size in bytes of a record's key part. This matches the ``MDB_MAXKEYSIZE`` constant set at compile time.""" return _lib.mdb_env_get_maxkeysize(self._env) def max_readers(self): """Return the maximum number of readers specified during open of the environment by the first process. This is the same as `max_readers=` specified to the constructor if this process was the first to open the environment.""" readers_ = _ffi.new('unsigned int[]', 1) rc = _lib.mdb_env_get_maxreaders(self._env, readers_) if rc: raise _error("mdb_env_get_maxreaders", rc) return readers_[0] def readers(self): """Return a multi line Unicode string describing the current state of the reader lock table.""" _callbacks.msg_func = [] try: rc = _lib.mdb_reader_list(self._env, _msg_func, _ffi.NULL) if rc: raise _error("mdb_reader_list", rc) return UnicodeType().join(_callbacks.msg_func) finally: del _callbacks.msg_func def reader_check(self): """Search the reader lock table for stale entries, for example due to a crashed process. Returns the number of stale entries that were cleared. """ reaped = _ffi.new('int[]', 1) rc = _lib.mdb_reader_check(self._env, reaped) if rc: raise _error('mdb_reader_check', rc) return reaped[0] def open_db(self, key=None, txn=None, reverse_key=False, dupsort=False, create=True, integerkey=False, integerdup=False, dupfixed=False): """ Open a database, returning an instance of :py:class:`_Database`. Repeat :py:meth:`Environment.open_db` calls for the same name will return the same handle. As a special case, the main database is always open. Equivalent to `mdb_dbi_open() `_ Named databases are implemented by *storing a special descriptor in the main database*. All databases in an environment *share the same file*. Because the descriptor is present in the main database, attempts to create a named database will fail if a key matching the database's name already exists. Furthermore *the key is visible to lookups and enumerations*. If your main database keyspace conflicts with the names you use for named databases, then move the contents of your main database to another named database. :: >>> env = lmdb.open('/tmp/test', max_dbs=2) >>> with env.begin(write=True) as txn ... txn.put('somename', 'somedata') >>> # Error: database cannot share name of existing key! >>> subdb = env.open_db('somename') A newly created database will not exist if the transaction that created it aborted, nor if another process deleted it. The handle resides in the shared environment, it is not owned by the current transaction or process. Only one thread should call this function; it is not mutex-protected in a read-only transaction. The `dupsort`, `integerkey`, `integerdup`, and `dupfixed` parameters are ignored if the database already exists. The state of those settings are persistent and immutable per database. See :py:meth:`_Database.flags` to view the state of those options for an opened database. A consequence of the immutability of these flags is that the default non-named database will never have these flags set. Preexisting transactions, other than the current transaction and any parents, must not use the new handle, nor must their children. `key`: Bytestring database name. If ``None``, indicates the main database should be returned, otherwise indicates a named database should be created inside the main database. In other words, *a key representing the database will be visible in the main database, and the database name cannot conflict with any existing key.* `txn`: Transaction used to create the database if it does not exist. If unspecified, a temporarily write transaction is used. Do not call :py:meth:`open_db` from inside an existing transaction without supplying it here. Note the passed transaction must have `write=True`. `reverse_key`: If ``True``, keys are compared from right to left (e.g. DNS names). `dupsort`: Duplicate keys may be used in the database. (Or, from another perspective, keys may have multiple data items, stored in sorted order.) By default keys must be unique and may have only a single data item. `create`: If ``True``, create the database if it doesn't exist, otherwise raise an exception. `integerkey`: If ``True``, indicates keys in the database are C unsigned or ``size_t`` integers encoded in native byte order. Keys must all be either unsigned or ``size_t``, they cannot be mixed in a single database. `integerdup`: If ``True`` and `dupsort` is also ``True``, values in the database are C unsigned or ``size_t`` integers encode din native byte order. `dupfixed`: If ``True`` and `dupsort` is also ``True``, values for each key in database are of fixed size, allowing each additional duplicate value for a key to be stored without a header indicating its size. """ if isinstance(key, UnicodeType): raise TypeError('key must be bytes') db = self._dbs.get(key) if db: return db if txn: db = _Database(self, txn, key, reverse_key, dupsort, create, integerkey, integerdup, dupfixed) else: with self.begin(write=not self.readonly) as txn: db = _Database(self, txn, key, reverse_key, dupsort, create, integerkey, integerdup, dupfixed) self._dbs[key] = db return db def begin(self, db=None, parent=None, write=False, buffers=False): """Shortcut for :py:class:`lmdb.Transaction`""" return Transaction(self, db, parent, write, buffers) class _Database(object): """ Internal database handle. This class is opaque, save a single method. Should not be constructed directly. Use :py:meth:`Environment.open_db` instead. """ def __init__(self, env, txn, name, reverse_key, dupsort, create, integerkey, integerdup, dupfixed): env._deps.add(self) self._deps = set() self._name = name flags = 0 if reverse_key: flags |= _lib.MDB_REVERSEKEY if dupsort: flags |= _lib.MDB_DUPSORT if create: flags |= _lib.MDB_CREATE if integerkey: flags |= _lib.MDB_INTEGERKEY if integerdup: flags |= _lib.MDB_INTEGERDUP if dupfixed: flags |= _lib.MDB_DUPFIXED dbipp = _ffi.new('MDB_dbi *') self._dbi = None rc = _lib.mdb_dbi_open(txn._txn, name or _ffi.NULL, flags, dbipp) if rc: raise _error("mdb_dbi_open", rc) self._dbi = dbipp[0] self._load_flags(txn) def _load_flags(self, txn): """Load MDB's notion of the database flags.""" flags_ = _ffi.new('unsigned int[]', 1) rc = _lib.mdb_dbi_flags(txn._txn, self._dbi, flags_) if rc: raise _error("mdb_dbi_flags", rc) self._flags = flags_[0] def flags(self, *args): """Return the database's associated flags as a dict of _Database constructor kwargs.""" if len(args) > 1: raise TypeError('flags takes 0 or 1 arguments') return { 'reverse_key': bool(self._flags & _lib.MDB_REVERSEKEY), 'dupsort': bool(self._flags & _lib.MDB_DUPSORT), 'integerkey': bool(self._flags & _lib.MDB_INTEGERKEY), 'integerdup': bool(self._flags & _lib.MDB_INTEGERDUP), 'dupfixed': bool(self._flags & _lib.MDB_DUPFIXED), } def _invalidate(self): self._dbi = _invalid open = Environment class Transaction(object): """ A transaction object. All operations require a transaction handle, transactions may be read-only or read-write. Write transactions may not span threads. Transaction objects implement the context manager protocol, so that reliable release of the transaction happens even in the face of unhandled exceptions: .. code-block:: python # Transaction aborts correctly: with env.begin(write=True) as txn: crash() # Transaction commits automatically: with env.begin(write=True) as txn: txn.put('a', 'b') Equivalent to `mdb_txn_begin() `_ `env`: Environment the transaction should be on. `db`: Default named database to operate on. If unspecified, defaults to the environment's main database. Can be overridden on a per-call basis below. `parent`: ``None``, or a parent transaction (see lmdb.h). `write`: Transactions are read-only by default. To modify the database, you must pass `write=True`. This flag is ignored if :py:class:`Environment` was opened with ``readonly=True``. `buffers`: If ``True``, indicates :py:func:`buffer` objects should be yielded instead of bytestrings. This setting applies to the :py:class:`Transaction` instance itself and any :py:class:`Cursors ` created within the transaction. This feature significantly improves performance, since MDB has a zero-copy design, but it requires care when manipulating the returned buffer objects. The benefit of this facility is diminished when using small keys and values. """ # If constructor fails, then __del__ will attempt to access these # attributes. _env = _invalid _txn = _invalid _parent = None _write = False # Mutations occurred since transaction start. Required to know when Cursor # key/value must be refreshed. _mutations = 0 def __init__(self, env, db=None, parent=None, write=False, buffers=False): env._deps.add(self) self.env = env # hold ref self._db = db or env._db self._env = env._env self._key = _ffi.new('MDB_val *') self._val = _ffi.new('MDB_val *') self._to_py = _mvbuf if buffers else _mvstr self._deps = set() if parent: self._parent = parent parent_txn = parent._txn parent._deps.add(self) else: parent_txn = _ffi.NULL if write: if env.readonly: msg = 'Cannot start write transaction with read-only env' raise _error(msg, _lib.EACCES) txnpp = _ffi.new('MDB_txn **') rc = _lib.mdb_txn_begin(self._env, parent_txn, 0, txnpp) if rc: raise _error("mdb_txn_begin", rc) self._txn = txnpp[0] self._write = True else: try: # Exception catch in order to avoid racy 'if txns:' test self._txn = env._spare_txns.pop() env._max_spare_txns += 1 rc = _lib.mdb_txn_renew(self._txn) if rc: _lib.mdb_txn_abort(self._txn) raise _error("mdb_txn_renew", rc) except IndexError: txnpp = _ffi.new('MDB_txn **') flags = _lib.MDB_RDONLY rc = _lib.mdb_txn_begin(self._env, parent_txn, flags, txnpp) if rc: raise _error("mdb_txn_begin", rc) self._txn = txnpp[0] def _invalidate(self): if self._txn: self.abort() self.env._deps.discard(self) self._parent = None self._env = _invalid def __del__(self): self.abort() def __enter__(self): return self def __exit__(self, exc_type, exc_value, traceback): if exc_type: self.abort() else: self.commit() def id(self): """id() Return the transaction's ID. This returns the identifier associated with this transaction. For a read-only transaction, this corresponds to the snapshot being read; concurrent readers will frequently have the same transaction ID. """ return _lib.mdb_txn_id(self._txn) def stat(self, db): """stat(db) Return statistics like :py:meth:`Environment.stat`, except for a single DBI. `db` must be a database handle returned by :py:meth:`open_db`. """ st = _ffi.new('MDB_stat *') rc = _lib.mdb_stat(self._txn, db._dbi, st) if rc: raise _error('mdb_stat', rc) return self.env._convert_stat(st) def drop(self, db, delete=True): """Delete all keys in a named database and optionally delete the named database itself. Deleting the named database causes it to become unavailable, and invalidates existing cursors. Equivalent to `mdb_drop() `_ """ while db._deps: db._deps.pop()._invalidate() rc = _lib.mdb_drop(self._txn, db._dbi, delete) self._mutations += 1 if rc: raise _error("mdb_drop", rc) if db._name in self.env._dbs: del self.env._dbs[db._name] def _cache_spare(self): # In order to avoid taking and maintaining a lock, a race is allowed # below which may result in more spare txns than desired. It seems # unlikely the race could ever result in a large amount of spare txns, # and in any case a correctly configured program should not be opening # more read-only transactions than there are configured spares. if self.env._max_spare_txns > 0: _lib.mdb_txn_reset(self._txn) self.env._spare_txns.append(self._txn) self.env._max_spare_txns -= 1 self._txn = _invalid self._invalidate() return True def commit(self): """Commit the pending transaction. Equivalent to `mdb_txn_commit() `_ """ while self._deps: self._deps.pop()._invalidate() if self._write or not self._cache_spare(): rc = _lib.mdb_txn_commit(self._txn) self._txn = _invalid if rc: raise _error("mdb_txn_commit", rc) self._invalidate() def abort(self): """Abort the pending transaction. Repeat calls to :py:meth:`abort` have no effect after a previously successful :py:meth:`commit` or :py:meth:`abort`, or after the associated :py:class:`Environment` has been closed. Equivalent to `mdb_txn_abort() `_ """ if self._txn: while self._deps: self._deps.pop()._invalidate() if self._write or not self._cache_spare(): rc = _lib.mdb_txn_abort(self._txn) self._txn = _invalid if rc: raise _error("mdb_txn_abort", rc) self._invalidate() def get(self, key, default=None, db=None): """Fetch the first value matching `key`, returning `default` if `key` does not exist. A cursor must be used to fetch all values for a key in a `dupsort=True` database. Equivalent to `mdb_get() `_ """ rc = _lib.pymdb_get(self._txn, (db or self._db)._dbi, key, len(key), self._val) if rc: if rc == _lib.MDB_NOTFOUND: return default raise _error("mdb_cursor_get", rc) preload(self._val) return self._to_py(self._val) def put(self, key, value, dupdata=True, overwrite=True, append=False, db=None): """Store a record, returning ``True`` if it was written, or ``False`` to indicate the key was already present and `overwrite=False`. On success, the cursor is positioned on the new record. Equivalent to `mdb_put() `_ `key`: Bytestring key to store. `value`: Bytestring value to store. `dupdata`: If ``True`` and database was opened with `dupsort=True`, add pair as a duplicate if the given key already exists. Otherwise overwrite any existing matching key. `overwrite`: If ``False``, do not overwrite any existing matching key. If False and writing to a dupsort=True database, this will not add a value to the key and this function will return False. `append`: If ``True``, append the pair to the end of the database without comparing its order first. Appending a key that is not greater than the highest existing key will cause corruption. `db`: Named database to operate on. If unspecified, defaults to the database given to the :py:class:`Transaction` constructor. """ flags = 0 if not dupdata: flags |= _lib.MDB_NODUPDATA if not overwrite: flags |= _lib.MDB_NOOVERWRITE if append: flags |= _lib.MDB_APPEND rc = _lib.pymdb_put(self._txn, (db or self._db)._dbi, key, len(key), value, len(value), flags) self._mutations += 1 if rc: if rc == _lib.MDB_KEYEXIST: return False raise _error("mdb_put", rc) return True def replace(self, key, value, db=None): """Use a temporary cursor to invoke :py:meth:`Cursor.replace`. `db`: Named database to operate on. If unspecified, defaults to the database given to the :py:class:`Transaction` constructor. """ with Cursor(db or self._db, self) as curs: return curs.replace(key, value) def pop(self, key, db=None): """Use a temporary cursor to invoke :py:meth:`Cursor.pop`. `db`: Named database to operate on. If unspecified, defaults to the database given to the :py:class:`Transaction` constructor. """ with Cursor(db or self._db, self) as curs: return curs.pop(key) def delete(self, key, value=EMPTY_BYTES, db=None): """Delete a key from the database. Equivalent to `mdb_del() `_ `key`: The key to delete. value: If the database was opened with dupsort=True and value is not the empty bytestring, then delete elements matching only this `(key, value)` pair, otherwise all values for key are deleted. Returns True if at least one key was deleted. """ rc = _lib.pymdb_del(self._txn, (db or self._db)._dbi, key, len(key), value, len(value)) self._mutations += 1 if rc: if rc == _lib.MDB_NOTFOUND: return False raise _error("mdb_del", rc) return True def cursor(self, db=None): """Shortcut for ``lmdb.Cursor(db, self)``""" return Cursor(db or self._db, self) class Cursor(object): """ Structure for navigating a database. Equivalent to `mdb_cursor_open() `_ `db`: :py:class:`_Database` to navigate. `txn`: :py:class:`Transaction` to navigate. As a convenience, :py:meth:`Transaction.cursor` can be used to quickly return a cursor: :: >>> env = lmdb.open('/tmp/foo') >>> child_db = env.open_db('child_db') >>> with env.begin() as txn: ... cursor = txn.cursor() # Cursor on main database. ... cursor2 = txn.cursor(child_db) # Cursor on child database. Cursors start in an unpositioned state. If :py:meth:`iternext` or :py:meth:`iterprev` are used in this state, iteration proceeds from the start or end respectively. Iterators directly position using the cursor, meaning strange behavior results when multiple iterators exist on the same cursor. .. note:: From the perspective of the Python binding, cursors return to an 'unpositioned' state once any scanning or seeking method (e.g. :py:meth:`next`, :py:meth:`prev_nodup`, :py:meth:`set_range`) returns ``False`` or raises an exception. This is primarily to ensure safe, consistent semantics in the face of any error condition. When the Cursor returns to an unpositioned state, its :py:meth:`key` and :py:meth:`value` return empty strings to indicate there is no active position, although internally the LMDB cursor may still have a valid position. This may lead to slightly surprising behaviour when iterating the values for a `dupsort=True` database's keys, since methods such as :py:meth:`iternext_dup` will cause Cursor to appear unpositioned, despite it returning ``False`` only to indicate there are no more values for the current key. In that case, simply calling :py:meth:`next` would cause iteration to resume at the next available key. This behaviour may change in future. Iterator methods such as :py:meth:`iternext` and :py:meth:`iterprev` accept `keys` and `values` arguments. If both are ``True``, then the value of :py:meth:`item` is yielded on each iteration. If only `keys` is ``True``, :py:meth:`key` is yielded, otherwise only :py:meth:`value` is yielded. Prior to iteration, a cursor can be positioned anywhere in the database: :: >>> with env.begin() as txn: ... cursor = txn.cursor() ... if not cursor.set_range('5'): # Position at first key >= '5'. ... print('Not found!') ... else: ... for key, value in cursor: # Iterate from first key >= '5'. ... print((key, value)) Iteration is not required to navigate, and sometimes results in ugly or inefficient code. In cases where the iteration order is not obvious, or is related to the data being read, use of :py:meth:`set_key`, :py:meth:`set_range`, :py:meth:`key`, :py:meth:`value`, and :py:meth:`item` may be preferable: :: >>> # Record the path from a child to the root of a tree. >>> path = ['child14123'] >>> while path[-1] != 'root': ... assert cursor.set_key(path[-1]), \\ ... 'Tree is broken! Path: %s' % (path,) ... path.append(cursor.value()) """ def __init__(self, db, txn): db._deps.add(self) txn._deps.add(self) self.db = db # hold ref self.txn = txn # hold ref self._dbi = db._dbi self._txn = txn._txn self._key = _ffi.new('MDB_val *') self._val = _ffi.new('MDB_val *') self._valid = False self._to_py = txn._to_py curpp = _ffi.new('MDB_cursor **') self._cur = None rc = _lib.mdb_cursor_open(self._txn, self._dbi, curpp) if rc: raise _error("mdb_cursor_open", rc) self._cur = curpp[0] # If Transaction.mutations!=last_mutation, must MDB_GET_CURRENT to # refresh `key' and `val'. self._last_mutation = txn._mutations def _invalidate(self): if self._cur: _lib.mdb_cursor_close(self._cur) self.db._deps.discard(self) self.txn._deps.discard(self) self._cur = _invalid self._dbi = _invalid self._txn = _invalid def __del__(self): self._invalidate() def close(self): """Close the cursor, freeing its associated resources.""" self._invalidate() def __enter__(self): return self def __exit__(self, _1, _2, _3): self._invalidate() def key(self): """Return the current key.""" # Must refresh `key` and `val` following mutation. if self._last_mutation != self.txn._mutations: self._cursor_get(_lib.MDB_GET_CURRENT) return self._to_py(self._key) def value(self): """Return the current value.""" # Must refresh `key` and `val` following mutation. if self._last_mutation != self.txn._mutations: self._cursor_get(_lib.MDB_GET_CURRENT) preload(self._val) return self._to_py(self._val) def item(self): """Return the current `(key, value)` pair.""" # Must refresh `key` and `val` following mutation. if self._last_mutation != self.txn._mutations: self._cursor_get(_lib.MDB_GET_CURRENT) preload(self._val) return self._to_py(self._key), self._to_py(self._val) def _iter(self, op, keys, values): if not values: get = self.key elif not keys: get = self.value else: get = self.item cur = self._cur key = self._key val = self._val rc = 0 while self._valid: yield get() rc = _lib.mdb_cursor_get(cur, key, val, op) self._valid = not rc if rc: self._key.mv_size = 0 self._val.mv_size = 0 if rc != _lib.MDB_NOTFOUND: raise _error("mdb_cursor_get", rc) def iternext(self, keys=True, values=True): """Return a forward iterator that yields the current element before calling :py:meth:`next`, repeating until the end of the database is reached. As a convenience, :py:class:`Cursor` implements the iterator protocol by automatically returning a forward iterator when invoked: :: >>> # Equivalent: >>> it = iter(cursor) >>> it = cursor.iternext(keys=True, values=True) If the cursor is not yet positioned, it is moved to the first key in the database, otherwise iteration proceeds from the current position. """ if not self._valid: self.first() return self._iter(_lib.MDB_NEXT, keys, values) __iter__ = iternext def iternext_dup(self, keys=False, values=True): """Return a forward iterator that yields the current value ("duplicate") of the current key before calling :py:meth:`next_dup`, repeating until the last value of the current key is reached. Only meaningful for databases opened with `dupsort=True`. .. code-block:: python if not cursor.set_key("foo"): print("No values found for 'foo'") else: for idx, data in enumerate(cursor.iternext_dup()): print("%d'th value for 'foo': %s" % (idx, data)) """ return self._iter(_lib.MDB_NEXT_DUP, keys, values) def iternext_nodup(self, keys=True, values=False): """Return a forward iterator that yields the current value ("duplicate") of the current key before calling :py:meth:`next_nodup`, repeating until the end of the database is reached. Only meaningful for databases opened with `dupsort=True`. If the cursor is not yet positioned, it is moved to the first key in the database, otherwise iteration proceeds from the current position. .. code-block:: python for key in cursor.iternext_nodup(): print("Key '%s' has %d values" % (key, cursor.count())) """ if not self._valid: self.first() return self._iter(_lib.MDB_NEXT_NODUP, keys, values) def iterprev(self, keys=True, values=True): """Return a reverse iterator that yields the current element before calling :py:meth:`prev`, until the start of the database is reached. If the cursor is not yet positioned, it is moved to the last key in the database, otherwise iteration proceeds from the current position. :: >>> with env.begin() as txn: ... for i, (key, value) in enumerate(txn.cursor().iterprev()): ... print('%dth last item is (%r, %r)' % (1+i, key, value)) """ if not self._valid: self.last() return self._iter(_lib.MDB_PREV, keys, values) def iterprev_dup(self, keys=False, values=True): """Return a reverse iterator that yields the current value ("duplicate") of the current key before calling :py:meth:`prev_dup`, repeating until the first value of the current key is reached. Only meaningful for databases opened with `dupsort=True`. """ return self._iter(_lib.MDB_PREV_DUP, keys, values) def iterprev_nodup(self, keys=True, values=False): """Return a reverse iterator that yields the current value ("duplicate") of the current key before calling :py:meth:`prev_nodup`, repeating until the start of the database is reached. If the cursor is not yet positioned, it is moved to the last key in the database, otherwise iteration proceeds from the current position. Only meaningful for databases opened with `dupsort=True`. """ if not self._valid: self.last() return self._iter(_lib.MDB_PREV_NODUP, keys, values) def _cursor_get(self, op): rc = _lib.mdb_cursor_get(self._cur, self._key, self._val, op) self._valid = v = not rc self._last_mutation = self.txn._mutations if rc: self._key.mv_size = 0 self._val.mv_size = 0 if rc != _lib.MDB_NOTFOUND: if not (rc == _lib.EINVAL and op == _lib.MDB_GET_CURRENT): raise _error("mdb_cursor_get", rc) return v def _cursor_get_kv(self, op, k, v): rc = _lib.pymdb_cursor_get(self._cur, k, len(k), v, len(v), self._key, self._val, op) self._valid = v = not rc if rc: self._key.mv_size = 0 self._val.mv_size = 0 if rc != _lib.MDB_NOTFOUND: if not (rc == _lib.EINVAL and op == _lib.MDB_GET_CURRENT): raise _error("mdb_cursor_get", rc) return v def first(self): """Move to the first key in the database, returning ``True`` on success or ``False`` if the database is empty. If the database was opened with `dupsort=True` and the key contains duplicates, the cursor is positioned on the first value ("duplicate"). Equivalent to `mdb_cursor_get() `_ with `MDB_FIRST `_ """ return self._cursor_get(_lib.MDB_FIRST) def first_dup(self): """Move to the first value ("duplicate") for the current key, returning ``True`` on success or ``False`` if the database is empty. Only meaningful for databases opened with `dupsort=True`. Equivalent to `mdb_cursor_get() `_ with `MDB_FIRST_DUP `_ """ return self._cursor_get(_lib.MDB_FIRST_DUP) def last(self): """Move to the last key in the database, returning ``True`` on success or ``False`` if the database is empty. If the database was opened with `dupsort=True` and the key contains duplicates, the cursor is positioned on the last value ("duplicate"). Equivalent to `mdb_cursor_get() `_ with `MDB_LAST `_ """ return self._cursor_get(_lib.MDB_LAST) def last_dup(self): """Move to the last value ("duplicate") for the current key, returning ``True`` on success or ``False`` if the database is empty. Only meaningful for databases opened with `dupsort=True`. Equivalent to `mdb_cursor_get() `_ with `MDB_LAST_DUP `_ """ return self._cursor_get(_lib.MDB_LAST_DUP) def prev(self): """Move to the previous element, returning ``True`` on success or ``False`` if there is no previous item. For databases opened with `dupsort=True`, moves to the previous data item ("duplicate") for the current key if one exists, otherwise moves to the previous key. Equivalent to `mdb_cursor_get() `_ with `MDB_PREV `_ """ return self._cursor_get(_lib.MDB_PREV) def prev_dup(self): """Move to the previous value ("duplicate") of the current key, returning ``True`` on success or ``False`` if there is no previous value. Only meaningful for databases opened with `dupsort=True`. Equivalent to `mdb_cursor_get() `_ with `MDB_PREV_DUP `_ """ return self._cursor_get(_lib.MDB_PREV_DUP) def prev_nodup(self): """Move to the last value ("duplicate") of the previous key, returning ``True`` on success or ``False`` if there is no previous key. Only meaningful for databases opened with `dupsort=True`. Equivalent to `mdb_cursor_get() `_ with `MDB_PREV_NODUP `_ """ return self._cursor_get(_lib.MDB_PREV_NODUP) def next(self): """Move to the next element, returning ``True`` on success or ``False`` if there is no next element. For databases opened with `dupsort=True`, moves to the next value ("duplicate") for the current key if one exists, otherwise moves to the first value of the next key. Equivalent to `mdb_cursor_get() `_ with `MDB_NEXT `_ """ return self._cursor_get(_lib.MDB_NEXT) def next_dup(self): """Move to the next value ("duplicate") of the current key, returning ``True`` on success or ``False`` if there is no next value. Only meaningful for databases opened with `dupsort=True`. Equivalent to `mdb_cursor_get() `_ with `MDB_NEXT_DUP `_ """ return self._cursor_get(_lib.MDB_NEXT_DUP) def next_nodup(self): """Move to the first value ("duplicate") of the next key, returning ``True`` on success or ``False`` if there is no next key. Only meaningful for databases opened with `dupsort=True`. Equivalent to `mdb_cursor_get() `_ with `MDB_NEXT_NODUP `_ """ return self._cursor_get(_lib.MDB_NEXT_NODUP) def set_key(self, key): """Seek exactly to `key`, returning ``True`` on success or ``False`` if the exact key was not found. It is an error to :py:meth:`set_key` the empty bytestring. For databases opened with `dupsort=True`, moves to the first value ("duplicate") for the key. Equivalent to `mdb_cursor_get() `_ with `MDB_SET_KEY `_ """ return self._cursor_get_kv(_lib.MDB_SET_KEY, key, EMPTY_BYTES) def set_key_dup(self, key, value): """Seek exactly to `(key, value)`, returning ``True`` on success or ``False`` if the exact key and value was not found. It is an error to :py:meth:`set_key` the empty bytestring. Only meaningful for databases opened with `dupsort=True`. Equivalent to `mdb_cursor_get() `_ with `MDB_GET_BOTH `_ """ return self._cursor_get_kv(_lib.MDB_GET_BOTH, key, value) def get(self, key, default=None): """Equivalent to :py:meth:`set_key()`, except :py:meth:`value` is returned when `key` is found, otherwise `default`. """ if self._cursor_get_kv(_lib.MDB_SET_KEY, key, EMPTY_BYTES): return self.value() return default def set_range(self, key): """Seek to the first key greater than or equal to `key`, returning ``True`` on success, or ``False`` to indicate key was past end of database. Behaves like :py:meth:`first` if `key` is the empty bytestring. For databases opened with `dupsort=True`, moves to the first value ("duplicate") for the key. Equivalent to `mdb_cursor_get() `_ with `MDB_SET_RANGE `_ """ if not key: return self.first() return self._cursor_get_kv(_lib.MDB_SET_RANGE, key, EMPTY_BYTES) def set_range_dup(self, key, value): """Seek to the first key/value pair greater than or equal to `key`, returning ``True`` on success, or ``False`` to indicate that `value` was past the last value of `key` or that `(key, value)` was past the end end of database. Only meaningful for databases opened with `dupsort=True`. Equivalent to `mdb_cursor_get() `_ with `MDB_GET_BOTH_RANGE `_ """ rc = self._cursor_get_kv(_lib.MDB_GET_BOTH_RANGE, key, value) # issue #126: MDB_GET_BOTH_RANGE does not satisfy its documentation, # and fails to update `key` and `value` on success. Therefore # explicitly call MDB_GET_CURRENT after MDB_GET_BOTH_RANGE. self._cursor_get(_lib.MDB_GET_CURRENT) return rc def delete(self, dupdata=False): """Delete the current element and move to the next, returning ``True`` on success or ``False`` if the database was empty. If `dupdata` is ``True``, delete all values ("duplicates") for the current key, otherwise delete only the currently positioned value. Only meaningful for databases opened with `dupsort=True`. Equivalent to `mdb_cursor_del() `_ """ v = self._valid if v: flags = _lib.MDB_NODUPDATA if dupdata else 0 rc = _lib.mdb_cursor_del(self._cur, flags) self.txn._mutations += 1 if rc: raise _error("mdb_cursor_del", rc) self._cursor_get(_lib.MDB_GET_CURRENT) v = rc == 0 return v def count(self): """Return the number of values ("duplicates") for the current key. Only meaningful for databases opened with `dupsort=True`. Equivalent to `mdb_cursor_count() `_ """ countp = _ffi.new('size_t *') rc = _lib.mdb_cursor_count(self._cur, countp) if rc: raise _error("mdb_cursor_count", rc) return countp[0] def put(self, key, val, dupdata=True, overwrite=True, append=False): """Store a record, returning ``True`` if it was written, or ``False`` to indicate the key was already present and `overwrite=False`. On success, the cursor is positioned on the key. Equivalent to `mdb_cursor_put() `_ `key`: Bytestring key to store. `val`: Bytestring value to store. `dupdata`: If ``True`` and database was opened with `dupsort=True`, add pair as a duplicate if the given key already exists. Otherwise overwrite any existing matching key. `overwrite`: If ``False``, do not overwrite the value for the key if it exists, just return ``False``. For databases opened with `dupsort=True`, ``False`` will always be returned if a duplicate key/value pair is inserted, regardless of the setting for `overwrite`. `append`: If ``True``, append the pair to the end of the database without comparing its order first. Appending a key that is not greater than the highest existing key will cause corruption. """ flags = 0 if not dupdata: flags |= _lib.MDB_NODUPDATA if not overwrite: flags |= _lib.MDB_NOOVERWRITE if append: flags |= _lib.MDB_APPEND rc = _lib.pymdb_cursor_put(self._cur, key, len(key), val, len(val), flags) self.txn._mutations += 1 if rc: if rc == _lib.MDB_KEYEXIST: return False raise _error("mdb_cursor_put", rc) self._cursor_get(_lib.MDB_GET_CURRENT) return True def putmulti(self, items, dupdata=True, overwrite=True, append=False): """Invoke :py:meth:`put` for each `(key, value)` 2-tuple from the iterable `items`. Elements must be exactly 2-tuples, they may not be of any other type, or tuple subclass. Returns a tuple `(consumed, added)`, where `consumed` is the number of elements read from the iterable, and `added` is the number of new entries added to the database. `added` may be less than `consumed` when `overwrite=False`. `items`: Iterable to read records from. `dupdata`: If ``True`` and database was opened with `dupsort=True`, add pair as a duplicate if the given key already exists. Otherwise overwrite any existing matching key. `overwrite`: If ``False``, do not overwrite the value for the key if it exists, just return ``False``. For databases opened with `dupsort=True`, ``False`` will always be returned if a duplicate key/value pair is inserted, regardless of the setting for `overwrite`. `append`: If ``True``, append records to the end of the database without comparing their order first. Appending a key that is not greater than the highest existing key will cause corruption. """ flags = 0 if not dupdata: flags |= _lib.MDB_NODUPDATA if not overwrite: flags |= _lib.MDB_NOOVERWRITE if append: if self.txn._db._flags & _lib.MDB_DUPSORT: flags |= _lib.MDB_APPENDDUP else: flags |= _lib.MDB_APPEND added = 0 skipped = 0 for key, value in items: rc = _lib.pymdb_cursor_put(self._cur, key, len(key), value, len(value), flags) self.txn._mutations += 1 added += 1 if rc: if rc == _lib.MDB_KEYEXIST: skipped += 1 else: raise _error("mdb_cursor_put", rc) self._cursor_get(_lib.MDB_GET_CURRENT) return added, added-skipped def replace(self, key, val): """Store a record, returning its previous value if one existed. Returns ``None`` if no previous value existed. This uses the best available mechanism to minimize the cost of a `set-and-return-previous` operation. For databases opened with `dupsort=True`, only the first data element ("duplicate") is returned if it existed, all data elements are removed and the new `(key, data)` pair is inserted. `key`: Bytestring key to store. `value`: Bytestring value to store. """ if self.db._flags & _lib.MDB_DUPSORT: if self._cursor_get_kv(_lib.MDB_SET_KEY, key, EMPTY_BYTES): preload(self._val) old = _mvstr(self._val) self.delete(True) else: old = None self.put(key, val) return old flags = _lib.MDB_NOOVERWRITE keylen = len(key) rc = _lib.pymdb_cursor_put(self._cur, key, keylen, val, len(val), flags) self.txn._mutations += 1 if not rc: return if rc != _lib.MDB_KEYEXIST: raise _error("mdb_cursor_put", rc) self._cursor_get(_lib.MDB_GET_CURRENT) preload(self._val) old = _mvstr(self._val) rc = _lib.pymdb_cursor_put(self._cur, key, keylen, val, len(val), 0) self.txn._mutations += 1 if rc: raise _error("mdb_cursor_put", rc) self._cursor_get(_lib.MDB_GET_CURRENT) return old def pop(self, key): """Fetch a record's value then delete it. Returns ``None`` if no previous value existed. This uses the best available mechanism to minimize the cost of a `delete-and-return-previous` operation. For databases opened with `dupsort=True`, the first data element ("duplicate") for the key will be popped. `key`: Bytestring key to delete. """ if self._cursor_get_kv(_lib.MDB_SET_KEY, key, EMPTY_BYTES): preload(self._val) old = _mvstr(self._val) rc = _lib.mdb_cursor_del(self._cur, 0) self.txn._mutations += 1 if rc: raise _error("mdb_cursor_del", rc) self._cursor_get(_lib.MDB_GET_CURRENT) return old def _iter_from(self, k, reverse): """Helper for centidb. Please do not rely on this interface, it may be removed in future. """ if not k and not reverse: found = self.first() else: found = self.set_range(k) if reverse: if not found: self.last() return self.iterprev() else: if not found: return iter(()) return self.iternext() py-lmdb-py-lmdb_1.0.0/lmdb/cpython.c000066400000000000000000003017101372223456500172610ustar00rootroot00000000000000/* * Copyright 2013 The py-lmdb authors, all rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted only as authorized by the OpenLDAP * Public License. * * A copy of this license is available in the file LICENSE in the * top-level directory of the distribution or, alternatively, at * . * * OpenLDAP is a registered trademark of the OpenLDAP Foundation. * * Individual files and/or contributed packages may be copyright by * other parties and/or subject to additional restrictions. * * This work also contains materials derived from public sources. * * Additional information about OpenLDAP can be obtained at * . */ #define PY_SSIZE_T_CLEAN /* Include order matters! */ #include "Python.h" /* Search lib/win32 first, then fallthrough to as required.*/ #include "stdint.h" #include #include #include #ifdef _WIN32 # define bool int # define true 1 # define false 0 #else # include #endif #include #include "structmember.h" #ifdef HAVE_MEMSINK #define USING_MEMSINK #include "memsink.h" #endif #ifdef _WIN32 #include /* HANDLE */ #endif #include "lmdb.h" #include "preload.h" /* Comment out for copious debug. */ #define NODEBUG #ifdef NODEBUG # define DEBUG(s, ...) #else # define DEBUG(s, ...) fprintf(stderr, \ "lmdb.cpython: %s:%d: " s "\n", __func__, __LINE__, ## __VA_ARGS__); #endif #define MDEBUG(s, ...) DEBUG("%p: " s, self, ## __VA_ARGS__); /* Inlining control for compatible compilers. */ #if (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define NOINLINE __attribute__((noinline)) #else # define NOINLINE #endif /** * On Win32, Environment.copyfd() needs _get_osfmodule() from the C library, * except that function performs no input validation. So instead we import * msvcrt standard library module, which wraps _get_osfmodule() in a way that * is crash-safe. */ #ifdef _WIN32 static PyObject *msvcrt; #endif /** PyLong representing integer 0. */ static PyObject *py_zero; /** PyLong representing INT_MAX. */ static PyObject *py_int_max; /** PyLong representing SIZE_MAX. */ static PyObject *py_size_max; /** lmdb.Error type. */ static PyObject *Error; /** Typedefs and forward declarations. */ static PyTypeObject PyDatabase_Type; static PyTypeObject PyEnvironment_Type; static PyTypeObject PyTransaction_Type; static PyTypeObject PyCursor_Type; static PyTypeObject PyIterator_Type; typedef struct CursorObject CursorObject; typedef struct DbObject DbObject; typedef struct EnvObject EnvObject; typedef struct IterObject IterObject; typedef struct TransObject TransObject; /* ------------------------ */ /* Python 3.x Compatibility */ /* ------------------------ */ #if PY_MAJOR_VERSION >= 3 # define MOD_RETURN(mod) return mod; # define MODINIT_NAME PyInit_cpython # define MAKE_ID(id) PyCapsule_New((void *) (1 + (id)), NULL, NULL) # define READ_ID(obj) (((int) (long) PyCapsule_GetPointer(obj, NULL)) - 1) #else # define MOD_RETURN(mod) return # define MODINIT_NAME initcpython # define MAKE_ID(id) PyInt_FromLong((long) id) # define READ_ID(obj) PyInt_AS_LONG(obj) # define PyUnicode_InternFromString PyString_InternFromString # define PyBytes_AS_STRING PyString_AS_STRING # define PyBytes_GET_SIZE PyString_GET_SIZE # define PyBytes_CheckExact PyString_CheckExact # define PyBytes_FromStringAndSize PyString_FromStringAndSize # define _PyBytes_Resize _PyString_Resize # define PyMemoryView_FromMemory(x, y, z) PyBuffer_FromMemory(x, y) # ifndef PyBUF_READ # define PyBUF_READ 0 # endif /* Python 2.5 */ # ifndef Py_TYPE # define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) # endif # ifndef PyVarObject_HEAD_INIT # define PyVarObject_HEAD_INIT(x, y) \ PyObject_HEAD_INIT(x) y, # endif #endif struct list_head { struct lmdb_object *prev; struct lmdb_object *next; }; #define LmdbObject_HEAD \ PyObject_HEAD \ struct list_head siblings; \ struct list_head children; \ int valid; struct lmdb_object { LmdbObject_HEAD }; #define OBJECT_INIT(o) \ ((struct lmdb_object *)o)->siblings.prev = NULL; \ ((struct lmdb_object *)o)->siblings.next = NULL; \ ((struct lmdb_object *)o)->children.prev = NULL; \ ((struct lmdb_object *)o)->children.next = NULL; \ ((struct lmdb_object *)o)->valid = 1; /** lmdb._Database */ struct DbObject { LmdbObject_HEAD /** Python Environment reference. Not refcounted; when the last strong ref * to Environment is released, DbObject.tp_clear() will be called, causing * DbObject.env and DbObject.dbi to be cleared. This is to prevent a * cyclical reference from DB->Env keeping the environment alive. */ struct EnvObject *env; /** MDB database handle. */ MDB_dbi dbi; /** Flags at time of creation. */ unsigned int flags; }; /** lmdb.Environment */ struct EnvObject { LmdbObject_HEAD /** Python-managed list of weakrefs to this object. */ PyObject *weaklist; /** MDB environment object. */ MDB_env *env; /** DBI for main database, opened during Environment construction. */ DbObject *main_db; /** 1 if env opened read-only; transactions must always be read-only. */ int readonly; /** Max free txns to keep on free_txn list. */ int max_spare_txns; /** Spare read-only transaction list head. */ struct TransObject *spare_txns; }; /** TransObject.flags bitfield values. */ enum trans_flags { /** Buffers should be yielded by get. */ TRANS_BUFFERS = 1, /** Transaction can be can go on freelist instead of deallocation. */ TRANS_RDONLY = 2, /** Transaction is spare, ready for mdb_txn_renew() */ TRANS_SPARE = 4 }; /** lmdb.Transaction */ struct TransObject { LmdbObject_HEAD /** Python-managed list of weakrefs to this object. */ PyObject *weaklist; EnvObject *env; #ifdef HAVE_MEMSINK /** Copy-on-invalid list head. */ PyObject *sink_head; #endif /** MDB transaction object. */ MDB_txn *txn; /** Bitfield of trans_flags values. */ int flags; /** Default database if none specified. */ DbObject *db; /** Number of mutations occurred since start of transaction. Required to * know when cursor key/value must be refreshed. */ int mutations; /** Next free read-only txn, or NULL. */ struct TransObject *spare_next; }; /** lmdb.Cursor */ struct CursorObject { LmdbObject_HEAD /** Transaction cursor belongs to. */ TransObject *trans; /** 1 if mdb_cursor_get() has been called and it last returned 0. */ int positioned; /** MDB-level cursor object. */ MDB_cursor *curs; /** mv_size==0 if positioned==0, otherwise points to current key. */ MDB_val key; /** mv_size==0 if positioned==0, otherwise points to current value. */ MDB_val val; /** If TransObject.mutations!=last_mutation, must MDB_GET_CURRENT to * refresh `key' and `val'. */ int last_mutation; /** DBI flags at time of creation. */ unsigned int dbi_flags; }; typedef PyObject *(*IterValFunc)(CursorObject *); /** lmdb.Iterator * * This is separate from Cursor since we want to define Cursor.next() to mean * MDB_NEXT, and a Python iterator's next() has different semantics. */ struct IterObject { PyObject_HEAD /** Cursor being iterated, or NULL for freelist iterator. */ CursorObject *curs; /** 1 if iteration has started (Cursor should advance on next()). */ int started; /** Operation used to advance cursor. */ MDB_cursor_op op; /** Iterator value function, should be item(), key(), or value(). */ IterValFunc val_func; }; /** * Link `child` into `parent`'s list of dependent objects. Use LINK_CHILD() * maro to avoid casting PyObject to lmdb_object. */ static void link_child(struct lmdb_object *parent, struct lmdb_object *child) { struct lmdb_object *sibling = parent->children.next; if(sibling) { child->siblings.next = sibling; sibling->siblings.prev = child; } parent->children.next = child; } #define LINK_CHILD(parent, child) link_child((void *)parent, (void *)child); /** * Remove `child` from `parent`'s list of dependent objects. Use UNLINK_CHILD * macro to avoid casting PyObject to lmdb_object. */ static void unlink_child(struct lmdb_object *parent, struct lmdb_object *child) { if(parent) { struct lmdb_object *prev = child->siblings.prev; struct lmdb_object *next = child->siblings.next; if(prev) { prev->siblings.next = next; /* If double unlink_child(), this test my legitimately fail: */ } else if(parent->children.next == child) { parent->children.next = next; } if(next) { next->siblings.prev = prev; } child->siblings.prev = NULL; child->siblings.next = NULL; } } #define UNLINK_CHILD(parent, child) unlink_child((void *)parent, (void *)child); /** * Notify dependents of `parent` that `parent` is about to become invalid, * and that they should free any dependent resources. * * To save effort, tp_clear is overloaded to be the invalidation function, * instead of carrying a separate pointer. Objects are added to their parent's * list during construction and removed during deallocation. * * When the environment is closed, it walks its list calling tp_clear on each * child, which in turn walk their own lists. Child transactions are added to * their parent transaction's list. Iterators keep no significant state, so * they are not tracked. * * Use INVALIDATE() macro to avoid casting PyObject to lmdb_object. */ static void invalidate(struct lmdb_object *parent) { struct lmdb_object *child = parent->children.next; while(child) { struct lmdb_object *next = child->siblings.next; DEBUG("invalidating parent=%p child %p", parent, child) Py_TYPE(child)->tp_clear((PyObject *) child); child = next; } } #define INVALIDATE(parent) invalidate((void *)parent); /* ---------- */ /* Exceptions */ /* ---------- */ struct error_map { int code; const char *name; }; /** Array of Error subclasses corresponding to `error_map'. */ static PyObject **error_tbl; /** Mapping from LMDB error code to py-lmdb exception class. */ static const struct error_map error_map[] = { {MDB_KEYEXIST, "KeyExistsError"}, {MDB_NOTFOUND, "NotFoundError"}, {MDB_PAGE_NOTFOUND, "PageNotFoundError"}, {MDB_CORRUPTED, "CorruptedError"}, {MDB_PANIC, "PanicError"}, {MDB_VERSION_MISMATCH, "VersionMismatchError"}, {MDB_INVALID, "InvalidError"}, {MDB_MAP_FULL, "MapFullError"}, {MDB_DBS_FULL, "DbsFullError"}, {MDB_READERS_FULL, "ReadersFullError"}, {MDB_TLS_FULL, "TlsFullError"}, {MDB_TXN_FULL, "TxnFullError"}, {MDB_CURSOR_FULL, "CursorFullError"}, {MDB_PAGE_FULL, "PageFullError"}, {MDB_MAP_RESIZED, "MapResizedError"}, {MDB_INCOMPATIBLE, "IncompatibleError"}, {MDB_BAD_RSLOT, "BadRslotError"}, {MDB_BAD_DBI, "BadDbiError"}, {MDB_BAD_TXN, "BadTxnError"}, {MDB_BAD_VALSIZE, "BadValsizeError"}, {EACCES, "ReadonlyError"}, {EINVAL, "InvalidParameterError"}, {EAGAIN, "LockError"}, {ENOMEM, "MemoryError"}, {ENOSPC, "DiskError"} }; /* ---------- */ /* Exceptions */ /* ---------- */ /** * Raise an exception appropriate for the given `rc` MDB error code. */ static void * NOINLINE err_set(const char *what, int rc) { size_t count = sizeof error_map / sizeof error_map[0]; PyObject *klass = Error; size_t i; if(rc) { for(i = 0; i < count; i++) { if(error_map[i].code == rc) { klass = error_tbl[i]; break; } } } PyErr_Format(klass, "%s: %s", what, mdb_strerror(rc)); return NULL; } /** * Raise an exception from a format string. */ static void * NOINLINE err_format(int rc, const char *fmt, ...) { char buf[128]; va_list ap; va_start(ap, fmt); vsnprintf(buf, sizeof buf, fmt, ap); buf[sizeof buf - 1] = '\0'; va_end(ap); return err_set(buf, rc); } static void * NOINLINE err_invalid(void) { PyErr_Format(Error, "Attempt to operate on closed/deleted/dropped object."); return NULL; } static void * NOINLINE type_error(const char *what) { PyErr_Format(PyExc_TypeError, "%s", what); return NULL; } /** * Convert a PyObject to filesystem bytes. Must call fspath_fini() when done. * Return 0 on success, or set an exception and return -1 on failure. */ static PyObject * get_fspath(PyObject *src) { if(PyBytes_CheckExact(src)) { Py_INCREF(src); return src; } if(! PyUnicode_CheckExact(src)) { type_error("Filesystem path must be Unicode or bytes."); return NULL; } return PyUnicode_AsEncodedString(src, Py_FileSystemDefaultEncoding, "strict"); } /* ------- */ /* Helpers */ /* ------- */ /** * Describes the type of a struct field. */ enum field_type { /** Last field in set, stop converting. */ TYPE_EOF, /** Unsigned 32bit integer. */ TYPE_UINT, /** size_t */ TYPE_SIZE, /** void pointer */ TYPE_ADDR }; /** * Describes a struct field. */ struct dict_field { /** Field type. */ enum field_type type; /** Field name in target dict. */ const char *name; /* Offset into structure where field is found. */ int offset; }; /** * Return a new reference to Py_True if the given argument is true, otherwise * a new reference to Py_False. */ static PyObject * py_bool(int pred) { PyObject *obj = pred ? Py_True : Py_False; Py_INCREF(obj); return obj; } /** * Convert the structure `o` described by `fields` to a dict and return the new * dict. */ static PyObject * dict_from_fields(void *o, const struct dict_field *fields) { PyObject *dict = PyDict_New(); if(! dict) { return NULL; } while(fields->type != TYPE_EOF) { uint8_t *p = ((uint8_t *) o) + fields->offset; unsigned PY_LONG_LONG l = 0; PyObject *lo; if(fields->type == TYPE_UINT) { l = *(unsigned int *)p; } else if(fields->type == TYPE_SIZE) { l = *(size_t *)p; } else if(fields->type == TYPE_ADDR) { l = (intptr_t) *(void **)p; } if(! ((lo = PyLong_FromUnsignedLongLong(l)))) { Py_DECREF(dict); return NULL; } if(PyDict_SetItemString(dict, fields->name, lo)) { Py_DECREF(lo); Py_DECREF(dict); return NULL; } Py_DECREF(lo); fields++; } return dict; } /** * Given an MDB_val `val`, convert it to a Python string or bytes object, * depending on the Python version. Returns a new reference to the object on * sucess, or NULL on failure. */ static PyObject * obj_from_val(MDB_val *val, int as_buffer) { if(as_buffer) { return PyMemoryView_FromMemory(val->mv_data, val->mv_size, PyBUF_READ); } return PyBytes_FromStringAndSize(val->mv_data, val->mv_size); } /** * Given some Python object, try to get at its raw data. For string or bytes * objects, this is the object value. For Unicode objects, this is the UTF-8 * representation of the object value. For all other objects, attempt to invoke * the Python 2.x buffer protocol. */ static int NOINLINE val_from_buffer(MDB_val *val, PyObject *buf) { if(PyBytes_CheckExact(buf)) { val->mv_data = PyBytes_AS_STRING(buf); val->mv_size = PyBytes_GET_SIZE(buf); return 0; } if(PyUnicode_CheckExact(buf)) { type_error("Won't implicitly convert Unicode to bytes; use .encode()"); return -1; } return PyObject_AsReadBuffer(buf, (const void **) &val->mv_data, (Py_ssize_t *) &val->mv_size); } /* ------------------- */ /* Concurrency control */ /* ------------------- */ #define UNLOCKED(out, e) \ Py_BEGIN_ALLOW_THREADS \ out = (e); \ Py_END_ALLOW_THREADS #define PRELOAD_UNLOCKED(_rc, _data, _size) \ Py_BEGIN_ALLOW_THREADS \ preload(_rc, _data, _size); \ Py_END_ALLOW_THREADS /* ---------------- */ /* Argument parsing */ /* ---------------- */ #define OFFSET(k, y) offsetof(struct k, y) #define SPECSIZE() (sizeof(argspec) / sizeof(argspec[0])) enum arg_type { ARG_DB, /** DbObject* */ ARG_TRANS, /** TransObject* */ ARG_ENV, /** EnvObject* */ ARG_OBJ, /** PyObject* */ ARG_BOOL, /** int */ ARG_BUF, /** MDB_val */ ARG_STR, /** char* */ ARG_INT, /** int */ ARG_SIZE /** size_t */ }; struct argspec { const char *string; unsigned short type; unsigned short offset; }; static PyTypeObject *type_tbl[] = { &PyDatabase_Type, &PyTransaction_Type, &PyEnvironment_Type }; static int NOINLINE parse_ulong(PyObject *obj, uint64_t *l, PyObject *max) { int rc = PyObject_RichCompareBool(obj, py_zero, Py_GE); if(rc == -1) { return -1; } else if(! rc) { PyErr_Format(PyExc_OverflowError, "Integer argument must be >= 0"); return -1; } rc = PyObject_RichCompareBool(obj, max, Py_LE); if(rc == -1) { return -1; } else if(! rc) { PyErr_Format(PyExc_OverflowError, "Integer argument exceeds limit."); return -1; } #if PY_MAJOR_VERSION >= 3 *l = PyLong_AsUnsignedLongLongMask(obj); #else *l = PyInt_AsUnsignedLongLongMask(obj); #endif return 0; } /** * Parse a single argument specified by `spec` into `out`, returning 0 on * success or setting an exception and returning -1 on error. */ static int parse_arg(const struct argspec *spec, PyObject *val, void *out) { void *dst = ((uint8_t *)out) + spec->offset; int ret = 0; uint64_t l; if(val != Py_None) { switch((enum arg_type) spec->type) { case ARG_DB: case ARG_TRANS: case ARG_ENV: if(val->ob_type != type_tbl[spec->type]) { type_error("invalid type"); return -1; } /* fallthrough */ case ARG_OBJ: *((PyObject **) dst) = val; break; case ARG_BOOL: *((int *)dst) = PyObject_IsTrue(val); break; case ARG_BUF: ret = val_from_buffer((MDB_val *)dst, val); break; case ARG_STR: { MDB_val mv; if(! (ret = val_from_buffer(&mv, val))) { *((char **) dst) = mv.mv_data; } break; } case ARG_INT: if(! (ret = parse_ulong(val, &l, py_int_max))) { *((int *) dst) = (int)l; } break; case ARG_SIZE: if(! (ret = parse_ulong(val, &l, py_size_max))) { *((size_t *) dst) = (size_t)l; } break; } } return ret; } /** * Walk `argspec`, building a Python dictionary mapping keyword arguments to a * PyInt describing their offset in the array. Used to reduce keyword argument * parsing from O(specsize) to O(number of supplied kwargs). */ static int NOINLINE make_arg_cache(int specsize, const struct argspec *argspec, PyObject **cache) { Py_ssize_t i; if(! ((*cache = PyDict_New()))) { return -1; } for(i = 0; i < specsize; i++) { const struct argspec *spec = argspec + i; PyObject *key = PyUnicode_InternFromString(spec->string); PyObject *val = MAKE_ID(i); if((! (key && val)) || PyDict_SetItem(*cache, key, val)) { return -1; } Py_DECREF(val); } return 0; } /** * Like PyArg_ParseTupleAndKeywords except types are specialized for this * module, keyword strings aren't dup'd every call and the code is >3x smaller. */ static int NOINLINE parse_args(int valid, int specsize, const struct argspec *argspec, PyObject **cache, PyObject *args, PyObject *kwds, void *out) { unsigned set = 0; unsigned i; if(! valid) { err_invalid(); return -1; } if(args) { Py_ssize_t size = PyTuple_GET_SIZE(args); if(size > specsize) { type_error("too many positional arguments."); return -1; } if(specsize < size) { size = specsize; } for(i = 0; i < size; i++) { if(parse_arg(argspec + i, PyTuple_GET_ITEM(args, i), out)) { return -1; } set |= 1 << i; } } if(kwds) { Py_ssize_t ppos = 0; PyObject *pkey; PyObject *pvalue; if((! *cache) && make_arg_cache(specsize, argspec, cache)) { return -1; } while(PyDict_Next(kwds, &ppos, &pkey, &pvalue)) { PyObject *specidx; int i; if(! ((specidx = PyDict_GetItem(*cache, pkey)))) { type_error("unrecognized keyword argument"); return -1; } i = READ_ID(specidx); if(set & (1 << i)) { PyErr_Format(PyExc_TypeError, "duplicate argument: %U", pkey); return -1; } if(parse_arg(argspec + i, pvalue, out)) { return -1; } } } return 0; } /** * Return 1 if `db` is associated with the given `env`, otherwise raise an * exception. Used to prevent DBIs from unrelated envs from being mixed * together (which in future, would cause one env to access another's cursor * pointers). */ static int db_owner_check(DbObject *db, EnvObject *env) { if(db->env != env) { err_set("Database handle belongs to another environment.", 0); return 0; } return 1; } /* -------------------------------------------------------- */ /* Functionality shared between Transaction and Environment */ /* -------------------------------------------------------- */ static PyObject * make_trans(EnvObject *env, DbObject *db, TransObject *parent, int write, int buffers) { MDB_txn *parent_txn; TransObject *self; int flags; int rc; DEBUG("make_trans(env=%p, parent=%p, write=%d, buffers=%d)", env, parent, write, buffers) if(! env->valid) { return err_invalid(); } if(! db) { db = env->main_db; } else if(! db_owner_check(db, env)) { return NULL; } parent_txn = NULL; if(parent) { if(parent->flags & TRANS_RDONLY) { return err_set("Read-only transactions cannot be nested.", EINVAL); } if(! parent->valid) { return err_invalid(); } parent_txn = parent->txn; } if((!write) && env->spare_txns) { self = env->spare_txns; DEBUG("found freelist txn; self=%p self->txn=%p", self, self->txn) env->spare_txns = self->spare_next; UNLOCKED(rc, mdb_txn_renew(self->txn)); if(rc) { mdb_txn_abort(self->txn); PyObject_Del(self); return err_set("mdb_txn_begin", rc); } env->max_spare_txns++; self->flags &= ~TRANS_SPARE; } else { MDB_txn *txn; if(write && env->readonly) { const char *msg = "Cannot start write transaction with read-only env"; return err_set(msg, EACCES); } flags = write ? 0 : MDB_RDONLY; UNLOCKED(rc, mdb_txn_begin(env->env, parent_txn, flags, &txn)); if(rc) { return err_set("mdb_txn_begin", rc); } if(! ((self = PyObject_New(TransObject, &PyTransaction_Type)))) { mdb_txn_abort(txn); return NULL; } self->txn = txn; } OBJECT_INIT(self) LINK_CHILD(env, self) self->weaklist = NULL; self->env = env; Py_INCREF(env); self->db = db; Py_INCREF(db); #ifdef HAVE_MEMSINK self->sink_head = NULL; #endif self->mutations = 0; self->spare_next = NULL; self->flags = 0; if(! write) { self->flags |= TRANS_RDONLY; } if(buffers) { self->flags |= TRANS_BUFFERS; } return (PyObject *)self; } static PyObject * make_cursor(DbObject *db, TransObject *trans) { CursorObject *self; MDB_cursor *curs; int rc; if(! trans->valid) { return err_invalid(); } if(! db) { db = trans->env->main_db; } else if(! db_owner_check(db, trans->env)) { return NULL; } UNLOCKED(rc, mdb_cursor_open(trans->txn, db->dbi, &curs)); if(rc) { return err_set("mdb_cursor_open", rc); } self = PyObject_New(CursorObject, &PyCursor_Type); if (!self) { mdb_cursor_close(curs); return NULL; } DEBUG("sizeof cursor = %d", (int) sizeof *self) OBJECT_INIT(self) LINK_CHILD(trans, self) self->curs = curs; self->positioned = 0; self->key.mv_size = 0; self->key.mv_data = NULL; self->val.mv_size = 0; self->val.mv_data = NULL; self->trans = trans; self->last_mutation = trans->mutations; self->dbi_flags = db->flags; Py_INCREF(self->trans); return (PyObject *) self; } /* -------- */ /* Database */ /* -------- */ static DbObject * db_from_name(EnvObject *env, MDB_txn *txn, const char *name, unsigned int flags) { MDB_dbi dbi; unsigned int f; int rc; DbObject *dbo; UNLOCKED(rc, mdb_dbi_open(txn, name, flags, &dbi)); if(rc) { err_set("mdb_dbi_open", rc); return NULL; } if((rc = mdb_dbi_flags(txn, dbi, &f))) { err_set("mdb_dbi_flags", rc); mdb_dbi_close(env->env, dbi); return NULL; } if(! ((dbo = PyObject_New(DbObject, &PyDatabase_Type)))) { return NULL; } OBJECT_INIT(dbo) LINK_CHILD(env, dbo) dbo->env = env; /* no refcount */ dbo->dbi = dbi; dbo->flags = f; DEBUG("DbObject '%s' opened at %p", name, dbo) return dbo; } /** * Use a temporary transaction to manufacture a new _Database object for * `name`. */ static DbObject * txn_db_from_name(EnvObject *env, const char *name, unsigned int flags) { int rc; MDB_txn *txn; DbObject *dbo; int begin_flags = (name == NULL || env->readonly) ? MDB_RDONLY : 0; UNLOCKED(rc, mdb_txn_begin(env->env, NULL, begin_flags, &txn)); if(rc) { err_set("mdb_txn_begin", rc); return NULL; } if(! ((dbo = db_from_name(env, txn, name, flags)))) { Py_BEGIN_ALLOW_THREADS mdb_txn_abort(txn); Py_END_ALLOW_THREADS return NULL; } UNLOCKED(rc, mdb_txn_commit(txn)); if(rc) { Py_DECREF(dbo); return err_set("mdb_txn_commit", rc); } return dbo; } static int db_clear(DbObject *self) { if(self->env) { UNLINK_CHILD(self->env, self) self->env = NULL; } self->valid = 0; return 0; } /** * _Database.flags() */ static PyObject * db_flags(DbObject *self, PyObject *args, PyObject *kwds) { PyObject *dct; unsigned int f; if (args) { Py_ssize_t size = PyTuple_GET_SIZE(args); if(size > 1) { return type_error("too many positional arguments."); } } dct = PyDict_New(); f = self->flags; PyDict_SetItemString(dct, "reverse_key", py_bool(f & MDB_REVERSEKEY)); PyDict_SetItemString(dct, "dupsort", py_bool(f & MDB_DUPSORT)); PyDict_SetItemString(dct, "integerkey", py_bool(f & MDB_INTEGERKEY)); PyDict_SetItemString(dct, "integerdup", py_bool(f & MDB_INTEGERDUP)); PyDict_SetItemString(dct, "dupfixed", py_bool(f & MDB_DUPFIXED)); return dct; } /** * _Database.__del__() */ static void db_dealloc(DbObject *self) { db_clear(self); PyObject_Del(self); } static struct PyMethodDef db_methods[] = { {"flags", (PyCFunction)db_flags, METH_VARARGS|METH_KEYWORDS}, {0, 0, 0, 0} }; static PyTypeObject PyDatabase_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_Database", /*tp_name*/ sizeof(DbObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor)db_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ (inquiry)db_clear, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ db_methods /*tp_methods*/ }; /* ----------- */ /* Environment */ /* ----------- */ static void trans_dealloc(TransObject *self); static int env_clear(EnvObject *self) { MDEBUG("killing env..") INVALIDATE(self) self->valid = 0; Py_CLEAR(self->main_db); /* Force trans_dealloc() to free by setting avail size to 0 */ self->max_spare_txns = 0; while(self->spare_txns) { TransObject *cur = self->spare_txns; MDEBUG("killing spare txn %p", self->spare_txns) self->spare_txns = cur->spare_next; trans_dealloc(cur); } if(self->env) { DEBUG("Closing env") Py_BEGIN_ALLOW_THREADS mdb_env_close(self->env); Py_END_ALLOW_THREADS self->env = NULL; } return 0; } /** * Environment.__del__() */ static void env_dealloc(EnvObject *self) { if(self->weaklist != NULL) { MDEBUG("Clearing weaklist..") PyObject_ClearWeakRefs((PyObject *) self); } env_clear(self); PyObject_Del(self); } /** * Environment.close() */ static PyObject * env_close(EnvObject *self) { env_clear(self); Py_RETURN_NONE; } /** * Environment() -> new object. */ static PyObject * env_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { struct env_new { PyObject *path; size_t map_size; int subdir; int readonly; int metasync; int sync; int map_async; int mode; int create; int readahead; int writemap; int meminit; int max_readers; int max_dbs; int max_spare_txns; int lock; } arg = {NULL, 10485760, 1, 0, 1, 1, 0, 0755, 1, 1, 0, 1, 126, 0, 1, 1}; static const struct argspec argspec[] = { {"path", ARG_OBJ, OFFSET(env_new, path)}, {"map_size", ARG_SIZE, OFFSET(env_new, map_size)}, {"subdir", ARG_BOOL, OFFSET(env_new, subdir)}, {"readonly", ARG_BOOL, OFFSET(env_new, readonly)}, {"metasync", ARG_BOOL, OFFSET(env_new, metasync)}, {"sync", ARG_BOOL, OFFSET(env_new, sync)}, {"map_async", ARG_BOOL, OFFSET(env_new, map_async)}, {"mode", ARG_INT, OFFSET(env_new, mode)}, {"create", ARG_BOOL, OFFSET(env_new, create)}, {"readahead", ARG_BOOL, OFFSET(env_new, readahead)}, {"writemap", ARG_BOOL, OFFSET(env_new, writemap)}, {"meminit", ARG_INT, OFFSET(env_new, meminit)}, {"max_readers", ARG_INT, OFFSET(env_new, max_readers)}, {"max_dbs", ARG_INT, OFFSET(env_new, max_dbs)}, {"max_spare_txns", ARG_INT, OFFSET(env_new, max_spare_txns)}, {"lock", ARG_BOOL, OFFSET(env_new, lock)} }; PyObject *fspath_obj = NULL; EnvObject *self; const char *fspath; int flags; int rc; int mode; static PyObject *cache = NULL; if(parse_args(1, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! arg.path) { return type_error("'path' argument required"); } if(! ((self = PyObject_New(EnvObject, type)))) { return NULL; } OBJECT_INIT(self) self->weaklist = NULL; self->main_db = NULL; self->env = NULL; self->max_spare_txns = arg.max_spare_txns; self->spare_txns = NULL; if((rc = mdb_env_create(&self->env))) { err_set("mdb_env_create", rc); goto fail; } if((rc = mdb_env_set_mapsize(self->env, arg.map_size))) { err_set("mdb_env_set_mapsize", rc); goto fail; } if((rc = mdb_env_set_maxreaders(self->env, arg.max_readers))) { err_set("mdb_env_set_maxreaders", rc); goto fail; } if((rc = mdb_env_set_maxdbs(self->env, arg.max_dbs))) { err_set("mdb_env_set_maxdbs", rc); goto fail; } if(! ((fspath_obj = get_fspath(arg.path)))) { goto fail; } fspath = PyBytes_AS_STRING(fspath_obj); if(arg.create && arg.subdir && !arg.readonly) { if(mkdir(fspath, arg.mode) && errno != EEXIST) { PyErr_SetFromErrnoWithFilename(PyExc_OSError, fspath); goto fail; } } flags = MDB_NOTLS; if(! arg.subdir) { flags |= MDB_NOSUBDIR; } if(arg.readonly) { flags |= MDB_RDONLY; } self->readonly = arg.readonly; if(! arg.metasync) { flags |= MDB_NOMETASYNC; } if(! arg.sync) { flags |= MDB_NOSYNC; } if(arg.map_async) { flags |= MDB_MAPASYNC; } if(! arg.readahead) { flags |= MDB_NORDAHEAD; } if(arg.writemap) { flags |= MDB_WRITEMAP; } if(! arg.meminit) { flags |= MDB_NOMEMINIT; } if(! arg.lock) { flags |= MDB_NOLOCK; } /* Strip +x. */ mode = arg.mode & ~0111; DEBUG("mdb_env_open(%p, '%s', %d, %o);", self->env, fspath, flags, mode) UNLOCKED(rc, mdb_env_open(self->env, fspath, flags, mode)); if(rc) { err_set(fspath, rc); goto fail; } self->main_db = txn_db_from_name(self, NULL, 0); if(self->main_db) { self->valid = 1; DEBUG("EnvObject '%s' opened at %p", fspath, self) return (PyObject *) self; } fail: DEBUG("initialization failed") Py_CLEAR(fspath_obj); Py_CLEAR(self); return NULL; } /** * Environment.begin() */ static PyObject * env_begin(EnvObject *self, PyObject *args, PyObject *kwds) { struct env_begin { DbObject *db; TransObject *parent; int write; int buffers; } arg = {self->main_db, NULL, 0, 0}; static const struct argspec argspec[] = { {"db", ARG_DB, OFFSET(env_begin, db)}, {"parent", ARG_TRANS, OFFSET(env_begin, parent)}, {"write", ARG_BOOL, OFFSET(env_begin, write)}, {"buffers", ARG_BOOL, OFFSET(env_begin, buffers)}, }; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } return make_trans(self, arg.db, arg.parent, arg.write, arg.buffers); } /** * Environment.copy() */ static PyObject * env_copy(EnvObject *self, PyObject *args, PyObject *kwds) { struct env_copy { PyObject *path; int compact; TransObject *txn; } arg = {NULL, 0, NULL}; static const struct argspec argspec[] = { {"path", ARG_OBJ, OFFSET(env_copy, path)}, {"compact", ARG_BOOL, OFFSET(env_copy, compact)}, {"txn", ARG_TRANS, OFFSET(env_copy, txn)} }; PyObject *fspath_obj; const char *fspath_s; int flags; int rc; #ifdef HAVE_PATCHED_LMDB MDB_txn *txn; #endif static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! arg.path) { return type_error("path argument required"); } if(! ((fspath_obj = get_fspath(arg.path)))) { return NULL; } #ifdef HAVE_PATCHED_LMDB if (arg.txn) { txn = arg.txn->txn; if (!arg.compact) { return type_error("txn argument only compatible with compact=True"); } } else { txn = NULL; } #else if (arg.txn) { return type_error("Non-patched LMDB doesn't support transaction with env.copy"); } #endif fspath_s = PyBytes_AS_STRING(fspath_obj); flags = arg.compact ? MDB_CP_COMPACT : 0; #ifdef HAVE_PATCHED_LMDB UNLOCKED(rc, mdb_env_copy3(self->env, fspath_s, flags, txn)); #else UNLOCKED(rc, mdb_env_copy2(self->env, fspath_s, flags)); #endif Py_CLEAR(fspath_obj); if(rc) { #ifdef HAVE_PATCHED_LMDB return err_set("mdb_env_copy3", rc); #else return err_set("mdb_env_copy2", rc); #endif } Py_RETURN_NONE; } /** * Environment.copyfd(fd) */ static PyObject * env_copyfd(EnvObject *self, PyObject *args, PyObject *kwds) { struct env_copyfd { int fd; int compact; TransObject *txn; } arg = {-1, 0}; int rc; #ifdef HAVE_PATCHED_LMDB MDB_txn *txn; #endif #ifdef _WIN32 PyObject *temp; Py_ssize_t handle; #endif static const struct argspec argspec[] = { {"fd", ARG_INT, OFFSET(env_copyfd, fd)}, {"compact", ARG_BOOL, OFFSET(env_copyfd, compact)}, {"txn", ARG_TRANS, OFFSET(env_copyfd, txn)}, }; int flags; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(arg.fd == -1) { return type_error("fd argument required"); } flags = arg.compact ? MDB_CP_COMPACT : 0; #ifdef HAVE_PATCHED_LMDB if (arg.txn) { txn = arg.txn->txn; if (!arg.compact) { return type_error("txn argument only compatible with compact=True"); } } else { txn = NULL; } #else if (arg.txn) { return type_error("Non-patched LMDB doesn't support transaction with env.copyfd"); } #endif #ifdef _WIN32 temp = PyObject_CallMethod(msvcrt, "get_osfhandle", "i", arg.fd); if(! temp) { return NULL; } handle = PyNumber_AsSsize_t(temp, PyExc_OverflowError); Py_DECREF(temp); if(PyErr_Occurred()) { return NULL; } #define HANDLE_ARG (HANDLE)handle #else #define HANDLE_ARG arg.fd #endif #ifdef HAVE_PATCHED_LMDB UNLOCKED(rc, mdb_env_copyfd3(self->env, HANDLE_ARG, flags, txn)); #else UNLOCKED(rc, mdb_env_copyfd2(self->env, HANDLE_ARG, flags)); #endif if(rc) { return err_set("mdb_env_copyfd3", rc); } Py_RETURN_NONE; } /** * Environment.info() -> dict */ static PyObject * env_info(EnvObject *self) { static const struct dict_field fields[] = { {TYPE_ADDR, "map_addr", offsetof(MDB_envinfo, me_mapaddr)}, {TYPE_SIZE, "map_size", offsetof(MDB_envinfo, me_mapsize)}, {TYPE_SIZE, "last_pgno", offsetof(MDB_envinfo, me_last_pgno)}, {TYPE_SIZE, "last_txnid", offsetof(MDB_envinfo, me_last_txnid)}, {TYPE_UINT, "max_readers", offsetof(MDB_envinfo, me_maxreaders)}, {TYPE_UINT, "num_readers", offsetof(MDB_envinfo, me_numreaders)}, {TYPE_EOF, NULL, 0} }; MDB_envinfo info; int rc; if(! self->valid) { return err_invalid(); } UNLOCKED(rc, mdb_env_info(self->env, &info)); if(rc) { err_set("mdb_env_info", rc); return NULL; } return dict_from_fields(&info, fields); } /** * Environment.flags() -> dict */ static PyObject * env_flags(EnvObject *self) { PyObject *dct; unsigned int flags; int rc; if(! self->valid) { return err_invalid(); } if((rc = mdb_env_get_flags(self->env, &flags))) { err_set("mdb_env_get_flags", rc); return NULL; } dct = PyDict_New(); PyDict_SetItemString(dct, "subdir", py_bool(!(flags & MDB_NOSUBDIR))); PyDict_SetItemString(dct, "readonly", py_bool(flags & MDB_RDONLY)); PyDict_SetItemString(dct, "metasync", py_bool(!(flags & MDB_NOMETASYNC))); PyDict_SetItemString(dct, "sync", py_bool(!(flags & MDB_NOSYNC))); PyDict_SetItemString(dct, "map_async", py_bool(flags & MDB_MAPASYNC)); PyDict_SetItemString(dct, "readahead", py_bool(!(flags & MDB_NORDAHEAD))); PyDict_SetItemString(dct, "writemap", py_bool(flags & MDB_WRITEMAP)); PyDict_SetItemString(dct, "meminit", py_bool(!(flags & MDB_NOMEMINIT))); PyDict_SetItemString(dct, "lock", py_bool(!(flags & MDB_NOLOCK))); return dct; } /** * Environment.max_key_size() -> int */ static PyObject * env_max_key_size(EnvObject *self) { int key_size; if(! self->valid) { return err_invalid(); } key_size = mdb_env_get_maxkeysize(self->env); return PyLong_FromLongLong(key_size); } /** * Environment.max_key_size() -> int */ static PyObject * env_max_readers(EnvObject *self) { unsigned int readers; int rc; if(! self->valid) { return err_invalid(); } if((rc = mdb_env_get_maxreaders(self->env, &readers))) { return err_set("mdb_env_get_maxreaders", rc); } return PyLong_FromLongLong(readers); } /** * Environment.open_db() -> handle */ static PyObject * env_open_db(EnvObject *self, PyObject *args, PyObject *kwds) { struct env_open_db { const char *key; TransObject *txn; int reverse_key; int dupsort; int create; int integerkey; int integerdup; int dupfixed; } arg = {NULL, NULL, 0, 0, 1}; static const struct argspec argspec[] = { {"key", ARG_STR, OFFSET(env_open_db, key)}, {"txn", ARG_TRANS, OFFSET(env_open_db, txn)}, {"reverse_key", ARG_BOOL, OFFSET(env_open_db, reverse_key)}, {"dupsort", ARG_BOOL, OFFSET(env_open_db, dupsort)}, {"create", ARG_BOOL, OFFSET(env_open_db, create)}, {"integerkey", ARG_BOOL, OFFSET(env_open_db, integerkey)}, {"integerdup", ARG_BOOL, OFFSET(env_open_db, integerdup)}, {"dupfixed", ARG_BOOL, OFFSET(env_open_db, dupfixed)}, }; int flags; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } flags = 0; if(arg.reverse_key) { flags |= MDB_REVERSEKEY; } if(arg.dupsort) { flags |= MDB_DUPSORT; } if(arg.create) { flags |= MDB_CREATE; } if(arg.integerkey) { flags |= MDB_INTEGERKEY; } if(arg.integerdup) { flags |= MDB_INTEGERDUP; } if(arg.dupfixed) { flags |= MDB_DUPFIXED; } if(arg.txn) { return (PyObject *) db_from_name(self, arg.txn->txn, arg.key, flags); } else { return (PyObject *) txn_db_from_name(self, arg.key, flags); } } /** * Environment.path() -> Unicode */ static PyObject * env_path(EnvObject *self) { const char *path; int rc; if(! self->valid) { return err_invalid(); } if((rc = mdb_env_get_path(self->env, &path))) { return err_set("mdb_env_get_path", rc); } return PyUnicode_FromString(path); } static const struct dict_field mdb_stat_fields[] = { {TYPE_UINT, "psize", offsetof(MDB_stat, ms_psize)}, {TYPE_UINT, "depth", offsetof(MDB_stat, ms_depth)}, {TYPE_SIZE, "branch_pages", offsetof(MDB_stat, ms_branch_pages)}, {TYPE_SIZE, "leaf_pages", offsetof(MDB_stat, ms_leaf_pages)}, {TYPE_SIZE, "overflow_pages", offsetof(MDB_stat, ms_overflow_pages)}, {TYPE_SIZE, "entries", offsetof(MDB_stat, ms_entries)}, {TYPE_EOF, NULL, 0} }; /** * Environment.stat() -> dict */ static PyObject * env_stat(EnvObject *self) { MDB_stat st; int rc; if(! self->valid) { return err_invalid(); } UNLOCKED(rc, mdb_env_stat(self->env, &st)); if(rc) { err_set("mdb_env_stat", rc); return NULL; } return dict_from_fields(&st, mdb_stat_fields); } /** * Callback to receive string result for env_readers(). Return 0 on success or * -1 on error. */ static int env_readers_callback(const char *msg, void *str_) { PyObject **str = str_; PyObject *s = PyUnicode_FromString(msg); PyObject *new; if(! s) { return -1; } new = PyUnicode_Concat(*str, s); Py_CLEAR(*str); *str = new; if(! new) { return -1; } return 0; } /** * Environment.readers() -> string */ static PyObject * env_readers(EnvObject *self) { PyObject *str; if(! self->valid) { return err_invalid(); } if(! ((str = PyUnicode_FromString("")))) { return NULL; } if(mdb_reader_list(self->env, env_readers_callback, &str)) { Py_CLEAR(str); } return str; } /** * Environment.reader_check() -> int */ static PyObject * env_reader_check(EnvObject *self) { int rc; int dead; if(! self->valid) { return err_invalid(); } if((rc = mdb_reader_check(self->env, &dead))) { return err_set("mdb_reader_check", rc); } return PyLong_FromLongLong(dead); } /** * Environment.set_mapsize(size) -> None */ static PyObject * env_reader_set_mapsize(EnvObject *self, PyObject *args, PyObject *kwargs) { struct env_set_mapsize { size_t map_size; } arg = {0}; static const struct argspec argspec[] = { {"map_size", ARG_SIZE, OFFSET(env_set_mapsize, map_size)} }; int rc; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwargs, &arg)) { return NULL; } rc = mdb_env_set_mapsize(self->env, arg.map_size); if(rc) { return err_set("mdb_env_set_mapsize", rc); } Py_RETURN_NONE; } /** * Environment.sync() */ static PyObject * env_sync(EnvObject *self, PyObject *args) { struct env_sync { int force; } arg = {0}; static const struct argspec argspec[] = { {"force", ARG_BOOL, OFFSET(env_sync, force)} }; int rc; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, NULL, &arg)) { return NULL; } UNLOCKED(rc, mdb_env_sync(self->env, arg.force)); if(rc) { return err_set("mdb_env_sync", rc); } Py_RETURN_NONE; } /** * Environment.__enter__() */ static PyObject *env_enter(EnvObject *self) { Py_INCREF(self); return (PyObject *)self; } /** * Environment.__exit__() */ static PyObject *env_exit(EnvObject *self, PyObject *args) { env_clear(self); Py_RETURN_NONE; } static struct PyMethodDef env_methods[] = { {"__enter__", (PyCFunction)env_enter, METH_NOARGS}, {"__exit__", (PyCFunction)env_exit, METH_VARARGS}, {"begin", (PyCFunction)env_begin, METH_VARARGS|METH_KEYWORDS}, {"close", (PyCFunction)env_close, METH_NOARGS}, {"copy", (PyCFunction)env_copy, METH_VARARGS|METH_KEYWORDS}, {"copyfd", (PyCFunction)env_copyfd, METH_VARARGS|METH_KEYWORDS}, {"info", (PyCFunction)env_info, METH_NOARGS}, {"flags", (PyCFunction)env_flags, METH_NOARGS}, {"max_key_size", (PyCFunction)env_max_key_size, METH_NOARGS}, {"max_readers", (PyCFunction)env_max_readers, METH_NOARGS}, {"open_db", (PyCFunction)env_open_db, METH_VARARGS|METH_KEYWORDS}, {"path", (PyCFunction)env_path, METH_NOARGS}, {"stat", (PyCFunction)env_stat, METH_NOARGS}, {"readers", (PyCFunction)env_readers, METH_NOARGS}, {"reader_check", (PyCFunction)env_reader_check, METH_NOARGS}, {"set_mapsize", (PyCFunction)env_reader_set_mapsize, METH_VARARGS|METH_KEYWORDS}, {"sync", (PyCFunction)env_sync, METH_VARARGS}, {NULL, NULL} }; static PyTypeObject PyEnvironment_Type = { PyVarObject_HEAD_INIT(NULL, 0) "Environment", /*tp_name*/ sizeof(EnvObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor) env_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ (inquiry) env_clear, /*tp_clear*/ 0, /*tp_richcompare*/ offsetof(EnvObject, weaklist), /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ env_methods, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ env_new, /*tp_new*/ }; /* ------- */ /* Cursors */ /* ------- */ static int cursor_clear(CursorObject *self) { if(self->valid) { INVALIDATE(self) UNLINK_CHILD(self->trans, self) Py_BEGIN_ALLOW_THREADS mdb_cursor_close(self->curs); Py_END_ALLOW_THREADS self->valid = 0; } Py_CLEAR(self->trans); return 0; } /** * Cursor.__del__() */ static void cursor_dealloc(CursorObject *self) { DEBUG("destroying cursor") cursor_clear(self); PyObject_Del(self); } /** * Environment.Cursor(db, trans) -> new instance. */ static PyObject * cursor_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { struct cursor_new { DbObject *db; TransObject *trans; } arg = {NULL, NULL}; static const struct argspec argspec[] = { {"db", ARG_DB, OFFSET(cursor_new, db)}, {"txn", ARG_TRANS, OFFSET(cursor_new, trans)} }; static PyObject *cache = NULL; if(parse_args(1, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! (arg.db && arg.trans)) { return type_error("db and transaction parameters required."); } return make_cursor(arg.db, arg.trans); } /** * Cursor.count() -> long */ static PyObject * cursor_count(CursorObject *self) { size_t count; int rc; if(! self->valid) { return err_invalid(); } UNLOCKED(rc, mdb_cursor_count(self->curs, &count)); if(rc) { return err_set("mdb_cursor_count", rc); } return PyLong_FromUnsignedLongLong(count); } /** * Apply `op` to the cursor using the Cursor instance's `key` and `val` * MDB_vals. On completion, check for an error and if one occurred, set the * cursor to the unpositioned state. Finally record the containing * transaction's last mutation count, so we know if `key` and `val` become * invalid before the next attempt to read them. */ static int _cursor_get_c(CursorObject *self, enum MDB_cursor_op op) { int rc; Py_BEGIN_ALLOW_THREADS; rc = mdb_cursor_get(self->curs, &self->key, &self->val, op); Py_END_ALLOW_THREADS; self->positioned = rc == 0; self->last_mutation = self->trans->mutations; if(rc) { self->key.mv_size = 0; self->val.mv_size = 0; if(rc != MDB_NOTFOUND) { if(! (rc == EINVAL && op == MDB_GET_CURRENT)) { err_set("mdb_cursor_get", rc); return -1; } } } return 0; } /** * Wrap _cursor_get_c() to return True or False depending on whether the * Cursor's final state is positioned. */ static PyObject * _cursor_get(CursorObject *self, enum MDB_cursor_op op) { if(! self->valid) { return err_invalid(); } if(_cursor_get_c(self, op)) { return NULL; } return py_bool(self->positioned); } /** * Cursor.delete(dupdata=False) -> bool */ static PyObject * cursor_delete(CursorObject *self, PyObject *args, PyObject *kwds) { struct cursor_delete { int dupdata; } arg = {0}; static const struct argspec argspec[] = { {"dupdata", ARG_BOOL, OFFSET(cursor_delete, dupdata)} }; int res; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } res = 0; if(self->positioned) { int rc; int flags = arg.dupdata ? MDB_NODUPDATA : 0; DEBUG("deleting key '%.*s'", (int) self->key.mv_size, (char*) self->key.mv_data) UNLOCKED(rc, mdb_cursor_del(self->curs, flags)); self->trans->mutations++; if(rc) { return err_set("mdb_cursor_del", rc); } res = 1; _cursor_get_c(self, MDB_GET_CURRENT); } return py_bool(res); } /** * Cursor.first() -> bool */ static PyObject * cursor_first(CursorObject *self) { return _cursor_get(self, MDB_FIRST); } /** * Cursor.first_dup() -> bool */ static PyObject * cursor_first_dup(CursorObject *self) { return _cursor_get(self, MDB_FIRST_DUP); } static PyObject * cursor_value(CursorObject *self); /** * Cursor.get() -> result */ static PyObject * cursor_get(CursorObject *self, PyObject *args, PyObject *kwds) { struct cursor_get { MDB_val key; PyObject *default_; } arg = {{0, 0}, Py_None}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(cursor_get, key)}, {"default", ARG_OBJ, OFFSET(cursor_get, default_)} }; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! arg.key.mv_data) { return type_error("key must be given."); } self->key = arg.key; if(_cursor_get_c(self, MDB_SET_KEY)) { return NULL; } if(! self->positioned) { Py_INCREF(arg.default_); return arg.default_; } return cursor_value(self); } /** * Cursor.item() -> (key, value) */ static PyObject * cursor_item(CursorObject *self) { int as_buffer; PyObject *key; PyObject *val; PyObject *tup; int rc = 0; if(! self->valid) { return err_invalid(); } /* Must refresh `key` and `val` following mutation. */ if(self->last_mutation != self->trans->mutations && _cursor_get_c(self, MDB_GET_CURRENT)) { return NULL; } as_buffer = self->trans->flags & TRANS_BUFFERS; key = obj_from_val(&self->key, as_buffer); PRELOAD_UNLOCKED(rc, self->val.mv_data, self->val.mv_size); val = obj_from_val(&self->val, as_buffer); tup = PyTuple_New(2); if(tup && key && val) { PyTuple_SET_ITEM(tup, 0, key); PyTuple_SET_ITEM(tup, 1, val); return tup; } Py_CLEAR(key); Py_CLEAR(val); Py_CLEAR(tup); return NULL; } /** * Cursor.key() -> result */ static PyObject * cursor_key(CursorObject *self) { if(! self->valid) { return err_invalid(); } /* Must refresh `key` and `val` following mutation. */ if(self->last_mutation != self->trans->mutations && _cursor_get_c(self, MDB_GET_CURRENT)) { return NULL; } return obj_from_val(&self->key, self->trans->flags & TRANS_BUFFERS); } /** * Cursor.last() -> bool */ static PyObject * cursor_last(CursorObject *self) { return _cursor_get(self, MDB_LAST); } /** * Cursor.last_dup() -> bool */ static PyObject * cursor_last_dup(CursorObject *self) { return _cursor_get(self, MDB_LAST_DUP); } /** * Cursor.next() -> bool */ static PyObject * cursor_next(CursorObject *self) { return _cursor_get(self, MDB_NEXT); } /** * Cursor.next_dup() -> bool */ static PyObject * cursor_next_dup(CursorObject *self) { return _cursor_get(self, MDB_NEXT_DUP); } /** * Cursor.next_nodup() -> bool */ static PyObject * cursor_next_nodup(CursorObject *self) { return _cursor_get(self, MDB_NEXT_NODUP); } /** * Cursor.prev() -> bool */ static PyObject * cursor_prev(CursorObject *self) { return _cursor_get(self, MDB_PREV); } /** * Cursor.prev_dup() -> bool */ static PyObject * cursor_prev_dup(CursorObject *self) { return _cursor_get(self, MDB_PREV_DUP); } /** * Cursor.prev_nodup() -> bool */ static PyObject * cursor_prev_nodup(CursorObject *self) { return _cursor_get(self, MDB_PREV_NODUP); } /** * Cursor.putmulti(iter|dict) -> (consumed, added) */ static PyObject * cursor_put_multi(CursorObject *self, PyObject *args, PyObject *kwds) { struct cursor_put { PyObject *items; int dupdata; int overwrite; int append; } arg = {Py_None, 1, 1, 0}; PyObject *iter; PyObject *item; static const struct argspec argspec[] = { {"items", ARG_OBJ, OFFSET(cursor_put, items)}, {"dupdata", ARG_BOOL, OFFSET(cursor_put, dupdata)}, {"overwrite", ARG_BOOL, OFFSET(cursor_put, overwrite)}, {"append", ARG_BOOL, OFFSET(cursor_put, append)} }; int flags; int rc; Py_ssize_t consumed; Py_ssize_t added; PyObject *ret = NULL; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } flags = 0; if(! arg.dupdata) { flags |= MDB_NODUPDATA; } if(! arg.overwrite) { flags |= MDB_NOOVERWRITE; } if(arg.append) { flags |= (self->trans->db->flags & MDB_DUPSORT) ? MDB_APPENDDUP : MDB_APPEND; } if(! ((iter = PyObject_GetIter(arg.items)))) { return NULL; } consumed = 0; added = 0; while((item = PyIter_Next(iter))) { MDB_val mkey, mval; if(! (PyTuple_CheckExact(item) && PyTuple_GET_SIZE(item) == 2)) { PyErr_SetString(PyExc_TypeError, "putmulti() elements must be 2-tuples"); Py_DECREF(item); Py_DECREF(iter); return NULL; } if(val_from_buffer(&mkey, PyTuple_GET_ITEM(item, 0)) || val_from_buffer(&mval, PyTuple_GET_ITEM(item, 1))) { Py_DECREF(item); Py_DECREF(iter); return NULL; /* val_from_buffer sets exception */ } UNLOCKED(rc, mdb_cursor_put(self->curs, &mkey, &mval, flags)); self->trans->mutations++; switch(rc) { case MDB_SUCCESS: added++; break; case MDB_KEYEXIST: break; default: Py_DECREF(item); Py_DECREF(iter); return err_format(rc, "mdb_cursor_put() element #%d", consumed); } Py_DECREF(item); consumed++; } Py_DECREF(iter); if(! PyErr_Occurred()) { ret = Py_BuildValue("(nn)", consumed, added); } return ret; } /** * Cursor.put() -> bool */ static PyObject * cursor_put(CursorObject *self, PyObject *args, PyObject *kwds) { struct cursor_put { MDB_val key; MDB_val val; int dupdata; int overwrite; int append; } arg = {{0, 0}, {0, 0}, 1, 1, 0}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(cursor_put, key)}, {"value", ARG_BUF, OFFSET(cursor_put, val)}, {"dupdata", ARG_BOOL, OFFSET(cursor_put, dupdata)}, {"overwrite", ARG_BOOL, OFFSET(cursor_put, overwrite)}, {"append", ARG_BOOL, OFFSET(cursor_put, append)} }; int flags; int rc; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } flags = 0; if(! arg.dupdata) { flags |= MDB_NODUPDATA; } if(! arg.overwrite) { flags |= MDB_NOOVERWRITE; } if(arg.append) { flags |= MDB_APPEND; } UNLOCKED(rc, mdb_cursor_put(self->curs, &arg.key, &arg.val, flags)); self->trans->mutations++; if(rc) { if(rc == MDB_KEYEXIST) { Py_RETURN_FALSE; } return err_set("mdb_put", rc); } Py_RETURN_TRUE; } /** * Shared between Cursor.replace() and Transaction.replace() */ static PyObject * do_cursor_replace(CursorObject *self, MDB_val *key, MDB_val *val) { int rc = 0; PyObject *old; MDB_val newval = *val; if(self->dbi_flags & MDB_DUPSORT) { self->key = *key; if(_cursor_get_c(self, MDB_SET_KEY)) { return NULL; } if(self->positioned) { PRELOAD_UNLOCKED(rc, self->val.mv_data, self->val.mv_size); if(! ((old = obj_from_val(&self->val, 0)))) { return NULL; } UNLOCKED(rc, mdb_cursor_del(self->curs, MDB_NODUPDATA)); self->trans->mutations++; if(rc) { Py_CLEAR(old); return err_set("mdb_cursor_del", rc); } } else { old = Py_None; Py_INCREF(old); } } else { /* val is updated if MDB_KEYEXIST. */ int flags = MDB_NOOVERWRITE; UNLOCKED(rc, mdb_cursor_put(self->curs, key, val, flags)); self->trans->mutations++; if(! rc) { Py_RETURN_NONE; } else if(rc != MDB_KEYEXIST) { return err_set("mdb_put", rc); } if(! ((old = obj_from_val(val, 0)))) { return NULL; } } UNLOCKED(rc, mdb_cursor_put(self->curs, key, &newval, 0)); if(rc) { Py_DECREF(old); return err_set("mdb_put", rc); } return old; } /** * Cursor.replace() -> None|result */ static PyObject * cursor_replace(CursorObject *self, PyObject *args, PyObject *kwds) { struct cursor_replace { MDB_val key; MDB_val val; } arg = {{0, 0}, {0, 0}}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(cursor_replace, key)}, {"value", ARG_BUF, OFFSET(cursor_replace, val)} }; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } return do_cursor_replace(self, &arg.key, &arg.val); } /** * Cursor.pop() -> None|result */ static PyObject * cursor_pop(CursorObject *self, PyObject *args, PyObject *kwds) { struct cursor_pop { MDB_val key; } arg = {{0, 0}}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(cursor_pop, key)}, }; PyObject *old; int rc = 0; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } self->key = arg.key; if(_cursor_get_c(self, MDB_SET_KEY)) { return NULL; } if(! self->positioned) { Py_RETURN_NONE; } PRELOAD_UNLOCKED(rc, self->val.mv_data, self->val.mv_size); if(! ((old = obj_from_val(&self->val, 0)))) { return NULL; } UNLOCKED(rc, mdb_cursor_del(self->curs, 0)); self->trans->mutations++; if(rc) { Py_DECREF(old); return err_set("mdb_cursor_del", rc); } return old; } /** * Cursor.set_key(key) -> bool */ static PyObject * cursor_set_key(CursorObject *self, PyObject *arg) { if(! self->valid) { return err_invalid(); } if(val_from_buffer(&self->key, arg)) { return NULL; } return _cursor_get(self, MDB_SET_KEY); } /** * Cursor.set_key_dup(key, value) -> bool */ static PyObject * cursor_set_key_dup(CursorObject *self, PyObject *args, PyObject *kwds) { struct cursor_set_key_dup { MDB_val key; MDB_val value; } arg = {{0, 0}, {0, 0}}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(cursor_set_key_dup, key)}, {"value", ARG_BUF, OFFSET(cursor_set_key_dup, value)} }; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } self->key = arg.key; self->val = arg.value; return _cursor_get(self, MDB_GET_BOTH); } /** * Cursor.set_range(key) -> bool */ static PyObject * cursor_set_range(CursorObject *self, PyObject *arg) { if(! self->valid) { return err_invalid(); } if(val_from_buffer(&self->key, arg)) { return NULL; } if(self->key.mv_size) { return _cursor_get(self, MDB_SET_RANGE); } return _cursor_get(self, MDB_FIRST); } /** * Cursor.set_range_dup(key, value) -> bool */ static PyObject * cursor_set_range_dup(CursorObject *self, PyObject *args, PyObject *kwds) { PyObject *ret; struct cursor_set_range_dup { MDB_val key; MDB_val value; } arg = {{0, 0}, {0, 0}}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(cursor_set_range_dup, key)}, {"value", ARG_BUF, OFFSET(cursor_set_range_dup, value)} }; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } self->key = arg.key; self->val = arg.value; ret = _cursor_get(self, MDB_GET_BOTH_RANGE); /* issue #126: MDB_GET_BOTH_RANGE does not satisfy its documentation, and * fails to update `key` and `value` on success. Therefore explicitly call * MDB_GET_CURRENT after MDB_GET_BOTH_RANGE. */ _cursor_get_c(self, MDB_GET_CURRENT); return ret; } /** * Cursor.value() -> result */ static PyObject * cursor_value(CursorObject *self) { if(! self->valid) { return err_invalid(); } /* Must refresh `key` and `val` following mutation. */ if(self->last_mutation != self->trans->mutations && _cursor_get_c(self, MDB_GET_CURRENT)) { return NULL; } PRELOAD_UNLOCKED(0, self->val.mv_data, self->val.mv_size); return obj_from_val(&self->val, self->trans->flags & TRANS_BUFFERS); } static PyObject * new_iterator(CursorObject *cursor, IterValFunc val_func, MDB_cursor_op op) { IterObject *iter = PyObject_New(IterObject, &PyIterator_Type); if (!iter) { return NULL; } iter->val_func = val_func; iter->curs = cursor; Py_INCREF(cursor); iter->started = 0; iter->op = op; DEBUG("new_iterator: %p", (void *)iter) return (PyObject *) iter; } static PyObject * iter_from_args(CursorObject *self, PyObject *args, PyObject *kwds, signed int pos_op, enum MDB_cursor_op op, int keys_default, int values_default) { struct iter_from_args { int keys; int values; } arg = {keys_default, values_default}; static const struct argspec argspec[] = { {"keys", ARG_BOOL, OFFSET(iter_from_args, keys)}, {"values", ARG_BOOL, OFFSET(iter_from_args, values)} }; void *val_func; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(pos_op != -1 && !self->positioned) { if(_cursor_get_c(self, (enum MDB_cursor_op) pos_op)) { return NULL; } } if(! arg.values) { val_func = cursor_key; } else if(! arg.keys) { val_func = cursor_value; } else { val_func = cursor_item; } return new_iterator(self, val_func, op); } static PyObject * cursor_iter(CursorObject *self) { return iter_from_args(self, NULL, NULL, MDB_FIRST, MDB_NEXT, 1, 1); } /** * Cursor.iternext() -> Iterator */ static PyObject * cursor_iternext(CursorObject *self, PyObject *args, PyObject *kwargs) { return iter_from_args(self, args, kwargs, MDB_FIRST, MDB_NEXT, 1, 1); } /** * Cursor.iternext_dup() -> Iterator */ static PyObject * cursor_iternext_dup(CursorObject *self, PyObject *args, PyObject *kwargs) { return iter_from_args(self, args, kwargs, -1, MDB_NEXT_DUP, 0, 1); } /** * Cursor.iternext_nodup() -> Iterator */ static PyObject * cursor_iternext_nodup(CursorObject *self, PyObject *args, PyObject *kwargs) { return iter_from_args(self, args, kwargs, MDB_FIRST, MDB_NEXT_NODUP, 1, 0); } /** * Cursor.iterprev() -> Iterator */ static PyObject * cursor_iterprev(CursorObject *self, PyObject *args, PyObject *kwargs) { return iter_from_args(self, args, kwargs, MDB_LAST, MDB_PREV, 1, 1); } /** * Cursor.iterprev_dup() -> Iterator */ static PyObject * cursor_iterprev_dup(CursorObject *self, PyObject *args, PyObject *kwargs) { return iter_from_args(self, args, kwargs, -1, MDB_PREV_DUP, 0, 1); } /** * Cursor.iterprev_nodup() -> Iterator */ static PyObject * cursor_iterprev_nodup(CursorObject *self, PyObject *args, PyObject *kwargs) { return iter_from_args(self, args, kwargs, MDB_LAST, MDB_PREV_NODUP, 1, 0); } /** * Cursor._iter_from() -> Iterator */ static PyObject * cursor_iter_from(CursorObject *self, PyObject *args) { struct cursor_iter_from { MDB_val key; int reverse; } arg = {{0, 0}, 0}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(cursor_iter_from, key)}, {"reverse", ARG_BOOL, OFFSET(cursor_iter_from, reverse)} }; enum MDB_cursor_op op; int rc; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, NULL, &arg)) { return NULL; } if((! arg.key.mv_size) && (! arg.reverse)) { rc = _cursor_get_c(self, MDB_FIRST); } else { self->key = arg.key; rc = _cursor_get_c(self, MDB_SET_RANGE); } if(rc) { return NULL; } op = MDB_NEXT; if(arg.reverse) { op = MDB_PREV; if(! self->positioned) { if(_cursor_get_c(self, MDB_LAST)) { return NULL; } } } DEBUG("positioned? %d", self->positioned) return new_iterator(self, (void *)cursor_item, op); } /** * Cursor.__enter__() */ static PyObject *cursor_enter(CursorObject *self) { Py_INCREF(self); return (PyObject *)self; } /** * Cursor.__exit__() */ static PyObject *cursor_exit(CursorObject *self, PyObject *args) { cursor_clear(self); Py_RETURN_NONE; } /** * Cursor.close() */ static PyObject *cursor_close(CursorObject *self) { cursor_clear(self); Py_RETURN_NONE; } static struct PyMethodDef cursor_methods[] = { {"__enter__", (PyCFunction)cursor_enter, METH_NOARGS}, {"__exit__", (PyCFunction)cursor_exit, METH_VARARGS}, {"close", (PyCFunction)cursor_close, METH_NOARGS}, {"count", (PyCFunction)cursor_count, METH_NOARGS}, {"delete", (PyCFunction)cursor_delete, METH_VARARGS|METH_KEYWORDS}, {"first", (PyCFunction)cursor_first, METH_NOARGS}, {"first_dup", (PyCFunction)cursor_first_dup, METH_NOARGS}, {"get", (PyCFunction)cursor_get, METH_VARARGS|METH_KEYWORDS}, {"item", (PyCFunction)cursor_item, METH_NOARGS}, {"iternext", (PyCFunction)cursor_iternext, METH_VARARGS|METH_KEYWORDS}, {"iternext_dup", (PyCFunction)cursor_iternext_dup, METH_VARARGS|METH_KEYWORDS}, {"iternext_nodup", (PyCFunction)cursor_iternext_nodup, METH_VARARGS|METH_KEYWORDS}, {"iterprev", (PyCFunction)cursor_iterprev, METH_VARARGS|METH_KEYWORDS}, {"iterprev_dup", (PyCFunction)cursor_iterprev_dup, METH_VARARGS|METH_KEYWORDS}, {"iterprev_nodup", (PyCFunction)cursor_iterprev_nodup, METH_VARARGS|METH_KEYWORDS}, {"key", (PyCFunction)cursor_key, METH_NOARGS}, {"last", (PyCFunction)cursor_last, METH_NOARGS}, {"last_dup", (PyCFunction)cursor_last_dup, METH_NOARGS}, {"next", (PyCFunction)cursor_next, METH_NOARGS}, {"next_dup", (PyCFunction)cursor_next_dup, METH_NOARGS}, {"next_nodup", (PyCFunction)cursor_next_nodup, METH_NOARGS}, {"prev", (PyCFunction)cursor_prev, METH_NOARGS}, {"prev_dup", (PyCFunction)cursor_prev_dup, METH_NOARGS}, {"prev_nodup", (PyCFunction)cursor_prev_nodup, METH_NOARGS}, {"put", (PyCFunction)cursor_put, METH_VARARGS|METH_KEYWORDS}, {"putmulti", (PyCFunction)cursor_put_multi, METH_VARARGS|METH_KEYWORDS}, {"replace", (PyCFunction)cursor_replace, METH_VARARGS|METH_KEYWORDS}, {"pop", (PyCFunction)cursor_pop, METH_VARARGS|METH_KEYWORDS}, {"set_key", (PyCFunction)cursor_set_key, METH_O}, {"set_key_dup", (PyCFunction)cursor_set_key_dup, METH_VARARGS|METH_KEYWORDS}, {"set_range", (PyCFunction)cursor_set_range, METH_O}, {"set_range_dup", (PyCFunction)cursor_set_range_dup, METH_VARARGS|METH_KEYWORDS}, {"value", (PyCFunction)cursor_value, METH_NOARGS}, {"_iter_from", (PyCFunction)cursor_iter_from, METH_VARARGS}, {NULL, NULL} }; static PyTypeObject PyCursor_Type = { PyVarObject_HEAD_INIT(NULL, 0) "Cursor", /*tp_name*/ sizeof(CursorObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor) cursor_dealloc,/*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ (inquiry) cursor_clear, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ (getiterfunc)cursor_iter, /*tp_iter*/ 0, /*tp_iternext*/ cursor_methods, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ cursor_new, /*tp_new*/ 0, /*tp_free*/ }; /* --------- */ /* Iterators */ /* --------- */ /** * Iterator.__del__() */ static void iter_dealloc(IterObject *self) { DEBUG("destroying iterator") Py_CLEAR(self->curs); PyObject_Del(self); } /** * Iterator.__iter__() -> self */ static PyObject * iter_iter(IterObject *self) { Py_INCREF(self); return (PyObject *)self; } /** * Iterator.next() -> result */ static PyObject * iter_next(IterObject *self) { if(! self->curs->valid) { return err_invalid(); } if(! self->curs->positioned) { return NULL; } if(self->started) { if(_cursor_get_c(self->curs, self->op)) { return NULL; } if(! self->curs->positioned) { return NULL; } } self->started = 1; return self->val_func(self->curs); } static PyTypeObject PyIterator_Type = { PyVarObject_HEAD_INIT(NULL, 0) "_Iterator", /*tp_name*/ sizeof(IterObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor) iter_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ 0, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ (getiterfunc)iter_iter, /*tp_iter*/ (iternextfunc)iter_next, /*tp_iternext*/ 0, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ 0, /*tp_new*/ 0, /*tp_free*/ }; /* ------------ */ /* Transactions */ /* ------------ */ static int trans_clear(TransObject *self) { INVALIDATE(self) #ifdef HAVE_MEMSINK ms_notify((PyObject *) self, &self->sink_head); #endif if(self->txn) { Py_BEGIN_ALLOW_THREADS MDEBUG("aborting") mdb_txn_abort(self->txn); Py_END_ALLOW_THREADS self->txn = NULL; } MDEBUG("db is/was %p", self->db) Py_CLEAR(self->db); self->valid = 0; if(self->env) { UNLINK_CHILD(self->env, self) Py_CLEAR(self->env); } return 0; } /** * Transaction.__del__() */ static void trans_dealloc(TransObject *self) { if(self->weaklist != NULL) { MDEBUG("Clearing weaklist..") PyObject_ClearWeakRefs((PyObject *) self); } if(self->env && self->txn && (self->env->max_spare_txns > 0) && (self->flags & TRANS_RDONLY)) { MDEBUG("caching trans") if(! (self->flags & TRANS_SPARE)) { MDEBUG("resetting") mdb_txn_reset(self->txn); self->flags |= TRANS_SPARE; } self->spare_next = self->env->spare_txns; self->env->spare_txns = self; self->env->max_spare_txns--; Py_INCREF(self); Py_CLEAR(self->db); UNLINK_CHILD(self->env, self) Py_CLEAR(self->env); return; } MDEBUG("deleting trans") trans_clear(self); PyObject_Del(self); } /** * Transaction(env, db) -> new instance. */ static PyObject * trans_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { struct trans_new { EnvObject *env; DbObject *db; TransObject *parent; int write; int buffers; } arg = {NULL, NULL, NULL, 0, 0}; static const struct argspec argspec[] = { {"env", ARG_ENV, OFFSET(trans_new, env)}, {"db", ARG_DB, OFFSET(trans_new, db)}, {"parent", ARG_TRANS, OFFSET(trans_new, parent)}, {"write", ARG_BOOL, OFFSET(trans_new, write)}, {"buffers", ARG_BOOL, OFFSET(trans_new, buffers)} }; static PyObject *cache = NULL; if(parse_args(1, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! arg.env) { return type_error("'env' argument required"); } return make_trans(arg.env, arg.db, arg.parent, arg.write, arg.buffers); } /** * Transaction.abort() */ static PyObject * trans_abort(TransObject *self) { if(self->valid) { DEBUG("invalidate") INVALIDATE(self) #ifdef HAVE_MEMSINK ms_notify((PyObject *) self, &self->sink_head); #endif if(self->flags & TRANS_RDONLY) { DEBUG("resetting") /* Reset to spare state, ready for _dealloc to freelist it. */ mdb_txn_reset(self->txn); self->flags |= TRANS_SPARE; } else { DEBUG("aborting") Py_BEGIN_ALLOW_THREADS mdb_txn_abort(self->txn); Py_END_ALLOW_THREADS self->txn = NULL; } self->valid = 0; } Py_RETURN_NONE; } /** * Transaction.commit() */ static PyObject * trans_commit(TransObject *self) { int rc; if(! self->valid) { return err_invalid(); } DEBUG("invalidate") INVALIDATE(self) #ifdef HAVE_MEMSINK ms_notify((PyObject *) self, &self->sink_head); #endif if(self->flags & TRANS_RDONLY) { DEBUG("resetting") /* Reset to spare state, ready for _dealloc to freelist it. */ mdb_txn_reset(self->txn); self->flags |= TRANS_SPARE; } else { DEBUG("committing") UNLOCKED(rc, mdb_txn_commit(self->txn)); self->txn = NULL; if(rc) { return err_set("mdb_txn_commit", rc); } } self->valid = 0; Py_RETURN_NONE; } /** * Transaction.cursor() -> Cursor */ static PyObject * trans_cursor(TransObject *self, PyObject *args, PyObject *kwds) { struct trans_cursor { DbObject *db; } arg = {self->db}; static const struct argspec argspec[] = { {"db", ARG_DB, OFFSET(trans_cursor, db)} }; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } return make_cursor(arg.db, self); } /** * Transaction.delete() -> bool */ static PyObject * trans_delete(TransObject *self, PyObject *args, PyObject *kwds) { struct trans_delete { MDB_val key; MDB_val val; DbObject *db; } arg = {{0, 0}, {0, 0}, self->db}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(trans_delete, key)}, {"value", ARG_BUF, OFFSET(trans_delete, val)}, {"db", ARG_DB, OFFSET(trans_delete, db)} }; MDB_val *val_ptr; int rc; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! db_owner_check(arg.db, self->env)) { return NULL; } val_ptr = arg.val.mv_size ? &arg.val : NULL; self->mutations++; UNLOCKED(rc, mdb_del(self->txn, arg.db->dbi, &arg.key, val_ptr)); if(rc) { if(rc == MDB_NOTFOUND) { Py_RETURN_FALSE; } return err_set("mdb_del", rc); } Py_RETURN_TRUE; } /** * Transaction.drop(db) */ static PyObject * trans_drop(TransObject *self, PyObject *args, PyObject *kwds) { struct trans_drop { DbObject *db; int delete; } arg = {NULL, 1}; static const struct argspec argspec[] = { {"db", ARG_DB, OFFSET(trans_drop, db)}, {"delete", ARG_BOOL, OFFSET(trans_drop, delete)} }; int rc; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! arg.db) { return type_error("'db' argument required."); } else if(! db_owner_check(arg.db, self->env)) { return NULL; } UNLOCKED(rc, mdb_drop(self->txn, arg.db->dbi, arg.delete)); self->mutations++; if(rc) { return err_set("mdb_drop", rc); } Py_RETURN_NONE; } /** * Transaction.get() -> result */ static PyObject * trans_get(TransObject *self, PyObject *args, PyObject *kwds) { struct trans_get { MDB_val key; PyObject *default_; DbObject *db; } arg = {{0, 0}, Py_None, self->db}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(trans_get, key)}, {"default", ARG_OBJ, OFFSET(trans_get, default_)}, {"db", ARG_DB, OFFSET(trans_get, db)} }; MDB_val val; int rc; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! db_owner_check(arg.db, self->env)) { return NULL; } if(! arg.key.mv_data) { return type_error("key must be given."); } Py_BEGIN_ALLOW_THREADS rc = mdb_get(self->txn, arg.db->dbi, &arg.key, &val); preload(rc, val.mv_data, val.mv_size); Py_END_ALLOW_THREADS if(rc) { if(rc == MDB_NOTFOUND) { Py_INCREF(arg.default_); return arg.default_; } return err_set("mdb_get", rc); } return obj_from_val(&val, self->flags & TRANS_BUFFERS); } /** * Transaction.put() -> bool */ static PyObject * trans_put(TransObject *self, PyObject *args, PyObject *kwds) { struct trans_put { MDB_val key; MDB_val value; int dupdata; int overwrite; int append; DbObject *db; } arg = {{0, 0}, {0, 0}, 1, 1, 0, self->db}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(trans_put, key)}, {"value", ARG_BUF, OFFSET(trans_put, value)}, {"dupdata", ARG_BOOL, OFFSET(trans_put, dupdata)}, {"overwrite", ARG_BOOL, OFFSET(trans_put, overwrite)}, {"append", ARG_BOOL, OFFSET(trans_put, append)}, {"db", ARG_DB, OFFSET(trans_put, db)} }; int flags; int rc; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! db_owner_check(arg.db, self->env)) { return NULL; } flags = 0; if(! arg.dupdata) { flags |= MDB_NODUPDATA; } if(! arg.overwrite) { flags |= MDB_NOOVERWRITE; } if(arg.append) { flags |= MDB_APPEND; } DEBUG("inserting '%.*s' (%d) -> '%.*s' (%d)", (int)arg.key.mv_size, (char *)arg.key.mv_data, (int)arg.key.mv_size, (int)arg.value.mv_size, (char *)arg.value.mv_data, (int)arg.value.mv_size) self->mutations++; UNLOCKED(rc, mdb_put(self->txn, (arg.db)->dbi, &arg.key, &arg.value, flags)); if(rc) { if(rc == MDB_KEYEXIST) { Py_RETURN_FALSE; } return err_set("mdb_put", rc); } Py_RETURN_TRUE; } static PyObject * make_cursor(DbObject *db, TransObject *trans); static PyObject * do_cursor_replace(CursorObject *self, MDB_val *key, MDB_val *val); /** * Transaction.replace() -> None|result */ static PyObject * trans_replace(TransObject *self, PyObject *args, PyObject *kwds) { struct trans_replace { MDB_val key; MDB_val value; DbObject *db; } arg = {{0, 0}, {0, 0}, self->db}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(trans_replace, key)}, {"value", ARG_BUF, OFFSET(trans_replace, value)}, {"db", ARG_DB, OFFSET(trans_replace, db)} }; PyObject *ret; CursorObject *cursor; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! db_owner_check(arg.db, self->env)) { return NULL; } ret = NULL; cursor = (CursorObject *) make_cursor(arg.db, self); if(cursor) { ret = do_cursor_replace(cursor, &arg.key, &arg.value); Py_DECREF(cursor); } return ret; } static int _cursor_get_c(CursorObject *self, enum MDB_cursor_op op); /** * Transaction.pop() -> None|result */ static PyObject * trans_pop(TransObject *self, PyObject *args, PyObject *kwds) { struct trans_pop { MDB_val key; DbObject *db; } arg = {{0, 0}, self->db}; static const struct argspec argspec[] = { {"key", ARG_BUF, OFFSET(trans_pop, key)}, {"db", ARG_DB, OFFSET(trans_pop, db)} }; CursorObject *cursor; PyObject *old; int rc = 0; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! db_owner_check(arg.db, self->env)) { return NULL; } if(! ((cursor = (CursorObject *) make_cursor(arg.db, self)))) { return NULL; } cursor->key = arg.key; if(_cursor_get_c(cursor, MDB_SET_KEY)) { Py_DECREF((PyObject *)cursor); return NULL; } if(! cursor->positioned) { Py_DECREF((PyObject *)cursor); Py_RETURN_NONE; } PRELOAD_UNLOCKED(rc, cursor->val.mv_data, cursor->val.mv_size); if(! ((old = obj_from_val(&cursor->val, 0)))) { Py_DECREF((PyObject *)cursor); return NULL; } UNLOCKED(rc, mdb_cursor_del(cursor->curs, 0)); Py_DECREF((PyObject *)cursor); self->mutations++; if(rc) { Py_DECREF(old); return err_set("mdb_cursor_del", rc); } return old; } /** * Transaction.__enter__() */ static PyObject *trans_enter(TransObject *self) { if(! self->valid) { return err_invalid(); } Py_INCREF(self); return (PyObject *)self; } /** * Transaction.__exit__() */ static PyObject *trans_exit(TransObject *self, PyObject *args) { if(! self->valid) { return err_invalid(); } if(PyTuple_GET_ITEM(args, 0) == Py_None) { return trans_commit(self); } else { return trans_abort(self); } } /** * Transaction.id() -> int */ static PyObject *trans_id(TransObject *self) { size_t id; if(! self->valid) { return err_invalid(); } id = mdb_txn_id(self->txn); return PyLong_FromUnsignedLong(id); } /** * Transaction.stat() -> dict */ static PyObject * trans_stat(TransObject *self, PyObject *args, PyObject *kwds) { struct trans_stat { DbObject *db; } arg = {self->db}; static const struct argspec argspec[] = { {"db", ARG_DB, OFFSET(trans_stat, db)} }; MDB_stat st; int rc; static PyObject *cache = NULL; if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if(! db_owner_check(arg.db, self->env)) { return NULL; } UNLOCKED(rc, mdb_stat(self->txn, arg.db->dbi, &st)); if(rc) { return err_set("mdb_stat", rc); } return dict_from_fields(&st, mdb_stat_fields); } static struct PyMethodDef trans_methods[] = { {"__enter__", (PyCFunction)trans_enter, METH_NOARGS}, {"__exit__", (PyCFunction)trans_exit, METH_VARARGS}, {"abort", (PyCFunction)trans_abort, METH_NOARGS}, {"commit", (PyCFunction)trans_commit, METH_NOARGS}, {"cursor", (PyCFunction)trans_cursor, METH_VARARGS|METH_KEYWORDS}, {"delete", (PyCFunction)trans_delete, METH_VARARGS|METH_KEYWORDS}, {"drop", (PyCFunction)trans_drop, METH_VARARGS|METH_KEYWORDS}, {"get", (PyCFunction)trans_get, METH_VARARGS|METH_KEYWORDS}, {"put", (PyCFunction)trans_put, METH_VARARGS|METH_KEYWORDS}, {"replace", (PyCFunction)trans_replace, METH_VARARGS|METH_KEYWORDS}, {"pop", (PyCFunction)trans_pop, METH_VARARGS|METH_KEYWORDS}, {"id", (PyCFunction)trans_id, METH_NOARGS}, {"stat", (PyCFunction)trans_stat, METH_VARARGS|METH_KEYWORDS}, {NULL, NULL} }; static PyTypeObject PyTransaction_Type = { PyVarObject_HEAD_INIT(NULL, 0) "Transaction", /*tp_name*/ sizeof(TransObject), /*tp_basicsize*/ 0, /*tp_itemsize*/ (destructor) trans_dealloc, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ 0, /*tp_compare*/ 0, /*tp_repr*/ 0, /*tp_as_number*/ 0, /*tp_as_sequence*/ 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ (inquiry) trans_clear, /*tp_clear*/ 0, /*tp_richcompare*/ offsetof(TransObject, weaklist), /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ trans_methods, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ 0, /*tp_init*/ 0, /*tp_alloc*/ trans_new, /*tp_new*/ 0, /*tp_free*/ }; /** * Construct a PyString and append it to a list, returning 0 on success or -1 * on error. */ static int append_string(PyObject *list, const char *s) { #if PY_MAJOR_VERSION >= 3 PyObject *o = PyUnicode_FromString(s); #else PyObject *o = PyBytes_FromStringAndSize(s, strlen(s)); #endif if(! o) { return -1; } if(PyList_Append(list, o)) { Py_DECREF(o); return -1; } Py_DECREF(o); return 0; } /** * lmdb.enable_drop_gil() */ static PyObject * enable_drop_gil(void) { Py_RETURN_NONE; } /** * lmdb.get_version() -> tuple */ static PyObject * get_version(PyObject *mod, PyObject *args, PyObject *kwds) { struct version_args { int subpatch; } arg = {0}; static const struct argspec argspec[] = { {"subpatch", ARG_BOOL, OFFSET(version_args, subpatch)}, }; static PyObject *cache = NULL; if(parse_args(1, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { return NULL; } if (arg.subpatch) { #ifdef HAVE_PATCHED_LMDB const int subpatch = 1; #else const int subpatch = 0; #endif return Py_BuildValue("iiii", MDB_VERSION_MAJOR, MDB_VERSION_MINOR, MDB_VERSION_PATCH, subpatch); } return Py_BuildValue("iii", MDB_VERSION_MAJOR, MDB_VERSION_MINOR, MDB_VERSION_PATCH); } static struct PyMethodDef module_methods[] = { {"enable_drop_gil", (PyCFunction) enable_drop_gil, METH_NOARGS, ""}, {"version", (PyCFunction) get_version, METH_VARARGS|METH_KEYWORDS, ""}, {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef moduledef = { PyModuleDef_HEAD_INIT, "cpython", NULL, -1, module_methods, NULL, NULL, NULL, NULL }; #endif /** * Initialize and publish the LMDB built-in types. */ static int init_types(PyObject *mod, PyObject *__all__) { static PyTypeObject *types[] = { &PyEnvironment_Type, &PyCursor_Type, &PyTransaction_Type, &PyIterator_Type, &PyDatabase_Type, NULL }; int i; for(i = 0; types[i]; i++) { PyTypeObject *type = types[i]; char const * name = type->tp_name; if(PyType_Ready(type)) { return -1; } if(PyObject_SetAttrString(mod, name, (PyObject *)type)) { return -1; } /* As a special case, export _Database */ if((name[0] != '_' || 0 == strcmp(name, "_Database")) && append_string(__all__, name)) { return -1; } } return 0; } /** * Initialize a bunch of constants used to ease number compares. */ static int init_constants(PyObject *mod) { if(! ((py_zero = PyLong_FromUnsignedLongLong(0)))) { return -1; } if(! ((py_int_max = PyLong_FromUnsignedLongLong(INT_MAX)))) { return -1; } if(! ((py_size_max = PyLong_FromUnsignedLongLong(SIZE_MAX)))) { return -1; } return 0; } /** * Create lmdb.Error exception class, and one subclass for each entry in * `error_map`. */ static int init_errors(PyObject *mod, PyObject *__all__) { size_t count; char qualname[64]; size_t i; Error = PyErr_NewException("lmdb.Error", NULL, NULL); if(! Error) { return -1; } if(PyObject_SetAttrString(mod, "Error", Error)) { return -1; } if(append_string(__all__, "Error")) { return -1; } count = (sizeof error_map / sizeof error_map[0]); error_tbl = malloc(sizeof(PyObject *) * count); if(! error_tbl) { return -1; } for(i = 0; i < count; i++) { const struct error_map *error = &error_map[i]; PyObject *klass; snprintf(qualname, sizeof qualname, "lmdb.%s", error->name); qualname[sizeof qualname - 1] = '\0'; if(! ((klass = PyErr_NewException(qualname, Error, NULL)))) { return -1; } error_tbl[i] = klass; if(PyObject_SetAttrString(mod, error->name, klass)) { return -1; } if(append_string(__all__, error->name)) { return -1; } } return 0; } /** * Do all required to initialize the lmdb.cpython module. */ PyMODINIT_FUNC MODINIT_NAME(void) { PyObject *__all__; #if PY_MAJOR_VERSION >= 3 PyObject *mod = PyModule_Create(&moduledef); #else PyObject *mod = Py_InitModule3("cpython", module_methods, ""); #endif if(! mod) { MOD_RETURN(NULL); } if(! ((__all__ = PyList_New(0)))) { MOD_RETURN(NULL); } if(init_types(mod, __all__)) { MOD_RETURN(NULL); } if(append_string(__all__, "enable_drop_gil")) { MOD_RETURN(NULL); } if(append_string(__all__, "version")) { MOD_RETURN(NULL); } #ifdef HAVE_MEMSINK MemSink_IMPORT; if(ms_init_source(&PyTransaction_Type, offsetof(TransObject, sink_head))) { MOD_RETURN(NULL); } #endif #ifdef _WIN32 if(! ((msvcrt = PyImport_ImportModule("msvcrt")))) { MOD_RETURN(NULL); } #endif if(init_constants(mod)) { MOD_RETURN(NULL); } if(init_errors(mod, __all__)) { MOD_RETURN(NULL); } if(PyObject_SetAttrString(mod, "open", (PyObject *)&PyEnvironment_Type)) { MOD_RETURN(NULL); } if(PyObject_SetAttrString(mod, "__all__", __all__)) { MOD_RETURN(NULL); } Py_DECREF(__all__); MOD_RETURN(mod); } py-lmdb-py-lmdb_1.0.0/lmdb/tool.py000077500000000000000000000463241372223456500167720ustar00rootroot00000000000000# # Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # """ Basic tools for working with LMDB. copy: Consistent high speed backup an environment. %prog copy -e source.lmdb target.lmdb copyfd: Consistent high speed backup an environment to stdout. %prog copyfd -e source.lmdb > target.lmdb/data.mdb drop: Delete one or more sub-databases. %prog drop db1 dump: Dump one or more databases to disk in 'cdbmake' format. Usage: dump [db1=file1.cdbmake db2=file2.cdbmake] If no databases are given, dumps the main database to 'main.cdbmake'. edit: Add/delete/replace values from a database. %prog edit --set key=value --set-file key=/path \\ --add key=value --add-file key=/path/to/file \\ --delete key get: Read one or more values from a database. %prog get [ [ [..]]] readers: Display readers in the lock table %prog readers -e /path/to/db [-c] If -c is specified, clear stale readers. restore: Read one or more database from disk in 'cdbmake' format. %prog restore db1=file1.cdbmake db2=file2.cdbmake The special db name ":main:" may be used to indicate the main DB. rewrite: Re-create an environment using MDB_APPEND %prog rewrite -e src.lmdb -E dst.lmdb [ [ ..]] If no databases are given, rewrites only the main database. shell: Open interactive console with ENV set to the open environment. stat: Print environment statistics. warm: Read environment into page cache sequentially. watch: Show live environment statistics """ from __future__ import absolute_import from __future__ import with_statement import array import collections import csv import functools import optparse import os import pprint import signal import string import struct import sys import time # Python3.x bikeshedded trechery. try: from io import BytesIO as StringIO except ImportError: try: from cStringIO import StringIO # type: ignore except ImportError: from StringIO import StringIO # type: ignore import lmdb BUF_SIZE = 10485760 ENV = None DB = None # How strings get encoded to and decoded from DB ENCODING = 'utf-8' def _to_bytes(s): """Given either a Python 2.x or 3.x str, return either a str (Python 2.x) or a bytes instance (Python 3.x).""" return globals().get('unicode', str)(s).encode(ENCODING) def isprint(c): """Return ``True`` if the character `c` can be printed visibly and without adversely affecting printing position (e.g. newline).""" return c in string.printable and ord(c) > 16 def xxd(s): """Return a vaguely /usr/bin/xxd formatted representation of the bytestring `s`.""" sio = StringIO() pr = _to_bytes('') for idx, ch in enumerate(s): if sys.version_info[0] >= 3: ch = chr(ch) if not (idx % 16): if idx: sio.write(_to_bytes(' ')) sio.write(pr) sio.write(_to_bytes('\n')) sio.write(_to_bytes('%07x:' % idx)) pr = _to_bytes('') if not (idx % 2): sio.write(_to_bytes(' ')) sio.write(_to_bytes('%02x' % (ord(ch),))) pr += _to_bytes(ch) if isprint(ch) else _to_bytes('.') if idx % 16: need = 15 - (idx % 16) # fill remainder of last line. sio.write(_to_bytes(' ') * need) sio.write(_to_bytes(' ') * (need // 2)) sio.write(_to_bytes(' ')) sio.write(pr) sio.write(_to_bytes('\n')) return sio.getvalue().decode(ENCODING) def make_parser(): parser = optparse.OptionParser() parser.prog = 'python -mlmdb' parser.usage = '%prog [options] \n' + __doc__.rstrip() parser.add_option('-e', '--env', help='Environment file to open') parser.add_option('-d', '--db', help='Database to open (default: main)') parser.add_option('-r', '--read', help='Open environment read-only') parser.add_option('-S', '--map_size', type='int', default='10', help='Map size in megabytes (default: 10)') parser.add_option('-s', '--use-single-file', action='store_true', help='The database was created as a single file and not a subdirectory') # FIXME: implement --all # parser.add_option('-a', '--all', action='store_true', # help='Make "dump" dump all databases') parser.add_option('-E', '--target_env', help='Target environment file for "dumpfd"') parser.add_option('-x', '--xxd', action='store_true', help='Print values in xxd format') parser.add_option('-M', '--max-dbs', type='int', default=128, help='Maximum open DBs (default: 128)') parser.add_option('--out-fd', type='int', default=1, help='"copyfd" command target fd') group = parser.add_option_group('Options for "copy" command') group.add_option('--compact', action='store_true', default=False, help='Perform compaction while copying.') group = parser.add_option_group('Options for "edit" command') group.add_option('--set', action='append', help='List of key=value pairs to set.') group.add_option('--set-file', action='append', help='List of key pairs to read from files.') group.add_option('--add', action='append', help='List of key=value pairs to add.') group.add_option('--add-file', action='append', help='List of key pairs to read from files.') group.add_option('--delete', action='append', help='List of key=value pairs to delete.') group = parser.add_option_group('Options for "readers" command') group.add_option('-c', '--clean', action='store_true', help='Clean stale readers? (default: no)') group = parser.add_option_group('Options for "watch" command') group.add_option('--csv', action='store_true', help='Generate CSV instead of terminal output.') group.add_option('--interval', type='int', default=1, help='Interval size (default: 1sec)') group.add_option('--window', type='int', default=10, help='Average window size (default: 10)') return parser def die(fmt, *args): if args: fmt %= args sys.stderr.write('lmdb.tool: %s\n' % (fmt,)) raise SystemExit(1) def dump_cursor_to_fp(cursor, fp): for key, value in cursor: fp.write(_to_bytes('+%d,%d:' % (len(key), len(value)))) fp.write(key) fp.write(_to_bytes('->')) fp.write(value) fp.write(_to_bytes('\n')) fp.write(_to_bytes('\n')) def db_map_from_args(args): db_map = {} for arg in args: dbname, sep, path = arg.partition('=') if not sep: die('DB specification missing "=": %r', arg) if dbname == ':main:': dbname = None if dbname in db_map: die('DB specified twice: %r', arg) db_map[dbname] = (ENV.open_db(_to_bytes(dbname) if dbname else None), path) if not db_map: db_map[':main:'] = (ENV.open_db(None), 'main.cdbmake') return db_map def cmd_copy(opts, args): if len(args) != 1: die('Please specify output directory (see --help)') output_dir = args[0] if os.path.exists(output_dir): die('Output directory %r already exists.', output_dir) os.makedirs(output_dir, int('0755', 8)) print('Running copy to %r....' % (output_dir,)) ENV.copy(output_dir, compact=opts.compact) def cmd_copyfd(opts, args): if args: die('"copyfd" command takes no arguments (see --help)') try: os.fdopen(opts.out_fd, 'w', 0) except OSError: e = sys.exc_info()[1] die('Bad --out-fd %d: %s', opts.out_fd, e) ENV.copyfd(opts.out_fd) def cmd_dump(opts, args): db_map = db_map_from_args(args) with ENV.begin(buffers=True) as txn: for dbname, (db, path) in db_map.items(): with open(path, 'wb', BUF_SIZE) as fp: print('Dumping to %r...' % (path,)) cursor = txn.cursor(db=db) dump_cursor_to_fp(cursor, fp) def restore_cursor_from_fp(txn, fp, db): read = fp.read read1 = functools.partial(read, 1) read_until = lambda sep: ''.join(iter(read1, sep)) # NOQA: E731 rec_nr = 0 while True: rec_nr += 1 plus = read(1) if plus == '\n': break elif plus != '+': die('bad or missing plus, line/record #%d', rec_nr) try: klen = int(read_until(','), 10) dlen = int(read_until(':'), 10) except ValueError: die('bad or missing length, line/record #%d', rec_nr) key = read(klen) if read(2) != '->': die('bad or missing separator, line/record #%d', rec_nr) data = read(dlen) if (len(key) + len(data)) != (klen + dlen): die('short key or data, line/record #%d', rec_nr) if read(1) != '\n': die('bad line ending, line/record #%d', rec_nr) txn.put(key, data, db=db) return rec_nr def cmd_drop(opts, args): if not args: die('Must specify at least one sub-database (see --help)') dbs = map(ENV.open_db, (map(_to_bytes, args))) for idx, db in enumerate(dbs): name = args[idx] if name == ':main:': die('Cannot drop main DB') print('Dropping DB %r...' % (name,)) with ENV.begin(write=True) as txn: txn.drop(db) def cmd_readers(opts, args): if opts.clean: print('Cleaned %d stale entries.' % (ENV.reader_check(),)) print(ENV.readers()) def cmd_restore(opts, args): db_map = db_map_from_args(args) with ENV.begin(buffers=True, write=True) as txn: for dbname, (db, path) in db_map.items(): with open(path, 'rb', BUF_SIZE) as fp: print('Restoring from %r...' % (path,)) count = restore_cursor_from_fp(txn, fp, db) print('Loaded %d keys from %r' % (count, path)) def delta(hst): return [(hst[i] - hst[i - 1]) for i in range(1, len(hst))] SYS_BLOCK = '/sys/block' def _find_diskstat(path): if not os.path.exists(SYS_BLOCK): return st = os.stat(path) devs = '%s:%s' % (st.st_dev >> 8, st.st_dev & 0xff) def maybe(rootpath): dpath = os.path.join(rootpath, 'dev') if os.path.exists(dpath): with open(dpath) as fp: if fp.read().strip() == devs: return os.path.join(rootpath, 'stat') for name in os.listdir(SYS_BLOCK): basepath = os.path.join(SYS_BLOCK, name) statpath = maybe(basepath) if statpath: return statpath for name in os.listdir(basepath): base2path = os.path.join(basepath, name) statpath = maybe(base2path) if statpath: return statpath class DiskStatter(object): FIELDS = ( 'reads', 'reads_merged', 'sectors_read', 'read_ms', 'writes', 'writes_merged', 'sectors_written', 'write_ms', 'io_count', 'io_ms', 'total_ms' ) def __init__(self, path): self.fp = open(path) self.refresh() def refresh(self): self.fp.seek(0) vars(self).update((self.FIELDS[i], int(s)) for i, s in enumerate(self.fp.read().split())) def cmd_watch(opts, args): info = None stat = None def window(func): history = collections.deque() def windowfunc(): history.append(func()) if len(history) > opts.window: history.popleft() if len(history) <= 1: return 0 n = sum(delta(history)) / float(len(history) - 1) return n / opts.interval return windowfunc envmb = lambda: (info['last_pgno'] * stat['psize']) / 1048576. # NOQA cols = [ ('%d', 'Depth', lambda: stat['depth']), ('%d', 'Branch', lambda: stat['branch_pages']), ('%d', 'Leaf', lambda: stat['leaf_pages']), ('%+d', 'Leaf/s', window(lambda: stat['leaf_pages'])), ('%d', 'Oflow', lambda: stat['overflow_pages']), ('%+d', 'Oflow/s', window(lambda: stat['overflow_pages'])), ('%d', 'Recs', lambda: stat['entries']), ('%+d', 'Recs/s', window(lambda: stat['entries'])), ('%d', 'Rdrs', lambda: info['num_readers']), ('%.2f', 'EnvMb', envmb), ('%+.2f', 'EnvMb/s', window(envmb)), ('%d', 'Txs', lambda: info['last_txnid']), ('%+.2f', 'Txs/s', window(lambda: info['last_txnid'])) ] statter = None statpath = _find_diskstat(ENV.path()) if statpath: statter = DiskStatter(statpath) cols += [ ('%+d', 'SctRd/s', window(lambda: statter.sectors_read)), ('%+d', 'SctWr/s', window(lambda: statter.sectors_written)), ] term_width = 0 widths = [len(head) for _, head, _ in cols] if opts.csv: writer = csv.writer(sys.stdout, quoting=csv.QUOTE_ALL) writer.writerow([head for _, head, _ in cols]) cnt = 0 try: while True: stat = ENV.stat() info = ENV.info() if statter: statter.refresh() vals = [] for i, (fmt, head, func) in enumerate(cols): val = fmt % func() vals.append(val) widths[i] = max(widths[i], len(val)) if opts.csv: writer.writerow(vals) else: if term_width != _TERM_WIDTH or not (cnt % (_TERM_HEIGHT - 2)): for i, (fmt, head, func) in enumerate(cols): sys.stdout.write(head.rjust(widths[i] + 1)) sys.stdout.write('\n') term_width = _TERM_WIDTH for i, val in enumerate(vals): sys.stdout.write(val.rjust(widths[i] + 1)) sys.stdout.write('\n') time.sleep(opts.interval) cnt += 1 except KeyboardInterrupt: pass def cmd_warm(opts, args): stat = ENV.stat() info = ENV.info() bufsize = 32768 last_offset = stat['psize'] * info['last_pgno'] buf = array.array('B', _to_bytes('\x00' * bufsize)) t0 = time.time() if opts.use_single_file: fp = open(opts.env, 'rb', bufsize) else: fp = open(opts.env + '/data.mdb', 'rb', bufsize) while fp.tell() < last_offset: fp.readinto(buf) print('Warmed %.2fmb in %dms' % (last_offset / 1048576., 1000 * (time.time() - t0))) def cmd_rewrite(opts, args): if not opts.target_env: die('Must specify target environment path with -E') src_info = ENV.info() target_env = lmdb.open(opts.target_env, map_size=src_info['map_size'] * 2, max_dbs=opts.max_dbs, sync=False, writemap=True, map_async=True, metasync=False) dbs = [] for arg in args: name = None if arg == ':main:' else arg src_db = ENV.open_db(_to_bytes(name)) dst_db = target_env.open_db(_to_bytes(name)) dbs.append((arg, src_db, dst_db)) if not dbs: dbs.append((':main:', ENV.open_db(None), target_env.open_db(None))) for name, src_db, dst_db in dbs: print('Writing %r...' % (name,)) with target_env.begin(db=dst_db, write=True) as wtxn: with ENV.begin(db=src_db, buffers=True) as rtxn: for key, value in rtxn.cursor(): wtxn.put(key, value, append=True) print('Syncing..') target_env.sync(True) def cmd_get(opts, args): print_header = len(args) > 1 with ENV.begin(buffers=True, db=DB) as txn: for arg in args: value = txn.get(_to_bytes(arg)) if value is None: print('%r: missing' % (arg,)) continue if print_header: print('%r:' % (arg,)) if opts.xxd: print(xxd(value)) else: print(bytes(value)) def cmd_edit(opts, args): if args: die('Edit command only takes options, not arguments (see --help)') with ENV.begin(write=True) as txn: cursor = txn.cursor(db=DB) for elem in opts.add or []: key, _, value = _to_bytes(elem).partition(_to_bytes('=')) cursor.put(key, value, overwrite=False) for elem in opts.set or []: key, _, value = _to_bytes(elem).partition(_to_bytes('=')) cursor.put(key, value) for key in opts.delete or []: txn.delete(_to_bytes(key), db=DB) for elem in opts.add_file or []: key, _, path = _to_bytes(elem).partition(_to_bytes('=')) with open(path, 'rb') as fp: cursor.put(key, fp.read(), overwrite=False) for elem in opts.set_file or []: key, _, path = _to_bytes(elem).partition(_to_bytes('=')) with open(path, 'rb') as fp: cursor.put(key, fp.read()) def cmd_shell(opts, args): import code import readline # NOQA code.InteractiveConsole(globals()).interact() def cmd_stat(opts, args): pprint.pprint(ENV.stat()) pprint.pprint(ENV.info()) def _get_term_width(default=(80, 25)): try: import fcntl # No fcntl on win32 import termios # No termios on win32 s = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234') height, width = struct.unpack('hh', s) return width, height except Exception: return default def _on_sigwinch(*args): global _TERM_WIDTH, _TERM_HEIGHT _TERM_WIDTH, _TERM_HEIGHT = _get_term_width() def main(argv=None): parser = make_parser() opts, args = parser.parse_args(argv) if not args: die('Please specify a command (see --help)') if not opts.env: die('Please specify environment (--env)') global ENV ENV = lmdb.open(opts.env, map_size=opts.map_size * 1048576, subdir=not opts.use_single_file, max_dbs=opts.max_dbs, create=False, readonly=opts.read == 'READ') if opts.db: global DB DB = ENV.open_db(_to_bytes(opts.db)) if hasattr(signal, 'SIGWINCH'): # Disable on win32. signal.signal(signal.SIGWINCH, _on_sigwinch) _on_sigwinch() func = globals().get('cmd_' + args[0]) if not func: die('No such command: %r' % (args[0],)) func(opts, args[1:]) if __name__ == '__main__': main(sys.argv[1:]) py-lmdb-py-lmdb_1.0.0/misc/000077500000000000000000000000001372223456500154445ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/misc/cursor-del-break.c000066400000000000000000000041031372223456500207470ustar00rootroot00000000000000// http://www.openldap.org/its/index.cgi/Software%20Bugs?id=7722 // gcc -g -I src/py-lmdb/lib -o cursor-del-break cursor-del-break.c #include #include #include #include #include #include "lmdb.h" #include "mdb.c" #include "midl.c" void check(int x) { if(x) { fprintf(stderr, "eek %s\n", mdb_strerror(x)); _exit(1); } } #define RECS 2048 #define DB_PATH "/ram/tdb" MDB_dbi dbi; MDB_txn *txn; MDB_env *env; MDB_cursor *c1; char recpattern[256]; MDB_val keyv; MDB_val valv; void new_txn(void) { if(txn) { fprintf(stderr, "commit\n"); check(mdb_txn_commit(txn)); } check(mdb_txn_begin(env, NULL, 0, &txn)); } int main(void) { check(mdb_env_create(&env)); check(mdb_env_set_mapsize(env, 1048576UL*1024UL*3UL)); check(mdb_env_set_maxreaders(env, 126)); check(mdb_env_set_maxdbs(env, 1)); if(! access(DB_PATH, X_OK)) { system("rm -rf " DB_PATH); } check(mkdir(DB_PATH, 0777)); check(mdb_env_open(env, DB_PATH, MDB_MAPASYNC|MDB_NOSYNC|MDB_NOMETASYNC, 0644)); new_txn(); check(mdb_dbi_open(txn, NULL, 0, &dbi)); // make pattern int i; for(i = 0; i < sizeof recpattern; i++) { recpattern[i] = i % 256; } for(i = 0; i < RECS; i++) { char keybuf[40]; keyv.mv_size = sprintf(keybuf, "%08x", i); keyv.mv_data = keybuf; valv.mv_size = sizeof recpattern; valv.mv_data = recpattern; check(mdb_put(txn, dbi, &keyv, &valv, 0)); } new_txn(); check(mdb_cursor_open(txn, dbi, &c1)); check(mdb_cursor_get(c1, &keyv, &valv, MDB_FIRST)); check(mdb_del(txn, dbi, &keyv, NULL)); for(i = 1; i < RECS; i++) { check(mdb_cursor_get(c1, &keyv, &valv, MDB_NEXT)); char keybuf[40]; int sz = sprintf(keybuf, "%08x", i); check((!(sz==keyv.mv_size)) || memcmp(keyv.mv_data, keybuf, sz)); check(memcmp(valv.mv_data, recpattern, sizeof recpattern)); printf("%d\n", i); check(mdb_del(txn, dbi, &keyv, NULL)); } new_txn(); } py-lmdb-py-lmdb_1.0.0/misc/cursor_put_pyparse.diff000066400000000000000000000020041372223456500222420ustar00rootroot00000000000000diff --git a/lmdb/cpython.c b/lmdb/cpython.c index dd1c8b9..ced5ea3 100644 --- a/lmdb/cpython.c +++ b/lmdb/cpython.c @@ -2319,11 +2319,25 @@ cursor_put(CursorObject *self, PyObject *args, PyObject *kwds) {ARG_BOOL, OVERWRITE_S, OFFSET(cursor_put, overwrite)}, {ARG_BOOL, APPEND_S, OFFSET(cursor_put, append)} }; + static char *keywords[] = { + "key", "value", "dupdata", "overwrite", "append", NULL + }; + PyObject *key, *val; int flags; int rc; static PyObject *cache = NULL; - if(parse_args(self->valid, SPECSIZE(), argspec, &cache, args, kwds, &arg)) { + if(! self->valid) { + return err_invalid(); + } + if(! PyArg_ParseTupleAndKeywords(args, kwds, "OO|iii", keywords, + &key, &val, &arg.dupdata, &arg.overwrite, + &arg.append)) { + return NULL; + } + + if(val_from_buffer(&arg.key, key) || + val_from_buffer(&arg.val, val)) { return NULL; } py-lmdb-py-lmdb_1.0.0/misc/gdb.commands000066400000000000000000000005611372223456500177250ustar00rootroot00000000000000# vim:syntax=gdb # # Print a backtrace if a program crashes. Run using: # gdb -x misc/gdb.commands --args argv0 argv1 .. # set confirm off define hook-stop init-if-undefined $_exitcode = 999 if $_exitcode == 999 echo Abnormal stop.\n backtrace quit 2 else echo Normal exit.\n quit $_exitcode end end run py-lmdb-py-lmdb_1.0.0/misc/helpers.sh000066400000000000000000000012001372223456500174330ustar00rootroot00000000000000quiet() { "$@" > /tmp/$$ || { cat /tmp/$$; return 1; } } clean() { git clean -qdfx find /usr/local/lib -name '*lmdb*' | xargs rm -rf find /usr/lib -name '*lmdb*' | xargs rm -rf } with_gdb() { gdb --batch -x misc/gdb.commands --args "$@" } native() { clean unset LMDB_FORCE_CFFI export LMDB_FORCE_CPYTHON=1 quiet $1 setup.py develop quiet $1 -c 'import lmdb.cpython' with_gdb $1 -m pytest tests || fail=1 } cffi() { clean unset LMDB_FORCE_CPYTHON export LMDB_FORCE_CFFI=1 quiet $1 setup.py develop quiet $1 -c 'import lmdb.cffi' with_gdb $1 -m pytest tests || fail=1 } py-lmdb-py-lmdb_1.0.0/misc/its7733.c000066400000000000000000000027721372223456500167430ustar00rootroot00000000000000// http://www.openldap.org/its/index.cgi/Software%20Bugs?id=7733 // gcc -g -I ../lib -o its7733 its7733.c #include #include #include #include #include #include "lmdb.h" #include "mdb.c" #include "midl.c" void check(int x) { if(x) { fprintf(stderr, "eek %s\n", mdb_strerror(x)); _exit(1); } } #define DB_PATH "/ram/tdb" MDB_dbi dbi; MDB_txn *txn; MDB_env *env; MDB_cursor *c1; MDB_val keyv; MDB_val valv; void new_txn(void) { if(txn) { fprintf(stderr, "commit\n"); check(mdb_txn_commit(txn)); } check(mdb_txn_begin(env, NULL, 0, &txn)); } void put(const char *k) { keyv.mv_size = strlen(k); keyv.mv_data = k; valv.mv_size = 0; valv.mv_data = ""; check(mdb_put(txn, dbi, &keyv, &valv, 0)); } int main(void) { check(mdb_env_create(&env)); check(mdb_env_set_mapsize(env, 1048576UL*1024UL*3UL)); check(mdb_env_set_maxreaders(env, 126)); check(mdb_env_set_maxdbs(env, 1)); if(! access(DB_PATH, X_OK)) { system("rm -rf " DB_PATH); } check(mkdir(DB_PATH, 0777)); check(mdb_env_open(env, DB_PATH, MDB_MAPASYNC|MDB_NOSYNC|MDB_NOMETASYNC, 0644)); new_txn(); check(mdb_dbi_open(txn, NULL, 0, &dbi)); put("a"); put("b"); put("baa"); put("d"); new_txn(); check(mdb_cursor_open(txn, dbi, &c1)); check(mdb_cursor_get(c1, &keyv, &valv, MDB_LAST)); check(mdb_cursor_del(c1, 0)); check(mdb_cursor_del(c1, 0)); new_txn(); } py-lmdb-py-lmdb_1.0.0/misc/readers_mrb_env.patch000066400000000000000000000032341372223456500216240ustar00rootroot00000000000000Store the address of the MDB_env structure that owns a reader in addition to its PID and TID, to allow multiple MDB_envs to be open on the same thread, since on mdb_env_close(), LMDB unconditionally obliterates any readers with a matching PID. This patch extends the test to (PID, MDB_env*). diff --git a/lib/mdb.c b/lib/mdb.c index fd0a3b5..f2ebdfa 100644 --- a/lib/mdb.c +++ b/lib/mdb.c @@ -536,6 +536,8 @@ typedef struct MDB_rxbody { txnid_t mrb_txnid; /** The process ID of the process owning this reader txn. */ MDB_PID_T mrb_pid; + /** MDB_env within the process owning this reader txn. */ + void * mrb_env; /** The thread ID of the thread owning this txn. */ pthread_t mrb_tid; } MDB_rxbody; @@ -547,6 +549,7 @@ typedef struct MDB_reader { /** shorthand for mrb_txnid */ #define mr_txnid mru.mrx.mrb_txnid #define mr_pid mru.mrx.mrb_pid +#define mr_env mru.mrx.mrb_env #define mr_tid mru.mrx.mrb_tid /** cache line alignment */ char pad[(sizeof(MDB_rxbody)+CACHELINE-1) & ~(CACHELINE-1)]; @@ -2285,6 +2288,7 @@ mdb_txn_renew0(MDB_txn *txn) return MDB_READERS_FULL; } ti->mti_readers[i].mr_pid = pid; + ti->mti_readers[i].mr_env = env; ti->mti_readers[i].mr_tid = tid; if (i == nr) ti->mti_numreaders = ++nr; @@ -4254,7 +4258,8 @@ mdb_env_close0(MDB_env *env, int excl) * me_txkey with its destructor must be disabled first. */ for (i = env->me_numreaders; --i >= 0; ) - if (env->me_txns->mti_readers[i].mr_pid == pid) + if (env->me_txns->mti_readers[i].mr_pid == pid + && env->me_txns->mti_readers[i].mr_env == env) env->me_txns->mti_readers[i].mr_pid = 0; #ifdef _WIN32 if (env->me_rmutex) { py-lmdb-py-lmdb_1.0.0/misc/run_in_vm.py000066400000000000000000000051651372223456500200210ustar00rootroot00000000000000# # Copyright 2014 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # from __future__ import absolute_import import atexit import json import os import shutil import socket import subprocess import sys import tempfile def run(*args): if os.path.exists('build'): shutil.rmtree('build') try: subprocess.check_call(args) except: print '!!! COMMAND WAS:', args raise def qmp_write(fp, o): buf = json.dumps(o) + '\n' fp.write(buf.replace('{', '{ ')) def qmp_read(fp): s = fp.readline() return json.loads(s) def qmp_say_hello(fp): assert 'QMP' in qmp_read(fp) qmp_write(fp, {'execute': 'qmp_capabilities'}) assert qmp_read(fp)['return'] == {} def qmp_command(fp, name, args): qmp_write(fp, {'execute': name, 'arguments': args}) while True: o = qmp_read(fp) if 'return' not in o: print 'skip', o continue print 'cmd out', o return o['return'] def qmp_monitor(fp, cmd): return qmp_command(fp, 'human-monitor-command', { 'command-line': cmd }) def main(): vm = sys.argv[1] cmdline = sys.argv[2:] rsock, wsock = socket.socketpair() rfp = rsock.makefile('r+b', 1) qemu_path = '/usr/local/bin/qemu-system-x86_64' qemu_args = ['sudo', qemu_path, '-enable-kvm', '-m', '1024', '-qmp', 'stdio', '-nographic', '-S', '-vnc', '127.0.0.1:0', '-net', 'user,hostfwd=tcp:127.0.0.1:9422-:22', '-net', 'nic,model=virtio', '-drive', 'file=%s,if=virtio' % (vm,)] print ' '.join(qemu_args).replace('qmp', 'monitor') exit() proc = subprocess.Popen(qemu_args, stdin=wsock.fileno(), stdout=wsock.fileno() ) qmp_say_hello(rfp) assert '' == qmp_monitor(rfp, 'loadvm 1') assert '' == qmp_monitor(rfp, 'cont') import time time.sleep(100) qmp_monitor(rfp, 'quit') if __name__ == '__main__': main() py-lmdb-py-lmdb_1.0.0/misc/runtests-travisci.sh000077500000000000000000000016651372223456500215240ustar00rootroot00000000000000#!/bin/bash -ex source misc/helpers.sh quiet() { "$@" > /tmp/$$ || { cat /tmp/$$; return 1; } } # Delete Travis PyPy or it'll supercede the PPA version. rm -rf /usr/local/pypy/bin /usr/local/lib/pypy2.7 find /usr/lib -name '*setuptools*' | xargs rm -rf find /usr/local/lib -name '*setuptools*' | xargs rm -rf quiet add-apt-repository -y ppa:fkrull/deadsnakes quiet add-apt-repository -y ppa:pypy quiet apt-get -qq update quiet apt-get install --force-yes -qq python{2.5,2.6}-dev libffi-dev gdb wget -qO ez_setup_24.py \ https://raw.githubusercontent.com/pypa/setuptools/bootstrap-py24/ez_setup.py wget -q https://raw.githubusercontent.com/pypa/setuptools/bootstrap/ez_setup.py quiet python2.5 ez_setup_24.py quiet python2.6 ez_setup.py quiet python2.5 -measy_install py==1.4.20 pytest==2.5.2 quiet python2.6 -measy_install py==1.4.20 pytest==2.5.2 cffi native python2.5 native python2.6 cffi python2.6 [ "$fail" ] && exit 1 exit 0 py-lmdb-py-lmdb_1.0.0/misc/test_monster_acid_trace.diff000066400000000000000000000027451372223456500231720ustar00rootroot00000000000000diff --git a/tests/crash_test.py b/tests/crash_test.py index 1ac3b46..3785bd5 100644 --- a/tests/crash_test.py +++ b/tests/crash_test.py @@ -173,21 +173,43 @@ class MultiCursorDeleteTest(unittest.TestCase): c2.delete() assert next(c1f) == B('eeee') + def _trace(self, op, *args): + bits = [] + for arg in args: + if isinstance(arg, bytes): + bits.append(arg.encode('hex')) + elif isinstance(arg, bool): + bits.append(bytes(int(arg))) + self.fp.write('%s %s %s\n' % (self.idx, op, ' '.join(bits))) + def test_monster(self): # Generate predictable sequence of sizes. rand = random.Random() rand.seed(0) + self.fp = open('trace.out', 'w') + self._counter = 0 + self.idx = 0 + txn = self.env.begin(write=True) keys = [] for i in range(20000): key = B('%06x' % i) val = B('x' * rand.randint(76, 350)) + self._trace('put', key, val) assert txn.put(key, val) keys.append(key) + + iter_id = self._counter + self._counter += 1 + self._trace('iter', iter_id, '0', False) + deleted = 0 for key in txn.cursor().iternext(values=False): + self._trace('fetch', iter_id) + self._trace('yield', iter_id, key, '') + self._trace('delete', key) assert txn.delete(key), key deleted += 1 py-lmdb-py-lmdb_1.0.0/misc/tox.ini000066400000000000000000000024611372223456500167620ustar00rootroot00000000000000[tox] ; py25_c disabled because TRAVISCI RAGE envlist = pypy_cffi,py26_cffi,py27_cffi,py30_cffi,py31_cffi,py32_cffi,py33_cffi,py26_c,py27_c,py33_c skipsdist = True [testenv] install_command = pip install {opts} {packages} commands = pip install -e . python -mpytest ./tests [testenv:pypy_cffi] basepython = pypy deps = pytest [testenv:py26_cffi] basepython = python2.6 deps = pytest cffi setenv = LMDB_FORCE_CFFI=1 [testenv:py27_cffi] basepython = python2.7 deps = pytest cffi setenv = LMDB_FORCE_CFFI=1 [testenv:py30_cffi] basepython = python3.0 deps = pytest cffi setenv = LMDB_FORCE_CFFI=1 [testenv:py31_cffi] basepython = python3.1 deps = pytest cffi setenv = LMDB_FORCE_CFFI=1 [testenv:py32_cffi] basepython = python3.2 deps = pytest cffi setenv = LMDB_FORCE_CFFI=1 [testenv:py33_cffi] basepython = python3.3 deps = pytest cffi setenv = LMDB_FORCE_CFFI=1 [testenv:py34_cffi] basepython = python3.4 deps = pytest cffi setenv = LMDB_FORCE_CFFI=1 [testenv:py25_c] deps = pytest setenv = PIP_INSECURE=1 basepython = python2.5 [testenv:py26_c] deps = pytest basepython = python2.6 [testenv:py27_c] deps = pytest basepython = python2.7 [testenv:py33_c] deps = pytest basepython = python3.3 ;[testenv:py34_c] ;basepython = python3.4 py-lmdb-py-lmdb_1.0.0/misc/windows_build.py000066400000000000000000000052571372223456500207000ustar00rootroot00000000000000# # Copyright 2014 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # from __future__ import absolute_import import glob import os import shutil import subprocess import sys import tempfile INTERPS = ( ('Python26', False), ('Python26-64', False), ('Python27', False), ('Python27-64', False), #('Python31', False), #('Python31-64', False), #('Python32', False), ('Python32-64', False), ('Python33', False), ('Python33-64', False), ('Python34', False), ('Python34-64', False), ('Python35', False), ('Python35-64', False), ('Python36', False), ('Python36-64', False), ) def interp_path(interp): return r'C:\%s\Python' % (interp,) def pip_path(interp): return os.path.join(os.path.dirname(interp), 'scripts', 'pip.exe') def interp_has_module(path, module): return run_or_false(path, '-c', 'import ' + module) def run(*args): if os.path.exists('build'): shutil.rmtree('build') try: subprocess.check_call(args) except: print '!!! COMMAND WAS:', args raise def run_or_false(*args): try: run(*args) except subprocess.CalledProcessError: return False return True def main(): run('git', 'clean', '-dfx', 'dist') for interp, is_cffi in INTERPS: path = interp_path(interp) run('git', 'clean', '-dfx', 'build', 'temp', 'lmdb') run(pip_path(path), 'install', '-e', '.') if is_cffi: os.environ['LMDB_FORCE_CFFI'] = '1' os.environ.pop('LMDB_FORCE_CPYTHON', '') else: os.environ['LMDB_FORCE_CPYTHON'] = '1' os.environ.pop('LMDB_FORCE_CFFI', '') if os.path.exists('lmdb\\cpython.pyd'): os.unlink('lmdb\\cpython.pyd') #run(path, '-mpy.test') run(path, 'setup.py', 'bdist_egg') run(path, 'setup.py', 'bdist_wheel') run(sys.executable, '-m', 'twine', 'upload', '--skip-existing', *glob.glob('dist/*')) if __name__ == '__main__': main() py-lmdb-py-lmdb_1.0.0/misc/windows_setup.py000066400000000000000000000036731372223456500207410ustar00rootroot00000000000000# # Copyright 2014 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # from __future__ import absolute_import import os import urllib from windows_build import interp_has_module from windows_build import interp_path from windows_build import INTERPS from windows_build import run from windows_build import run_or_false EZSETUP_URL = ('https://bitbucket.org/pypa/setuptools' '/raw/bootstrap/ez_setup.py') def ezsetup_path(): path = os.path.join(os.environ['TEMP'], 'ez_setup.py') if not os.path.exists(path): fp = urllib.urlopen(EZSETUP_URL) with open(path, 'wb') as fp2: fp2.write(fp.read()) fp.close() return path def easy_install_path(interp): return os.path.join(os.path.dirname(interp), 'scripts', 'easy_install.exe') def main(): for interp, is_cffi in INTERPS: path = interp_path(interp) run_or_false(path, '-m', 'ensurepip') if not interp_has_module(path, 'easy_install'): run(path, ezsetup_path()) for pkg in 'pip', 'cffi', 'pytest', 'wheel': modname = 'py.test' if pkg == 'pytest' else pkg if not interp_has_module(path, modname): run(easy_install_path(path), pkg) if __name__ == '__main__': main() py-lmdb-py-lmdb_1.0.0/setup.py000066400000000000000000000165351372223456500162350ustar00rootroot00000000000000# # Copyright 2013-2020 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # from __future__ import absolute_import from __future__ import with_statement import os import sys import shutil import platform from setuptools import Extension from setuptools import setup try: import memsink except ImportError: memsink = None if hasattr(platform, 'python_implementation'): use_cpython = platform.python_implementation() == 'CPython' else: use_cpython = True if os.getenv('LMDB_FORCE_CFFI') is not None: use_cpython = False if sys.version[:3] < '2.7' or (3, 0) < sys.version_info[:2] < (3, 4): sys.stderr.write('Error: py-lmdb requires at least CPython 2.7 or 3.4\n') raise SystemExit(1) # # Figure out which LMDB implementation to use. # if os.getenv('LMDB_INCLUDEDIR'): extra_include_dirs = [os.getenv('LMDB_INCLUDEDIR')] else: extra_include_dirs = [] if os.getenv('LMDB_LIBDIR'): extra_library_dirs = [os.getenv('LMDB_LIBDIR')] else: extra_library_dirs = [] extra_include_dirs += ['lib/py-lmdb'] extra_compile_args = [] patch_lmdb_source = False if os.getenv('LMDB_FORCE_SYSTEM') is not None: print('py-lmdb: Using system version of liblmdb.') extra_sources = [] extra_include_dirs += [] libraries = ['lmdb'] elif os.getenv('LMDB_PURE') is not None: print('py-lmdb: Using bundled unmodified liblmdb; override with LMDB_FORCE_SYSTEM=1.') extra_sources = ['lib/mdb.c', 'lib/midl.c'] extra_include_dirs += ['lib'] libraries = [] else: print('py-lmdb: Using bundled liblmdb with py-lmdb patches; override with LMDB_FORCE_SYSTEM=1 or LMDB_PURE=1.') extra_sources = ['build/lib/mdb.c', 'build/lib/midl.c'] extra_include_dirs += ['build/lib'] extra_compile_args += ['-DHAVE_PATCHED_LMDB=1'] libraries = [] patch_lmdb_source = True if patch_lmdb_source: if sys.platform.startswith('win'): try: import patch_ng as patch except ImportError: raise Exception('Building py-lmdb from source on Windows requires the "patch-ng" python module.') # Clean out any previously patched files dest = 'build' + os.sep + 'lib' try: os.mkdir('build') except Exception: pass try: shutil.rmtree(dest) except Exception: pass shutil.copytree('lib', dest) # Copy away the lmdb source then patch it if sys.platform.startswith('win'): patchfile = 'lib' + os.sep + 'py-lmdb' + os.sep + 'env-copy-txn.patch' patchset = patch.fromfile(patchfile) rv = patchset.apply(2, root=dest) if not rv: raise Exception('Applying patch failed') else: rv = os.system('/usr/bin/patch -N -p3 -d build/lib < lib/py-lmdb/env-copy-txn.patch') if rv: raise Exception('Applying patch failed') # distutils perplexingly forces NDEBUG for package code! extra_compile_args += ['-UNDEBUG'] # Disable some Clang/GCC warnings. if not os.getenv('LMDB_MAINTAINER'): extra_compile_args += ['-w'] # Microsoft Visual Studio 9 ships with neither inttypes.h, stdint.h, or a sane # definition for ssize_t, so here we add lib/win32 to the search path, which # contains emulation header files provided by a third party. We force-include # Python.h everywhere since it has a portable definition of ssize_t, which # inttypes.h and stdint.h lack, and to avoid having to modify the LMDB source # code. Advapi32 is needed for LMDB's use of Windows security APIs. p = sys.version.find('MSC v.') msvc_ver = int(sys.version[p + 6: p + 10]) if p != -1 else None if sys.platform.startswith('win'): # If running on Visual Studio<=2010 we must provide . Newer # versions provide it out of the box. if msvc_ver and not msvc_ver >= 1600: extra_include_dirs += ['lib\\win32-stdint'] extra_include_dirs += ['lib\\win32'] extra_compile_args += [r'/FIPython.h'] libraries += ['Advapi32'] # Capture setup.py configuration for later use by cffi, otherwise the # configuration may differ, forcing a recompile (and therefore likely compile # errors). This happens even when `use_cpython` since user might want to # LMDB_FORCE_CFFI=1 during testing. with open('lmdb/_config.py', 'w') as fp: fp.write('CONFIG = dict(%r)\n\n' % (( ('extra_compile_args', extra_compile_args), ('extra_sources', extra_sources), ('extra_library_dirs', extra_library_dirs), ('extra_include_dirs', extra_include_dirs), ('libraries', libraries), ),)) if use_cpython: print('py-lmdb: Using CPython extension; override with LMDB_FORCE_CFFI=1.') install_requires = [] if memsink: extra_compile_args += ['-DHAVE_MEMSINK', '-I' + os.path.dirname(memsink.__file__)] ext_modules = [Extension( name='cpython', sources=['lmdb/cpython.c'] + extra_sources, extra_compile_args=extra_compile_args, libraries=libraries, include_dirs=extra_include_dirs, library_dirs=extra_library_dirs )] else: print('Using cffi extension.') install_requires = ['cffi>=0.8'] try: import lmdb.cffi ext_modules = [lmdb.cffi._ffi.verifier.get_extension()] except ImportError: sys.stderr.write('Could not import lmdb; ensure cffi is installed!\n') ext_modules = [] def grep_version(): path = os.path.join(os.path.dirname(__file__), 'lmdb/__init__.py') with open(path) as fp: for line in fp: if line.startswith('__version__'): return eval(line.split()[-1]) setup( name='lmdb', version=grep_version(), description="Universal Python binding for the LMDB 'Lightning' Database", long_description="Universal Python binding for the LMDB 'Lightning' Database", long_description_content_type="text/plain", author='David Wilson', maintainer='Nic Watson', license='OpenLDAP BSD', url='http://github.com/jnwatson/py-lmdb/', packages=['lmdb'], classifiers=[ "Programming Language :: Python", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Topic :: Database", "Topic :: Database :: Database Engines/Servers", ], ext_package='lmdb', ext_modules=ext_modules, install_requires=install_requires, ) py-lmdb-py-lmdb_1.0.0/tests/000077500000000000000000000000001372223456500156535ustar00rootroot00000000000000py-lmdb-py-lmdb_1.0.0/tests/crash_test.py000066400000000000000000000207441372223456500203730ustar00rootroot00000000000000# # Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # # This is not a test suite! More like a collection of triggers for previously # observed crashes. Want to contribute to py-lmdb? Please write a test suite! # # what happens when empty keys/ values passed to various funcs # incorrect types # try to break cpython arg parsing - too many/few/incorrect args # Various efforts to cause Python-level leaks. # from __future__ import absolute_import from __future__ import with_statement import itertools import random import unittest import lmdb import testlib from testlib import B from testlib import O class CrashTest(unittest.TestCase): def tearDown(self): testlib.cleanup() # Various efforts to cause segfaults. def setUp(self): self.path, self.env = testlib.temp_env() with self.env.begin(write=True) as txn: txn.put(B('dave'), B('')) txn.put(B('dave2'), B('')) def testOldCrash(self): txn = self.env.begin() dir(iter(txn.cursor())) def testCloseWithTxn(self): txn = self.env.begin(write=True) self.env.close() self.assertRaises(Exception, (lambda: list(txn.cursor()))) def testDoubleClose(self): self.env.close() self.env.close() def testTxnCloseActiveIter(self): with self.env.begin() as txn: it = txn.cursor().iternext() self.assertRaises(Exception, (lambda: list(it))) def testDbCloseActiveIter(self): db = self.env.open_db(key=B('dave3')) with self.env.begin(write=True) as txn: txn.put(B('a'), B('b'), db=db) it = txn.cursor(db=db).iternext() self.assertRaises(Exception, (lambda: list(it))) class IteratorTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def setUp(self): self.path, self.env = testlib.temp_env() self.txn = self.env.begin(write=True) self.c = self.txn.cursor() def testEmpty(self): self.assertEqual([], list(self.c)) self.assertEqual([], list(self.c.iternext())) self.assertEqual([], list(self.c.iterprev())) def testFilled(self): testlib.putData(self.txn) self.assertEqual(testlib.ITEMS, list(self.c)) self.assertEqual(testlib.ITEMS, list(self.c)) self.assertEqual(testlib.ITEMS, list(self.c.iternext())) self.assertEqual(testlib.ITEMS[::-1], list(self.txn.cursor().iterprev())) self.assertEqual(testlib.ITEMS[::-1], list(self.c.iterprev())) self.assertEqual(testlib.ITEMS, list(self.c)) def testFilledSkipForward(self): testlib.putData(self.txn) self.c.set_range(B('b')) self.assertEqual(testlib.ITEMS[1:], list(self.c)) def testFilledSkipReverse(self): testlib.putData(self.txn) self.c.set_range(B('b')) self.assertEqual(testlib.REV_ITEMS[-2:], list(self.c.iterprev())) def testFilledSkipEof(self): testlib.putData(self.txn) self.assertEqual(False, self.c.set_range(B('z'))) self.assertEqual(testlib.REV_ITEMS, list(self.c.iterprev())) class BigReverseTest(unittest.TestCase): def tearDown(self): testlib.cleanup() # Test for issue with MDB_LAST+MDB_PREV skipping chunks of database. def test_big_reverse(self): path, env = testlib.temp_env() txn = env.begin(write=True) keys = [B('%05d' % i) for i in range(0xffff)] for k in keys: txn.put(k, k, append=True) assert list(txn.cursor().iterprev(values=False)) == list(reversed(keys)) class MultiCursorDeleteTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def setUp(self): self.path, self.env = testlib.temp_env() def test1(self): """Ensure MDB_NEXT is ignored on `c1' when it was previously positioned on the key that `c2' just deleted.""" txn = self.env.begin(write=True) cur = txn.cursor() while cur.first(): cur.delete() for i in range(1, 10): cur.put(O(ord('a') + i) * i, B('')) c1 = txn.cursor() c1f = c1.iternext(values=False) while next(c1f) != B('ddd'): pass c2 = txn.cursor() assert c2.set_key(B('ddd')) c2.delete() assert next(c1f) == B('eeee') def test_monster(self): # Generate predictable sequence of sizes. rand = random.Random() rand.seed(0) txn = self.env.begin(write=True) keys = [] for i in range(20000): key = B('%06x' % i) val = B('x' * rand.randint(76, 350)) assert txn.put(key, val) keys.append(key) deleted = 0 for key in txn.cursor().iternext(values=False): assert txn.delete(key), key deleted += 1 assert deleted == len(keys), deleted class TxnFullTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_17bf75b12eb94d9903cd62329048b146d5313bad(self): """ me_txn0 previously cached MDB_TXN_ERROR permanently. Fixed by 17bf75b12eb94d9903cd62329048b146d5313bad. """ path, env = testlib.temp_env(map_size=4096 * 9, sync=False, max_spare_txns=0) for i in itertools.count(): try: with env.begin(write=True) as txn: txn.put(B(str(i)), B(str(i))) except lmdb.MapFullError: break # Should not crash with MDB_BAD_TXN: with env.begin(write=True) as txn: txn.delete(B('1')) class EmptyIterTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_python3_iternext_segfault(self): # https://github.com/dw/py-lmdb/issues/105 _, env = testlib.temp_env() txn = env.begin() cur = txn.cursor() ite = cur.iternext() nex = getattr(ite, 'next', getattr(ite, '__next__', None)) assert nex is not None self.assertRaises(StopIteration, nex) class MultiputTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_multiput_segfault(self): # http://github.com/jnwatson/py-lmdb/issues/173 _, env = testlib.temp_env() db = env.open_db(b'foo', dupsort=True) txn = env.begin(db=db, write=True) txn.put(b'a', b'\x00\x00\x00\x00\x00\x00\x00\x00') txn.put(b'a', b'\x05') txn.put(b'a', b'\t') txn.put(b'a', b'\r') txn.put(b'a', b'\x11') txn.put(b'a', b'\x15') txn.put(b'a', b'\x19') txn.put(b'a', b'\x1d') txn.put(b'a', b'!') txn.put(b'a', b'%') txn.put(b'a', b')') txn.put(b'a', b'-') txn.put(b'a', b'1') txn.put(b'a', b'5') txn.commit() class InvalidArgTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_duplicate_arg(self): # https://github.com/jnwatson/py-lmdb/issues/203 _, env = testlib.temp_env() txn = env.begin(write=True) c = txn.cursor() self.assertRaises(TypeError, c.get, b'a', key=True) class BadCursorTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_cursor_open_failure(self): ''' Test the error path for when mdb_cursor_open fails Note: this only would crash if cpython is built with Py_TRACE_REFS ''' # https://github.com/jnwatson/py-lmdb/issues/216 path, env = testlib.temp_env() db = env.open_db(b'db', dupsort=True) env.close() del env env = lmdb.open(path, readonly=True, max_dbs=4) txn1 = env.begin(write=False) db = env.open_db(b'db', dupsort=True, txn=txn1) txn2 = env.begin(write=False) self.assertRaises(lmdb.InvalidParameterError, txn2.cursor, db=db) if __name__ == '__main__': unittest.main() py-lmdb-py-lmdb_1.0.0/tests/cursor_test.py000066400000000000000000000224141372223456500206040ustar00rootroot00000000000000# # Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # # test delete(dupdata) from __future__ import absolute_import from __future__ import with_statement import sys import unittest import testlib from testlib import B from testlib import BT class ContextManagerTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_ok(self): path, env = testlib.temp_env() txn = env.begin(write=True) with txn.cursor() as curs: curs.put(B('foo'), B('123')) self.assertRaises(Exception, lambda: curs.get(B('foo'))) def test_crash(self): path, env = testlib.temp_env() txn = env.begin(write=True) try: with txn.cursor() as curs: curs.put(123, 123) except Exception: pass self.assertRaises(Exception, lambda: curs.get(B('foo'))) class CursorTestBase(unittest.TestCase): def tearDown(self): testlib.cleanup() def setUp(self): self.path, self.env = testlib.temp_env() self.txn = self.env.begin(write=True) self.c = self.txn.cursor() class CursorTest(CursorTestBase): def testKeyValueItemEmpty(self): self.assertEqual(B(''), self.c.key()) self.assertEqual(B(''), self.c.value()) self.assertEqual(BT('', ''), self.c.item()) def testFirstLastEmpty(self): self.assertEqual(False, self.c.first()) self.assertEqual(False, self.c.last()) def testFirstFilled(self): testlib.putData(self.txn) self.assertEqual(True, self.c.first()) self.assertEqual(testlib.ITEMS[0], self.c.item()) def testLastFilled(self): testlib.putData(self.txn) self.assertEqual(True, self.c.last()) self.assertEqual(testlib.ITEMS[-1], self.c.item()) def testSetKey(self): self.assertRaises(Exception, (lambda: self.c.set_key(B('')))) self.assertEqual(False, self.c.set_key(B('missing'))) testlib.putData(self.txn) self.assertEqual(True, self.c.set_key(B('b'))) self.assertEqual(False, self.c.set_key(B('ba'))) def testSetRange(self): self.assertEqual(False, self.c.set_range(B('x'))) testlib.putData(self.txn) self.assertEqual(False, self.c.set_range(B('x'))) self.assertEqual(True, self.c.set_range(B('a'))) self.assertEqual(B('a'), self.c.key()) self.assertEqual(True, self.c.set_range(B('ba'))) self.assertEqual(B('baa'), self.c.key()) self.c.set_range(B('')) self.assertEqual(B('a'), self.c.key()) def testDeleteEmpty(self): self.assertEqual(False, self.c.delete()) def testDeleteFirst(self): testlib.putData(self.txn) self.assertEqual(False, self.c.delete()) self.c.first() self.assertEqual(BT('a', ''), self.c.item()) self.assertEqual(True, self.c.delete()) self.assertEqual(BT('b', ''), self.c.item()) self.assertEqual(True, self.c.delete()) self.assertEqual(BT('baa', ''), self.c.item()) self.assertEqual(True, self.c.delete()) self.assertEqual(BT('d', ''), self.c.item()) self.assertEqual(True, self.c.delete()) self.assertEqual(BT('', ''), self.c.item()) self.assertEqual(False, self.c.delete()) self.assertEqual(BT('', ''), self.c.item()) def testDeleteLast(self): testlib.putData(self.txn) self.assertEqual(True, self.c.last()) self.assertEqual(BT('d', ''), self.c.item()) self.assertEqual(True, self.c.delete()) self.assertEqual(BT('', ''), self.c.item()) self.assertEqual(False, self.c.delete()) self.assertEqual(BT('', ''), self.c.item()) def testCount(self): self.assertRaises(Exception, (lambda: self.c.count())) testlib.putData(self.txn) self.c.first() # TODO: complete dup key support. #self.assertEqual(1, self.c.count()) def testPut(self): pass class PutmultiTest(CursorTestBase): def test_empty_seq(self): consumed, added = self.c.putmulti(()) assert consumed == added == 0 def test_2list(self): l = [BT('a', ''), BT('a', '')] consumed, added = self.c.putmulti(l) assert consumed == added == 2 li = iter(l) consumed, added = self.c.putmulti(li) assert consumed == added == 2 def test_2list_preserve(self): l = [BT('a', ''), BT('a', '')] consumed, added = self.c.putmulti(l, overwrite=False) assert consumed == 2 assert added == 1 assert self.c.set_key(B('a')) assert self.c.delete() li = iter(l) consumed, added = self.c.putmulti(li, overwrite=False) assert consumed == 2 assert added == 1 def test_bad_seq1(self): self.assertRaises(Exception, lambda: self.c.putmulti(range(2))) def test_dupsort(self): _, env = testlib.temp_env() db1 = env.open_db(B('db1'), dupsort=True) txn = env.begin(write=True, db=db1) with txn.cursor() as c: tups = [BT('a', 'value1'), BT('b', 'value1'), BT('b', 'value2')] assert (3, 3) == c.putmulti(tups) def test_dupsort_append(self): _, env = testlib.temp_env() db1 = env.open_db(B('db1'), dupsort=True) txn = env.begin(write=True, db=db1) with txn.cursor() as c: tups = [BT('a', 'value1'), BT('b', 'value1'), BT('b', 'value2')] assert (3, 3) == c.putmulti(tups, append=True) class ReplaceTest(CursorTestBase): def test_replace(self): assert None is self.c.replace(B('a'), B('')) assert B('') == self.c.replace(B('a'), B('x')) assert B('x') == self.c.replace(B('a'), B('y')) class ContextManagerTest2(CursorTestBase): def test_enter(self): with self.c as c: assert c is self.c c.put(B('a'), B('a')) assert c.get(B('a')) == B('a') self.assertRaises(Exception, lambda: c.get(B('a'))) def test_exit_success(self): with self.txn.cursor() as c: c.put(B('a'), B('a')) self.assertRaises(Exception, lambda: c.get(B('a'))) def test_exit_failure(self): try: with self.txn.cursor() as c: c.put(B('a'), B('a')) raise ValueError except ValueError: pass self.assertRaises(Exception, lambda: c.get(B('a'))) def test_close(self): self.c.close() self.assertRaises(Exception, lambda: c.get(B('a'))) def test_double_close(self): self.c.close() self.c.close() self.assertRaises(Exception, lambda: self.c.put(B('a'), B('a'))) GiB = 1024 * 1024 * 1024 class PreloadTest(CursorTestBase): def setUp(self, redo=False): env_args = {'writemap': True, 'map_size': GiB} if not redo: self.path, self.env = testlib.temp_env(**env_args) else: self.path, self.env = testlib.temp_env(path=self.path, **env_args) self.txn = self.env.begin(write=True) self.c = self.txn.cursor() @unittest.skipIf(sys.platform != 'linux', "test only works on Linux") def test_preload(self): """ Test that reading just the key doesn't prefault the value contents, but reading the data does. """ import resource self.c.put(B('a'), B('a') * (256 * 1024 * 1024)) self.txn.commit() self.env.close() # Just reading the data is obviously going to fault the value in. The # point is to fault it in while the GIL is unlocked. We use the buffers # API so that we're not actually copying the data in. This doesn't # actually show that we're prefaulting with the GIL unlocked, but it # does prove we prefault at all, and in 2 correct places. self.path, self.env = testlib.temp_env(path=self.path, writemap=True) self.txn = self.env.begin(write=True, buffers=True) self.c = self.txn.cursor() minflts_before = resource.getrusage(resource.RUSAGE_THREAD)[6] self.c.set_key(B('a')) assert self.c.key() == B('a') minflts_after_key = resource.getrusage(resource.RUSAGE_THREAD)[6] self.c.value() minflts_after_value = resource.getrusage(resource.RUSAGE_THREAD)[6] epsilon = 20 # Setting the position doesn't prefault the data assert minflts_after_key - minflts_before < epsilon # Getting the value does prefault the data, even if we only get it by pointer assert minflts_after_value - minflts_after_key > 1000 if __name__ == '__main__': unittest.main() py-lmdb-py-lmdb_1.0.0/tests/env_test.py000066400000000000000000000665041372223456500200670ustar00rootroot00000000000000# # Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # from __future__ import absolute_import from __future__ import with_statement import os import sys import unittest import weakref import testlib from testlib import B from testlib import OCT from testlib import INT_TYPES from testlib import UnicodeType import lmdb # Whether we have the patch that allows env.copy* to take a txn have_txn_patch = lmdb.version(subpatch=True)[3] NO_READERS = UnicodeType('(no active readers)\n') try: PAGE_SIZE = os.sysconf(os.sysconf_names['SC_PAGE_SIZE']) except (AttributeError, KeyError, OSError): PAGE_SIZE = 4096 class VersionTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_version(self): ver = lmdb.version() assert len(ver) == 3 assert all(isinstance(i, INT_TYPES) for i in ver) assert all(i >= 0 for i in ver) def test_version_subpatch(self): ver = lmdb.version(subpatch=True) assert len(ver) == 4 assert all(isinstance(i, INT_TYPES) for i in ver) assert all(i >= 0 for i in ver) class OpenTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_bad_paths(self): self.assertRaises(Exception, lambda: lmdb.open('/doesnt/exist/at/all')) self.assertRaises(Exception, lambda: lmdb.open(testlib.temp_file())) def test_ok_path(self): path, env = testlib.temp_env() assert os.path.exists(path) assert os.path.exists(os.path.join(path, 'data.mdb')) assert os.path.exists(os.path.join(path, 'lock.mdb')) assert env.path() == path def test_bad_size(self): self.assertRaises(OverflowError, lambda: testlib.temp_env(map_size=-123)) def test_tiny_size(self): _, env = testlib.temp_env(map_size=10) def txn(): with env.begin(write=True) as txn: txn.put(B('a'), B('a')) self.assertRaises(lmdb.MapFullError, txn) def test_subdir_false_junk(self): path = testlib.temp_file() fp = open(path, 'wb') fp.write(B('A' * 8192)) fp.close() self.assertRaises(lmdb.InvalidError, lambda: lmdb.open(path, subdir=False)) def test_subdir_false_ok(self): path = testlib.temp_file(create=False) _, env = testlib.temp_env(path, subdir=False) assert os.path.exists(path) assert os.path.isfile(path) assert os.path.isfile(path + '-lock') assert not env.flags()['subdir'] def test_subdir_true_noexist_nocreate(self): path = testlib.temp_dir(create=False) self.assertRaises(lmdb.Error, lambda: testlib.temp_env(path, subdir=True, create=False)) assert not os.path.exists(path) def test_subdir_true_noexist_create(self): path = testlib.temp_dir(create=False) path_, env = testlib.temp_env(path, subdir=True, create=True) assert path_ == path assert env.path() == path def test_subdir_true_exist_nocreate(self): path, env = testlib.temp_env() assert lmdb.open(path, subdir=True, create=False).path() == path def test_subdir_true_exist_create(self): path, env = testlib.temp_env() assert lmdb.open(path, subdir=True, create=True).path() == path def test_readonly_false(self): path, env = testlib.temp_env(readonly=False) with env.begin(write=True) as txn: txn.put(B('a'), B('')) with env.begin() as txn: assert txn.get(B('a')) == B('') assert not env.flags()['readonly'] def test_readonly_true_noexist(self): path = testlib.temp_dir(create=False) # Open readonly missing store should fail. self.assertRaises(lmdb.Error, lambda: lmdb.open(path, readonly=True, create=True)) # And create=True should not have mkdir'd it. assert not os.path.exists(path) def test_readonly_true_exist(self): path, env = testlib.temp_env() env2 = lmdb.open(path, readonly=True) assert env2.path() == path # Attempting a write txn should fail. self.assertRaises(lmdb.ReadonlyError, lambda: env2.begin(write=True)) # Flag should be set. assert env2.flags()['readonly'] def test_metasync(self): for flag in True, False: path, env = testlib.temp_env(metasync=flag) assert env.flags()['metasync'] == flag def test_lock(self): for flag in True, False: path, env = testlib.temp_env(lock=flag) lock_path = os.path.join(path, 'lock.mdb') assert env.flags()['lock'] == flag assert flag == os.path.exists(lock_path) def test_sync(self): for flag in True, False: path, env = testlib.temp_env(sync=flag) assert env.flags()['sync'] == flag def test_map_async(self): for flag in True, False: path, env = testlib.temp_env(map_async=flag) assert env.flags()['map_async'] == flag def test_mode_subdir_create(self): if sys.platform == 'win32': # Mode argument is ignored on Windows; see lmdb.h return oldmask = os.umask(0) try: for mode in OCT('777'), OCT('755'), OCT('700'): path = testlib.temp_dir(create=False) env = lmdb.open(path, subdir=True, create=True, mode=mode) fmode = mode & ~OCT('111') assert testlib.path_mode(path) == mode assert testlib.path_mode(path+'/data.mdb') == fmode assert testlib.path_mode(path+'/lock.mdb') == fmode finally: os.umask(oldmask) def test_mode_subdir_nocreate(self): if sys.platform == 'win32': # Mode argument is ignored on Windows; see lmdb.h return oldmask = os.umask(0) try: for mode in OCT('777'), OCT('755'), OCT('700'): path = testlib.temp_dir() env = lmdb.open(path, subdir=True, create=False, mode=mode) fmode = mode & ~OCT('111') assert testlib.path_mode(path+'/data.mdb') == fmode assert testlib.path_mode(path+'/lock.mdb') == fmode finally: os.umask(oldmask) def test_readahead(self): for flag in True, False: path, env = testlib.temp_env(readahead=flag) assert env.flags()['readahead'] == flag def test_writemap(self): for flag in True, False: path, env = testlib.temp_env(writemap=flag) assert env.flags()['writemap'] == flag def test_meminit(self): for flag in True, False: path, env = testlib.temp_env(meminit=flag) assert env.flags()['meminit'] == flag def test_max_readers(self): self.assertRaises(lmdb.InvalidParameterError, lambda: testlib.temp_env(max_readers=0)) for val in 123, 234: _, env = testlib.temp_env(max_readers=val) assert env.info()['max_readers'] == val def test_max_dbs(self): self.assertRaises(OverflowError, lambda: testlib.temp_env(max_dbs=-1)) for val in 0, 10, 20: _, env = testlib.temp_env(max_dbs=val) dbs = [env.open_db(B('db%d' % i)) for i in range(val)] self.assertRaises(lmdb.DbsFullError, lambda: env.open_db(B('toomany'))) class SetMapSizeTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_invalid(self): _, env = testlib.temp_env() env.close() self.assertRaises(Exception, lambda: env.set_mapsize(999999)) def test_negative(self): _, env = testlib.temp_env() self.assertRaises(OverflowError, lambda: env.set_mapsize(-2015)) def test_applied(self): _, env = testlib.temp_env(map_size=PAGE_SIZE * 8) assert env.info()['map_size'] == PAGE_SIZE * 8 env.set_mapsize(PAGE_SIZE * 16) assert env.info()['map_size'] == PAGE_SIZE * 16 class CloseTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_close(self): _, env = testlib.temp_env() # Attempting things should be ok. txn = env.begin(write=True) txn.put(B('a'), B('')) cursor = txn.cursor() list(cursor) cursor.first() it = iter(cursor) env.close() # Repeated calls are ignored: env.close() # Attempting to use invalid objects should crash. self.assertRaises(Exception, lambda: txn.cursor()) self.assertRaises(Exception, lambda: txn.commit()) self.assertRaises(Exception, lambda: cursor.first()) self.assertRaises(Exception, lambda: list(it)) # Abort should be OK though. txn.abort() # Attempting to start new txn should crash. self.assertRaises(Exception, lambda: env.begin()) class ContextManagerTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_ok(self): path, env = testlib.temp_env() with env as env_: assert env_ is env with env.begin() as txn: txn.get(B('foo')) self.assertRaises(Exception, lambda: env.begin()) def test_crash(self): path, env = testlib.temp_env() try: with env as env_: assert env_ is env with env.begin() as txn: txn.get(123) except: pass self.assertRaises(Exception, lambda: env.begin()) class InfoMethodsTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_path(self): path, env = testlib.temp_env() assert path == env.path() assert isinstance(env.path(), UnicodeType) env.close() self.assertRaises(Exception, lambda: env.path()) def test_stat(self): _, env = testlib.temp_env() stat = env.stat() for k in 'psize', 'depth', 'branch_pages', 'overflow_pages',\ 'entries': assert isinstance(stat[k], INT_TYPES), k assert stat[k] >= 0 assert stat['entries'] == 0 txn = env.begin(write=True) txn.put(B('a'), B('b')) txn.commit() stat = env.stat() assert stat['entries'] == 1 env.close() self.assertRaises(Exception, lambda: env.stat()) def test_info(self): _, env = testlib.temp_env() info = env.info() for k in 'map_addr', 'map_size', 'last_pgno', 'last_txnid', \ 'max_readers', 'num_readers': assert isinstance(info[k], INT_TYPES), k assert info[k] >= 0 assert info['last_txnid'] == 0 txn = env.begin(write=True) txn.put(B('a'), B('')) txn.commit() info = env.info() assert info['last_txnid'] == 1 env.close() self.assertRaises(Exception, lambda: env.info()) def test_flags(self): _, env = testlib.temp_env() info = env.flags() for k in 'subdir', 'readonly', 'metasync', 'sync', 'map_async',\ 'readahead', 'writemap': assert isinstance(info[k], bool) env.close() self.assertRaises(Exception, lambda: env.flags()) def test_max_key_size(self): _, env = testlib.temp_env() mks = env.max_key_size() assert isinstance(mks, INT_TYPES) assert mks > 0 env.close() self.assertRaises(Exception, lambda: env.max_key_size()) def test_max_readers(self): _, env = testlib.temp_env() mr = env.max_readers() assert isinstance(mr, INT_TYPES) assert mr > 0 and mr == env.info()['max_readers'] env.close() self.assertRaises(Exception, lambda: env.max_readers()) def test_readers(self): _, env = testlib.temp_env(max_spare_txns=0) r = env.readers() assert isinstance(r, UnicodeType) assert r == NO_READERS rtxn = env.begin() r2 = env.readers() assert isinstance(env.readers(), UnicodeType) assert env.readers() != r env.close() self.assertRaises(Exception, lambda: env.readers()) class OtherMethodsTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_copy(self): _, env = testlib.temp_env() txn = env.begin(write=True) txn.put(B('a'), B('b')) txn.commit() dest_dir = testlib.temp_dir() if have_txn_patch: with env.begin() as txn: self.assertRaises(Exception, lambda: env.copy(dest_dir, txn=txn)) env.copy(dest_dir, compact=True) assert os.path.exists(dest_dir + '/data.mdb') cenv = lmdb.open(dest_dir) ctxn = cenv.begin() assert ctxn.get(B('a')) == B('b') env.close() self.assertRaises(Exception, lambda: env.copy(testlib.temp_dir())) def test_copy_compact(self): _, env = testlib.temp_env() txn = env.begin(write=True) txn.put(B('a'), B('b')) txn.commit() dest_dir = testlib.temp_dir() env.copy(dest_dir, compact=True) assert os.path.exists(dest_dir + '/data.mdb') cenv = lmdb.open(dest_dir) ctxn = cenv.begin() assert ctxn.get(B('a')) == B('b') # Test copy with transaction provided dest_dir = testlib.temp_dir() with env.begin(write=True) as txn: copy_txn = env.begin() txn.put(B('b'), B('b')) assert ctxn.get(B('b')) is None if have_txn_patch: env.copy(dest_dir, compact=True, txn=copy_txn) assert os.path.exists(dest_dir + '/data.mdb') cenv = lmdb.open(dest_dir) ctxn = cenv.begin() assert ctxn.get(B('a')) == B('b') # Verify that the write that occurred outside the txn isn't seen in the # copy assert ctxn.get(B('b')) is None else: self.assertRaises(Exception, lambda: env.copy(dest_dir, compact=True, txn=copy_txn)) env.close() self.assertRaises(Exception, lambda: env.copy(testlib.temp_dir())) def test_copyfd_compact(self): path, env = testlib.temp_env() txn = env.begin(write=True) txn.put(B('a'), B('b')) txn.commit() dst_path = testlib.temp_file(create=False) fp = open(dst_path, 'wb') env.copyfd(fp.fileno()) dstenv = lmdb.open(dst_path, subdir=False) dtxn = dstenv.begin() assert dtxn.get(B('a')) == B('b') fp.close() # Test copy with transaction provided dst_path = testlib.temp_file(create=False) fp = open(dst_path, 'wb') with env.begin(write=True) as txn: copy_txn = env.begin() txn.put(B('b'), B('b')) assert dtxn.get(B('b')) is None if have_txn_patch: env.copyfd(fp.fileno(), compact=True, txn=copy_txn) dstenv = lmdb.open(dst_path, subdir=False) dtxn = dstenv.begin() assert dtxn.get(B('a')) == B('b') # Verify that the write that occurred outside the txn isn't seen in the # copy assert dtxn.get(B('b')) is None dstenv.close() else: self.assertRaises(Exception, lambda: env.copyfd(fp.fileno(), compact=True, txn=copy_txn)) env.close() self.assertRaises(Exception, lambda: env.copyfd(fp.fileno())) fp.close() def test_copyfd(self): path, env = testlib.temp_env() txn = env.begin(write=True) txn.put(B('a'), B('b')) txn.commit() dst_path = testlib.temp_file(create=False) fp = open(dst_path, 'wb') if have_txn_patch: with env.begin() as txn: self.assertRaises(Exception, lambda: env.copyfd(fp.fileno(), txn=txn)) env.copyfd(fp.fileno()) dstenv = lmdb.open(dst_path, subdir=False) dtxn = dstenv.begin() assert dtxn.get(B('a')) == B('b') env.close() self.assertRaises(Exception, lambda: env.copyfd(fp.fileno())) fp.close() def test_sync(self): _, env = testlib.temp_env() env.sync(False) env.sync(True) env.close() self.assertRaises(Exception, lambda: env.sync(False)) @staticmethod def _test_reader_check_child(path): """Function to run in child process since we can't use fork() on win32.""" env = lmdb.open(path, max_spare_txns=0) txn = env.begin() os._exit(0) def test_reader_check(self): if sys.platform == 'win32': # Stale writers are cleared automatically on Windows, see lmdb.h return path, env = testlib.temp_env(max_spare_txns=0) rc = env.reader_check() assert rc == 0 # We need to open a separate env since Transaction.abort() always calls # reset for a read-only txn, the actual abort doesn't happen until # __del__, when Transaction discovers there is no room for it on the # freelist. env1 = lmdb.open(path) txn1 = env1.begin() assert env.readers() != NO_READERS assert env.reader_check() == 0 # Start a child, open a txn, then crash the child. rc = os.spawnl(os.P_WAIT, sys.executable, sys.executable, __file__, 'test_reader_check_child', path) assert rc == 0 assert env.reader_check() == 1 assert env.reader_check() == 0 assert env.readers() != NO_READERS txn1.abort() env1.close() assert env.readers() == NO_READERS env.close() self.assertRaises(Exception, lambda: env.reader_check()) class BeginTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_begin_closed(self): _, env = testlib.temp_env() env.close() self.assertRaises(Exception, lambda: env.begin()) def test_begin_readonly(self): _, env = testlib.temp_env() txn = env.begin() # Read txn can't write. self.assertRaises(lmdb.ReadonlyError, lambda: txn.put(B('a'), B(''))) txn.abort() def test_begin_write(self): _, env = testlib.temp_env() txn = env.begin(write=True) # Write txn can write. assert txn.put(B('a'), B('')) txn.commit() def test_bind_db(self): _, env = testlib.temp_env() main = env.open_db(None) sub = env.open_db(B('db1')) txn = env.begin(write=True, db=sub) assert txn.put(B('b'), B('')) # -> sub assert txn.put(B('a'), B(''), db=main) # -> main txn.commit() txn = env.begin() assert txn.get(B('a')) == B('') assert txn.get(B('b')) is None assert txn.get(B('a'), db=sub) is None assert txn.get(B('b'), db=sub) == B('') txn.abort() def test_parent_readonly(self): _, env = testlib.temp_env() parent = env.begin() # Nonsensical. self.assertRaises(lmdb.InvalidParameterError, lambda: env.begin(parent=parent)) def test_parent(self): _, env = testlib.temp_env() parent = env.begin(write=True) parent.put(B('a'), B('a')) child = env.begin(write=True, parent=parent) assert child.get(B('a')) == B('a') assert child.put(B('a'), B('b')) child.abort() # put() should have rolled back assert parent.get(B('a')) == B('a') child = env.begin(write=True, parent=parent) assert child.put(B('a'), B('b')) child.commit() # put() should be visible assert parent.get(B('a')) == B('b') def test_buffers(self): _, env = testlib.temp_env() txn = env.begin(write=True, buffers=True) assert txn.put(B('a'), B('a')) b = txn.get(B('a')) assert b is not None assert len(b) == 1 assert not isinstance(b, type(B(''))) txn.commit() txn = env.begin(buffers=False) b = txn.get(B('a')) assert b is not None assert len(b) == 1 assert isinstance(b, type(B(''))) txn.abort() class OpenDbTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_main(self): _, env = testlib.temp_env() # Start write txn, so we cause deadlock if open_db attempts txn. txn = env.begin(write=True) # Now get main DBI, we should already be open. db = env.open_db(None) # w00t, no deadlock. flags = db.flags(txn) assert not flags['reverse_key'] assert not flags['dupsort'] txn.abort() def test_unicode(self): _, env = testlib.temp_env() assert env.open_db(B('myindex')) is not None self.assertRaises(TypeError, lambda: env.open_db(UnicodeType('myindex'))) def test_sub_notxn(self): _, env = testlib.temp_env() assert env.info()['last_txnid'] == 0 db1 = env.open_db(B('subdb1')) assert env.info()['last_txnid'] == 1 db2 = env.open_db(B('subdb2')) assert env.info()['last_txnid'] == 2 env.close() self.assertRaises(Exception, lambda: env.open_db('subdb3')) def test_sub_rotxn(self): _, env = testlib.temp_env() txn = env.begin(write=False) self.assertRaises(lmdb.ReadonlyError, lambda: env.open_db(B('subdb'), txn=txn)) def test_sub_txn(self): _, env = testlib.temp_env() txn = env.begin(write=True) db1 = env.open_db(B('subdb1'), txn=txn) db2 = env.open_db(B('subdb2'), txn=txn) for db in db1, db2: assert db.flags(txn) == { 'dupfixed': False, 'dupsort': False, 'integerdup': False, 'integerkey': False, 'reverse_key': False, } txn.commit() def test_reopen(self): path, env = testlib.temp_env() db1 = env.open_db(B('subdb1')) env.close() env = lmdb.open(path, max_dbs=10) db1 = env.open_db(B('subdb1')) FLAG_SETS = [ (flag, val) for flag in ( 'reverse_key', 'dupsort', 'integerkey', 'integerdup', 'dupfixed' ) for val in (True, False) ] def test_flags(self): path, env = testlib.temp_env() txn = env.begin(write=True) for flag, val in self.FLAG_SETS: key = B('%s-%s' % (flag, val)) db = env.open_db(key, txn=txn, **{flag: val}) assert db.flags(txn)[flag] == val assert db.flags(None)[flag] == val assert db.flags()[flag] == val self.assertRaises(TypeError, lambda: db.flags(1, 2, 3)) txn.commit() # Test flag persistence. env.close() env = lmdb.open(path, max_dbs=10) txn = env.begin(write=True) for flag, val in self.FLAG_SETS: key = B('%s-%s' % (flag, val)) db = env.open_db(key, txn=txn) assert db.flags(txn)[flag] == val def test_readonly_env_main(self): path, env = testlib.temp_env() env.close() env = lmdb.open(path, readonly=True) db = env.open_db(None) def test_readonly_env_sub_noexist(self): # https://github.com/dw/py-lmdb/issues/109 path, env = testlib.temp_env() env.close() env = lmdb.open(path, max_dbs=10, readonly=True) self.assertRaises(lmdb.NotFoundError, lambda: env.open_db(B('node_schedules'), create=False)) def test_readonly_env_sub_eperm(self): # https://github.com/dw/py-lmdb/issues/109 path, env = testlib.temp_env() env.close() env = lmdb.open(path, max_dbs=10, readonly=True) self.assertRaises(lmdb.ReadonlyError, lambda: env.open_db(B('node_schedules'), create=True)) def test_readonly_env_sub(self): # https://github.com/dw/py-lmdb/issues/109 path, env = testlib.temp_env() assert env.open_db(B('node_schedules')) is not None env.close() env = lmdb.open(path, max_dbs=10, readonly=True) db = env.open_db(B('node_schedules'), create=False) assert db is not None reader_count = lambda env: env.readers().count('\n') - 1 class SpareTxnTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_none(self): _, env = testlib.temp_env(max_spare_txns=0) assert 0 == reader_count(env) t1 = env.begin() assert 1 == reader_count(env) t2 = env.begin() assert 2 == reader_count(env) t1.abort() del t1 assert 1 == reader_count(env) t2.abort() del t2 assert 0 == reader_count(env) def test_one(self): _, env = testlib.temp_env(max_spare_txns=1) # 1 here, since CFFI uses a temporary reader during init. assert 1 >= reader_count(env) t1 = env.begin() assert 1 == reader_count(env) t2 = env.begin() assert 2 == reader_count(env) t1.abort() del t1 assert 2 == reader_count(env) # 1 live, 1 cached t2.abort() del t2 assert 1 == reader_count(env) # 1 cached t3 = env.begin() assert 1 == reader_count(env) # 1 live t3.abort() del t3 assert 1 == reader_count(env) # 1 cached class LeakTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_open_unref_does_not_leak(self): temp_dir = testlib.temp_dir() env = lmdb.open(temp_dir) ref = weakref.ref(env) env = None testlib.debug_collect() assert ref() is None def test_open_close_does_not_leak(self): temp_dir = testlib.temp_dir() env = lmdb.open(temp_dir) env.close() ref = weakref.ref(env) env = None testlib.debug_collect() assert ref() is None def test_weakref_callback_invoked_once(self): temp_dir = testlib.temp_dir() env = lmdb.open(temp_dir) env.close() count = [0] def callback(ref): count[0] += 1 ref = weakref.ref(env, callback) env = None testlib.debug_collect() assert ref() is None assert count[0] == 1 if __name__ == '__main__': if len(sys.argv) > 1 and sys.argv[1] == 'test_reader_check_child': OtherMethodsTest._test_reader_check_child(sys.argv[2]) else: unittest.main() py-lmdb-py-lmdb_1.0.0/tests/iteration_test.py000066400000000000000000000211771372223456500212720ustar00rootroot00000000000000#! /usr/bin/env python # # Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # # test delete(dupdata) from __future__ import absolute_import from __future__ import with_statement import unittest import testlib from testlib import B from testlib import BT from testlib import KEYS, ITEMS, KEYS2, ITEMS2 from testlib import putData, putBigData class IterationTestBase(unittest.TestCase): def tearDown(self): testlib.cleanup() def setUp(self): self.path, self.env = testlib.temp_env() # creates 10 databases self.txn = self.env.begin(write=True) putData(self.txn) self.c = self.txn.cursor() self.empty_entry = (B(''), B('')) def matchList(self, ls_a, ls_b): return all(map(lambda x, y: x == y, ls_a, ls_b)) class IterationTestBase2(unittest.TestCase): """ This puts more data than its predecessor""" def tearDown(self): testlib.cleanup() def setUp(self): self.path, self.env = testlib.temp_env() # creates 10 databases self.txn = self.env.begin(write=True) putBigData(self.txn) # HERE! self.c = self.txn.cursor() self.empty_entry = ('', '') def matchList(self, ls_a, ls_b): return all(map(lambda x, y: x == y, ls_a, ls_b)) class IterationTest(IterationTestBase): def testFromStart(self): # From start self.c.first() self.assertEqual(self.c.key(), KEYS[0]) # start of db test_list = [i for i in iter(self.c)] self.assertEqual(self.matchList(test_list, ITEMS), True) self.assertEqual(self.c.item(), self.empty_entry) # end of db def testFromStartWithIternext(self): # From start with iternext self.c.first() self.assertEqual(self.c.key(), KEYS[0]) # start of db test_list = [i for i in self.c.iternext()] # remaining elements in db self.assertEqual(self.matchList(test_list, ITEMS), True) self.assertEqual(self.c.item(), self.empty_entry) # end of db def testFromStartWithNext(self): # From start with next self.c.first() self.assertEqual(self.c.key(), KEYS[0]) # start of db test_list = [] while 1: test_list.append(self.c.item()) if not self.c.next(): break self.assertEqual(self.matchList(test_list, ITEMS), True) def testFromExistentKeySetKey(self): self.c.first() self.c.set_key(KEYS[1]) self.assertEqual(self.c.key(), KEYS[1]) test_list = [i for i in self.c.iternext()] self.assertEqual(self.matchList(test_list, ITEMS[1:]), True) def testFromExistentKeySetRange(self): self.c.first() self.c.set_range(KEYS[1]) self.assertEqual(self.c.key(), KEYS[1]) test_list = [i for i in self.c.iternext()] self.assertEqual(self.matchList(test_list, ITEMS[1:]), True) def testFromNonExistentKeySetRange(self): self.c.first() self.c.set_range(B('c')) self.assertEqual(self.c.key(), B('d')) test_list = [i for i in self.c.iternext()] test_items = [i for i in ITEMS if i[0] > B('c')] self.assertEqual(self.matchList(test_list, test_items), True) def testFromLastKey(self): self.c.last() self.assertEqual(self.c.key(), KEYS[-1]) test_list = [i for i in self.c.iternext()] self.assertEqual(self.matchList(test_list, ITEMS[-1:]), True) def testFromNonExistentKeyPastEnd(self): self.c.last() self.assertEqual(self.c.key(), KEYS[-1]) # next() fails, leaving iterator in an unpositioned state. self.c.next() self.assertEqual(self.c.item(), self.empty_entry) # iternext() from an unpositioned state proceeds from start of DB. test_list = list(self.c.iternext()) self.assertEqual(test_list, ITEMS) class ReverseIterationTest(IterationTestBase): def testFromStartRev(self): # From start self.c.first() self.assertEqual(self.c.key(), KEYS[0]) # start of db test_list = [i for i in self.c.iterprev()] self.assertEqual(self.matchList(test_list, ITEMS[:1][::-1]), True) self.assertEqual(self.c.item(), self.empty_entry) # very start of db def testFromExistentKeySetKeyRev(self): self.c.first() self.c.set_key(KEYS[2]) self.assertEqual(self.c.key(), KEYS[2]) test_list = [i for i in self.c.iterprev()] self.assertEqual(self.matchList(test_list, ITEMS[:3][::-1]), True) def testFromExistentKeySetRangeRev(self): self.c.first() self.c.set_range(KEYS[2]) self.assertEqual(self.c.key(), KEYS[2]) test_list = [i for i in self.c.iterprev()] self.assertEqual(self.matchList(test_list, ITEMS[:3][::-1]), True) def testFromNonExistentKeySetRangeRev(self): self.c.first() self.c.set_range(B('c')) self.assertEqual(self.c.key(), B('d')) test_list = [i for i in self.c.iterprev()] test_items = [i for i in ITEMS if i[0] <= B('d')] test_items = test_items[::-1] self.assertEqual(self.matchList(test_list, test_items), True) def testFromLastKeyRev(self): self.c.last() self.assertEqual(self.c.key(), KEYS[-1]) test_list = [i for i in self.c.iterprev()] self.assertEqual(self.matchList(test_list, ITEMS[::-1]), True) def testFromLastKeyWithPrevRev(self): self.c.last() self.assertEqual(self.c.key(), KEYS[-1]) # end of db test_list = [] while 1: test_list.append(self.c.item()) if not self.c.prev(): break self.assertEqual(self.matchList(test_list, ITEMS[::-1]), True) def testFromNonExistentKeyPastEndRev(self): self.c.first() self.assertEqual(self.c.key(), KEYS[0]) # prev() fails, leaving iterator in an unpositioned state. self.c.prev() self.assertEqual(self.c.item(), self.empty_entry) # iterprev() from an unpositioned state proceeds from end of DB. test_list = list(self.c.iterprev()) self.assertEqual(test_list, ITEMS[::-1]) class IterationTestWithDupsBase(unittest.TestCase): def tearDown(self): testlib.cleanup() def setUp(self): self.path, self.env = testlib.temp_env() db = self.env.open_db(B('db1'), dupsort=True) self.txn = self.env.begin(db, write=True) for _ in range(2): putData(self.txn) self.c = self.txn.cursor() self.empty_entry = ('', '') def matchList(self, ls_a, ls_b): return all(map(lambda x, y: x == y, ls_a, ls_b)) class IterationTestWithDups(IterationTestWithDupsBase): pass class SeekIterationTest(IterationTestBase2): def testForwardIterationSeek(self): self.c.first() test_list = [] for i in self.c.iternext(): test_list.append(i) # skips d and e if self.c.key() == B('baa'): self.c.set_key(B('e')) test_item = [i for i in ITEMS2 if i[0] not in (B('d'), B('e'))] self.assertEqual(test_list, test_item) def testPutDuringIteration(self): self.c.first() test_list = [] c = self.txn.cursor() for i in c.iternext(): test_list.append(i) # adds 'i' upon seeing 'e' if c.key() == B('e'): self.c.put(B('i'), B('')) test_item = ITEMS2 + [(B('i'), B(''))] self.assertEqual(test_list, test_item) def testDeleteDuringIteration(self): self.c.first() test_list = [] for i in self.c.iternext(): # deletes 'e' upon seeing it if self.c.key() == B('e'): # Causes 'e' to be deleted, and advances cursor to next # element. self.c.delete() i = self.c.item() test_list.append(i) test_item = [i for i in ITEMS2 if i[0] != B('e')] self.assertEqual(test_list, test_item) if __name__ == '__main__': unittest.main() py-lmdb-py-lmdb_1.0.0/tests/package_test.py000066400000000000000000000040121372223456500206540ustar00rootroot00000000000000# # Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # from __future__ import absolute_import import unittest import lmdb class PackageExportsTest(unittest.TestCase): """ Ensure the list of exported names matches a predefined list. Designed to ensure future interface changes to cffi.py and cpython.c don't break consistency of "from lmdb import *". """ def test_exports(self): assert sorted(lmdb.__all__) == [ 'BadDbiError', 'BadRslotError', 'BadTxnError', 'BadValsizeError', 'CorruptedError', 'Cursor', 'CursorFullError', 'DbsFullError', 'DiskError', 'Environment', 'Error', 'IncompatibleError', 'InvalidError', 'InvalidParameterError', 'KeyExistsError', 'LockError', 'MapFullError', 'MapResizedError', 'MemoryError', 'NotFoundError', 'PageFullError', 'PageNotFoundError', 'PanicError', 'ReadersFullError', 'ReadonlyError', 'TlsFullError', 'Transaction', 'TxnFullError', 'VersionMismatchError', '_Database', 'enable_drop_gil', 'version', ] py-lmdb-py-lmdb_1.0.0/tests/testlib.py000066400000000000000000000075071372223456500177040ustar00rootroot00000000000000# # Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # from __future__ import absolute_import import atexit import gc import os import shutil import stat import sys import tempfile import traceback import unittest try: import __builtin__ except ImportError: import builtins as __builtin__ import lmdb _cleanups = [] def cleanup(): while _cleanups: func = _cleanups.pop() try: func() except Exception: traceback.print_exc() atexit.register(cleanup) class LmdbTest(unittest.TestCase): def tearDown(self): cleanup() def temp_dir(create=True): path = tempfile.mkdtemp(prefix='lmdb_test') assert path is not None, 'tempfile.mkdtemp failed' if not create: os.rmdir(path) _cleanups.append(lambda: shutil.rmtree(path, ignore_errors=True)) if hasattr(path, 'decode'): path = path.decode(sys.getfilesystemencoding()) return path def temp_file(create=True): fd, path = tempfile.mkstemp(prefix='lmdb_test') assert path is not None, 'tempfile.mkstemp failed' os.close(fd) if not create: os.unlink(path) _cleanups.append(lambda: os.path.exists(path) and os.unlink(path)) pathlock = path + '-lock' _cleanups.append(lambda: os.path.exists(pathlock) and os.unlink(pathlock)) if hasattr(path, 'decode'): path = path.decode(sys.getfilesystemencoding()) return path def temp_env(path=None, max_dbs=10, **kwargs): if not path: path = temp_dir() env = lmdb.open(path, max_dbs=max_dbs, **kwargs) _cleanups.append(env.close) return path, env def path_mode(path): return stat.S_IMODE(os.stat(path).st_mode) def debug_collect(): if hasattr(gc, 'set_debug') and hasattr(gc, 'get_debug'): old = gc.get_debug() gc.set_debug(gc.DEBUG_LEAK) gc.collect() gc.set_debug(old) else: for x in range(10): # PyPy doesn't collect objects with __del__ on first attempt. gc.collect() UnicodeType = getattr(__builtin__, 'unicode', str) BytesType = getattr(__builtin__, 'bytes', str) try: INT_TYPES = (int, long) except NameError: INT_TYPES = (int,) # B(ascii 'string') -> bytes try: bytes('') # Python>=2.6, alias for str(). B = lambda s: s except TypeError: # Python3.x, requires encoding parameter. B = lambda s: bytes(s, 'ascii') # BL('s1', 's2') -> ['bytes1', 'bytes2'] BL = lambda *args: list(map(B, args)) # TS('s1', 's2') -> ('bytes1', 'bytes2') BT = lambda *args: tuple(B(s) for s in args) # O(int) -> length-1 bytes O = lambda arg: B(chr(arg)) # OCT(s) -> parse string as octal OCT = lambda s: int(s, 8) KEYS = BL('a', 'b', 'baa', 'd') ITEMS = [(k, B('')) for k in KEYS] REV_ITEMS = ITEMS[::-1] VALUES = [B('') for k in KEYS] KEYS2 = BL('a', 'b', 'baa', 'd', 'e', 'f', 'g', 'h') ITEMS2 = [(k, B('')) for k in KEYS2] REV_ITEMS2 = ITEMS2[::-1] VALUES2 = [B('') for k in KEYS2] def putData(t, db=None): for k, v in ITEMS: if db: t.put(k, v, db=db) else: t.put(k, v) def putBigData(t, db=None): for k, v in ITEMS2: if db: t.put(k, v, db=db) else: t.put(k, v) py-lmdb-py-lmdb_1.0.0/tests/tool_test.py000066400000000000000000000031301372223456500202360ustar00rootroot00000000000000# # Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # from __future__ import absolute_import import sys import shlex import unittest import lmdb import lmdb.tool import testlib def call_tool(cmdline): if sys.platform == 'win32': args = cmdline.split() else: args = shlex.split(cmdline) return lmdb.tool.main(args) class ToolTest(testlib.LmdbTest): def test_cmd_get(self): frompath, env = testlib.temp_env() db = env.open_db(b'subdb') with env.begin(write=True, db=db) as txn: txn.put(b'foo', b'bar', db=db) env.close() call_tool('-d subdb get --env %s' % (frompath,)) def test_cmd_rewrite(self): frompath, env = testlib.temp_env() env.open_db(b'subdb') env.close() topath = testlib.temp_dir() call_tool('rewrite -e %s -E %s subdb' % (frompath, topath)) if __name__ == '__main__': unittest.main() py-lmdb-py-lmdb_1.0.0/tests/txn_test.py000066400000000000000000000400411372223456500200740ustar00rootroot00000000000000# # Copyright 2013 The py-lmdb authors, all rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted only as authorized by the OpenLDAP # Public License. # # A copy of this license is available in the file LICENSE in the # top-level directory of the distribution or, alternatively, at # . # # OpenLDAP is a registered trademark of the OpenLDAP Foundation. # # Individual files and/or contributed packages may be copyright by # other parties and/or subject to additional restrictions. # # This work also contains materials derived from public sources. # # Additional information about OpenLDAP can be obtained at # . # from __future__ import absolute_import from __future__ import with_statement import struct import unittest import weakref import testlib from testlib import B from testlib import INT_TYPES from testlib import BytesType import lmdb UINT_0001 = struct.pack('I', 1) UINT_0002 = struct.pack('I', 2) ULONG_0001 = struct.pack('L', 1) # L != size_t ULONG_0002 = struct.pack('L', 2) # L != size_t class InitTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_closed(self): _, env = testlib.temp_env() env.close() self.assertRaises(Exception, lambda: lmdb.Transaction(env)) def test_readonly(self): _, env = testlib.temp_env() txn = lmdb.Transaction(env) # Read txn can't write. self.assertRaises(lmdb.ReadonlyError, lambda: txn.put(B('a'), B(''))) txn.abort() def test_begin_write(self): _, env = testlib.temp_env() txn = lmdb.Transaction(env, write=True) # Write txn can write. assert txn.put(B('a'), B('')) txn.commit() def test_bind_db(self): _, env = testlib.temp_env() main = env.open_db(None) sub = env.open_db(B('db1')) txn = lmdb.Transaction(env, write=True, db=sub) assert txn.put(B('b'), B('')) # -> sub assert txn.put(B('a'), B(''), db=main) # -> main txn.commit() txn = lmdb.Transaction(env) assert txn.get(B('a')) == B('') assert txn.get(B('b')) is None assert txn.get(B('a'), db=sub) is None assert txn.get(B('b'), db=sub) == B('') txn.abort() def test_bind_db_methods(self): _, env = testlib.temp_env() maindb = env.open_db(None) db1 = env.open_db(B('d1')) txn = lmdb.Transaction(env, write=True, db=db1) assert txn.put(B('a'), B('d1')) assert txn.get(B('a'), db=db1) == B('d1') assert txn.get(B('a'), db=maindb) is None assert txn.replace(B('a'), B('d11')) == B('d1') assert txn.pop(B('a')) == B('d11') assert txn.put(B('a'), B('main'), db=maindb, overwrite=False) assert not txn.delete(B('a')) txn.abort() def test_parent_readonly(self): _, env = testlib.temp_env() parent = lmdb.Transaction(env) # Nonsensical. self.assertRaises(lmdb.InvalidParameterError, lambda: lmdb.Transaction(env, parent=parent)) def test_parent(self): _, env = testlib.temp_env() parent = lmdb.Transaction(env, write=True) parent.put(B('a'), B('a')) child = lmdb.Transaction(env, write=True, parent=parent) assert child.get(B('a')) == B('a') assert child.put(B('a'), B('b')) child.abort() # put() should have rolled back assert parent.get(B('a')) == B('a') child = lmdb.Transaction(env, write=True, parent=parent) assert child.put(B('a'), B('b')) child.commit() # put() should be visible assert parent.get(B('a')) == B('b') def test_buffers(self): _, env = testlib.temp_env() txn = lmdb.Transaction(env, write=True, buffers=True) assert txn.put(B('a'), B('a')) b = txn.get(B('a')) assert b is not None assert len(b) == 1 assert not isinstance(b, type(B(''))) txn.commit() txn = lmdb.Transaction(env, buffers=False) b = txn.get(B('a')) assert b is not None assert len(b) == 1 assert isinstance(b, type(B(''))) txn.abort() class ContextManagerTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_ok(self): path, env = testlib.temp_env() txn = env.begin(write=True) with txn as txn_: assert txn is txn_ txn.put(B('foo'), B('123')) self.assertRaises(Exception, lambda: txn.get(B('foo'))) with env.begin() as txn: assert txn.get(B('foo')) == B('123') def test_crash(self): path, env = testlib.temp_env() txn = env.begin(write=True) try: with txn as txn_: txn.put(B('foo'), B('123')) txn.put(123, 123) except: pass self.assertRaises(Exception, lambda: txn.get(B('foo'))) with env.begin() as txn: assert txn.get(B('foo')) is None class IdTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_readonly_new(self): _, env = testlib.temp_env() with env.begin() as txn: assert txn.id() == 0 def test_write_new(self): _, env = testlib.temp_env() with env.begin(write=True) as txn: assert txn.id() == 1 def test_readonly_after_write(self): _, env = testlib.temp_env() with env.begin(write=True) as txn: txn.put(B('a'), B('a')) with env.begin() as txn: assert txn.id() == 1 def test_invalid_txn(self): _, env = testlib.temp_env() txn = env.begin() txn.abort() self.assertRaises(Exception, lambda: txn.id()) class StatTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_stat(self): _, env = testlib.temp_env() db1 = env.open_db(B('db1')) db2 = env.open_db(B('db2')) txn = lmdb.Transaction(env) for db in db1, db2: stat = txn.stat(db) for k in 'psize', 'depth', 'branch_pages', 'overflow_pages',\ 'entries': assert isinstance(stat[k], INT_TYPES), k assert stat[k] >= 0 assert stat['entries'] == 0 txn = lmdb.Transaction(env, write=True) txn.put(B('a'), B('b'), db=db1) txn.commit() txn = lmdb.Transaction(env) stat = txn.stat(db1) assert stat['entries'] == 1 stat = txn.stat(db2) assert stat['entries'] == 0 txn.abort() self.assertRaises(Exception, lambda: env.stat(db1)) env.close() self.assertRaises(Exception, lambda: env.stat(db1)) class DropTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_empty(self): _, env = testlib.temp_env() db1 = env.open_db(B('db1')) txn = env.begin(write=True) txn.put(B('a'), B('a'), db=db1) assert txn.get(B('a'), db=db1) == B('a') txn.drop(db1, False) assert txn.get(B('a')) is None txn.drop(db1, False) # should succeed. assert txn.get(B('a')) is None def test_delete(self): _, env = testlib.temp_env() db1 = env.open_db(B('db1')) txn = env.begin(write=True) txn.put(B('a'), B('a'), db=db1) txn.drop(db1) self.assertRaises(lmdb.InvalidParameterError, lambda: txn.get(B('a'), db=db1)) self.assertRaises(lmdb.InvalidParameterError, lambda: txn.drop(db1)) def test_double_delete(self): _, env = testlib.temp_env() db1 = env.open_db(B('db1')) txn = env.begin(write=True, db=db1) txn.put(B('a'), B('a'), db=db1) txn.drop(db1) self.assertRaises(lmdb.InvalidParameterError, lambda: txn.get(B('a'), db=db1)) self.assertRaises(lmdb.InvalidParameterError, lambda: txn.drop(db1)) txn.commit() db1 = env.open_db(B('db1')) txn = env.begin(write=True, db=db1) txn.put(B('a'), B('a'), db=db1) txn.drop(db1) self.assertRaises(lmdb.InvalidParameterError, lambda: txn.get(B('a'), db=db1)) self.assertRaises(lmdb.InvalidParameterError, lambda: txn.drop(db1)) txn.commit() class CommitTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_bad_txn(self): _, env = testlib.temp_env() txn = env.begin() txn.abort() self.assertRaises(Exception, lambda: txn.commit()) def test_bad_env(self): _, env = testlib.temp_env() txn = env.begin() env.close() self.assertRaises(Exception, lambda: txn.commit()) def test_commit_ro(self): _, env = testlib.temp_env() txn = env.begin() txn.commit() self.assertRaises(Exception, lambda: txn.commit()) def test_commit_rw(self): _, env = testlib.temp_env() txn = env.begin(write=True) assert txn.put(B('a'), B('a')) txn.commit() self.assertRaises(Exception, lambda: txn.commit()) txn = env.begin() assert txn.get(B('a')) == B('a') txn.abort() class AbortTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_abort_ro(self): _, env = testlib.temp_env() txn = env.begin() assert txn.get(B('a')) is None txn.abort() self.assertRaises(Exception, lambda: txn.get(B('a'))) env.close() self.assertRaises(Exception, lambda: txn.get(B('a'))) def test_abort_rw(self): _, env = testlib.temp_env() txn = env.begin(write=True) assert txn.put(B('a'), B('a')) txn.abort() txn = env.begin() assert txn.get(B('a')) is None class GetTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_bad_txn(self): _, env = testlib.temp_env() txn = env.begin() txn.abort() self.assertRaises(Exception, lambda: txn.get(B('a'))) def test_bad_env(self): _, env = testlib.temp_env() txn = env.begin() env.close() self.assertRaises(Exception, lambda: txn.get(B('a'))) def test_missing(self): _, env = testlib.temp_env() txn = env.begin() assert txn.get(B('a')) is None assert txn.get(B('a'), default='default') is 'default' def test_empty_key(self): _, env = testlib.temp_env() txn = env.begin() self.assertRaises(lmdb.BadValsizeError, lambda: txn.get(B(''))) def test_db(self): _, env = testlib.temp_env() maindb = env.open_db(None) db1 = env.open_db(B('db1')) txn = env.begin() assert txn.get(B('a'), db=db1) is None txn.abort() txn = env.begin(write=True) txn.put(B('a'), B('a'), db=db1) txn.commit() txn = env.begin() assert txn.get(B('a')) is None txn.abort() txn = env.begin(db=db1) assert txn.get(B('a')) == B('a') assert txn.get(B('a'), db=maindb) is None def test_buffers_no(self): _, env = testlib.temp_env() txn = env.begin(write=True) assert txn.put(B('a'), B('a')) assert type(txn.get(B('a'))) is BytesType def test_buffers_yes(self): _, env = testlib.temp_env() txn = env.begin(write=True, buffers=True) assert txn.put(B('a'), B('a')) assert type(txn.get(B('a'))) is not BytesType def test_dupsort(self): _, env = testlib.temp_env() db1 = env.open_db(B('db1'), dupsort=True) txn = env.begin(write=True, db=db1) assert txn.put(B('a'), B('a')) assert txn.put(B('a'), B('b')) assert txn.get(B('a')) == B('a') def test_integerkey(self): _, env = testlib.temp_env() db1 = env.open_db(B('db1'), integerkey=True) txn = env.begin(write=True, db=db1) assert txn.put(UINT_0001, B('a')) assert txn.put(UINT_0002, B('b')) assert txn.get(UINT_0001) == B('a') assert txn.get(UINT_0002) == B('b') def test_integerdup(self): _, env = testlib.temp_env() db1 = env.open_db(B('db1'), dupsort=True, integerdup=True) txn = env.begin(write=True, db=db1) assert txn.put(UINT_0001, UINT_0002) assert txn.put(UINT_0001, UINT_0001) assert txn.get(UINT_0001) == UINT_0001 def test_dupfixed(self): _, env = testlib.temp_env() db1 = env.open_db(B('db1'), dupsort=True, dupfixed=True) txn = env.begin(write=True, db=db1) assert txn.put(B('a'), B('a')) assert txn.put(B('a'), B('b')) assert txn.get(B('a')) == B('a') class PutTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_bad_txn(self): _, env = testlib.temp_env() txn = env.begin(write=True) txn.abort() self.assertRaises(Exception, lambda: txn.put(B('a'), B('a'))) def test_bad_env(self): _, env = testlib.temp_env() txn = env.begin(write=True) env.close() self.assertRaises(Exception, lambda: txn.put(B('a'), B('a'))) def test_ro_txn(self): _, env = testlib.temp_env() txn = env.begin() self.assertRaises(lmdb.ReadonlyError, lambda: txn.put(B('a'), B('a'))) def test_empty_key_value(self): _, env = testlib.temp_env() txn = env.begin(write=True) self.assertRaises(lmdb.BadValsizeError, lambda: txn.put(B(''), B('a'))) def test_dupsort(self): _, env = testlib.temp_env() def test_dupdata_no_dupsort(self): _, env = testlib.temp_env() txn = env.begin(write=True) assert txn.put(B('a'), B('a'), dupdata=True) assert txn.put(B('a'), B('b'), dupdata=True) txn.get(B('a')) class ReplaceTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_bad_txn(self): _, env = testlib.temp_env() txn = env.begin(write=True) txn.abort() self.assertRaises(Exception, lambda: txn.replace(B('a'), B('a'))) def test_bad_env(self): _, env = testlib.temp_env() txn = env.begin(write=True) env.close() self.assertRaises(Exception, lambda: txn.replace(B('a'), B('a'))) def test_ro_txn(self): _, env = testlib.temp_env() txn = env.begin() self.assertRaises(lmdb.ReadonlyError, lambda: txn.replace(B('a'), B('a'))) def test_empty_key_value(self): _, env = testlib.temp_env() txn = env.begin(write=True) self.assertRaises(lmdb.BadValsizeError, lambda: txn.replace(B(''), B('a'))) def test_dupsort_noexist(self): _, env = testlib.temp_env() db = env.open_db(B('db1'), dupsort=True) txn = env.begin(write=True, db=db) assert None == txn.replace(B('a'), B('x')) assert B('x') == txn.replace(B('a'), B('y')) assert B('y') == txn.replace(B('a'), B('z')) cur = txn.cursor() assert cur.set_key(B('a')) assert [B('z')] == list(cur.iternext_dup()) def test_dupdata_no_dupsort(self): _, env = testlib.temp_env() txn = env.begin(write=True) assert txn.put(B('a'), B('a'), dupdata=True) assert txn.put(B('a'), B('b'), dupdata=True) txn.get(B('a')) class LeakTest(unittest.TestCase): def tearDown(self): testlib.cleanup() def test_open_close(self): temp_dir = testlib.temp_dir() env = lmdb.open(temp_dir) with env.begin() as txn: pass env.close() r1 = weakref.ref(env) r2 = weakref.ref(txn) env = None txn = None testlib.debug_collect() assert r1() is None assert r2() is None if __name__ == '__main__': unittest.main()