From 1abe63acd56257239677ef26d3ba0d9f0f41633f Mon Sep 17 00:00:00 2001 From: Miod Vallat Date: Fri, 19 Sep 2025 14:42:21 +0200 Subject: [PATCH] Reverse polarity Signed-off-by: Miod Vallat (cherry picked from commit 86d641da024d9a153f8fdc710d38e1bc18f1b7de) --- docs/backends/lmdb.rst | 17 +++++++++-------- modules/lmdbbackend/lmdbbackend.cc | 11 +++++------ modules/lmdbbackend/lmdbbackend.hh | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/docs/backends/lmdb.rst b/docs/backends/lmdb.rst index 642604eba..1e4737057 100644 --- a/docs/backends/lmdb.rst +++ b/docs/backends/lmdb.rst @@ -129,19 +129,20 @@ Defaults to 100 on 32 bit systems, and 16000 on 64 bit systems. Instead of deleting items from the database, flag them as deleted in the item's `Lightning Stream `_ header. Only enable this if you are using Lightning Stream. -``lmdb-skip-notification-update`` -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +``lmdb-write-notification-update`` +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - .. versionadded:: 5.1.0 + .. versionadded:: 4.9.9 - Boolean -- Default: no +- Default: yes -Do not update the domains table in the database when the last notification -timestamp is modified. These timestamps will only be written back to the -database when other changes to the domain (such as accounts) occur. +Always update the domains table in the database when the last notification +timestamp is modified. +If disabled, these timestamps will only be written back to the database when +other changes to the domain (such as accounts) occur. -**Warning**: Running with this flag enabled will cause spurious notifications +**Warning**: Running with this flag disabled will cause spurious notifications to be sent upon startup. ``lmdb-lightning-stream`` diff --git a/modules/lmdbbackend/lmdbbackend.cc b/modules/lmdbbackend/lmdbbackend.cc index 657f860f4..62aa28b6a 100644 --- a/modules/lmdbbackend/lmdbbackend.cc +++ b/modules/lmdbbackend/lmdbbackend.cc @@ -697,7 +697,7 @@ LMDBBackend::LMDBBackend(const std::string& suffix) throw std::runtime_error(std::string("Unable to parse the 'map-size' LMDB value: ") + e.what()); } - d_skip_notification_update = mustDo("skip-notification-update"); + d_write_notification_update = mustDo("write-notification-update"); if (mustDo("lightning-stream")) { d_random_ids = true; @@ -1052,7 +1052,7 @@ bool LMDBBackend::findDomain(uint32_t domainid, DomainInfo& info) const void LMDBBackend::consolidateDomainInfo(DomainInfo& info) const { // Update the notified_serial value if we have a cached value in memory. - if (d_skip_notification_update) { + if (!d_write_notification_update) { auto container = s_notified_serial.read_lock(); container->get(info.id, info.notified_serial); } @@ -1060,7 +1060,7 @@ void LMDBBackend::consolidateDomainInfo(DomainInfo& info) const void LMDBBackend::writeDomainInfo(const DomainInfo& info) { - if (d_skip_notification_update) { + if (!d_write_notification_update) { uint32_t last_notified_serial{0}; auto container = s_notified_serial.write_lock(); container->get(info.id, last_notified_serial); @@ -1883,7 +1883,7 @@ void LMDBBackend::getUpdatedPrimaries(vector& updatedDomains, std::u void LMDBBackend::setNotified(uint32_t domain_id, uint32_t serial) { - if (!d_skip_notification_update) { + if (d_write_notification_update) { genChangeDomain(domain_id, [serial](DomainInfo& info) { info.notified_serial = serial; }); @@ -1895,7 +1895,6 @@ void LMDBBackend::setNotified(uint32_t domain_id, uint32_t serial) auto container = s_notified_serial.write_lock(); container->update(info.id, serial); } - // else throw something? this should be a "can't happen" situation. } class getCatalogMembersReturnFalseException : std::runtime_error @@ -2830,7 +2829,7 @@ public: declare(suffix, "random-ids", "Numeric IDs inside the database are generated randomly instead of sequentially", "no"); declare(suffix, "map-size", "LMDB map size in megabytes", (sizeof(void*) == 4) ? "100" : "16000"); declare(suffix, "flag-deleted", "Flag entries on deletion instead of deleting them", "no"); - declare(suffix, "skip-notification-update", "Do not update domain table upon notification", "no"); + declare(suffix, "write-notification-update", "Do not update domain table upon notification", "yes"); declare(suffix, "lightning-stream", "Run in Lightning Stream compatible mode", "no"); } DNSBackend* make(const string& suffix = "") override diff --git a/modules/lmdbbackend/lmdbbackend.hh b/modules/lmdbbackend/lmdbbackend.hh index 813cde3e1..c7d6c1158 100644 --- a/modules/lmdbbackend/lmdbbackend.hh +++ b/modules/lmdbbackend/lmdbbackend.hh @@ -351,7 +351,7 @@ private: bool d_dolog; bool d_random_ids; bool d_handle_dups; - bool d_skip_notification_update; + bool d_write_notification_update; DTime d_dtime; // used only for logging uint64_t d_mapsize; }; -- 2.47.3