]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Provide rrset timestamps in LMDB.
authorMiod Vallat <miod.vallat@powerdns.com>
Fri, 18 Jul 2025 08:27:25 +0000 (10:27 +0200)
committerMiod Vallat <miod.vallat@powerdns.com>
Fri, 18 Jul 2025 09:33:50 +0000 (11:33 +0200)
Signed-off-by: Miod Vallat <miod.vallat@powerdns.com>
modules/lmdbbackend/lmdbbackend.cc
modules/lmdbbackend/lmdbbackend.hh

index bc7ba9da265d0c67f2e581c01dbea5baa22a3aca..b3f016361ca5666cd55984b065396ee553d8c927 100644 (file)
@@ -1751,6 +1751,8 @@ bool LMDBBackend::deleteDomain(const ZoneName& domain)
  *                 cursor, i.e. same qname but possibly different qtype)
  * d_currentrrsetpos: position in the above when returning its elements one
  *                    by one
+ * d_currentrrsettime: timestamp of d_currentrrset (can't be stored in
+ *                     DNSZoneRecord)
  * d_currentKey: database key at cursor
  * d_currentVal: database contents at cursor
  * d_includedisabled: whether to include disabled records in the results
@@ -1900,6 +1902,7 @@ bool LMDBBackend::get(DNSZoneRecord& zr)
       }
 
       deserializeFromBuffer(d_currentVal.get<string_view>(), d_currentrrset);
+      d_currentrrsettime = LMDBLS::LSgetTimestamp(d_currentVal.getNoStripHeader<string_view>()) / (1000UL * 1000UL * 1000UL);
       d_currentrrsetpos = 0;
     }
     else {
@@ -1963,6 +1966,7 @@ bool LMDBBackend::get(DNSResourceRecord& rr)
   rr.domain_id = zr.domain_id;
   rr.auth = zr.auth;
   rr.disabled = zr.disabled;
+  rr.last_modified = d_currentrrsettime;
 
   return true;
 }
index 1071a50731db73fd0a586b6ad06c44d4b8b81d5b..e7db2b43d9ceabe76f4288639349b4d72c7a79e0 100644 (file)
@@ -355,6 +355,7 @@ private:
   DNSName d_lookupsubmatch;
   vector<LMDBResourceRecord> d_currentrrset;
   size_t d_currentrrsetpos;
+  time_t d_currentrrsettime;
   MDBOutVal d_currentKey;
   MDBOutVal d_currentVal;
   bool d_includedisabled;