| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| | |
Allow n+1s caused by avatar fetches on the project dashboard. See…
See merge request gitlab-org/gitlab-ce!14475
|
| |
| |
| |
| | |
https://gitlab.com/gitlab-org/gitlab-ce/issues/38261
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Fix bug that caused merge requests with diff notes imported from Bitbucket to raise errors
Closes #38100
See merge request gitlab-org/gitlab-ce!14438
|
| | | |
|
| |/ |
|
| | |
|
|/ |
|
|
|
|
|
|
| |
See:
* https://www.kernel.org/pub/software/scm/git/docs/git-replace.html
* https://git-scm.com/book/en/v2/Git-Tools-Replace
|
|\
| |
| |
| |
| |
| |
| | |
Remove redundant WHERE from event queries
Closes #38129
See merge request gitlab-org/gitlab-ce!14389
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The default scope in Event would add a "WHERE author_id IS NOT NULL"
clause to every query. Now that "events.author_id" has a NOT NULL clause
set this filter is redundant and we can safely remove it.
In this commit we also add a validation on events.author_id (previously
only defined in PushEvent) just in case something tries to create data
without an author ID. This way we can present a nicer error message
compared to PostgreSQL's foreign key error messages.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/38129
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Stop using Sidekiq for updating Key#last_used_at
Closes #36663
See merge request gitlab-org/gitlab-ce!14391
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This makes things simpler as no scheduling is involved. Further we
remove the need for running a SELECT + UPDATE just to get the key and
update it, whereas we only need an UPDATE when setting last_used_at
directly in a request.
The added service class takes care of updating Key#last_used_at without
using Sidekiq. Further it makes sure we only try to obtain a Redis lease
if we're confident that we actually need to do so, instead of always
obtaining it. We also make sure to _only_ update last_used_at instead of
also updating updated_at.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36663
|
|\ \
| |/
|/|
| |
| |
| |
| | |
Fix refreshing of issues/MR count caches
Closes #38061
See merge request gitlab-org/gitlab-ce!14363
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This ensures the open issues/MR count caches are refreshed properly when
creating new issues or MRs. This MR also includes a change to the cache
keys to ensure all caches are rebuilt on the fly.
This particular problem was not caught in the test suite due to a null
cache being used, resulting in all calls that would use a cache using
the underlying data directly. In production the code would fail because
a newly saved record returns an empty hash in #changes meaning checks
such as `state_changed? || confidential_changed?` would return false for
new rows, thus never updating the counters.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/38061
|
| | |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Resolve "Handle if Auto DevOps domain is not set"
Closes #37894
See merge request gitlab-org/gitlab-ce!14319
|
| |/ |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | | |
Reorganize indexes for the "deployments" table
Closes #36877
See merge request gitlab-org/gitlab-ce!14348
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This removes the need for a default scope that adds a "WHERE project_id
= X" clause. This commit also includes an additional index for
Environment#last_deployment, ensuring this query uses just an index scan
instead of also applying a Filter.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36877
|
| | | |
|
|\ \ \
| |_|/
|/| |
| | |
| | |
| | |
| | | |
Implement job policy specifications
Closes #37280
See merge request gitlab-org/gitlab-ce!14265
|
| | | |
|
| | |
| | |
| | |
| | | |
Use project full path that can be received from a pipeline object
|
| | | |
|
|\ \ \
| |_|/
|/| |
| | |
| | |
| | |
| | | |
Allow updating of project auto devops settings
Closes #37893
See merge request gitlab-org/gitlab-ce!14291
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Updating didn't work, as the project_id was missing to be set for the
project_auto_devops model.
Fixes gitlab-org/gitlab-ce#37893
|
|\ \ \
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Eliminate N+1 queries in loading discussions.json endpoint
Closes #37955
See merge request gitlab-org/gitlab-ce!14327
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
In #37955,we see that the profile had a number of N+1 queries from repeated
access to `cross_reference_not_visible_for?`. This was optimized in previous
versions of GitLab by rendering all notes at once, counting the number of
visible references, and then using that number to check whether a system note
should be fully redacted.
There was also another N+1 query calling `ProjectTeam#member?`, which did not
take advantage of an optimization in prepare_notes_for_rendering that would
preload the maximum access level per project.
Closes #37955
|
|\ \ \ \
| |_|_|/
|/| | |
| | | |
| | | |
| | | |
| | | | |
Clean up read_registry scope changes
Closes #37789
See merge request gitlab-org/gitlab-ce!14307
|
| | | |
| | | |
| | | |
| | | | |
Closes #37789
|
|\ \ \ \
| |_|/ /
|/| | |
| | | |
| | | |
| | | |
| | | | |
Prepare Repository#merge for migration to Gitaly
Closes gitaly#559
See merge request gitlab-org/gitlab-ce!14154
|
| | |/
| |/| |
|
|\ \ \
| | | |
| | | |
| | | | |
# Conflicts:
# db/schema.rb
|
| |\ \ \
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Fix setting share_with_group_lock
Closes #37916
See merge request gitlab-org/gitlab-ce!14300
|
| | |/ /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Prior to this commit running
Namespace#force_share_with_group_lock_on_descendants would result in
updating _all_ namespaces in the namespaces table, not just the
descendants. This is the result of ActiveRecord::Relation#update_all not
taking into account the CTE. To work around this we use the CTE query as
a sub-query instead of directly calling #update_all.
To prevent this from happening the relations returned by
Gitlab::GroupHierarchy are now marked as read-only, resulting in an
error being raised when methods such as #update_all are used.
Fortunately on GitLab.com our statement timeouts appear to have
prevented this query from actually doing any damage other than causing
a very large amount of dead tuples.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/37916
|
| | | | |
|
| |\ \ \
| | |/ /
| |/| |
| | | |
| | | | |
SQL performance improvements for ProjectsController#show
See merge request gitlab-org/gitlab-ce!14226
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This ensures that if a pipeline is present for the last commit on a
project's homepage we only run 1 query to get the builds, instead of
running 2 queries.
See https://gitlab.com/gitlab-org/gitlab-ce/issues/36878#note_40073339
for more information.
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
This adds Project#latest_successful_pipeline_for and
Project#latest_successful_pipeline_for_default_branch. The 2nd method
memoizes the result (taking nil values into account) to ensure the
underlying query isn't executed multiple times when viewing a project's
homepage.
See https://gitlab.com/gitlab-org/gitlab-ce/issues/36878#note_40073607
for more information.
|
| |\ \ \
| | |_|/
| |/| |
| | | |
| | | |
| | | |
| | | | |
Constrain environment deployments to project IDs
Closes #36877
See merge request gitlab-org/gitlab-ce!14252
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
When querying the deployments of an environment the query Rails produces
will be along the lines of the following:
SELECT *
FROM deployments
WHERE environment_id = X
For queries such as this (or queries that use this as their base and add
more conditions) there is no meaningful index that can be used as long
as deployments.project_id is not part of a WHERE clause.
To work around this we change that "has_many :deployments" relation to
always add a "WHERE project_id = X" condition. This means that queries
filtering deployments can make better use of the existing indexes. For
example, when filtering by deployments.iid this will result in the
following query:
SELECT *
FROM deployments
WHERE environment_id = X
AND project_id = Y
AND iid = Z
This means PostgreSQL can use the existing index on
(project_id, environment_id, iid) instead of having to use a different
index (or none at all) and having to scan over a large amount of data.
Query plan wise this means that instead of this query and plan:
EXPLAIN (BUFFERS, ANALYZE)
SELECT deployments.*
FROM deployments
WHERE deployments.environment_id = 5
AND deployments.iid = 225;
Index Scan using index_deployments_on_project_id_and_iid on deployments (cost=0.42..14465.75 rows=1 width=117) (actual time=6.394..38.048 rows=1 loops=1)
Index Cond: (iid = 225)
Filter: (environment_id = 5)
Rows Removed by Filter: 839
Buffers: shared hit=4534
Planning time: 0.076 ms
Execution time: 38.073 ms
We produce the following query and plan:
EXPLAIN (BUFFERS, ANALYZE)
SELECT deployments.*
FROM deployments
WHERE deployments.environment_id = 5
AND deployments.iid = 225
AND deployments.project_id = 1292351;
Index Scan using index_deployments_on_project_id_and_iid on deployments (cost=0.42..4.45 rows=1 width=117) (actual time=0.018..0.018 rows=1 loops=1)
Index Cond: ((project_id = 1292351) AND (iid = 225))
Filter: (environment_id = 5)
Buffers: shared hit=4
Planning time: 0.088 ms
Execution time: 0.039 ms
On GitLab.com these changes result in a (roughly) 11x improvement in SQL
timings for the CI environment status endpoint.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/36877
|
| |\ \ \
| | | | |
| | | | |
| | | | |
| | | | | |
Rename Gitlab::Git::Committer to User
See merge request gitlab-org/gitlab-ce!14254
|
| | | | | |
|
| |\ \ \ \
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
Treat newlines as separators for pipeline emails service
Closes #37759
See merge request gitlab-org/gitlab-ce!14250
|
| | | |/ /
| | |/| |
| | | | |
| | | | |
| | | | | |
Before this fix, I don't know if those emails would work
having newlines in them.
|
| | |_|/
| |/| |
| | | |
| | | | |
This method was moved to ::Git but it is not cached there which causes performance problems
|
| |\ \ \
| | |_|/
| |/| |
| | | |
| | | |
| | | |
| | | | |
fix #34510 add association preloading for issue boards
Closes #34510
See merge request gitlab-org/gitlab-ce!14198
|
| | | |
| | | |
| | | |
| | | | |
added a QueryRecorder for IssuesController#index.json
|
| |\ \ \
| | |_|/
| |/| |
| | | |
| | | | |
Delete duplicated lines.
See merge request !14180
|
| | | | |
|