From 14b68fdb492bfcab47c786e56df511f7453e9b67 Mon Sep 17 00:00:00 2001 From: Peter van Dijk Date: Thu, 6 Apr 2023 12:19:59 +0200 Subject: [PATCH] lmdb indexops: avoid updating timestamp when there is no change --- ext/lmdb-safe/lmdb-typed.hh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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) -- 2.47.2