Skip to content

Bonsai archive hybrid#10192

Draft
jframe wants to merge 16 commits intobesu-eth:mainfrom
jframe:bonsai_archive_hybrid
Draft

Bonsai archive hybrid#10192
jframe wants to merge 16 commits intobesu-eth:mainfrom
jframe:bonsai_archive_hybrid

Conversation

@jframe
Copy link
Copy Markdown
Contributor

@jframe jframe commented Apr 7, 2026

Implements hybrid Bonsai Archive so that recent block reads within 512 Bonsai archive limit used Bonsai and Bonsai archive used for historical queries.

Fixed Issue(s)

fixes #9981

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • spotless: ./gradlew spotlessApply
  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests
  • hive tests: Engine or other RPCs modified?

@jframe jframe changed the title Bonsai archive sync state Bonsai archive hybrid Apr 7, 2026
@jframe jframe force-pushed the bonsai_archive_hybrid branch from b559b7c to 9bab604 Compare April 9, 2026 04:35
jframe added 9 commits April 10, 2026 08:47
…orage

Signed-off-by: Jason Frame <jason.frame@consensys.net>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Jason Frame <jason.frame@consensys.net>
…chive read storage

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Jason Frame <jason.frame@consensys.net>
…latDbToArchiveMigrator

- Add boundaryDistance constructor param; migration loop stops at HEAD - boundaryDistance
- Add startOngoingMigration() to register a permanent block observer post-migration
- Extract archiveTarget() helper to encapsulate Math.max(0, block - boundaryDistance)
- Replace ExecutorService with ScheduledExecutorService; each migrator owns its executor
- Use OptionalLong for blockObserverId to avoid sentinel values
- Inline observer cleanup into close() instead of a separate stop() method
- Wire boundaryDistance (maxLayersToLoad) and ongoing migration in BesuControllerBuilder
- Use Awaitility instead of Thread.sleep in observer tests

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Jason Frame <jason.frame@consensys.net>
…c fix

Replace single-block processBlockFromObserver with catchUp() which reads
saved progress and calls migrateBlocks() up to the new archive target.
This handles multiple blocks behind and fixes migratedBlockNumber not
being updated during ongoing migration.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Jason Frame <jason.frame@consensys.net>
…ngMigration

On restart the metric gauge started at 0 instead of reflecting actual
archived progress. Initialize from getMigrationProgress() on startup.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Archive CFs (ACCOUNT_INFO_STATE_ARCHIVE, ACCOUNT_STORAGE_ARCHIVE,
ACCOUNT_INFO_STATE_FREEZER, ACCOUNT_STORAGE_FREEZER) accumulate large
numbers of SST files during migration. With cache_index_and_filter_blocks=false
(the prior hardcoded default), each SST file's index and filter blocks are
held in unbounded native memory outside the block cache, causing RSS to
grow ~1.5 GB/hr and reach 15+ GB above control nodes by the time the
full 24M-block migration completes.

Add isCacheIndexAndFilterBlocks() to SegmentIdentifier (default false,
preserving existing behaviour for all other segments) and set it true on
the four archive CFs so their index/filter blocks are evictable via the
bounded block cache.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Jason Frame <jason.frame@consensys.net>
BesuCommand gated isParallelTxProcessingEnabled behind a strict
DataStorageFormat.BONSAI equality check. Archive nodes use
X_BONSAI_ARCHIVE, so the flag was never set and defaulted to false,
silently disabling parallel transaction processing on all archive nodes.

Changed to isBonsaiFormat() which covers both BONSAI and X_BONSAI_ARCHIVE.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

Signed-off-by: Jason Frame <jason.frame@consensys.net>
@jframe jframe force-pushed the bonsai_archive_hybrid branch from 12d13ca to df1ee44 Compare April 9, 2026 23:04
jframe added 7 commits April 10, 2026 09:12
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
…onsaiFlatDbToArchiveMigrator

Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
Signed-off-by: Jason Frame <jason.frame@consensys.net>
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.

Bonsai Archive: Hybrid mode

1 participant