Skip to content

Filter Ci::Build association by partition_id

Max Orefice requested to merge morefice/filter-ci-build-in-by-partition into master

Ref: #423054 (closed)

What does this MR do and why?

This MR allows to make sure we always fetch a given build record in the proper partition where the data is in by including partition_id in the where clause.

Example of updated query

Before

SELECT "p_ci_builds.*"
FROM "p_ci_builds"
WHERE "p_ci_builds"."type" = 'Ci::Build'
  AND "p_ci_builds"."id" = 279
LIMIT 1

After

SELECT "p_ci_builds.*"
FROM "p_ci_builds"
WHERE "p_ci_builds"."type" = 'Ci::Build'
  AND "p_ci_builds"."id" = 279
+ AND "p_ci_builds"."partition_id" = 100
LIMIT 1

MR acceptance checklist

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

Edited by Max Orefice

Merge request reports