Spec failure in `spec/controllers/projects/pipelines_controller_spec.rb` | Projects::PipelinesController GET index.json when using persisted stages does not execute N+1 queries
Job #1772231737 failed for 95bbd574:
Failures:
1) Projects::PipelinesController GET index.json when using persisted stages does not execute N+1 queries
Failure/Error: expect { get_pipelines_index_json }.not_to exceed_query_limit(control_count + 1)
Expected a maximum of 28 queries, got 32:
SELECT COUNT(*) FROM (SELECT 1 AS one FROM "ci_pipelines" WHERE "ci_pipelines"."project_id" = 462 AND "ci_pipelines"."source" != 12 LIMIT 1001) subquery_for_count /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT COUNT(*) FROM (SELECT 1 AS one FROM "ci_pipelines" WHERE "ci_pipelines"."project_id" = 462 AND "ci_pipelines"."source" != 12 LIMIT 1001) subquery_for_count /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_pipelines".* FROM "ci_pipelines" WHERE "ci_pipelines"."project_id" = 462 AND "ci_pipelines"."source" != 12 ORDER BY "ci_pipelines"."id" DESC LIMIT 15 OFFSET 0 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."status" IN ('running', 'waiting_for_resource', 'preparing', 'pending', 'created', 'scheduled') AND "ci_builds"."commit_id" IN (234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' AND ("ci_builds"."retried" = FALSE OR "ci_builds"."retried" IS NULL) AND ("ci_builds"."status" IN ('failed','canceled')) AND "ci_builds"."commit_id" IN (234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "projects"."id", "projects"."name", "projects"."path", "projects"."description", "projects"."created_at", "projects"."updated_at", "projects"."creator_id", "projects"."namespace_id", "projects"."last_activity_at", "projects"."import_url", "projects"."visibility_level", "projects"."archived", "projects"."avatar", "projects"."merge_requests_template", "projects"."star_count", "projects"."merge_requests_rebase_enabled", "projects"."import_type", "projects"."import_source", "projects"."approvals_before_merge", "projects"."reset_approvals_on_push", "projects"."merge_requests_ff_only_enabled", "projects"."issues_template", "projects"."mirror", "projects"."mirror_user_id", "projects"."shared_runners_enabled", "projects"."runners_token", "projects"."build_coverage_regex", "projects"."build_allow_git_fetch", "projects"."build_timeout", "projects"."mirror_trigger_builds", "projects"."pending_delete", "projects"."public_builds", "projects"."last_repository_check_failed", "projects"."last_repository_check_at", "projects"."only_allow_merge_if_pipeline_succeeds", "projects"."has_external_issue_tracker", "projects"."repository_storage", "projects"."repository_read_only", "projects"."request_access_enabled", "projects"."has_external_wiki", "projects"."ci_config_path", "projects"."lfs_enabled", "projects"."description_html", "projects"."only_allow_merge_if_all_discussions_are_resolved", "projects"."repository_size_limit", "projects"."printing_merge_request_link_enabled", "projects"."auto_cancel_pending_pipelines", "projects"."service_desk_enabled", "projects"."cached_markdown_version", "projects"."delete_error", "projects"."last_repository_updated_at", "projects"."disable_overriding_approvers_per_merge_request", "projects"."storage_version", "projects"."resolve_outdated_diff_discussions", "projects"."remote_mirror_available_overridden", "projects"."only_mirror_protected_branches", "projects"."pull_mirror_available_overridden", "projects"."jobs_cache_index", "projects"."external_authorization_classification_label", "projects"."mirror_overwrites_diverged_branches", "projects"."pages_https_only", "projects"."external_webhook_token", "projects"."packages_enabled", "projects"."merge_requests_author_approval", "projects"."pool_repository_id", "projects"."runners_token_encrypted", "projects"."bfg_object_map", "projects"."detected_repository_languages", "projects"."merge_requests_disable_committers_approval", "projects"."require_password_to_approve", "projects"."emails_disabled", "projects"."max_pages_size", "projects"."max_artifacts_size", "projects"."remove_source_branch_after_merge", "projects"."marked_for_deletion_at", "projects"."marked_for_deletion_by_user_id", "projects"."autoclose_referenced_issues", "projects"."suggestion_commit_message", "projects"."project_namespace_id" FROM "projects" WHERE "projects"."id" = 462 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_stages".* FROM "ci_stages" WHERE "ci_stages"."pipeline_id" IN (234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223) ORDER BY "ci_stages"."position" ASC /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_builds".* FROM "ci_builds" WHERE ("ci_builds"."retried" = FALSE OR "ci_builds"."retried" IS NULL) AND "ci_builds"."commit_id" IN (234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_trigger_requests".* FROM "ci_trigger_requests" WHERE "ci_trigger_requests"."commit_id" IN (234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "users".* FROM "users" WHERE "users"."id" IN (805, 804, 803, 802, 801, 800, 799, 798, 797, 796, 795, 794) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' AND ("ci_builds"."retried" = FALSE OR "ci_builds"."retried" IS NULL) AND "ci_builds"."when" = 'manual' AND "ci_builds"."status" IN ('success', 'failed', 'canceled', 'skipped', 'manual') AND "ci_builds"."commit_id" IN (234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' AND ("ci_builds"."retried" = FALSE OR "ci_builds"."retried" IS NULL) AND "ci_builds"."when" = 'delayed' AND "ci_builds"."status" IN ('success', 'failed', 'canceled', 'skipped', 'scheduled') AND "ci_builds"."commit_id" IN (234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' AND ("ci_builds"."retried" = FALSE OR "ci_builds"."retried" IS NULL) AND ("ci_builds"."status" IN ('failed')) AND "ci_builds"."commit_id" IN (234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "projects"."id", "projects"."name", "projects"."path", "projects"."description", "projects"."created_at", "projects"."updated_at", "projects"."creator_id", "projects"."namespace_id", "projects"."last_activity_at", "projects"."import_url", "projects"."visibility_level", "projects"."archived", "projects"."avatar", "projects"."merge_requests_template", "projects"."star_count", "projects"."merge_requests_rebase_enabled", "projects"."import_type", "projects"."import_source", "projects"."approvals_before_merge", "projects"."reset_approvals_on_push", "projects"."merge_requests_ff_only_enabled", "projects"."issues_template", "projects"."mirror", "projects"."mirror_user_id", "projects"."shared_runners_enabled", "projects"."runners_token", "projects"."build_coverage_regex", "projects"."build_allow_git_fetch", "projects"."build_timeout", "projects"."mirror_trigger_builds", "projects"."pending_delete", "projects"."public_builds", "projects"."last_repository_check_failed", "projects"."last_repository_check_at", "projects"."only_allow_merge_if_pipeline_succeeds", "projects"."has_external_issue_tracker", "projects"."repository_storage", "projects"."repository_read_only", "projects"."request_access_enabled", "projects"."has_external_wiki", "projects"."ci_config_path", "projects"."lfs_enabled", "projects"."description_html", "projects"."only_allow_merge_if_all_discussions_are_resolved", "projects"."repository_size_limit", "projects"."printing_merge_request_link_enabled", "projects"."auto_cancel_pending_pipelines", "projects"."service_desk_enabled", "projects"."cached_markdown_version", "projects"."delete_error", "projects"."last_repository_updated_at", "projects"."disable_overriding_approvers_per_merge_request", "projects"."storage_version", "projects"."resolve_outdated_diff_discussions", "projects"."remote_mirror_available_overridden", "projects"."only_mirror_protected_branches", "projects"."pull_mirror_available_overridden", "projects"."jobs_cache_index", "projects"."external_authorization_classification_label", "projects"."mirror_overwrites_diverged_branches", "projects"."pages_https_only", "projects"."external_webhook_token", "projects"."packages_enabled", "projects"."merge_requests_author_approval", "projects"."pool_repository_id", "projects"."runners_token_encrypted", "projects"."bfg_object_map", "projects"."detected_repository_languages", "projects"."merge_requests_disable_committers_approval", "projects"."require_password_to_approve", "projects"."emails_disabled", "projects"."max_pages_size", "projects"."max_artifacts_size", "projects"."remove_source_branch_after_merge", "projects"."marked_for_deletion_at", "projects"."marked_for_deletion_by_user_id", "projects"."autoclose_referenced_issues", "projects"."suggestion_commit_message", "projects"."project_namespace_id" FROM "projects" WHERE "projects"."id" = 462 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_builds_metadata"."project_id", "ci_builds_metadata"."timeout", "ci_builds_metadata"."timeout_source", "ci_builds_metadata"."interruptible", "ci_builds_metadata"."config_options", "ci_builds_metadata"."config_variables", "ci_builds_metadata"."has_exposed_artifacts", "ci_builds_metadata"."environment_auto_stop_in", "ci_builds_metadata"."expanded_environment_name", "ci_builds_metadata"."secrets", "ci_builds_metadata"."build_id", "ci_builds_metadata"."id", "ci_builds_metadata"."runtime_runner_features" FROM "ci_builds_metadata" WHERE "ci_builds_metadata"."build_id" IN (246, 252, 220, 231, 238, 241) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "merge_requests".* FROM "merge_requests" WHERE "merge_requests"."id" IN (183, 182) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "projects"."id", "projects"."name", "projects"."path", "projects"."description", "projects"."created_at", "projects"."updated_at", "projects"."creator_id", "projects"."namespace_id", "projects"."last_activity_at", "projects"."import_url", "projects"."visibility_level", "projects"."archived", "projects"."avatar", "projects"."merge_requests_template", "projects"."star_count", "projects"."merge_requests_rebase_enabled", "projects"."import_type", "projects"."import_source", "projects"."approvals_before_merge", "projects"."reset_approvals_on_push", "projects"."merge_requests_ff_only_enabled", "projects"."issues_template", "projects"."mirror", "projects"."mirror_user_id", "projects"."shared_runners_enabled", "projects"."runners_token", "projects"."build_coverage_regex", "projects"."build_allow_git_fetch", "projects"."build_timeout", "projects"."mirror_trigger_builds", "projects"."pending_delete", "projects"."public_builds", "projects"."last_repository_check_failed", "projects"."last_repository_check_at", "projects"."only_allow_merge_if_pipeline_succeeds", "projects"."has_external_issue_tracker", "projects"."repository_storage", "projects"."repository_read_only", "projects"."request_access_enabled", "projects"."has_external_wiki", "projects"."ci_config_path", "projects"."lfs_enabled", "projects"."description_html", "projects"."only_allow_merge_if_all_discussions_are_resolved", "projects"."repository_size_limit", "projects"."printing_merge_request_link_enabled", "projects"."auto_cancel_pending_pipelines", "projects"."service_desk_enabled", "projects"."cached_markdown_version", "projects"."delete_error", "projects"."last_repository_updated_at", "projects"."disable_overriding_approvers_per_merge_request", "projects"."storage_version", "projects"."resolve_outdated_diff_discussions", "projects"."remote_mirror_available_overridden", "projects"."only_mirror_protected_branches", "projects"."pull_mirror_available_overridden", "projects"."jobs_cache_index", "projects"."external_authorization_classification_label", "projects"."mirror_overwrites_diverged_branches", "projects"."pages_https_only", "projects"."external_webhook_token", "projects"."packages_enabled", "projects"."merge_requests_author_approval", "projects"."pool_repository_id", "projects"."runners_token_encrypted", "projects"."bfg_object_map", "projects"."detected_repository_languages", "projects"."merge_requests_disable_committers_approval", "projects"."require_password_to_approve", "projects"."emails_disabled", "projects"."max_pages_size", "projects"."max_artifacts_size", "projects"."remove_source_branch_after_merge", "projects"."marked_for_deletion_at", "projects"."marked_for_deletion_by_user_id", "projects"."autoclose_referenced_issues", "projects"."suggestion_commit_message", "projects"."project_namespace_id" FROM "projects" WHERE "projects"."id" = 462 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "routes".* FROM "routes" WHERE "routes"."source_type" = 'Project' AND "routes"."source_id" = 462 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "namespaces"."id", "namespaces"."name", "namespaces"."path", "namespaces"."owner_id", "namespaces"."created_at", "namespaces"."updated_at", "namespaces"."type", "namespaces"."description", "namespaces"."avatar", "namespaces"."membership_lock", "namespaces"."share_with_group_lock", "namespaces"."visibility_level", "namespaces"."request_access_enabled", "namespaces"."ldap_sync_status", "namespaces"."ldap_sync_error", "namespaces"."ldap_sync_last_update_at", "namespaces"."ldap_sync_last_successful_update_at", "namespaces"."ldap_sync_last_sync_at", "namespaces"."description_html", "namespaces"."lfs_enabled", "namespaces"."parent_id", "namespaces"."shared_runners_minutes_limit", "namespaces"."repository_size_limit", "namespaces"."require_two_factor_authentication", "namespaces"."two_factor_grace_period", "namespaces"."cached_markdown_version", "namespaces"."project_creation_level", "namespaces"."runners_token", "namespaces"."file_template_project_id", "namespaces"."saml_discovery_token", "namespaces"."runners_token_encrypted", "namespaces"."custom_project_templates_group_id", "namespaces"."auto_devops_enabled", "namespaces"."extra_shared_runners_minutes_limit", "namespaces"."last_ci_minutes_notification_at", "namespaces"."last_ci_minutes_usage_notification_level", "namespaces"."subgroup_creation_level", "namespaces"."emails_disabled", "namespaces"."max_pages_size", "namespaces"."max_artifacts_size", "namespaces"."mentions_disabled", "namespaces"."default_branch_protection", "namespaces"."unlock_membership_to_ldap", "namespaces"."max_personal_access_token_lifetime", "namespaces"."push_rule_id", "namespaces"."shared_runners_enabled", "namespaces"."allow_descendants_override_disabled_shared_runners", "namespaces"."traversal_ids" FROM "namespaces" WHERE "namespaces"."id" = 1282 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "routes".* FROM "routes" WHERE "routes"."source_type" = 'Namespace' AND "routes"."source_id" = 1282 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "projects"."id", "projects"."name", "projects"."path", "projects"."description", "projects"."created_at", "projects"."updated_at", "projects"."creator_id", "projects"."namespace_id", "projects"."last_activity_at", "projects"."import_url", "projects"."visibility_level", "projects"."archived", "projects"."avatar", "projects"."merge_requests_template", "projects"."star_count", "projects"."merge_requests_rebase_enabled", "projects"."import_type", "projects"."import_source", "projects"."approvals_before_merge", "projects"."reset_approvals_on_push", "projects"."merge_requests_ff_only_enabled", "projects"."issues_template", "projects"."mirror", "projects"."mirror_user_id", "projects"."shared_runners_enabled", "projects"."runners_token", "projects"."build_coverage_regex", "projects"."build_allow_git_fetch", "projects"."build_timeout", "projects"."mirror_trigger_builds", "projects"."pending_delete", "projects"."public_builds", "projects"."last_repository_check_failed", "projects"."last_repository_check_at", "projects"."only_allow_merge_if_pipeline_succeeds", "projects"."has_external_issue_tracker", "projects"."repository_storage", "projects"."repository_read_only", "projects"."request_access_enabled", "projects"."has_external_wiki", "projects"."ci_config_path", "projects"."lfs_enabled", "projects"."description_html", "projects"."only_allow_merge_if_all_discussions_are_resolved", "projects"."repository_size_limit", "projects"."printing_merge_request_link_enabled", "projects"."auto_cancel_pending_pipelines", "projects"."service_desk_enabled", "projects"."cached_markdown_version", "projects"."delete_error", "projects"."last_repository_updated_at", "projects"."disable_overriding_approvers_per_merge_request", "projects"."storage_version", "projects"."resolve_outdated_diff_discussions", "projects"."remote_mirror_available_overridden", "projects"."only_mirror_protected_branches", "projects"."pull_mirror_available_overridden", "projects"."jobs_cache_index", "projects"."external_authorization_classification_label", "projects"."mirror_overwrites_diverged_branches", "projects"."pages_https_only", "projects"."external_webhook_token", "projects"."packages_enabled", "projects"."merge_requests_author_approval", "projects"."pool_repository_id", "projects"."runners_token_encrypted", "projects"."bfg_object_map", "projects"."detected_repository_languages", "projects"."merge_requests_disable_committers_approval", "projects"."require_password_to_approve", "projects"."emails_disabled", "projects"."max_pages_size", "projects"."max_artifacts_size", "projects"."remove_source_branch_after_merge", "projects"."marked_for_deletion_at", "projects"."marked_for_deletion_by_user_id", "projects"."autoclose_referenced_issues", "projects"."suggestion_commit_message", "projects"."project_namespace_id" FROM "projects" WHERE "projects"."id" = 462 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "routes".* FROM "routes" WHERE "routes"."source_type" = 'Project' AND "routes"."source_id" = 462 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "namespaces"."id", "namespaces"."name", "namespaces"."path", "namespaces"."owner_id", "namespaces"."created_at", "namespaces"."updated_at", "namespaces"."type", "namespaces"."description", "namespaces"."avatar", "namespaces"."membership_lock", "namespaces"."share_with_group_lock", "namespaces"."visibility_level", "namespaces"."request_access_enabled", "namespaces"."ldap_sync_status", "namespaces"."ldap_sync_error", "namespaces"."ldap_sync_last_update_at", "namespaces"."ldap_sync_last_successful_update_at", "namespaces"."ldap_sync_last_sync_at", "namespaces"."description_html", "namespaces"."lfs_enabled", "namespaces"."parent_id", "namespaces"."shared_runners_minutes_limit", "namespaces"."repository_size_limit", "namespaces"."require_two_factor_authentication", "namespaces"."two_factor_grace_period", "namespaces"."cached_markdown_version", "namespaces"."project_creation_level", "namespaces"."runners_token", "namespaces"."file_template_project_id", "namespaces"."saml_discovery_token", "namespaces"."runners_token_encrypted", "namespaces"."custom_project_templates_group_id", "namespaces"."auto_devops_enabled", "namespaces"."extra_shared_runners_minutes_limit", "namespaces"."last_ci_minutes_notification_at", "namespaces"."last_ci_minutes_usage_notification_level", "namespaces"."subgroup_creation_level", "namespaces"."emails_disabled", "namespaces"."max_pages_size", "namespaces"."max_artifacts_size", "namespaces"."mentions_disabled", "namespaces"."default_branch_protection", "namespaces"."unlock_membership_to_ldap", "namespaces"."max_personal_access_token_lifetime", "namespaces"."push_rule_id", "namespaces"."shared_runners_enabled", "namespaces"."allow_descendants_override_disabled_shared_runners", "namespaces"."traversal_ids" FROM "namespaces" WHERE "namespaces"."id" = 1282 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "routes".* FROM "routes" WHERE "routes"."source_type" = 'Namespace' AND "routes"."source_id" = 1282 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_builds".* FROM "ci_builds" WHERE "ci_builds"."type" = 'Ci::Build' AND ("ci_builds"."status" IN ('pending')) AND "ci_builds"."commit_id" IN (234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "projects"."id", "projects"."name", "projects"."path", "projects"."description", "projects"."created_at", "projects"."updated_at", "projects"."creator_id", "projects"."namespace_id", "projects"."last_activity_at", "projects"."import_url", "projects"."visibility_level", "projects"."archived", "projects"."avatar", "projects"."merge_requests_template", "projects"."star_count", "projects"."merge_requests_rebase_enabled", "projects"."import_type", "projects"."import_source", "projects"."approvals_before_merge", "projects"."reset_approvals_on_push", "projects"."merge_requests_ff_only_enabled", "projects"."issues_template", "projects"."mirror", "projects"."mirror_user_id", "projects"."shared_runners_enabled", "projects"."runners_token", "projects"."build_coverage_regex", "projects"."build_allow_git_fetch", "projects"."build_timeout", "projects"."mirror_trigger_builds", "projects"."pending_delete", "projects"."public_builds", "projects"."last_repository_check_failed", "projects"."last_repository_check_at", "projects"."only_allow_merge_if_pipeline_succeeds", "projects"."has_external_issue_tracker", "projects"."repository_storage", "projects"."repository_read_only", "projects"."request_access_enabled", "projects"."has_external_wiki", "projects"."ci_config_path", "projects"."lfs_enabled", "projects"."description_html", "projects"."only_allow_merge_if_all_discussions_are_resolved", "projects"."repository_size_limit", "projects"."printing_merge_request_link_enabled", "projects"."auto_cancel_pending_pipelines", "projects"."service_desk_enabled", "projects"."cached_markdown_version", "projects"."delete_error", "projects"."last_repository_updated_at", "projects"."disable_overriding_approvers_per_merge_request", "projects"."storage_version", "projects"."resolve_outdated_diff_discussions", "projects"."remote_mirror_available_overridden", "projects"."only_mirror_protected_branches", "projects"."pull_mirror_available_overridden", "projects"."jobs_cache_index", "projects"."external_authorization_classification_label", "projects"."mirror_overwrites_diverged_branches", "projects"."pages_https_only", "projects"."external_webhook_token", "projects"."packages_enabled", "projects"."merge_requests_author_approval", "projects"."pool_repository_id", "projects"."runners_token_encrypted", "projects"."bfg_object_map", "projects"."detected_repository_languages", "projects"."merge_requests_disable_committers_approval", "projects"."require_password_to_approve", "projects"."emails_disabled", "projects"."max_pages_size", "projects"."max_artifacts_size", "projects"."remove_source_branch_after_merge", "projects"."marked_for_deletion_at", "projects"."marked_for_deletion_by_user_id", "projects"."autoclose_referenced_issues", "projects"."suggestion_commit_message", "projects"."project_namespace_id" FROM "projects" WHERE "projects"."id" = 462 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_sources_pipelines".* FROM "ci_sources_pipelines" WHERE "ci_sources_pipelines"."pipeline_id" IN (234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_sources_pipelines".* FROM "ci_sources_pipelines" WHERE "ci_sources_pipelines"."source_pipeline_id" IN (234, 233, 232, 231, 230, 229, 228, 227, 226, 225, 224, 223) /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT COUNT(*) AS count_all, "ci_builds"."commit_id" AS ci_builds_commit_id FROM "ci_builds" WHERE "ci_builds"."commit_id" IN (228, 227, 226, 225, 224, 223, 234, 233, 232, 231, 230, 229) AND ("ci_builds"."retried" = FALSE OR "ci_builds"."retried" IS NULL) AND "ci_builds"."allow_failure" = TRUE AND "ci_builds"."status" IN ('failed', 'canceled') GROUP BY "ci_builds"."commit_id" /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "project_ci_cd_settings".* FROM "project_ci_cd_settings" WHERE "project_ci_cd_settings"."project_id" = 462 LIMIT 1 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "namespaces"."id", "namespaces"."name", "namespaces"."path", "namespaces"."owner_id", "namespaces"."created_at", "namespaces"."updated_at", "namespaces"."type", "namespaces"."description", "namespaces"."avatar", "namespaces"."membership_lock", "namespaces"."share_with_group_lock", "namespaces"."visibility_level", "namespaces"."request_access_enabled", "namespaces"."ldap_sync_status", "namespaces"."ldap_sync_error", "namespaces"."ldap_sync_last_update_at", "namespaces"."ldap_sync_last_successful_update_at", "namespaces"."ldap_sync_last_sync_at", "namespaces"."description_html", "namespaces"."lfs_enabled", "namespaces"."parent_id", "namespaces"."shared_runners_minutes_limit", "namespaces"."repository_size_limit", "namespaces"."require_two_factor_authentication", "namespaces"."two_factor_grace_period", "namespaces"."cached_markdown_version", "namespaces"."project_creation_level", "namespaces"."runners_token", "namespaces"."file_template_project_id", "namespaces"."saml_discovery_token", "namespaces"."runners_token_encrypted", "namespaces"."custom_project_templates_group_id", "namespaces"."auto_devops_enabled", "namespaces"."extra_shared_runners_minutes_limit", "namespaces"."last_ci_minutes_notification_at", "namespaces"."last_ci_minutes_usage_notification_level", "namespaces"."subgroup_creation_level", "namespaces"."emails_disabled", "namespaces"."max_pages_size", "namespaces"."max_artifacts_size", "namespaces"."mentions_disabled", "namespaces"."default_branch_protection", "namespaces"."unlock_membership_to_ldap", "namespaces"."max_personal_access_token_lifetime", "namespaces"."push_rule_id", "namespaces"."shared_runners_enabled", "namespaces"."allow_descendants_override_disabled_shared_runners", "namespaces"."traversal_ids" FROM "namespaces" WHERE "namespaces"."id" = 1282 LIMIT 1 /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
SELECT "ci_runners".* FROM ((SELECT "ci_runners".* FROM "ci_runners" INNER JOIN "ci_runner_projects" ON "ci_runners"."id" = "ci_runner_projects"."runner_id" WHERE "ci_runner_projects"."project_id" = 462)
UNION
(SELECT "ci_runners".* FROM "ci_runners" INNER JOIN "ci_runner_namespaces" ON "ci_runner_namespaces"."runner_id" = "ci_runners"."id" INNER JOIN "namespaces" ON "namespaces"."id" = "ci_runner_namespaces"."namespace_id" AND "namespaces"."type" = 'Group' WHERE "namespaces"."id" IN (WITH RECURSIVE "base_and_ancestors" AS ((SELECT "namespaces"."id", "namespaces"."name", "namespaces"."path", "namespaces"."owner_id", "namespaces"."created_at", "namespaces"."updated_at", "namespaces"."type", "namespaces"."description", "namespaces"."avatar", "namespaces"."membership_lock", "namespaces"."share_with_group_lock", "namespaces"."visibility_level", "namespaces"."request_access_enabled", "namespaces"."ldap_sync_status", "namespaces"."ldap_sync_error", "namespaces"."ldap_sync_last_update_at", "namespaces"."ldap_sync_last_successful_update_at", "namespaces"."ldap_sync_last_sync_at", "namespaces"."description_html", "namespaces"."lfs_enabled", "namespaces"."parent_id", "namespaces"."shared_runners_minutes_limit", "namespaces"."repository_size_limit", "namespaces"."require_two_factor_authentication", "namespaces"."two_factor_grace_period", "namespaces"."cached_markdown_version", "namespaces"."project_creation_level", "namespaces"."runners_token", "namespaces"."file_template_project_id", "namespaces"."saml_discovery_token", "namespaces"."runners_token_encrypted", "namespaces"."custom_project_templates_group_id", "namespaces"."auto_devops_enabled", "namespaces"."extra_shared_runners_minutes_limit", "namespaces"."last_ci_minutes_notification_at", "namespaces"."last_ci_minutes_usage_notification_level", "namespaces"."subgroup_creation_level", "namespaces"."emails_disabled", "namespaces"."max_pages_size", "namespaces"."max_artifacts_size", "namespaces"."mentions_disabled", "namespaces"."default_branch_protection", "namespaces"."unlock_membership_to_ldap", "namespaces"."max_personal_access_token_lifetime", "namespaces"."push_rule_id", "namespaces"."shared_runners_enabled", "namespaces"."allow_descendants_override_disabled_shared_runners", "namespaces"."traversal_ids" FROM "namespaces" INNER JOIN "projects" ON "projects"."namespace_id" = "namespaces"."id" WHERE "namespaces"."type" = 'Group' AND "projects"."id" = 462)
UNION
(SELECT "namespaces"."id", "namespaces"."name", "namespaces"."path", "namespaces"."owner_id", "namespaces"."created_at", "namespaces"."updated_at", "namespaces"."type", "namespaces"."description", "namespaces"."avatar", "namespaces"."membership_lock", "namespaces"."share_with_group_lock", "namespaces"."visibility_level", "namespaces"."request_access_enabled", "namespaces"."ldap_sync_status", "namespaces"."ldap_sync_error", "namespaces"."ldap_sync_last_update_at", "namespaces"."ldap_sync_last_successful_update_at", "namespaces"."ldap_sync_last_sync_at", "namespaces"."description_html", "namespaces"."lfs_enabled", "namespaces"."parent_id", "namespaces"."shared_runners_minutes_limit", "namespaces"."repository_size_limit", "namespaces"."require_two_factor_authentication", "namespaces"."two_factor_grace_period", "namespaces"."cached_markdown_version", "namespaces"."project_creation_level", "namespaces"."runners_token", "namespaces"."file_template_project_id", "namespaces"."saml_discovery_token", "namespaces"."runners_token_encrypted", "namespaces"."custom_project_templates_group_id", "namespaces"."auto_devops_enabled", "namespaces"."extra_shared_runners_minutes_limit", "namespaces"."last_ci_minutes_notification_at", "namespaces"."last_ci_minutes_usage_notification_level", "namespaces"."subgroup_creation_level", "namespaces"."emails_disabled", "namespaces"."max_pages_size", "namespaces"."max_artifacts_size", "namespaces"."mentions_disabled", "namespaces"."default_branch_protection", "namespaces"."unlock_membership_to_ldap", "namespaces"."max_personal_access_token_lifetime", "namespaces"."push_rule_id", "namespaces"."shared_runners_enabled", "namespaces"."allow_descendants_override_disabled_shared_runners", "namespaces"."traversal_ids" FROM "namespaces", "base_and_ancestors" WHERE "namespaces"."type" = 'Group' AND "namespaces"."id" = "base_and_ancestors"."parent_id")) SELECT "namespaces"."id" FROM "base_and_ancestors" AS "namespaces") /* allow_cross_joins_across_databases */)
UNION
(SELECT "ci_runners".* FROM "ci_runners" WHERE "ci_runners"."runner_type" = 1)) ci_runners WHERE "ci_runners"."active" = TRUE AND (contacted_at > '2021-11-11 06:33:00.297168') /* allow_cross_joins_across_databases */ /*application:test,correlation_id:ca09af673f8336995c1de6a887f4a5a6,endpoint_id:Projects::PipelinesController#index,db_config_name:main*/
# ./spec/controllers/projects/pipelines_controller_spec.rb:57:in `block (4 levels) in <top (required)>'
# ./spec/spec_helper.rb:414:in `block (3 levels) in <top (required)>'
# ./spec/support/sidekiq_middleware.rb:9:in `with_sidekiq_server_middleware'
# ./spec/spec_helper.rb:405:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:401:in `block (3 levels) in <top (required)>'
# ./lib/gitlab/application_context.rb:31:in `with_raw_context'
# ./spec/spec_helper.rb:401:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:379:in `block (3 levels) in <top (required)>'
# ./lib/gitlab/with_request_store.rb:17:in `enabling_request_store'
# ./lib/gitlab/with_request_store.rb:10:in `with_request_store'
# ./spec/spec_helper.rb:379:in `block (2 levels) in <top (required)>'
# ./spec/spec_helper.rb:205:in `block (2 levels) in <top (required)>'
# ./spec/support/database/query_analyzer.rb:9:in `block (3 levels) in <top (required)>'
# ./lib/gitlab/database/query_analyzer.rb:42:in `within'
# ./spec/support/database/query_analyzer.rb:9:in `block (2 levels) in <top (required)>'
# ./spec/support/database/prevent_cross_joins.rb:102:in `block (3 levels) in <top (required)>'
# ./spec/support/database/prevent_cross_joins.rb:56:in `with_cross_joins_prevented'
# ./spec/support/database/prevent_cross_joins.rb:102:in `block (2 levels) in <top (required)>'
rspec ./spec/controllers/projects/pipelines_controller_spec.rb:47 # Projects::PipelinesController GET index.json when using persisted stages does not execute N+1 queries
Edited by Peter Leitzen