Skip to content

kvindexer: Remove event type from block event #571

@jmalicevic

Description

@jmalicevic

Feature Request

By introducing FinalizeBlock in v0.38.x, all block events will be returned in ResponseFinalizeBlock. Previously,
the events were returned from both BeginBlock and EndBlock. The indexer would then store the type of the function the event belongs to. With FinalizeBlock replacing them, the current events are indexed with one type of function, thus storing this information is redundant and useless, while taking storage space.

We propose removing the finalize_block value from the event key.

Summary

The information about the event function type should be removed from the event keys in the block indexer.

Problem Definition

Implementing this, removes extra bytes from the event key. THis might prove to have a significant impact as the indexer is anyways taking up a lot of storage.

The only possible disadvantage is supporting events indexed with older version (pre v0.38.x). Those events will contain event function type in their keys. But this can dealt with by accounting for that extra information on traversal. Potentially, we could offer the users the option to re-index the data and set a flag that the data is re-indexed. This would avoid checking for the parameter on every record.

Proposal

Indexing: Remove the typ parameter from the composite key in the Index method in state/indexer/block/kv/kv.go.

Querying: In all the functions that read the events from the database, implement a check whether the typ value exists or not. Ignore it if it does.

Potential improvement: Enable users t oconfigure a flag saying that the data indexed does not have typ stored so we can avoid the check described above.

DoD

  • Even function type removed
  • Queries work with data indexed with older version and data indexed with new versions

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions