From: Peter van Dijk Date: Thu, 6 Apr 2023 10:19:59 +0000 (+0200) Subject: lmdb indexops: avoid updating timestamp when there is no change X-Git-Tag: auth-4.8.0-beta1~1^2~14 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=14b68fdb492bfcab47c786e56df511f7453e9b67;p=thirdparty%2Fpdns.git lmdb indexops: avoid updating timestamp when there is no change --- diff --git a/ext/lmdb-safe/lmdb-typed.hh b/ext/lmdb-safe/lmdb-typed.hh index a0e2cefb0d..0e837a6091 100644 --- a/ext/lmdb-safe/lmdb-typed.hh +++ b/ext/lmdb-safe/lmdb-typed.hh @@ -162,7 +162,11 @@ struct LMDBIndexOps auto scombined = makeCombinedKey(keyConv(d_parent->getMember(t)), id); MDBInVal combined(scombined); - txn->put(d_idx, combined, empty, flags); + MDBOutVal currentvalue; + + if (txn->get(d_idx, combined, currentvalue) == MDB_NOTFOUND) { + txn->put(d_idx, combined, empty, flags); + } } void del(MDBRWTransaction& txn, const Class& t, uint32_t id)