From 4681620e66bbd0973bb441edf4910e9c8a2d9c52 Mon Sep 17 00:00:00 2001 From: Leo Yuriev Date: Thu, 2 Feb 2017 13:15:16 +0300 Subject: [PATCH] mdbx: don't ignore `data` arg in mdb_del() for libfpta. --- lmdb.h | 10 +++++++++- mdb.c | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/lmdb.h b/lmdb.h index 7463e4e8..b6a55f11 100644 --- a/lmdb.h +++ b/lmdb.h @@ -1,7 +1,7 @@ /** @file lmdb.h * @brief Extended Lightning memory-mapped database library * - * @mainpage Extended Lightning Memory-Mapped Database Manager (MDBX) + * @mainpage Extended Lightning Memory-Mapped Database (MDBX) * * @section intro_sec Introduction * MDBX is a Btree-based database management library modeled loosely on the @@ -1387,12 +1387,20 @@ int mdb_put(MDB_txn *txn, MDB_dbi dbi, MDB_val *key, MDB_val *data, /** @brief Delete items from a database. * * This function removes key/data pairs from the database. + * + * MDBX-mode: + * The data parameter is NOT ignored regardless the database does + * support sorted duplicate data items or not. If the data parameter + * is non-NULL only the matching data item will be deleted. + * + * LMDB-compatible mode: * 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() diff --git a/mdb.c b/mdb.c index 8b4afd00..449ba82f 100644 --- a/mdb.c +++ b/mdb.c @@ -8773,10 +8773,12 @@ mdb_del(MDB_txn *txn, MDB_dbi dbi, if (unlikely(txn->mt_flags & (MDB_TXN_RDONLY|MDB_TXN_BLOCKED))) return (txn->mt_flags & MDB_TXN_RDONLY) ? EACCES : MDB_BAD_TXN; +#if ! MDBX_MODE_ENABLED if (!F_ISSET(txn->mt_dbs[dbi].md_flags, MDB_DUPSORT)) { /* must ignore any data */ data = NULL; } +#endif return mdb_del0(txn, dbi, key, data, 0); }