Skip to content

Add transaction refresh support to store crawlers#5042

Merged
pwojcikdev merged 1 commit intonanocurrency:developfrom
pwojcikdev:crawler-refresh
Apr 3, 2026
Merged

Add transaction refresh support to store crawlers#5042
pwojcikdev merged 1 commit intonanocurrency:developfrom
pwojcikdev:crawler-refresh

Conversation

@pwojcikdev
Copy link
Copy Markdown
Contributor

Crawlers can now refresh their underlying transaction and re-establish iterator position, enabling long-running crawls without holding transactions open indefinitely. Also adds block_view::crawl() and reset() to iterators/crawlers.

@pwojcikdev pwojcikdev force-pushed the crawler-refresh branch 2 times, most recently from cef1655 to f131db8 Compare March 17, 2026 17:03
@gr0vity-dev-bot
Copy link
Copy Markdown

gr0vity-dev-bot commented Mar 17, 2026

Test Results for Commit 7eb4cd0

Pull Request 5042: Results
Overall Status:

Test Case Results

  • 5n4pr_conf_10k_bintree: PASS (Duration: 116s)
  • 5n4pr_conf_10k_change: PASS (Duration: 205s)
  • 5n4pr_conf_change_dependant: PASS (Duration: 115s)
  • 5n4pr_conf_change_independant: PASS (Duration: 113s)
  • 5n4pr_conf_send_dependant: PASS (Duration: 112s)
  • 5n4pr_conf_send_independant: PASS (Duration: 116s)
  • 5n4pr_rocks_10k_bintree: PASS (Duration: 118s)
  • 5n4pr_rocks_10k_change: FAIL (Duration: 280s)
  • Log

Last updated: 2026-04-03 10:24:01 UTC

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for long-running store scans by allowing crawlers to refresh their underlying transaction and restore iterator position, plus iterator/crawler reset APIs and a new block_view::crawl() entry point.

Changes:

  • Add transaction::refresh() and implement transaction refresh + position restoration in store::crawler.
  • Add reset() to backend iterators (lmdb/rocksdb), generic store::iterator, and typed_iterator to release iterator resources.
  • Extend ledger views (account, pending, block) with crawl(transaction&) and add unit tests for rewind/reset/refresh behavior.

Reviewed changes

Copilot reviewed 20 out of 20 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
nano/store/crawler.hpp Adds transaction refresh + iterator position restoration; introduces rewind() and reset() semantics.
nano/store/transaction.hpp Adds pure-virtual transaction::refresh() and overrides in read/write transactions.
nano/store/iterator.hpp Refactors backend iterator variant into an alias and adds iterator::reset().
nano/store/iterator.cpp Implements iterator::reset() by releasing backend iterator state.
nano/store/typed_iterator.hpp Exposes typed_iterator::reset().
nano/store/typed_iterator_templ.hpp Implements typed_iterator::reset().
nano/store/lmdb/iterator.hpp Adds lmdb::iterator::reset().
nano/store/lmdb/iterator.cpp Implements LMDB iterator reset by releasing the cursor.
nano/store/rocksdb/iterator.hpp Adds rocksdb::iterator::reset().
nano/store/rocksdb/iterator.cpp Implements RocksDB iterator reset by releasing the underlying RocksDB iterator.
nano/store/ledger/account.hpp Changes crawl to accept transaction& to allow refresh.
nano/store/ledger/account.cpp Implements updated account_view::crawl(transaction&).
nano/store/ledger/pending.hpp Changes crawl to accept transaction& to allow refresh.
nano/store/ledger/pending.cpp Implements updated pending_view::crawl(transaction&).
nano/store/ledger/block.hpp Adds block_view::crawler type + crawl(transaction&) declaration.
nano/store/ledger/block.cpp Implements block_view::crawl(transaction&).
nano/secure/transaction.hpp Adds non-const conversion operator to nano::store::transaction&.
nano/store/CMakeLists.txt Removes now-empty typed_iterator.cpp from build.
nano/core_test/crawler.cpp Updates tests for rewind/reset split and adds refresh coverage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@pwojcikdev pwojcikdev force-pushed the crawler-refresh branch 2 times, most recently from aef91a3 to 94e6245 Compare April 2, 2026 22:26
@pwojcikdev pwojcikdev requested a review from Copilot April 2, 2026 22:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for refreshing long-lived store crawlers by refreshing the underlying transaction and re-establishing iterator position, enabling long-running scans without holding a transaction open indefinitely.

Changes:

  • Added nano::store::transaction::refresh() and wired it into read/write transactions.
  • Updated nano::store::crawler to be parameterized by transaction type and added refresh() / refresh_if_needed() plus rewind() (renamed from reset()).
  • Updated ledger views (account_view, pending_view, block_view) to expose templated crawl() returning the new crawler type, and added/updated unit tests.

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
nano/store/typed_iterator.hpp Minor namespace closing formatting.
nano/store/typed_iterator.cpp Removed empty translation unit; no longer built.
nano/store/typed_iterator_templ.hpp Minor formatting change.
nano/store/transaction.hpp Adds virtual refresh() to transaction interface and overrides in read/write transactions.
nano/store/rocksdb/iterator.cpp Minor namespace closing formatting fix.
nano/store/ledger/pending.hpp Makes crawl() templated and returns new crawler type.
nano/store/ledger/pending.cpp Removes non-templated crawl() definition.
nano/store/ledger/block.hpp Adds crawl() for blocks and includes crawler header.
nano/store/ledger/account.hpp Makes crawl() templated and returns new crawler type.
nano/store/ledger/account.cpp Removes non-templated crawl() definition.
nano/store/iterator.hpp Introduces backend_iterator alias and updates iterator ctor signature.
nano/store/iterator.cpp Updates iterator ctor to use backend_iterator.
nano/store/crawler.hpp Adds transaction refresh + iterator re-establishment, renames reset() to rewind(), templates on transaction type.
nano/store/CMakeLists.txt Removes typed_iterator.cpp from build sources.
nano/secure/transaction.hpp Adds mutable access/conversion to underlying store transaction.
nano/core_test/crawler.cpp Updates tests for rewind() and adds refresh behavior tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@pwojcikdev pwojcikdev merged commit 1fd1df4 into nanocurrency:develop Apr 3, 2026
32 of 33 checks passed
@pwojcikdev pwojcikdev deleted the crawler-refresh branch April 3, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants