Skip to content

Bonsai Archive: Hybrid mode #9981

@jframe

Description

@jframe

Summary

Implement hybrid query routing for Bonsai Archive nodes, routing recent block reads to the fast O(1) Bonsai layer and historical reads to the Archive layer via seekForPrev. This follows the sync-as-Bonsai-then-migrate work in #9608.

Background

Once an archive node has synced and migrated historical state to [hash+blockN] archive keys, the node needs a routing layer to serve queries from the right storage layer:

  • Recent blocks (HEAD to HEAD - boundary): O(1) direct [hash] key lookups via the Bonsai layer
  • Historical blocks (beyond HEAD - boundary): seekForPrev via the Archive layer using [hash+blockN] keys

This preserves Engine API and recent query performance (same as regular Bonsai) while retaining full historical query support.

Acceptance Criteria

  • Recent block reads use [hash] keys (O(1), no seekForPrev)
  • Historical block reads use seekForPrev via BonsaiArchiveFlatDbStrategy
  • New block imports write [hash] keys to the Bonsai layer
  • Archive entries written for each block as it crosses the boundary
  • On restart with DB in ARCHIVE mode, ongoing archiving resumes without re-migrating
  • Archive and Bonsai keys stored in separate column families

Prerequisites

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions