-
Notifications
You must be signed in to change notification settings - Fork 38.1k
fees: make the class FeeFilterRounder thread-safe #24407
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
Conversation
|
This is revived from the original version of #19268 (cc @hebasto, @ajtowns). This achieves the same purpose as #22053, but in a different way (cc @MarcoFalke). My reasoning for opening this PR is that #19268 was reduced to just a comment because it is easier to just document the non-thread safe nature of |
I don't think the two pulls achieve the same goal. In fact I think they are completely orthogonal:
So I think the two pull requests are best reviewed and evaluated independently. Also, there is no dependency between them. Either can be merged before the other, or not at all. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK ecb5e10
The first commit message should be fixed from "Co-authoread-by:" to "Co-authored-by:"
ecb5e10 to
b2311fe
Compare
|
Invalidates ACK from @jonatack |
|
ACK b2311fe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK b2311fe
b2311fe to
f69670b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK f69670b
So that its methods can be called concurrently by different threads on the same object. Currently it has just one method (`round()`). Co-authored-by: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com>
It is only set in the constructor, thus improve readability by marking it as `const` and setting it from the initializer list using a helper function to derive its value. The idea was suggested by Anthony Towns <aj@erisian.com.au> in bitcoin#19268 (comment)
Rename the variables that were touched by the previous commit (split logical from style changes). minIncrementalFee -> min_incremental_fee minFeeLimit -> min_fee_limit bucketBoundary -> bucket_boundary feeset -> fee_set FeeFilterRounder::feeset -> FeeFilterRounder::m_fee_set
f69670b to
8173f16
Compare
|
|
|
re-ACK 8173f16 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review ACK 8173f16
|
Code review ACK 8173f16 |
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
|
CI currently fails on master, probably in connection with this: |
cbb2da8 add lock annotation for FeeFilterRounder::round() (glozow) Pull request description: CI failure from #24407: https://github.com/bitcoin/bitcoin/runs/8876014446 Calling `WITH_LOCK()` on a non-recursive mutex requires not holding it beforehand. ACKs for top commit: achow101: ACK cbb2da8 dergoegge: ACK cbb2da8 hebasto: ACK cbb2da8, tested on Ubuntu 22.04 with clang 14.0. Tree-SHA512: d6782ee48442b9d64d58a54c1ec7c53822ab051bf9728b44d6a0e05f1953e90f16420d349379345845db203fbad4e1f5750d9070adcb7daa18f12359a29488ca
8173f16 style: rename variables to match coding style (Vasil Dimov) 8b4ad20 fees: make FeeFilterRounder::feeset const (Vasil Dimov) e7a5bf6 fees: make the class FeeFilterRounder thread-safe (Vasil Dimov) Pull request description: Make the class `FeeFilterRounder` thread-safe so that its methods can be called concurrently by different threads on the same object. Currently it has just one method (`round()`). The second commit is optional, but it improves readability, showing that the `feeset` member will never be changed, thus does not need protection from concurrent access. ACKs for top commit: jonatack: re-ACK 8173f16 laanwj: Code review ACK 8173f16 promag: Code review ACK 8173f16 Tree-SHA512: 94b809997c485c0d114fa702d0406b980be8eaaebcfefa56808ed670aa943959c2f16cfd0ef72b4752fe2a409a23af1b4b7f2f236e51212957759569e3bbbefd
cbb2da8 add lock annotation for FeeFilterRounder::round() (glozow) Pull request description: CI failure from bitcoin#24407: https://github.com/bitcoin/bitcoin/runs/8876014446 Calling `WITH_LOCK()` on a non-recursive mutex requires not holding it beforehand. ACKs for top commit: achow101: ACK cbb2da8 dergoegge: ACK cbb2da8 hebasto: ACK cbb2da8, tested on Ubuntu 22.04 with clang 14.0. Tree-SHA512: d6782ee48442b9d64d58a54c1ec7c53822ab051bf9728b44d6a0e05f1953e90f16420d349379345845db203fbad4e1f5750d9070adcb7daa18f12359a29488ca
Make the class
FeeFilterRounderthread-safe so that its methods can be called concurrently by different threads on the same object. Currently it has just one method (round()).The second commit is optional, but it improves readability, showing that the
feesetmember will never be changed, thus does not need protection from concurrent access.