Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/models/bulk_imports/tracker.rb2
-rw-r--r--app/models/merge_request.rb2
-rw-r--r--changelogs/unreleased/33741-further-optimise-api-v3-github-endpoints.yml5
-rw-r--r--changelogs/unreleased/georgekoltsov-increase-bulk-import-default-page-size.yml6
-rw-r--r--config/unicorn.rb.example2
-rw-r--r--lib/api/v3/github.rb3
-rw-r--r--lib/bulk_imports/groups/graphql/get_labels_query.rb7
-rw-r--r--lib/bulk_imports/groups/graphql/get_members_query.rb7
-rw-r--r--lib/bulk_imports/groups/graphql/get_milestones_query.rb7
-rw-r--r--locale/gitlab.pot9
-rw-r--r--spec/requests/api/v3/github_spec.rb5
11 files changed, 37 insertions, 18 deletions
diff --git a/app/models/bulk_imports/tracker.rb b/app/models/bulk_imports/tracker.rb
index 8d16edccd5b..cf84414f9cf 100644
--- a/app/models/bulk_imports/tracker.rb
+++ b/app/models/bulk_imports/tracker.rb
@@ -18,6 +18,8 @@ class BulkImports::Tracker < ApplicationRecord
validates :stage, presence: true
+ DEFAULT_PAGE_SIZE = 500
+
state_machine :status, initial: :created do
state :created, value: 0
state :started, value: 1
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 720ee6f23d8..4a3162c5aa6 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -316,7 +316,7 @@ class MergeRequest < ApplicationRecord
}
scope :with_csv_entity_associations, -> { preload(:assignees, :approved_by_users, :author, :milestone, metrics: [:merged_by]) }
- scope :with_jira_integration_associations, -> { preload(:metrics, :assignees, :author, :target_project, :source_project) }
+ scope :with_jira_integration_associations, -> { preload_routables.preload(:metrics, :assignees, :author) }
scope :by_target_branch_wildcard, ->(wildcard_branch_name) do
where("target_branch LIKE ?", ApplicationRecord.sanitize_sql_like(wildcard_branch_name).tr('*', '%'))
diff --git a/changelogs/unreleased/33741-further-optimise-api-v3-github-endpoints.yml b/changelogs/unreleased/33741-further-optimise-api-v3-github-endpoints.yml
new file mode 100644
index 00000000000..62b7e30680f
--- /dev/null
+++ b/changelogs/unreleased/33741-further-optimise-api-v3-github-endpoints.yml
@@ -0,0 +1,5 @@
+---
+title: Resolve more N+1 issues in Jira pulls API
+merge_request: 57658
+author:
+type: performance
diff --git a/changelogs/unreleased/georgekoltsov-increase-bulk-import-default-page-size.yml b/changelogs/unreleased/georgekoltsov-increase-bulk-import-default-page-size.yml
new file mode 100644
index 00000000000..6171a184115
--- /dev/null
+++ b/changelogs/unreleased/georgekoltsov-increase-bulk-import-default-page-size.yml
@@ -0,0 +1,6 @@
+---
+title: Update BulkImport default page size to 500 in order to process larger page
+ of data
+merge_request: 57594
+author:
+type: other
diff --git a/config/unicorn.rb.example b/config/unicorn.rb.example
index 77e440eddde..0e475249868 100644
--- a/config/unicorn.rb.example
+++ b/config/unicorn.rb.example
@@ -41,7 +41,7 @@ working_directory "/home/git/gitlab" # available in 0.94.0+
listen "/home/git/gitlab/tmp/sockets/gitlab.socket", :backlog => 1024
listen "127.0.0.1:8080", :tcp_nopush => true
-# nuke workers after 30 seconds instead of 60 seconds (the default)
+# destroy workers after 30 seconds instead of 60 seconds (the default)
#
# NOTICE: git push over http depends on this value.
# If you want to be able to push huge amount of data to git repository over http
diff --git a/lib/api/v3/github.rb b/lib/api/v3/github.rb
index 7938339e1b1..29e4a79110f 100644
--- a/lib/api/v3/github.rb
+++ b/lib/api/v3/github.rb
@@ -197,16 +197,13 @@ module API
# Self-hosted Jira (tested on 7.11.1) requests this endpoint right
# after fetching branches.
- # rubocop: disable CodeReuse/ActiveRecord
get ':namespace/:project/events' do
user_project = find_project_with_access(params)
merge_requests = authorized_merge_requests_for_project(user_project)
- merge_requests = merge_requests.preload(:author, :assignees, :metrics, source_project: :namespace, target_project: :namespace)
present paginate(merge_requests), with: ::API::Github::Entities::PullRequestEvent
end
- # rubocop: enable CodeReuse/ActiveRecord
params do
use :project_full_path
diff --git a/lib/bulk_imports/groups/graphql/get_labels_query.rb b/lib/bulk_imports/groups/graphql/get_labels_query.rb
index 41c50cc9a36..f957cf0be52 100644
--- a/lib/bulk_imports/groups/graphql/get_labels_query.rb
+++ b/lib/bulk_imports/groups/graphql/get_labels_query.rb
@@ -8,9 +8,9 @@ module BulkImports
def to_s
<<-'GRAPHQL'
- query ($full_path: ID!, $cursor: String) {
+ query ($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) {
- labels(first: 100, after: $cursor, onlyGroupLabels: true) {
+ labels(first: $per_page, after: $cursor, onlyGroupLabels: true) {
page_info: pageInfo {
next_page: endCursor
has_next_page: hasNextPage
@@ -31,7 +31,8 @@ module BulkImports
def variables(context)
{
full_path: context.entity.source_full_path,
- cursor: context.tracker.next_page
+ cursor: context.tracker.next_page,
+ per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
}
end
diff --git a/lib/bulk_imports/groups/graphql/get_members_query.rb b/lib/bulk_imports/groups/graphql/get_members_query.rb
index 6e73201361f..e44d3c5aa9b 100644
--- a/lib/bulk_imports/groups/graphql/get_members_query.rb
+++ b/lib/bulk_imports/groups/graphql/get_members_query.rb
@@ -7,9 +7,9 @@ module BulkImports
extend self
def to_s
<<-'GRAPHQL'
- query($full_path: ID!, $cursor: String) {
+ query($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) {
- group_members: groupMembers(relations: DIRECT, first: 100, after: $cursor) {
+ group_members: groupMembers(relations: DIRECT, first: $per_page, after: $cursor) {
page_info: pageInfo {
next_page: endCursor
has_next_page: hasNextPage
@@ -34,7 +34,8 @@ module BulkImports
def variables(context)
{
full_path: context.entity.source_full_path,
- cursor: context.tracker.next_page
+ cursor: context.tracker.next_page,
+ per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
}
end
diff --git a/lib/bulk_imports/groups/graphql/get_milestones_query.rb b/lib/bulk_imports/groups/graphql/get_milestones_query.rb
index bf1943eb15b..07d671cd17c 100644
--- a/lib/bulk_imports/groups/graphql/get_milestones_query.rb
+++ b/lib/bulk_imports/groups/graphql/get_milestones_query.rb
@@ -8,9 +8,9 @@ module BulkImports
def to_s
<<-'GRAPHQL'
- query ($full_path: ID!, $cursor: String) {
+ query ($full_path: ID!, $cursor: String, $per_page: Int) {
group(fullPath: $full_path) {
- milestones(first: 100, after: $cursor, includeDescendants: false) {
+ milestones(first: $per_page, after: $cursor, includeDescendants: false) {
page_info: pageInfo {
next_page: endCursor
has_next_page: hasNextPage
@@ -33,7 +33,8 @@ module BulkImports
def variables(context)
{
full_path: context.entity.source_full_path,
- cursor: context.tracker.next_page
+ cursor: context.tracker.next_page,
+ per_page: ::BulkImports::Tracker::DEFAULT_PAGE_SIZE
}
end
diff --git a/locale/gitlab.pot b/locale/gitlab.pot
index 7358ffdb6c7..4e0c512c234 100644
--- a/locale/gitlab.pot
+++ b/locale/gitlab.pot
@@ -33456,6 +33456,12 @@ msgstr ""
msgid "ValueStreamAnalytics|Median time from issue created to issue closed."
msgstr ""
+msgid "ValueStreamEvent|Start"
+msgstr ""
+
+msgid "ValueStreamEvent|Stop"
+msgstr ""
+
msgid "ValueStream|The Default Value Stream cannot be deleted"
msgstr ""
@@ -36537,9 +36543,6 @@ msgstr ""
msgid "must be greater than start date"
msgstr ""
-msgid "must be later than active period start"
-msgstr ""
-
msgid "must contain only valid frameworks"
msgstr ""
diff --git a/spec/requests/api/v3/github_spec.rb b/spec/requests/api/v3/github_spec.rb
index 521187f0a81..4100b246218 100644
--- a/spec/requests/api/v3/github_spec.rb
+++ b/spec/requests/api/v3/github_spec.rb
@@ -246,7 +246,10 @@ RSpec.describe API::V3::Github do
control_count = ActiveRecord::QueryRecorder.new { perform_request }.count
- create(:merge_request, source_project: project, source_branch: 'fix')
+ project3 = create(:project, :repository, creator: user)
+ project3.add_maintainer(user)
+ assignee3 = create(:user)
+ create(:merge_request, source_project: project3, target_project: project3, author: user, assignees: [assignee3])
expect { perform_request }.not_to exceed_query_limit(control_count)
end