summaryrefslogtreecommitdiff
path: root/doc/development
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-03-02 12:07:57 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-03-02 12:07:57 +0000
commit988b28ec1a379d38f6ac9ed04886ee564fd447fd (patch)
tree9d93267209387e62d23ea7abf81ef9c0d64f2f0b /doc/development
parenta325f3a104748ecc68df7c3d793940aa709a111f (diff)
downloadgitlab-ce-988b28ec1a379d38f6ac9ed04886ee564fd447fd.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'doc/development')
-rw-r--r--doc/development/README.md1
-rw-r--r--doc/development/database_review.md2
-rw-r--r--doc/development/migration_style_guide.md4
-rw-r--r--doc/development/rails_initializers.md16
4 files changed, 18 insertions, 5 deletions
diff --git a/doc/development/README.md b/doc/development/README.md
index 01dff0c2017..6121ddf3ed6 100644
--- a/doc/development/README.md
+++ b/doc/development/README.md
@@ -97,6 +97,7 @@ Complementary reads:
- [Issue types vs first-class types](issue_types.md)
- [Application limits](application_limits.md)
- [Redis guidelines](redis.md)
+- [Rails initializers](rails_initializers.md)
## Performance guides
diff --git a/doc/development/database_review.md b/doc/development/database_review.md
index 77e5060720b..4e97e5961b6 100644
--- a/doc/development/database_review.md
+++ b/doc/development/database_review.md
@@ -187,4 +187,4 @@ NOTE: **Note:** Keep in mind that all runtimes should be measured against GitLab
|----|----|---|
| Regular migrations on `db/migrate` | `3 minutes` | A valid exception are index creation as this can take a long time. |
| Post migrations on `db/post_migrate` | `10 minutes` | |
-| Background migrations | --- | Since these are suitable for larger tables, it's not possible to set a precise timing guideline, however, any query must stay well below `10s` of execution time. |
+| Background migrations | --- | Since these are suitable for larger tables, it's not possible to set a precise timing guideline, however, any single query must stay below `1 second` execution time with cold caches. |
diff --git a/doc/development/migration_style_guide.md b/doc/development/migration_style_guide.md
index f3f46baa54f..3f202115b4c 100644
--- a/doc/development/migration_style_guide.md
+++ b/doc/development/migration_style_guide.md
@@ -432,10 +432,6 @@ default values if absolutely necessary. There is a RuboCop cop that will fail if
this method is used on some tables that are very large on GitLab.com, which
would cause other issues.
-For a small table (such as an empty one or one with less than `1,000` records),
-use `add_column` and `change_column_default` in a single-transaction migration,
-combining it with other operations that don't require `disable_ddl_transaction!`.
-
## Changing the column default
One might think that changing a default column with `change_column_default` is an
diff --git a/doc/development/rails_initializers.md b/doc/development/rails_initializers.md
new file mode 100644
index 00000000000..6473baf58d4
--- /dev/null
+++ b/doc/development/rails_initializers.md
@@ -0,0 +1,16 @@
+# Rails initializers
+
+By default, Rails loads Zeitwerk after the initializers in `config/initializers` are loaded.
+Autoloading before Zeitwerk is loaded is now deprecated but because we use a lot of autoloaded
+constants in our initializers, we had to move the loading of Zeitwerk earlier than these
+initializers.
+
+A side-effect of this is that in the initializers, `config.autoload_paths` is already frozen.
+
+To run an initializer before Zeitwerk is loaded, you need put them in `config/initializers_before_autoloader`.
+Ruby files in this folder are loaded in alphabetical order just like the default Rails initializers.
+
+Some examples where you would need to do this are:
+
+1. Modifying Rails' `config.autoload_paths`
+1. Changing configuration that Zeitwerk uses, e.g. inflections