v2.3: Adds Offset to callback on scan_accounts() family (backport of #6744)#6755
v2.3: Adds Offset to callback on scan_accounts() family (backport of #6744)#6755brooksprumo merged 2 commits intov2.3from
Offset to callback on scan_accounts() family (backport of #6744)#6755Conversation
|
Cherry-pick of b979967 has failed: To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## v2.3 #6755 +/- ##
=========================================
- Coverage 82.8% 82.8% -0.1%
=========================================
Files 850 850
Lines 379572 379579 +7
=========================================
- Hits 314484 314464 -20
- Misses 65088 65115 +27 🚀 New features to boost your workflow:
|
|
really seems like we're doing this backward and should have refactored the scan functions properly rather than the kludge half-step in the wrong direction |
What part is going in the wrong direction? Or iow, what should the scan functions be refactored to look like? |
exposing the one new thing needed. |
We need the offset during index generation. The offset is already exposed in the |
|
ok, but i'm nixing the next field that needs hoisted into the api |
Problem
When building the accounts index, if secondary indexes are on, we scan each account storage file twice. This is bad, performance wise. The second scan is needed to get each account's data, which secondary indexes need.
In theory we should be able to switch on if secondary indexes are enabled or not, and then decide how to scan the storage. E.g. if secondary indexes are on, scan once with account data. If secondary indexes are off, scan once without account data.
The problem this PR is solving is that there isn't a scan function that returns both account data and all the info the index needs. IOW, when secondary indexes are on, there's not a scan function available for us to use.
Summary of Changes
We observe that the only missing piece of information while scanning with account data is the offset of the account within the file. We also observe that the implementations of the scan functions do already have the offset information! So, we can bubble that information up, which will allow the next PR to use if for speeding up building the accounts index.
Tl;dr: Add an
Offsetfield to thescan_accounts()family of functions.Justification to Backport
This PR is a prerequisite if we want to backport #6745. If we don't backport 6745, then we do not need to backport this PR.
This is an automatic backport of pull request #6744 done by [Mergify](https://mergify.com).