Commit Graph

75 Commits

Author SHA1 Message Date
GitLab Bot ed00b1a6a3 Add latest changes from gitlab-org/gitlab@master 2020-07-28 12:09:49 +00:00
GitLab Bot 448ff1fb83 Add latest changes from gitlab-org/gitlab@master 2020-07-22 03:09:40 +00:00
GitLab Bot f9cda7671c Add latest changes from gitlab-org/gitlab@master 2020-07-14 21:09:03 +00:00
GitLab Bot fcda041fc0 Add latest changes from gitlab-org/gitlab@master 2020-07-09 12:08:56 +00:00
GitLab Bot c52b72f577 Add latest changes from gitlab-org/gitlab@master 2020-07-08 12:09:33 +00:00
GitLab Bot 4d8bd36aa2 Add latest changes from gitlab-org/gitlab@master 2020-07-07 03:09:32 +00:00
GitLab Bot 2a53c24c51 Add latest changes from gitlab-org/gitlab@master 2020-06-26 15:08:45 +00:00
GitLab Bot 5d6119a1a4 Add latest changes from gitlab-org/gitlab@master 2020-06-25 00:09:26 +00:00
GitLab Bot 72721699f1 Add latest changes from gitlab-org/gitlab@master 2020-02-18 00:09:20 +00:00
GitLab Bot 6b9d3a4e83 Add latest changes from gitlab-org/gitlab@master 2020-01-29 18:08:47 +00:00
GitLab Bot 96b0c1245c Add latest changes from gitlab-org/gitlab@master 2020-01-10 12:07:47 +00:00
GitLab Bot cfc792b9ca Add latest changes from gitlab-org/gitlab@master 2019-12-10 07:53:40 +00:00
GitLab Bot b4e072cbaf Add latest changes from gitlab-org/gitlab@master 2019-10-11 06:06:27 +00:00
GitLab Bot 80f61b4035 Add latest changes from gitlab-org/gitlab@master 2019-09-18 14:02:45 +00:00
GitLab Bot b7dfe2ae40 Add latest changes from gitlab-org/gitlab@master 2019-09-13 13:26:31 +00:00
Robert Speicher 7698d40550
Merge branch 'master' of dev.gitlab.org:gitlab/gitlabhq 2019-08-29 17:17:37 -05:00
Tiger 08fcb2379e CE port: allow SRV records in DB service discovery 2019-08-23 14:19:51 +10:00
Alexandru Croitor 5af535d919 Limit the size of issuable description and comments
Limiting the size of issuable description and comments to 1_000_000,
which is close to ~1MB of ASCII characters, which represents 99.9% of
all descriptions and comments we have in DB at the moment. This should
help prevent DoS attacks when comments contain refference strings.

Also this change updates regexp matching the namespaces paths by
limiting the namespaces paths to Namespace::NUMBER_OF_ANCESTORS_ALLOWED,
as we allow 20 levels deep groups.

see https://gitlab.com/gitlab-org/gitlab-ce/issues/61974#note_191274234
2019-08-22 10:43:13 +03:00
Andreas Brandl 988dc80585
Further remove code branches by database type
We dropped MySQL support and a lot of mysql specific code has been
removed in https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/29608.

This comes in from the other direction and removes any `if postgresql?`
branches.
2019-07-29 12:47:06 +02:00
Nick Thomas 4aa76dddec
Remove dead MySQL code
None of this code can be reached any more, so it can all be removed
2019-07-23 16:53:03 +01:00
Andreas Brandl e13f07f195 Merge branch 'js-specs-transactions' into 'master'
Use transactions in JS feature specs

Closes #60207

See merge request gitlab-org/gitlab-ce!27496
2019-07-12 13:30:42 +00:00
Heinrich Lee Yu d4a919679a Use transactions in JS feature specs
Uses Rails transactional tests instead of DatabaseCleaner
transaction strategy because that doesn't work with JS tests
2019-07-12 10:39:14 +08:00
Heinrich Lee Yu aeb67dd489 Upgrade to Rails 5.2
Updates changed method names and fixes spec failures
2019-07-12 10:15:31 +08:00
Mayra Cabrera 0ab89d8e36 Add a rubocop for Rails.logger
Suggests to use a JSON structured log instead

Related to https://gitlab.com/gitlab-org/gitlab-ce/issues/54102
2019-07-10 19:26:47 +00:00
DJ Mountney af28465556 Fix extra newline left by conflict resolution 2019-06-28 16:28:45 +00:00
DJ Mountney c1b1a1fb5e Merge branch 'master' into 'check-min-schema-migrate'
# Conflicts:
#   lib/gitlab/database.rb
2019-06-28 16:27:39 +00:00
Andrew Newdigate 56ae34e49b Adds metrics to measure database transactions
Currently we don't have good insight into the affect of Rails
transaction blocks on the application. If these blocks are held open for
extended periods, they can have detrimental effects on the application.

