-
Notifications
You must be signed in to change notification settings - Fork 46
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
Scan keys less often on ingest #1868
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #1868 +/- ##
==========================================
- Coverage 84.34% 84.30% -0.04%
==========================================
Files 328 328
Lines 18747 18747
==========================================
- Hits 15812 15805 -7
- Misses 2935 2942 +7
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
[sc-8994] |
This pull request has been linked to Shortcut Story #8994: reduce tikv scans. |
# Get all fields | ||
if len(self.all_fields_keys) == 0 or force: |
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.
This was a bug: resources that had no fields would fetching the fields ids list no matter what
# backward compatibility if all fields key is not set | ||
all_fields = PBAllFieldIDs() | ||
async for (field_type, field_id) in self._scan_fields_ids(): | ||
result.append((field_type, field_id)) | ||
all_fields.fields.append(FieldID(field_type=field_type, field=field_id)) |
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.
this bw/compatible code can be removed, as the migration ran in prod long time ago.
I've checked in stage and all fields ids keys match with the correct number of fields
Description
Scanning of keys to get field ids is no longer needed (a migration was run log time ago), as we are materializing the list of field ids in a separate key in the KV store.
This will reduce the amount of scan_keys that we do to tikv, who doesn't seem to be very happy.
How was this PR tested?
Existing tests should cover. I also tested agains stage to check that all field ids keys correspond to the valid list of fields.