Skip to content

Add getEvents full-history design doc - #635

Merged
urvisavla merged 15 commits into
stellar:feature/full-historyfrom
urvisavla:full-history-events-design
Apr 3, 2026
Merged

Add getEvents full-history design doc#635
urvisavla merged 15 commits into
stellar:feature/full-historyfrom
urvisavla:full-history-events-design

Conversation

@urvisavla

@urvisavla urvisavla commented Mar 18, 2026

Copy link
Copy Markdown
Contributor

What

This PR contains the design doc for the full-history getEvents storage and indexing layer.

The design covers:

  • Parts 1-3: Problem scope, architecture (hot/cold segments, bitmap index), and implementation reference (event addressing, write/read paths, freeze, startup, backfill)
  • Part 4: Capacity, performance, and scaling
    • Memory profile (measured bitmap index sizing)
    • Ingestion performance (backfill throughput, live ingestion latency, freeze time)
    • Query performance (event fetch and index lookup benchmarks on NVMe)
    • Scaling projections (disk and memory at 2x/5x/10x event density)
    • Tiered storage (NVMe/EBS approach)

Tracking issue: #665

Why

#637

Test plan

  • Review doc for technical accuracy
  • Verify diagrams render correctly (mermaid flowchart in Section 11.1)

Add the RPC getEvents full-history design document with architecture
diagrams. The doc covers the segment-based storage model, bitmap
indexing, hot/cold segment lifecycle, and backfill process.

Hot segment storage is presented as storage-backend agnostic (flat
files vs embedded DB), while keeping in-memory bitmaps as a design
decision.
Copilot AI review requested due to automatic review settings March 18, 2026 18:08

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a design document for a proposed getEvents full-history storage/indexing backend, plus extracted diagram assets to support the doc.

Changes:

  • Added getEvents full-history design doc describing segmentation, hot/cold storage, bitmap indexing, freeze/recovery, and capacity estimates.
  • Added query-routing flowchart diagram as a standalone PNG asset.

Reviewed changes

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

File Description
docs/getevents-full-history-design.md New full-history getEvents backend design doc (architecture, indexing, storage, query paths, capacity placeholders).
docs/query-routing-flowchart.png Diagram asset referenced by the design doc for query routing.

💡 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.

Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Co-authored-by: Copilot Autofix powered by AI <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a design doc describing the proposed storage + indexing architecture for serving full-history getEvents queries, along with an accompanying query-routing flowchart diagram.

Changes:

  • Added a full-history getEvents backend design doc (segments, bitmap indexing, hot/cold storage, freeze/backfill, query path).
  • Added a query-routing flowchart diagram referenced by the design doc.

Reviewed changes

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

File Description
docs/getevents-full-history-design.md New full-history getEvents design document with architecture and implementation reference sections.
docs/query-routing-flowchart.png New diagram referenced by the design doc’s query-routing section.

💡 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.

Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a design doc describing a proposed storage/indexing architecture to support full-history getEvents queries, including a query-routing flowchart diagram referenced by the doc.

Changes:

  • Add full-history getEvents backend design doc (segments, bitmap index, freeze/backfill flows, capacity placeholders).
  • Add query routing flowchart image used by the design doc.

Reviewed changes

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

File Description
design-docs/getevents-full-history-design.md New design doc covering architecture + implementation reference for full-history getEvents.
design-docs/query-routing-flowchart.png New diagram referenced by the doc for query routing flow.

💡 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.

Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
@urvisavla
urvisavla requested a review from Copilot March 18, 2026 19:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Adds a design document describing a full-history storage + indexing backend for the getEvents RPC, including segment architecture (hot/cold), roaring-bitmap indexing, freeze/backfill workflows, and query routing, with supporting diagrams.

Changes:

  • Add a full-history getEvents backend design doc covering data model, segment/index layout, query path, and operational workflows.
  • Add a query-routing flowchart diagram referenced by the doc.

Reviewed changes

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

