-
Notifications
You must be signed in to change notification settings - Fork 471
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
ledger: Remove redundant block header cache #5540
ledger: Remove redundant block header cache #5540
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5540 +/- ##
==========================================
- Coverage 55.06% 54.96% -0.10%
==========================================
Files 465 463 -2
Lines 64584 64468 -116
==========================================
- Hits 35561 35437 -124
- Misses 26652 26659 +7
- Partials 2371 2372 +1
... and 13 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
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.
please remove exceed locks from txtal.commitRound
Looking forward for part 2 with BlockHdrCached removal |
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.
Read through the PR, and the changes seem as described but I am not personally comfortable enough with the system and existing locking picture to approve myself.
The couple of questions that I do have are minor
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.
I confirmed that the AVM has its own check before calling BlockHdr()
so the change to return headers from DB is fine from that perspective.
I don't want to weigh in on the locking discussion, since I don't know it well. But if you want my input, ping me and I'll spend more time understanding it.
I'm really glad to see this cleanup!
@algonautshant there are some linter and benchmark failures like
Please take a look, most likely some benchmark mock is missing |
This PR removes
headerCache blockHeaderCache
fromLedger
struct.All requests to
BlockHdr
function which were fulfilled byheaderCache
are now addressed byl.txTail.blockHeader
, and fallback, when thetxTail
does not have the round, tol.blockQ.getBlockHdr
.All instances of
BlockHdrCached
are eliminated or replaced byBlockHdr
.Impact on the locks:
l.trackerMu
will no longer protect thetxTail
, instead,txTail
mutex will be responsible for protecting thetxTail
actions.BlockHdrCached
function will no longer lockl.trackerMu
.trackerRegistry
initialize
will be guarded by thetr.mu
lock.Resolves: https://github.com/algorand/go-algorand-internal/issues/2147
#5566 will address the test failure since it is independent of this work.