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

Clear the mempool by using a sync method #2777

Merged
merged 7 commits into from
Sep 23, 2021

Conversation

upbqdn
Copy link
Member

@upbqdn upbqdn commented Sep 20, 2021

Addresses #2773 (comment)

I changed

pub async fn tip_change(&mut self) -> Result<TipAction, watch::error::RecvError> {
to a private method so that get_tip_change() doesn't miss any tip changes.

Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

This looks good, there are just a few tricky edge cases we need to handle.

zebra-state/src/service/chain_tip.rs Outdated Show resolved Hide resolved
zebra-state/src/service/chain_tip.rs Outdated Show resolved Hide resolved
zebra-state/src/service/chain_tip.rs Outdated Show resolved Hide resolved
upbqdn and others added 2 commits September 20, 2021 23:03
Co-authored-by: teor <teor@riseup.net>
Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

Seems like I gave some bad advice here - we can't use unconstrained until we upgrade tokio.

But the alternative refactor gives us simpler and faster code, so let's just do that.

@upbqdn upbqdn requested a review from teor2345 September 22, 2021 16:36
@upbqdn
Copy link
Member Author

upbqdn commented Sep 22, 2021

All suggestions should be implemented now.

Copy link
Contributor

@jvff jvff left a comment

Choose a reason for hiding this comment

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

LGTM. I added a few optional suggestions, but they're minor.

zebra-state/src/service/chain_tip.rs Outdated Show resolved Hide resolved
zebrad/src/components/mempool.rs Outdated Show resolved Hide resolved
upbqdn and others added 2 commits September 22, 2021 22:18
Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
@upbqdn
Copy link
Member Author

upbqdn commented Sep 22, 2021

Now I'm not sure whether to merge this into main or the parent branch.

Copy link
Contributor

@teor2345 teor2345 left a comment

Choose a reason for hiding this comment

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

We could merge this as-is, but I'd like to fix a potential future performance issue.
(I expect we'll be using last_tip_change a lot, at the same time as the state is committing thousands of blocks.)

zebra-state/src/service/tests.rs Show resolved Hide resolved
zebra-state/src/service/chain_tip.rs Outdated Show resolved Hide resolved
@teor2345
Copy link
Contributor

Now I'm not sure whether to merge this into main or the parent branch.

We could:

But I'm happy to let @conradoplg make the final call here, because #2764 is his PR.

@conradoplg
Copy link
Collaborator

But I'm happy to let @conradoplg make the final call here, because #2764 is his PR.

I agree with the plan 👍 I can merge this after that last required change

Co-authored-by: teor <teor@riseup.net>
@upbqdn
Copy link
Member Author

upbqdn commented Sep 23, 2021

@conradoplg both PRs should be ready.

@conradoplg conradoplg merged commit 22f5a7d into clear-mempool-at-nu Sep 23, 2021
@conradoplg conradoplg deleted the use-sync-tip-change branch September 23, 2021 18:15
conradoplg pushed a commit that referenced this pull request Sep 23, 2021
* Update the expiry TODO

* Clear the mempool at a chain tip reset

* Clear the mempool by using a sync method (#2777)

* Clear the mempool by using a sync method

* Update docs

* Apply suggestions from code review

Co-authored-by: teor <teor@riseup.net>

* Refactor last_tip_change()

* Apply suggestions from code review

Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>

* Fix brackets

* Use best_tip_block instead of manual borrowing

Co-authored-by: teor <teor@riseup.net>

Co-authored-by: teor <teor@riseup.net>
Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>

Co-authored-by: teor <teor@riseup.net>
Co-authored-by: Janito Vaqueiro Ferreira Filho <janito.vff@gmail.com>
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