Skip to content

Cross-join fix for devops adoption

Adam Hegyi requested to merge 337541-remove-cross-join-in-devops-adoption into master

What does this MR do and why?

This MR fixes the cross-join query when calculating the pipeline_succeeded count.

Generated SQL:

SELECT COUNT(id)
FROM (
      VALUES (1), (2)) project_ids (id)
WHERE EXISTS
    (SELECT "ci_job_artifacts"."project_id",
            "ci_job_artifacts"."file_type",
            "ci_job_artifacts"."size",
            "ci_job_artifacts"."created_at",
            "ci_job_artifacts"."updated_at",
            "ci_job_artifacts"."expire_at",
            "ci_job_artifacts"."file",
            "ci_job_artifacts"."file_store",
            "ci_job_artifacts"."file_sha256",
            "ci_job_artifacts"."file_format",
            "ci_job_artifacts"."file_location",
            "ci_job_artifacts"."id",
            "ci_job_artifacts"."job_id",
            "ci_job_artifacts"."locked"
     FROM "ci_job_artifacts"
     WHERE "ci_job_artifacts"."file_type" = 5
       AND "ci_job_artifacts"."created_at" BETWEEN '2020-12-01 00:00:00' AND '2020-12-31 23:59:59.999999'
       AND "ci_job_artifacts"."project_id" = project_ids.id)

Additionally, the allow_cross_joins_across_databases block was added around the CI::Runner query (runner_configured) so we can remove the file from the cross-join-allowlist.yml.

The runner_configred method will be fixed after !67237 (closed)

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #337541 (closed)

Edited by Adam Hegyi

Merge request reports