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

feat: modify recon store to support event validation concepts #473

Merged
merged 10 commits into from
Aug 15, 2024

Conversation

dav1do
Copy link
Contributor

@dav1do dav1do commented Aug 9, 2024

The recon store returns a new struct that includes information about the store's willingness to process the data. It includes invalid items (e.g. something that made no sense) and the count of "pending" items (i.e. something that can't be interpreted without another event. For now, recon simply logs the count of pending/invalid items in prometheus and we close the conversation if a peer is sending us invalid items. There are also some changes to the service layer to support returning this information to the API and recon.

We don't track the pending items yet, we intend to have the event service keep a map of sorts from {neededCid: [events]} and then it can process them when discovered. This may cause odd behavior if recon isn't getting ranges for discovered keys, so we may need to push this information back up eventually. I initially added this tracking to recon but we pretty much just send them back every time unless we communicate more information about what is needed to recon. Since we don't really care to actively seek this out yet, having the store just manage this pending set will be simpler, and if recon not getting in sync is causing problems we'll have to fix that, but it can be tested with the next phase of event validation where we actually run into these.

Previously we just threw an error when an event can't be parsed, which has been modified to return invalid and errors will be reserved for real problems like an issue talking to the storage system. There is now a struct with some recon config injected (batch size, remote peer). I don't really like this, but didn't want to update the recon or role traits to require this. We can do that (or something else) if it's preferred, for now this was simple.

This targets #470, if it's easier I can merge them into one but there are already a decent number of changes in both. This does rework the API changed in the previous one, so consolidating might make sense.

@dav1do dav1do requested review from a team, AaronGoldman and nathanielc as code owners August 9, 2024 22:37
@dav1do dav1do requested review from christianlavoie and removed request for a team August 9, 2024 22:37
Copy link

linear bot commented Aug 9, 2024

@dav1do dav1do requested a review from samika98 August 9, 2024 22:37
@dav1do dav1do temporarily deployed to github-tests-2024 August 9, 2024 22:55 — with GitHub Actions Inactive
recon/src/recon/pending_cache.rs Outdated Show resolved Hide resolved
recon/src/recon.rs Show resolved Hide resolved
recon/src/recon.rs Outdated Show resolved Hide resolved
recon/src/protocol.rs Show resolved Hide resolved
recon/src/protocol.rs Outdated Show resolved Hide resolved
recon/src/recon.rs Outdated Show resolved Hide resolved
p2p/src/node.rs Outdated Show resolved Hide resolved
recon/src/protocol.rs Show resolved Hide resolved
recon/src/protocol.rs Outdated Show resolved Hide resolved
recon/src/protocol.rs Show resolved Hide resolved
recon/src/protocol.rs Outdated Show resolved Hide resolved
recon/src/recon.rs Outdated Show resolved Hide resolved
recon/src/recon.rs Outdated Show resolved Hide resolved
recon/src/recon/pending_cache.rs Outdated Show resolved Hide resolved
recon/src/recon/pending_cache.rs Outdated Show resolved Hide resolved
service/src/event/store.rs Show resolved Hide resolved
Base automatically changed from feat/aes-294-recon-event-batching to main August 13, 2024 19:37
we also explicitly hangup if the store says something is invalid
this probalby doesn't hurt to include, but we're particular about using our AHash so we'll leave it explicit for now
- rename InsertBatch -> InsertResult
- use for loop in pending_cache instead of while loop
- consistent Self::Key usage in trait
- recon pending tracking simplified to just retry every batch since we should get items close together
- fixes a bug where any event in an api batch that was invalid could have crashed the entire batch (now only that one gets an error)
- TODO: still need to modify the service to have a better validation hook that keeps track of the data we need to return so we don't have to iterate back through or lose info along the way
@dav1do dav1do force-pushed the feat/aes-304-recon-unprocessable branch from f1ab99a to cd34094 Compare August 13, 2024 23:07
@dav1do dav1do temporarily deployed to github-tests-2024 August 13, 2024 23:17 — with GitHub Actions Inactive
@dav1do dav1do requested a review from stbrody August 14, 2024 17:43
@dav1do dav1do temporarily deployed to github-tests-2024 August 14, 2024 17:53 — with GitHub Actions Inactive
Copy link
Collaborator

@stbrody stbrody left a comment

Choose a reason for hiding this comment

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

looks good, main question is if we can simplify the types and flow for the event parsing part.

recon/src/protocol.rs Outdated Show resolved Hide resolved
recon/src/recon.rs Outdated Show resolved Hide resolved
service/src/event/service.rs Show resolved Hide resolved
service/src/event/service.rs Outdated Show resolved Hide resolved
@dav1do dav1do temporarily deployed to github-tests-2024 August 15, 2024 02:57 — with GitHub Actions Inactive
Copy link
Collaborator

@stbrody stbrody left a comment

Choose a reason for hiding this comment

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

LGTM

@dav1do dav1do added this pull request to the merge queue Aug 15, 2024
Merged via the queue into main with commit a84018e Aug 15, 2024
5 checks passed
@dav1do dav1do deleted the feat/aes-304-recon-unprocessable branch August 15, 2024 14:22
@smrz2001 smrz2001 mentioned this pull request Aug 19, 2024
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.

2 participants