File Description
design-docs/getevents-full-history-design.md New design doc defining storage/indexing architecture, query execution, freeze/backfill, and capacity placeholders.
design-docs/query-routing-flowchart.png New diagram referenced by the doc for query routing flow.

💡 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.

Comment thread design-docs/getevents-full-history-design.md
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
@urvisavla
urvisavla marked this pull request as draft March 18, 2026 20:09
@tamirms
tamirms changed the base branch from main to feature/full-history March 19, 2026 13:13
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md
Comment thread design-docs/getevents-full-history-design.md
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md Outdated
@karthikiyer56

Copy link
Copy Markdown
Contributor

@urvisavla
i tried to trace through the cold index path end to end and couldn't follow it without filling in gaps myself.
would be really helpful to have a worked example(s) covering both build and query.

1/ build:
take a few terms from events with topics like ["transfer", "C-address-sender", "C-address-receiver", "asset-name"]. show how the term keys are computed, how the MPHF assigns slots, what gets physically written to index.pack and index.hash.

2/ query - hit:
query for contract X which exists in this chunk.
show: compute term key → feed into MPHF → get slot → read from index.pack → fingerprint check passes (first 4 bytes of term key match stored fingerprint (this is the partial match that can yeild false positives, right?) → deserialize bitmap → fetch events from events.pack → post-filter verifies fetched events actually match query terms → return results.

3/ query - miss:
query for contract Y which does NOT exist in this chunk.
show: compute term key → feed into MPHF → MPHF still returns a slot (because it maps any input) → read from index.pack → fingerprint check fails (first 4 bytes don't match) → term not present, return empty.

4/ query — multi-term:
query for contract X AND topic0 = "transfer".
show: look up both bitmaps, AND them together, iterate the intersection.

…30B/22B clarification

- Rename "blocks" to "records" throughout to match packfile terminology
- Add paragraph explaining queries spanning cold + hot segments
- Add Notes column to Network Parameters table clarifying 30B vs 22B event counts

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@urvisavla

urvisavla commented Mar 30, 2026

Copy link
Copy Markdown
Contributor Author

@urvisavla
i tried to trace through the cold index path end to end and couldn't follow it without filling in gaps myself.
would be really helpful to have a worked example(s) covering both build and query.

1/ build:
take a few terms from events with topics like ["transfer", "C-address-sender", "C-address-receiver", "asset-name"]. show how the term keys are computed, how the MPHF assigns slots, what gets physically written to index.pack and index.hash.

2/ query - hit:
query for contract X which exists in this chunk.
show: compute term key → feed into MPHF → get slot → read from index.pack → fingerprint check passes (first 4 bytes of term key match stored fingerprint (this is the partial match that can yeild false positives, right?) → deserialize bitmap → fetch events from events.pack → post-filter verifies fetched events actually match query terms → return results.

3/ query - miss:
query for contract Y which does NOT exist in this chunk.
show: compute term key → feed into MPHF → MPHF still returns a slot (because it maps any input) → read from index.pack → fingerprint check fails (first 4 bytes don't match) → term not present, return empty.

4/ query — multi-term:
query for contract X AND topic0 = "transfer".
show: look up both bitmaps, AND them together, iterate the intersection.

Good suggestion. A worked example would help with traceability, but the design doc is meant to describe the system's structure and behavior at a higher level. A concrete worked example with specific byte values, slot numbers, and step-by-step traces fits better as implementation-level documentation alongside the code, where it can stay in sync with the actual data formats. We'll add it there.

Comment thread design-docs/getevents-full-history-design.md Outdated
### 11.2 Hot Segment Read Path

```
1. Look up bitmaps for all query terms from the in-memory concurrent map. The map ensures readers always get a consistent snapshot without blocking writes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: based on what you wrote earlier ("The map is protected by a read-write lock so that concurrent readers do not block each other and only contend briefly with the single writer" )I think they do block writes but it shouldn't be a big deal because the read write lock should prevent starvation

karthikiyer56 added a commit that referenced this pull request Mar 31, 2026
…w fixes

- Add events cold segment as third process_chunk output (PR #635)
- Switch LFS from .data+.index to .pack format (PR #633)
- Add chunk:{C}:events meta store key, atomic 3-flag WriteBatch
- Add events_base to config Optional Sections table
- Add events/ to directory structure
- Add DAG setup pseudocode with explicit BUILD_READY handling
- Replace ASCII dependency diagram with Mermaid flowchart
- Expand LFS, BSB, MPHF acronyms on first use
- Explain 10,000 multiplier in validation rules
- Remove "Future: getEvents" section (events now first-class)
- Remove dead pseudocode branch, hedging language
@urvisavla
urvisavla marked this pull request as ready for review April 2, 2026 03:36
… design doc

- Section 15: Memory Profile — bitmap index memory breakdown from measured data
- Section 16: Ingestion Performance — backfill throughput, live ingestion latency, freeze time
- Section 17: Query Performance — event fetch and index lookup benchmarks on NVMe
- Section 18: Scaling Projections — disk and memory projections at 2x/5x/10x event density
- Section 19: Tiered Storage — NVMe/EBS approach and EBS query latency
- Remove query routing flowchart PNG (replaced by mermaid in prior commit)

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
Comment thread design-docs/getevents-full-history-design.md Outdated
Comment thread design-docs/getevents-full-history-design.md
@urvisavla
urvisavla force-pushed the full-history-events-design branch from 37bfd67 to 95d5f30 Compare April 3, 2026 02:46
@urvisavla
urvisavla force-pushed the full-history-events-design branch from 95d5f30 to 447a547 Compare April 3, 2026 04:19
@urvisavla
urvisavla merged commit 6ef106d into stellar:feature/full-history Apr 3, 2026
13 of 14 checks passed
@urvisavla
urvisavla deleted the full-history-events-design branch April 3, 2026 21:30
chowbao added a commit that referenced this pull request Jun 23, 2026
Stacked on slice 1 (the ledgers skeleton); this commit's diff is only the
events additions on top of it. Adds the EVENTS data type to the streaming
daemon:
- events column families in the per-chunk hot RocksDB (hotchunk), so one
  atomic synced WriteBatch per ledger now carries ledgers + events;
- the events cold-segment writer in processChunk;
- the chunk:{c}:events catalog key + its sweeps;
- events coverage in the audit (INV-3 disk<->catalog) and in the
  crash-injection/convergence suite and lifecycle E2E.

Events is a per-chunk artifact, like ledgers — no window/index subsystem
(that is tx-hash, deferred to slice 3).

Composes the events store (pkg/stores/eventstore, #740/#756) and the events
design (getevents-full-history-design.md, #635), already on
feature/full-history.

Built against RocksDB 10.9.1 (grocksdb 1.10.7); fullhistory tree green on the
non-short suite incl. the lifecycle E2E.
chowbao added a commit that referenced this pull request Jun 23, 2026
Stacked on slice 1 (the ledgers skeleton); this commit's diff is only the
events additions on top of it. Adds the EVENTS data type to the streaming
daemon:
- events column families in the per-chunk hot RocksDB (hotchunk), so one
  atomic synced WriteBatch per ledger now carries ledgers + events;
- the events cold-segment writer in processChunk;
- the chunk:{c}:events catalog key + its sweeps;
- events coverage in the audit (INV-3 disk<->catalog) and in the
  crash-injection/convergence suite and lifecycle E2E.

Events is a per-chunk artifact, like ledgers — no window/index subsystem
(that is tx-hash, deferred to slice 3).

Composes the events store (pkg/stores/eventstore, #740/#756) and the events
design (getevents-full-history-design.md, #635), already on
feature/full-history.

Built against RocksDB 10.9.1 (grocksdb 1.10.7); fullhistory tree green on the
non-short suite incl. the lifecycle E2E.
chowbao added a commit that referenced this pull request Jun 23, 2026
Stacked on slice 1 (the ledgers skeleton); this commit's diff is only the
events additions on top of it. Adds the EVENTS data type to the streaming
daemon:
- events column families in the per-chunk hot RocksDB (hotchunk), so one
  atomic synced WriteBatch per ledger now carries ledgers + events;
- the events cold-segment writer in processChunk;
- the chunk:{c}:events catalog key + its sweeps;
- events coverage in the audit (INV-3 disk<->catalog) and in the
  crash-injection/convergence suite and lifecycle E2E.

Events is a per-chunk artifact, like ledgers — no window/index subsystem
(that is tx-hash, deferred to slice 3).

Composes the events store (pkg/stores/eventstore, #740/#756) and the events
design (getevents-full-history-design.md, #635), already on
feature/full-history.

Built against RocksDB 10.9.1 (grocksdb 1.10.7); fullhistory tree green on the
non-short suite incl. the lifecycle E2E.
chowbao added a commit that referenced this pull request Jun 23, 2026
Stacked on slice 1 (the ledgers skeleton); this commit's diff is only the
events additions on top of it. Adds the EVENTS data type to the streaming
daemon:
- events column families in the per-chunk hot RocksDB (hotchunk), so one
  atomic synced WriteBatch per ledger now carries ledgers + events;
- the events cold-segment writer in processChunk;
- the chunk:{c}:events catalog key + its sweeps;
- events coverage in the audit (INV-3 disk<->catalog) and in the
  crash-injection/convergence suite and lifecycle E2E.

Events is a per-chunk artifact, like ledgers — no window/index subsystem
(that is tx-hash, deferred to slice 3).

Composes the events store (pkg/stores/eventstore, #740/#756) and the events
design (getevents-full-history-design.md, #635), already on
feature/full-history.

Built against RocksDB 10.9.1 (grocksdb 1.10.7); fullhistory tree green on the
non-short suite incl. the lifecycle E2E.
chowbao added a commit that referenced this pull request Jun 24, 2026
Stacked on slice 1 (the ledgers skeleton); this commit's diff is only the
events additions on top of it. Adds the EVENTS data type to the streaming
daemon:
- events column families in the per-chunk hot RocksDB (hotchunk), so one
  atomic synced WriteBatch per ledger now carries ledgers + events;
- the events cold-segment writer in processChunk;
- the chunk:{c}:events catalog key + its sweeps;
- events coverage in the audit (INV-3 disk<->catalog) and in the
  crash-injection/convergence suite and lifecycle E2E.

Events is a per-chunk artifact, like ledgers — no window/index subsystem
(that is tx-hash, deferred to slice 3).

Composes the events store (pkg/stores/eventstore, #740/#756) and the events
design (getevents-full-history-design.md, #635), already on
feature/full-history.

Built against RocksDB 10.9.1 (grocksdb 1.10.7); fullhistory tree green on the
non-short suite incl. the lifecycle E2E.
chowbao added a commit that referenced this pull request Jun 24, 2026
Stacked on slice 1 (the ledgers skeleton); this commit's diff is only the
events additions on top of it. Adds the EVENTS data type to the streaming
daemon:
- events column families in the per-chunk hot RocksDB (hotchunk), so one
  atomic synced WriteBatch per ledger now carries ledgers + events;
- the events cold-segment writer in processChunk;
- the chunk:{c}:events catalog key + its sweeps;
- events coverage in the audit (INV-3 disk<->catalog) and in the
  crash-injection/convergence suite and lifecycle E2E.

Events is a per-chunk artifact, like ledgers — no window/index subsystem
(that is tx-hash, deferred to slice 3).

Composes the events store (pkg/stores/eventstore, #740/#756) and the events
design (getevents-full-history-design.md, #635), already on
feature/full-history.

Built against RocksDB 10.9.1 (grocksdb 1.10.7); fullhistory tree green on the
non-short suite incl. the lifecycle E2E.
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.

4 participants