Skip to content

controllers/krate/search: Read downloads from crate_downloads table #8244

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

Merged
merged 3 commits into from
Mar 6, 2024

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented Mar 5, 2024

This PR builds on top of #8232 and switches our GET /api/v1/crates endpoint over to using the crate_downloads table instead of the crates.downloads column.

Performance tests on the production replica database indicated that this should not significantly affect the performance of the endpoint (see https://rust-lang.zulipchat.com/#narrow/stream/318791-t-crates-io/topic/.60crate_downloads.60.20table).

This should allow us to eventually remove the crates.downloads column, reducing the number of writes to the crates table.

@Turbo87 Turbo87 added C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear A-backend ⚙️ labels Mar 5, 2024
@Turbo87 Turbo87 requested a review from a team March 5, 2024 13:11
Copy link

codecov bot commented Mar 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.74%. Comparing base (4a29008) to head (ef105ce).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8244      +/-   ##
==========================================
- Coverage   87.74%   87.74%   -0.01%     
==========================================
  Files         273      273              
  Lines       27345    27354       +9     
==========================================
+ Hits        23994    24001       +7     
- Misses       3351     3353       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Turbo87 Turbo87 force-pushed the search-downloads branch from c02e090 to ef105ce Compare March 5, 2024 14:54
Copy link
Contributor

@eth3lbert eth3lbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

While we could add tests to verify that the downloads in the search response comes from crate_downloads.downloads rather than crate.downloads, I believe it should be sufficient for now.

Copy link
Contributor

@LawnGnome LawnGnome left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking readability concern, but let's ship it and see what happens.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants