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

chore: Move txpool statistics from callbacks to PoolMap #4276

Merged

Conversation

chenyukang
Copy link
Collaborator

What problem does this PR solve?

Problem Summary:

The total_tx_size and total_tx_cycle are zero when we use plug_entry to add entries into tx_pool, which caused some confusing when debugging.

Updating statics was implemented in callbacks because we had 3 separate queue in txpool, now we have refactor it to the only one PoolMap, it's better and cleaner to move this part to PoolMap.

What is changed and how it works?

What's Changed:

Cleanup callbacks to move txpool statics part to PoolMap.

Related changes

  • PR to update owner/repo:
  • Need to cherry-pick to the release branch

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code ci-runs-only: [ quick_checks,linters ]

Release note

Title Only: Include only the PR title in the release note.

@chenyukang chenyukang requested a review from a team as a code owner December 25, 2023 14:46
@chenyukang chenyukang requested review from zhangsoledad and removed request for a team December 25, 2023 14:46
@chenyukang chenyukang changed the title Move txpool statics from callbacks to PoolMap Move txpool statistics from callbacks to PoolMap Dec 25, 2023
return true;
}
false
!entries.is_empty()
Copy link
Collaborator

@eval-exec eval-exec Dec 25, 2023

Choose a reason for hiding this comment

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

I believe this change introduces a logical inconsistency compared to the previous commit. In the previous commit, when self.pool_map.remove_entry(id) was Some, it would return true, but now it returns false.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

self.pool_map.remove_entry(id) will never return Some(_), because the above self.pool_map.remove_entry_and_descendants(id) already removed the entry with id.

@eval-exec eval-exec added m:tx-pool t:enhancement Type: Feature, refactoring. labels Dec 25, 2023
@chenyukang chenyukang force-pushed the yukang_cleanup_txpool_statics branch from 433e6c1 to 7e06792 Compare December 25, 2023 15:39
@chenyukang chenyukang force-pushed the yukang_cleanup_txpool_statics branch from 7e06792 to 1a88a04 Compare December 25, 2023 15:40
@chenyukang chenyukang changed the title Move txpool statistics from callbacks to PoolMap chore: Move txpool statistics from callbacks to PoolMap Dec 26, 2023
tx-pool/src/pool.rs Outdated Show resolved Hide resolved
Co-authored-by: Quake Wang <quake.wang@gmail.com>
@chenyukang chenyukang force-pushed the yukang_cleanup_txpool_statics branch from f859bfe to b1a1e2a Compare December 26, 2023 08:38
@chenyukang chenyukang added this pull request to the merge queue Dec 26, 2023
Merged via the queue into nervosnetwork:develop with commit d30daec Dec 26, 2023
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
m:tx-pool t:enhancement Type: Feature, refactoring.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants