gitlab-org--gitlab-foss/spec/factories/ci
Greg Stark 271e7a3253 Add indexes and change SQL for expired artifacts to deal with artifacts migration efficiently
Artifacts are in the middle of being migrated from ci_builds to
ci_job_artifacts. The expiration date is currently visible in both of
these tables and the test for whether an expired artifact is present
for a job is complex as it requires checking both the of the tables.

Add two new indexes, one on ci_builds.artifacts_expire_at and one on
ci_job_artifacts.expire_at to enable finding expired artifacts
efficiently.

And until the migration is finished, replace the SQL for finding
expired and non-expired artifacts with a hand-crafted UNION ALL based
query instead of using OR. This overcomes a database optimizer
limitation that prevents it from using these indexes.

When the migration is finished the next version should remove this
query and replace it with a much simpler query on just
ci_job_artifacts. See
https://gitlab.com/gitlab-org/gitlab-ce/issues/42561 for followup.
2018-02-08 10:08:52 +01:00
..
build_trace_section_names.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
builds.rb Add indexes and change SQL for expired artifacts to deal with artifacts migration efficiently 2018-02-08 10:08:52 +01:00
group_variables.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
job_artifacts.rb Revert using expand_fixture_path in factory 2018-02-06 15:50:08 +09:00
pipeline_schedule.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
pipeline_schedule_variables.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
pipeline_variables.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
pipelines.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
runner_projects.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
runners.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
stages.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
trigger_requests.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
triggers.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00
variables.rb Replace factory_girl_rails with factory_bot_rails 2017-12-14 15:01:55 +01:00