This change will allow us to track these transactions, with the aim
of reducing their duration.
2019-06-28 12:46:51 +02:00
DJ Mountney de93bf1fbb Update comments and docs around min schema version
Fixed some spelling
Dropped rake task description for a prefix only task
Added note on skipping the check to the postgres debugging dev doc
2019-06-25 10:44:40 -07:00
DJ Mountney f4e1553519 Move min schema version check to db:migrate
Rather than have it checked only as part of gitlab:db:configure, we will
instead have it as a pre-req for every db:migrate command
2019-06-25 10:44:40 -07:00
DJ Mountney 7a089438fa Check supported version when migrating
Set the mininum supported migration version to be the schema version as
of 11.11.0, and errors you if that is not detected during
gitlab:db:configure
2019-06-25 10:44:40 -07:00
Andrew Newdigate 84cb1bdaed Refactor inside_transaction? to Gitlab::Database
This is a small change to move AfterCommitQueue.inside_transaction?
to Gitlab::Database.inside_transaction? Since this change is required
by different changes which may not arrive in sequence, it's easier
to extract this change out on it's own.
2019-06-25 09:15:35 +00:00
Douglas Barbosa Alexandre a86f48c79b
Add helper method to return a human-friendly name for database adapter 2019-03-21 19:03:26 -03:00
Ash McKenzie 26134eeece Rename pg_stat_wal_receiver_supported? DB helper
From pg_stat_wal_receiver_supported? to
postgresql_minimum_supported_version?

Also add test coverage
2019-03-14 15:25:05 +00:00
Jasper Maes 56296f1eda Remove rails4 specific code 2018-12-16 10:48:41 +01:00
Douglas Barbosa Alexandre 5f8423dd85
CE port of 'Move EE specific code from Gitbab::Database into ee' 2018-11-26 17:14:05 -02:00
gfyoung c858f70d07 Enable frozen string for lib/gitlab/*.rb 2018-10-22 07:00:50 +00:00
DJ Mountney 76cfe4f1fd Ensure the schema is loaded with post_migrations included
If doing a schema load, the post_migrations should also be marked as up,
even if SKIP_POST_DEPLOYMENT_MIGRATIONS was set, otherwise future
migration runs will be broken.
2018-09-11 18:41:14 -07:00
Yorick Peterse 2ade035eb2
Backport various EE changes to Gitlab::Database
These changes are useful for CE as well. For example, the MR
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/20720 can make
use of some of the backported methods.
2018-07-24 13:25:01 +02:00
Brett Walker fd2ea94f60 Ability to check if underlying database is read only 2018-07-06 17:07:49 +00:00
Jarka Kadlecová fa36101a7f Use data_source_exists? instead of table_exists?
Use data_source_exists? where possible instead of table_exists? in order to be Rails5 compatible
2018-06-14 08:39:43 +02:00
Yorick Peterse 63c58a6dd0
Memoize Gitlab::Database.version
This removes the need for running a database query every time we want to
check the database version.
2018-05-17 21:23:42 +02:00
Stan Hu 272783be20 Cache table_exists?('application_settings') to reduce repeated schema reloads
Closes #43355
2018-03-15 13:13:00 -07:00
Stan Hu 4acbc9410d Cache column_exists? for application settings
This is most a backport of
https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/4987/diffs but includes
other columns that use column_exists? in a way that may cause unnecessary
schema loads.
2018-03-15 12:51:39 -07:00
Stan Hu 29e39e55c3 Merge branch 'mk-add-old-attachments-to-uploads-table' into 'master'
Add old files to uploads table

See merge request gitlab-org/gitlab-ce!15270
2017-12-07 02:34:58 +00:00
Brett Walker 02d97d4621 add Gitlab::Database.replication_slots_supported? 2017-12-05 16:43:47 +00:00
Michael Kozono e5cf23dfcf Ensure consistent column order 2017-12-01 15:26:42 -08:00
Michael Kozono 3694fe0f3d Don’t quote `NOW()` for created_at column
To fix for MySQL.
2017-12-01 15:26:42 -08:00
Yorick Peterse bda30182e0
Add returning IDs to Gitlab::Database.bulk_insert
This adds the keyword argument "return_ids" to
Gitlab::Database.bulk_insert. When set to `true` (and PostgreSQL is
used) this method will return an Array of the IDs of the inserted rows,
otherwise it will return an empty Array.
2017-11-07 22:28:57 +01:00
Alejandro Rodríguez 1796936abc Handle large values on `MergeRequestDiffCommit` dates 2017-10-30 21:13:39 -03:00
Toon Claes d13669716a Create idea of read-only database
In GitLab EE, a GitLab instance can be read-only (e.g. when it's a Geo
secondary node). But in GitLab CE it also might be useful to have the
"read-only" idea around. So port it back to GitLab CE.

Also having the principle of read-only in GitLab CE would hopefully
lead to less errors introduced, doing write operations when there
aren't allowed for read-only calls.

Closes gitlab-org/gitlab-ce#37534.
2017-10-06 22:37:40 +02:00