Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
1862f4a83e
commit
aaedbff77d
|
@ -1,7 +1,7 @@
|
|||
#import "~/graphql_shared/fragments/user.fragment.graphql"
|
||||
#import "~/graphql_shared/fragments/user_availability.fragment.graphql"
|
||||
|
||||
query issueParticipants($fullPath: ID!, $iid: String!) {
|
||||
query issueParticipants($fullPath: ID!, $iid: String!, $getStatus: Boolean = false) {
|
||||
workspace: project(fullPath: $fullPath) {
|
||||
id
|
||||
issuable: issue(iid: $iid) {
|
||||
|
@ -9,7 +9,7 @@ query issueParticipants($fullPath: ID!, $iid: String!) {
|
|||
participants {
|
||||
nodes {
|
||||
...User
|
||||
...UserAvailability
|
||||
...UserAvailability @include(if: $getStatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#import "~/graphql_shared/fragments/user.fragment.graphql"
|
||||
#import "~/graphql_shared/fragments/user_availability.fragment.graphql"
|
||||
|
||||
query getMrParticipants($fullPath: ID!, $iid: String!) {
|
||||
query getMrParticipants($fullPath: ID!, $iid: String!, $getStatus: Boolean = false) {
|
||||
workspace: project(fullPath: $fullPath) {
|
||||
id
|
||||
issuable: mergeRequest(iid: $iid) {
|
||||
|
@ -9,7 +9,7 @@ query getMrParticipants($fullPath: ID!, $iid: String!) {
|
|||
participants {
|
||||
nodes {
|
||||
...User
|
||||
...UserAvailability
|
||||
...UserAvailability @include(if: $getStatus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -103,6 +103,7 @@ export default {
|
|||
return {
|
||||
iid: this.iid,
|
||||
fullPath: this.fullPath,
|
||||
getStatus: true,
|
||||
};
|
||||
},
|
||||
update(data) {
|
||||
|
|
|
@ -134,7 +134,7 @@ module Projects
|
|||
destroy_ci_records!
|
||||
destroy_mr_diff_relations!
|
||||
|
||||
destroy_merge_request_diffs! if ::Feature.enabled?(:extract_mr_diff_deletions)
|
||||
destroy_merge_request_diffs!
|
||||
|
||||
# Rails attempts to load all related records into memory before
|
||||
# destroying: https://github.com/rails/rails/issues/22510
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
---
|
||||
name: extract_mr_diff_deletions
|
||||
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/96455
|
||||
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/372060
|
||||
milestone: '15.4'
|
||||
type: development
|
||||
group: group::source code
|
||||
default_enabled: false
|
|
@ -0,0 +1,7 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class AddRejectNonDcoCommitsToPushRules < Gitlab::Database::Migration[2.0]
|
||||
def change
|
||||
add_column :push_rules, :reject_non_dco_commits, :boolean
|
||||
end
|
||||
end
|
|
@ -0,0 +1,19 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
class PrepareAsyncTrigramIndexForVulnerabilityReadsContainerImages < Gitlab::Database::Migration[2.0]
|
||||
disable_ddl_transaction!
|
||||
|
||||
INDEX_NAME = 'index_vulnerability_reads_on_location_image_trigram'
|
||||
REPORT_TYPES = { container_scanning: 2, cluster_image_scanning: 7 }.freeze
|
||||
|
||||
def up
|
||||
prepare_async_index :vulnerability_reads, :location_image,
|
||||
name: INDEX_NAME,
|
||||
using: :gin, opclass: { location_image: :gin_trgm_ops },
|
||||
where: "report_type = ANY (ARRAY[#{REPORT_TYPES.values.join(', ')}]) AND location_image IS NOT NULL"
|
||||
end
|
||||
|
||||
def down
|
||||
unprepare_async_index :vulnerability_reads, :location_image, name: INDEX_NAME
|
||||
end
|
||||
end
|
|
@ -0,0 +1 @@
|
|||
766866e84cdafce6506f18e574e1cfb760a581fa7464ce7e29c31d9778c687c0
|
|
@ -0,0 +1 @@
|
|||
9686a948e67f25d64f66187db27699b838b2caef11f27884dd6e868e4bcf7d47
|
|
@ -20511,7 +20511,8 @@ CREATE TABLE push_rules (
|
|||
reject_unsigned_commits boolean,
|
||||
commit_committer_check boolean,
|
||||
regexp_uses_re2 boolean DEFAULT true,
|
||||
commit_message_negative_regex character varying
|
||||
commit_message_negative_regex character varying,
|
||||
reject_non_dco_commits boolean
|
||||
);
|
||||
|
||||
CREATE SEQUENCE push_rules_id_seq
|
||||
|
|
|
@ -426,7 +426,7 @@ the three characters, such as `my-package`, `my_package`, and `my....package`.
|
|||
|
||||
## Troubleshooting
|
||||
|
||||
To improve performance, PyPI caches files related to a package. Note that PyPI doesn't remove data by
|
||||
To improve performance, the pip command caches files related to a package. Note that pip doesn't remove data by
|
||||
itself. The cache grows as new packages are installed. If you encounter issues, clear the cache with
|
||||
this command:
|
||||
|
||||
|
|
|
@ -14,8 +14,13 @@ module Gitlab
|
|||
# The maximum number of SQL queries that can be executed in a request. For
|
||||
# the sake of keeping things simple we hardcode this value here, it's not
|
||||
# supposed to be changed very often anyway.
|
||||
THRESHOLD = 100
|
||||
LOG_THRESHOLD = THRESHOLD * 1.5
|
||||
def self.threshold
|
||||
100
|
||||
end
|
||||
|
||||
def self.log_threshold
|
||||
threshold * 1.5
|
||||
end
|
||||
|
||||
# Error that is raised whenever exceeding the maximum number of queries.
|
||||
ThresholdExceededError = Class.new(StandardError)
|
||||
|
@ -76,7 +81,7 @@ module Gitlab
|
|||
end
|
||||
|
||||
def executed_sql(sql)
|
||||
return if @count > LOG_THRESHOLD || ignorable?(sql)
|
||||
return if @count > self.class.log_threshold || ignorable?(sql)
|
||||
|
||||
@sql_executed << sql
|
||||
end
|
||||
|
@ -86,15 +91,15 @@ module Gitlab
|
|||
end
|
||||
|
||||
def threshold_exceeded?
|
||||
count > THRESHOLD
|
||||
count > self.class.threshold
|
||||
end
|
||||
|
||||
def error_message
|
||||
header = 'Too many SQL queries were executed'
|
||||
header = "#{header} in #{action}" if action
|
||||
msg = "a maximum of #{THRESHOLD} is allowed but #{count} SQL queries were executed"
|
||||
msg = "a maximum of #{self.class.threshold} is allowed but #{count} SQL queries were executed"
|
||||
log = @sql_executed.each_with_index.map { |sql, i| "#{i}: #{sql}" }.join("\n").presence
|
||||
ellipsis = '...' if @count > LOG_THRESHOLD
|
||||
ellipsis = '...' if @count > self.class.log_threshold
|
||||
|
||||
["#{header}: #{msg}", log, ellipsis].compact.join("\n")
|
||||
end
|
||||
|
@ -105,3 +110,5 @@ module Gitlab
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
Gitlab::QueryLimiting::Transaction.prepend_mod
|
||||
|
|
|
@ -8,7 +8,7 @@ RSpec.describe 'Projects > Settings > User transfers a project', :js do
|
|||
let(:group) { create(:group) }
|
||||
|
||||
before do
|
||||
stub_const('Gitlab::QueryLimiting::Transaction::THRESHOLD', 120)
|
||||
allow(Gitlab::QueryLimiting::Transaction).to receive(:threshold).and_return(120)
|
||||
|
||||
group.add_owner(user)
|
||||
sign_in(user)
|
||||
|
|
|
@ -52,7 +52,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
|
|||
context 'when the query threshold is exceeded' do
|
||||
let(:transaction) do
|
||||
trans = described_class.new
|
||||
trans.count = described_class::THRESHOLD + 1
|
||||
trans.count = described_class.threshold + 1
|
||||
|
||||
trans
|
||||
end
|
||||
|
@ -120,7 +120,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
|
|||
|
||||
it 'returns true when the threshold is exceeded' do
|
||||
transaction = described_class.new
|
||||
transaction.count = described_class::THRESHOLD + 1
|
||||
transaction.count = described_class.threshold + 1
|
||||
|
||||
expect(transaction.threshold_exceeded?).to eq(true)
|
||||
end
|
||||
|
@ -129,7 +129,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
|
|||
describe '#error_message' do
|
||||
it 'returns the error message to display when the threshold is exceeded' do
|
||||
transaction = described_class.new
|
||||
transaction.count = max = described_class::THRESHOLD
|
||||
transaction.count = max = described_class.threshold
|
||||
|
||||
expect(transaction.error_message).to eq(
|
||||
"Too many SQL queries were executed: a maximum of #{max} " \
|
||||
|
@ -139,7 +139,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
|
|||
|
||||
it 'includes a list of executed queries' do
|
||||
transaction = described_class.new
|
||||
transaction.count = max = described_class::THRESHOLD
|
||||
transaction.count = max = described_class.threshold
|
||||
%w[foo bar baz].each { |sql| transaction.executed_sql(sql) }
|
||||
|
||||
message = transaction.error_message
|
||||
|
@ -154,7 +154,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
|
|||
|
||||
it 'indicates if the log is truncated' do
|
||||
transaction = described_class.new
|
||||
transaction.count = described_class::THRESHOLD * 2
|
||||
transaction.count = described_class.threshold * 2
|
||||
|
||||
message = transaction.error_message
|
||||
|
||||
|
@ -163,7 +163,7 @@ RSpec.describe Gitlab::QueryLimiting::Transaction do
|
|||
|
||||
it 'includes the action name in the error message when present' do
|
||||
transaction = described_class.new
|
||||
transaction.count = max = described_class::THRESHOLD
|
||||
transaction.count = max = described_class.threshold
|
||||
transaction.action = 'UsersController#show'
|
||||
|
||||
expect(transaction.error_message).to eq(
|
||||
|
|
|
@ -1033,7 +1033,7 @@ RSpec.describe API::Internal::Base do
|
|||
|
||||
context 'git push' do
|
||||
before do
|
||||
stub_const('Gitlab::QueryLimiting::Transaction::THRESHOLD', 120)
|
||||
allow(Gitlab::QueryLimiting::Transaction).to receive(:threshold).and_return(120)
|
||||
end
|
||||
|
||||
subject { push_with_path(key, full_path: path, changes: '_any') }
|
||||
|
|
|
@ -146,20 +146,6 @@ RSpec.describe Projects::DestroyService, :aggregate_failures, :event_store_publi
|
|||
expect { destroy_project(project, user, {}) }.to change(MergeRequestDiff, :count).by(-1)
|
||||
expect { another_project_mr.reload }.not_to raise_error
|
||||
end
|
||||
|
||||
context 'when extract_mr_diff_deletions feature flag is disabled' do
|
||||
before do
|
||||
stub_feature_flags(extract_mr_diff_deletions: false)
|
||||
end
|
||||
|
||||
it 'also deletes merge request diffs' do
|
||||
merge_request_diffs = merge_request.merge_request_diffs
|
||||
expect(merge_request_diffs.size).to eq(1)
|
||||
|
||||
expect { destroy_project(project, user, {}) }.to change(MergeRequestDiff, :count).by(-1)
|
||||
expect { another_project_mr.reload }.not_to raise_error
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
it_behaves_like 'deleting the project'
|
||||
|
|
|
@ -717,7 +717,7 @@ module GraphqlHelpers
|
|||
end
|
||||
|
||||
def allow_high_graphql_transaction_threshold
|
||||
stub_const("Gitlab::QueryLimiting::Transaction::THRESHOLD", 1000)
|
||||
allow(Gitlab::QueryLimiting::Transaction).to receive(:threshold).and_return(1000)
|
||||
end
|
||||
|
||||
def allow_high_graphql_query_size
|
||||
|
|
|
@ -20,7 +20,7 @@ RSpec.shared_examples 'issuable update endpoint' do
|
|||
end
|
||||
|
||||
it 'updates the issuable with labels param as array' do
|
||||
stub_const("Gitlab::QueryLimiting::Transaction::THRESHOLD", 110)
|
||||
allow(Gitlab::QueryLimiting::Transaction).to receive(:threshold).and_return(110)
|
||||
|
||||
params = { labels: ['label1', 'label2', 'foo, bar', '&,?'] }
|
||||
|
||||
|
|
Loading…
Reference in New Issue