Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle meta events #3070

Open
roman-khimov opened this issue Dec 25, 2024 · 5 comments
Open

Handle meta events #3070

roman-khimov opened this issue Dec 25, 2024 · 5 comments
Assignees
Labels
feature Completely new functionality I2 Regular impact S1 Highly significant U1 Critically important to resolve quickly
Milestone

Comments

@roman-khimov
Copy link
Member

Is your feature request related to a problem? Please describe.

A part of #2878.

Describe the solution you'd like

Add meta event handling:

Describe alternatives you've considered

There can be some, but we need this data to be processed fast and we'll need MPT for subsequent synchronization.

@roman-khimov roman-khimov added U1 Critically important to resolve quickly S1 Highly significant I2 Regular impact feature Completely new functionality labels Dec 25, 2024
@roman-khimov roman-khimov added this to the v0.45.0 milestone Dec 25, 2024
@roman-khimov
Copy link
Member Author

@AnnaShaleva and @AliceInHunterland can tell a bit more about the way storage is handled in NeoGo. What we're doing here is very similar to storeBlock except that we work with events and some data needs to be obtained additionally (but it's not a part of the state proper at the same time).

@carpawell
Copy link
Member

@roman-khimov

  1. So we have a new DB now for our indexes (not sure why it is a reuse of neo-go's one but ok, dont mind) and also have a MemCachedStore memory instance for every block, why? That is exactly "cached" version, not just a memory instance per block, right? Over what is it created, the original disk DB? What does the cache solve?
  2. "listen for events", "for each block". What is this new DB subscribed for? I thought that it should receive only our new events from meta-on-chain TXs but it also needs to process every block?
  3. "these prefixes are added into https://pkg.go.dev/github.com/nspcc-dev/[email protected]/pkg/core/mpt". What exact "these prefixes"? Why we need mpt here?
  4. "full header index ... not be a part of MPT" what is the criterion of what mpt and what is not?

@roman-khimov
Copy link
Member Author

  1. It can be done without MemCachedStore using per-block Bolt transactions, but reusing NeoGo storage subsystem allows to simplify some interfaces and make DBs changeable. In future we can also optimize flushing from per-block to something smarter. Memory itself is irrelevant here.
  2. Listen for new events, you need to watch for objects, that's the only thing you care about (epochs are interesting too, but maybe not immediately).
  3. MPT is to identify and synchronize state. Prefixes are those created above, not the full index.
  4. Reproducibility. I can fetch headers and recreate index using data stored in MPT, so adding everything into MPT is a resource waste.

@carpawell
Copy link
Member

@roman-khimov, @cthulhu-rider, considering #3085 and #3080 we now have two meta storages: first one is a fully new DB that relies only on the information from FSchain and currently stores only this info in MPT (and persisting it to the new DB instance); the second one(s) is the old metabase per every shard that takes info from PUT/REPLICATE RPC directly without any object flow changes.
AFAIU, our target goal is to have some combination of these PRs. We need to have meta-from-chain indexes in MPT but we also need to have an index(es) of what is stored on disk.
We need to discuss:

  1. If we need some third kind of DB that stores meta information but neither in MPT, nor in the old metabases. Indexes for objects that are not stored in the current node but that are also not just MTP data from the FSchain. As I understand ("...a full header index can be managed in a separate routine and not be a part of MPT..."), a full header should also be processed after receiving notification from FSchain, not just be a part of a regular shard's PUT routine.
  2. What code should be shared to prevent repeating? Should there be support for more than just bolt (neo-go supports more storages and works on interfaces, our current metabase code -- no)?
  3. In what order do we release our features?

@roman-khimov
Copy link
Member Author

  1. Same DB, different prefixes/handling.
  2. Leave Bolt to the old metabase, reuse DB abstraction provided by NeoGo. But you need to translate headers into KVs and this code can be shared.
  3. Search, meta.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Completely new functionality I2 Regular impact S1 Highly significant U1 Critically important to resolve quickly
Projects
None yet
Development

No branches or pull requests

2 participants