Skip to content

Commit

Permalink
Merge pull request #13803 from Habbie/lmdb-sync-mode
Browse files Browse the repository at this point in the history
lmdb: remove mapasync mode, it was always a lie
  • Loading branch information
Habbie committed Feb 15, 2024
2 parents bca00b9 + 092dcb6 commit 0491d8e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
15 changes: 10 additions & 5 deletions docs/backends/lmdb.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,14 @@ Default is 2 on 32 bits systems, and 64 on 64 bits systems.
``lmdb-sync-mode``
^^^^^^^^^^^^^^^^^^

* Synchronisation mode: sync, nosync, nometasync, mapasync
* Default: mapasync
.. versionchanged:: 4.9.0

``sync``
``mapasync`` choice removed

* Synchronisation mode: sync, nosync, nometasync
* Default: sync

``sync`` (default since 4.9.0)
LMDB synchronous mode. Safest option, but also slightly slower. Can also be enabled with ``lmdb-sync-mode=``

``nosync``
Expand All @@ -64,8 +68,9 @@ Default is 2 on 32 bits systems, and 64 on 64 bits systems.
``nometasync``
flush system buffers to disk only once per transaction, omit the metadata flush. This maintains database integrity, but can potentially lose the last committed transaction if the operating system crashes.

``mapasync`` (default)
Use asynchronous flushes to disk. As with nosync, a system crash can then corrupt the database or lose the last transactions.
``mapasync`` (default before 4.9.0)
Due to a bug before version 4.9.0, this actually gave ``sync`` behaviour.
The ``mapasync`` choice has been removed in version 4.9.0.

.. _setting-lmdb-schema-version:

Expand Down
4 changes: 4 additions & 0 deletions docs/upgrading.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ Various settings, deprecated since 4.5.0, have been removed.
* :ref:`setting-slave` is now :ref:`setting-secondary`
* :ref:`setting-superslave` is now :ref:`setting-autosecondary`

In :ref:`setting-lmdb-sync-mode`, the previous default ``mapasync`` is no longer a valid value.
Due to a bug, it was interpreted as ``sync`` in previous versions.
To avoid operational surprises, ``sync`` is the new default value.

Renamed options
^^^^^^^^^^^^^^^

Expand Down
4 changes: 1 addition & 3 deletions modules/lmdbbackend/lmdbbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -662,8 +662,6 @@ LMDBBackend::LMDBBackend(const std::string& suffix)
d_asyncFlag = MDB_NOSYNC;
else if (syncMode == "nometasync")
d_asyncFlag = MDB_NOMETASYNC;
else if (syncMode == "mapasync")
d_asyncFlag = MDB_MAPASYNC;
else if (syncMode.empty() || syncMode == "sync")
d_asyncFlag = 0;
else
Expand Down Expand Up @@ -2772,7 +2770,7 @@ class LMDBFactory : public BackendFactory
void declareArguments(const string& suffix = "") override
{
declare(suffix, "filename", "Filename for lmdb", "./pdns.lmdb");
declare(suffix, "sync-mode", "Synchronisation mode: nosync, nometasync, mapasync, sync", "mapasync");
declare(suffix, "sync-mode", "Synchronisation mode: nosync, nometasync, sync", "sync");
// there just is no room for more on 32 bit
declare(suffix, "shards", "Records database will be split into this number of shards", (sizeof(void*) == 4) ? "2" : "64");
declare(suffix, "schema-version", "Maximum allowed schema version to run on this DB. If a lower version is found, auto update is performed", std::to_string(SCHEMAVERSION));
Expand Down

0 comments on commit 0491d8e

Please sign in to comment.