mempool: allow ReapX and CheckTx functions to run in parallel#4759
mempool: allow ReapX and CheckTx functions to run in parallel#4759mergify[bot] merged 12 commits intomasterfrom
Conversation
if you look at the code, you'll discover that it's never used. consensus locks the whole mempool proxyMtx for the duration of Update (including rechecking). Note both ReapMaxBytesMaxGas and ReapMaxTxs try to lock the same mutex.
ReapMaxBytesMaxGas,ReapMaxTxs,CheckTx can now run in parallel. Update and ^ cannot run in parallel, thus preserving safety. Closes #2972
|
👋 Thanks for creating a PR! Before we can merge this PR, please make sure that all the following items have been
Thank you for your contribution to Tendermint! 🚀 |
Codecov Report
@@ Coverage Diff @@
## master #4759 +/- ##
=======================================
Coverage 64.78% 64.78%
=======================================
Files 241 241
Lines 23053 23062 +9
=======================================
+ Hits 14934 14941 +7
- Misses 6901 6905 +4
+ Partials 1218 1216 -2
|
| if (r.CheckTx.Code == abci.CodeTypeOK) && postCheckErr == nil { | ||
| // Check mempool isn't full again to reduce the chance of exceeding the | ||
| // limits. | ||
| if err := mem.isFull(len(tx)); err != nil { |
There was a problem hiding this comment.
Maybe we should wrap this in a mutex to serialize the checks? It will be serialized by the mutex in addTx() anyway, so serializing here as well shouldn't incur any additional cost.
There was a problem hiding this comment.
serializing here as well shouldn't incur any additional cost.
not sure we will get much by doing that
There was a problem hiding this comment.
It could cause missing transaction that BroadcastTxSync() returns a success (code = 0) but the tx is not added to mempool.
allow ReapX and CheckTx functions to run in parallel, making it not possible to block certain proposers from creating a new block.
Closes: #2972