Commit d5e3be8a authored by Lucas Charles's avatar Lucas Charles

chore: Drop optimize_sql_query_for_security_report feature flag

Drops feature flag introduced to improve performance within the
StoreReportService. This flag was enabled globally previously with
https://gitlab.com/gitlab-org/gitlab/-/issues/323059 and can now be
removed

Relates to https://gitlab.com/gitlab-org/gitlab/-/issues/333020

Changelog: performance
EE: true
parent c9f24697
......@@ -35,12 +35,6 @@ module Security
pipeline.vulnerability_findings.report_type(@report.type).any?
end
def optimize_sql_query_for_security_report_enabled?
strong_memoize(:optimize_sql_query_for_security_report_enabled) do
Feature.enabled?(:optimize_sql_query_for_security_report, project)
end
end
def create_all_vulnerabilities!
# Look for existing Findings using UUID
finding_uuids = @report.findings.map(&:uuid)
......@@ -48,18 +42,16 @@ module Security
.where(uuid: finding_uuids) # rubocop: disable CodeReuse/ActiveRecord
.to_h { |vf| [vf.uuid, vf] }
update_vulnerability_scanners!(@report.findings) if optimize_sql_query_for_security_report_enabled?
update_vulnerability_scanners!(@report.findings)
vulnerability_ids = @report.findings.map do |finding|
create_vulnerability_finding(vulnerability_findings_by_uuid, finding)&.id
end.compact.uniq
if optimize_sql_query_for_security_report_enabled?
update_vulnerability_links_info
create_vulnerability_pipeline_objects
update_vulnerabilities_identifiers
update_vulnerabilities_finding_identifiers
end
update_vulnerability_links_info
create_vulnerability_pipeline_objects
update_vulnerabilities_identifiers
update_vulnerabilities_finding_identifiers
vulnerability_ids
end
......@@ -85,8 +77,6 @@ module Security
vulnerability_finding_to_finding_map[vulnerability_finding] = finding
update_vulnerability_scanner(finding) unless optimize_sql_query_for_security_report_enabled?
update_vulnerability_finding(vulnerability_finding, vulnerability_params)
reset_remediations_for(vulnerability_finding, finding)
......@@ -95,17 +85,6 @@ module Security
update_finding_signatures(finding, vulnerability_finding)
end
unless optimize_sql_query_for_security_report_enabled?
# The maximum number of identifiers is not used in validation
# we just want to ignore the rest if a finding has more than that.
finding.identifiers.take(Vulnerabilities::Finding::MAX_NUMBER_OF_IDENTIFIERS).map do |identifier| # rubocop: disable CodeReuse/ActiveRecord
create_or_update_vulnerability_identifier_object(vulnerability_finding, identifier)
end
create_or_update_vulnerability_links(finding, vulnerability_finding)
create_vulnerability_pipeline_object(vulnerability_finding, pipeline)
end
create_vulnerability(vulnerability_finding, pipeline)
end
......
---
name: optimize_sql_query_for_security_report
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/57426
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/323059
milestone: '13.11'
type: development
group: group::static analysis
default_enabled: false
......@@ -15,17 +15,13 @@ RSpec.describe Security::StoreReportService, '#execute' do
subject { described_class.new(pipeline, report).execute }
where(:vulnerability_finding_signatures_enabled, :optimize_sql_query_for_security_report_ff) do
true | true
true | false
false | true
false | false
where(:vulnerability_finding_signatures_enabled) do
[true, false]
end
with_them do
before do
stub_feature_flags(vulnerability_finding_tracking_signatures: vulnerability_finding_signatures_enabled)
stub_feature_flags(optimize_sql_query_for_security_report: optimize_sql_query_for_security_report_ff)
stub_licensed_features(
sast: true,
dependency_scanning: true,
......@@ -675,7 +671,6 @@ RSpec.describe Security::StoreReportService, '#execute' do
stub_feature_flags(
vulnerability_finding_tracking_signatures: false
)
stub_feature_flags(optimize_sql_query_for_security_report: true)
expect do
expect do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment