Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
651259ee
Commit
651259ee
authored
Oct 19, 2021
by
lauraMon
Committed by
drew cimino
Dec 16, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removes all ci_optimize_project_records_destruction ff
Changelog: changed
parent
79decad5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
61 deletions
+12
-61
app/services/projects/destroy_service.rb
app/services/projects/destroy_service.rb
+1
-4
config/feature_flags/development/ci_optimize_project_records_destruction.yml
...s/development/ci_optimize_project_records_destruction.yml
+0
-8
spec/services/projects/destroy_service_spec.rb
spec/services/projects/destroy_service_spec.rb
+11
-49
No files found.
app/services/projects/destroy_service.rb
View file @
651259ee
...
...
@@ -130,10 +130,7 @@ module Projects
destroy_events!
destroy_web_hooks!
destroy_project_bots!
if
::
Feature
.
enabled?
(
:ci_optimize_project_records_destruction
,
project
,
default_enabled: :yaml
)
destroy_ci_records!
end
# Rails attempts to load all related records into memory before
# destroying: https://github.com/rails/rails/issues/22510
...
...
config/feature_flags/development/ci_optimize_project_records_destruction.yml
deleted
100644 → 0
View file @
79decad5
---
name
:
ci_optimize_project_records_destruction
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/71342
rollout_issue_url
:
https://gitlab.com/gitlab-org/gitlab/-/issues/341936
milestone
:
'
14.4'
type
:
development
group
:
group::pipeline execution
default_enabled
:
false
spec/services/projects/destroy_service_spec.rb
View file @
651259ee
...
...
@@ -55,33 +55,17 @@ RSpec.describe Projects::DestroyService, :aggregate_failures do
.
and
change
{
Ci
::
Pipeline
.
count
}.
by
(
-
1
)
end
context
'with ci_optimize_project_records_destruction disabled'
do
stub_feature_flags
(
ci_optimize_project_records_destruction:
false
)
it
'avoids N+1 queries'
do
recorder
=
ActiveRecord
::
QueryRecorder
.
new
{
destroy_project
(
project
,
user
,
{})
}
project
=
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
pipeline
=
create
(
:ci_pipeline
,
project:
project
)
builds
=
create_list
(
:ci_build
,
3
,
:artifacts
,
pipeline:
pipeline
)
create
(
:ci_pipeline_artifact
,
pipeline:
pipeline
)
create_list
(
:ci_build_trace_chunk
,
3
,
build:
builds
[
0
])
expect
{
destroy_project
(
project
,
project
.
owner
,
{})
}.
not_to
exceed_query_limit
(
recorder
)
end
end
context
'with ci_optimize_project_records_destruction enabled'
do
it
'avoids N+1 queries'
do
recorder
=
ActiveRecord
::
QueryRecorder
.
new
{
destroy_project
(
project
,
user
,
{})
}
project
=
create
(
:project
,
:repository
,
namespace:
user
.
namespace
)
pipeline
=
create
(
:ci_pipeline
,
project:
project
)
builds
=
create_list
(
:ci_build
,
3
,
:artifacts
,
pipeline:
pipeline
)
create_list
(
:ci_build_trace_chunk
,
3
,
build:
builds
[
0
])
expect
{
destroy_project
(
project
,
project
.
owner
,
{})
}.
not_to
exceed_query_limit
(
recorder
)
end
end
it_behaves_like
'deleting the project'
end
...
...
@@ -116,11 +100,11 @@ RSpec.describe Projects::DestroyService, :aggregate_failures do
destroy_project
(
project
,
user
,
{})
end
context
'with running pipelines
to be aborted
'
do
context
'with running pipelines'
do
let!
(
:pipelines
)
{
create_list
(
:ci_pipeline
,
3
,
:running
,
project:
project
)
}
let
(
:destroy_pipeline_service
)
{
double
(
'DestroyPipelineService'
,
execute:
nil
)
}
it
'
executes DestroyPipelineService for project ci
pipelines'
do
it
'
bulks-fails with AbortPipelineService and then executes DestroyPipelineService for each
pipelines'
do
allow
(
::
Ci
::
DestroyPipelineService
).
to
receive
(
:new
).
and_return
(
destroy_pipeline_service
)
expect
(
::
Ci
::
AbortPipelinesService
)
...
...
@@ -128,33 +112,11 @@ RSpec.describe Projects::DestroyService, :aggregate_failures do
.
with
(
project
.
all_pipelines
,
:project_deleted
)
pipelines
.
each
do
|
pipeline
|
expect
(
destroy_pipeline_service
)
.
to
receive
(
:execute
)
.
with
(
pipeline
)
expect
(
destroy_pipeline_service
).
to
receive
(
:execute
).
with
(
pipeline
)
end
destroy_project
(
project
,
user
,
{})
end
context
'with ci_optimize_project_records_destruction disabled'
do
before
do
stub_feature_flags
(
ci_optimize_project_records_destruction:
false
)
end
it
'bulk-fails project ci pipelines'
do
expect
(
::
Ci
::
AbortPipelinesService
)
.
to
receive_message_chain
(
:new
,
:execute
)
.
with
(
project
.
all_pipelines
,
:project_deleted
)
destroy_project
(
project
,
user
,
{})
end
it
'does not destroy CI records via DestroyPipelineService'
do
expect
(
::
Ci
::
DestroyPipelineService
).
not_to
receive
(
:new
)
destroy_project
(
project
,
user
,
{})
end
end
end
context
'when project has remote mirrors'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment