Skip to content

Fix timeout error when loading pipelines by commit SHA for GraphQL

Marius Bobin requested to merge ci-fix-pipeline-loading-by-sha-for-graphql into master

What does this MR do?

In https://gitlab.com/gitlab-org/gitlab/-/blob/409ada30e7100a944b9758d4a95cb24637ecfef2/app/graphql/resolvers/project_pipeline_resolver.rb#L34 we are calling Ci::PipelinesFinder with shas: shas, but the finder expects sha instead: https://gitlab.com/gitlab-org/gitlab/-/blob/409ada30e7100a944b9758d4a95cb24637ecfef2/app/finders/ci/pipelines_finder.rb#L101-107. Because of this it tries to load all the pipelines for the given project, resulting in database timeouts.

https://log.gprd.gitlab.net/app/discover#/doc/97f04200-024b-11eb-81e5-155ba78758d4/pubsub-postgres-inf-gprd-000325?id=J4vyxHgB_Tc-7m8c8ZuU

Problematic query:

SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."project_id" = $1 AND "ci_pipelines"."source" != $2 ORDER BY "ci_pipelines"."id" DESC

Screenshots (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by Marius Bobin

Merge request reports

Loading