Skip to content
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

Read build-status and rustc-version directly from builds instead of release #2267

Closed
wants to merge 2 commits into from

Conversation

Nemo157
Copy link
Member

@Nemo157 Nemo157 commented Oct 12, 2023

This is a first step on preparing the database for having a release without any builds. I have a separate branch that deletes the columns that become unused here, but think that this should be deployed first so that it can be easily reverted if necessary.

@github-actions github-actions bot added the S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed label Oct 12, 2023
@@ -117,7 +117,7 @@ impl CrateDetails {
releases.readme,
releases.description_long,
releases.release_time,
releases.build_status,
COALESCE(builds.build_status, false) as build_status,
Copy link
Member

Choose a reason for hiding this comment

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

I think we should already either remove or just rename the now unused columns.

This would also surface places which we might have forgotten.

@@ -136,7 +136,7 @@ impl CrateDetails {
releases.license,
releases.documentation_url,
releases.default_target,
releases.doc_rustc_version,
builds.rustc_version,
Copy link
Member

Choose a reason for hiding this comment

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

I think we should already either remove or just rename the now unused columns.

This would also surface places which we might have forgotten.

LEFT JOIN LATERAL (
SELECT * FROM builds
WHERE builds.rid = releases.id
ORDER BY builds.build_time
Copy link
Member

Choose a reason for hiding this comment

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

nit: the DESC should be on the same line as the ORDER BY for readablity

LEFT JOIN LATERAL (
SELECT build_status FROM builds
WHERE builds.rid = releases.id
ORDER BY builds.build_time
Copy link
Member

Choose a reason for hiding this comment

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

nit: the DESC should be on the same line as the ORDER BY for readablity

LEFT JOIN LATERAL (
SELECT * FROM builds
WHERE builds.rid = releases.id
ORDER BY builds.build_time
Copy link
Member

Choose a reason for hiding this comment

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

nit: the DESC should be on the same line as the ORDER BY for readablity

@@ -90,7 +90,7 @@ pub(crate) fn get_releases(
INNER JOIN builds ON releases.id = builds.rid
LEFT JOIN repositories ON releases.repository_id = repositories.id
WHERE
((NOT $3) OR (releases.build_status = FALSE AND releases.is_library = TRUE))
((NOT $3) OR (builds.build_status = FALSE AND releases.is_library = TRUE))
Copy link
Member

Choose a reason for hiding this comment

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

perhaps I'm missing something, but this would change behaviour of the query, for the case when we have multiple builds for a release.

releases.build_status will contain the last build result.

So assuming that the last build was successful, and the first one broke, in the old query we wouldn't see that release in the result, because the last build succeeded. In the new query we would see the release in the result because an older build failed, while the most recent one passed.

@@ -182,7 +188,10 @@ impl CrateDetails {
default_target: krate.get("default_target"),
doc_targets: MetaData::parse_doc_targets(krate.get("doc_targets")),
yanked: krate.get("yanked"),
rustdoc_css_file: get_correct_docsrs_style_file(krate.get("doc_rustc_version"))?,
rustdoc_css_file: krate
Copy link
Member

Choose a reason for hiding this comment

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

related question:
was there a time when we only stored records in the releases table? and nothing in builds?

Wouldn't this change not break old docs?

Copy link
Member Author

Choose a reason for hiding this comment

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

If so that was before my time, would have to check the prod database dump

@syphar syphar added S-waiting-on-author Status: This PR is incomplete or needs to address review comments and removed S-waiting-on-review Status: This pull request has been implemented and needs to be reviewed labels Oct 14, 2023
@Nemo157
Copy link
Member Author

Nemo157 commented Mar 19, 2024

Was merged as part of #2422

@Nemo157 Nemo157 closed this Mar 19, 2024
@Nemo157 Nemo157 deleted the normalize-build-status-read branch March 19, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This PR is incomplete or needs to address review comments
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants