Skip to content
GitLab
菜单
为什么选择 GitLab
定价
联系销售
探索
为什么选择 GitLab
定价
联系销售
探索
登录
获取免费试用
主导航
搜索或转到…
项目
GitLab
管理
动态
成员
标记
计划
议题
议题看板
里程碑
迭代
需求
代码
合并请求
仓库
分支
提交
标签
仓库图
比较修订版本
代码片段
锁定的文件
构建
流水线
作业
流水线计划
测试用例
产物
部署
发布
Package registry
Container registry
模型注册表
运维
环境
Terraform 模块
监控
事件
服务台
分析
价值流分析
贡献者分析
CI/CD 分析
仓库分析
代码评审分析
议题分析
洞察
模型实验
效能分析
帮助
帮助
支持
GitLab 文档
比较 GitLab 各版本
社区论坛
为极狐GitLab 提交贡献
提交反馈
隐私声明
快捷键
?
新增功能
4
代码片段
群组
项目
显示更多面包屑
gitlab-cn
GitLab
提交
262bcdd6
提交
262bcdd6
编辑于
5 years ago
作者:
Mayra Cabrera
浏览文件
操作
下载
差异文件
Merge branch 'update-background-migrations-docs' into 'master'
Updates background migration docs See merge request gitlab-org/gitlab!21354
上级
19bf148a
5607c555
No related branches found
No related tags found
无相关合并请求
变更
2
隐藏空白变更内容
行内
左右并排
显示
2 个更改的文件
doc/development/background_migrations.md
+6
-1
6 个添加, 1 个删除
doc/development/background_migrations.md
doc/development/database_review.md
+6
-3
6 个添加, 3 个删除
doc/development/database_review.md
有
12 个添加
和
4 个删除
doc/development/background_migrations.md
+
6
−
1
浏览文件 @
262bcdd6
...
...
@@ -16,10 +16,15 @@ migrations automatically reschedule themselves for a later point in time.
> the migrations.
In the vast majority of cases you will want to use a regular Rails migration
instead. Background migrations should
_only_
be used when migrating _data_ in
instead. Background migrations should be used when migrating _data_ in
tables that have so many rows this process would take hours when performed in a
regular Rails migration.
Background migrations _may_ also be used when executing numerous single-row queries
for every item on a large dataset. Typically, for single-record patterns, runtime is
largely dependent on the size of the dataset, hence it should be split accordingly
and put into background migrations.
Background migrations _may not_ be used to perform schema migrations, they
should only be used for data migrations.
...
...
此差异已折叠。
点击以展开。
doc/development/database_review.md
+
6
−
3
浏览文件 @
262bcdd6
...
...
@@ -103,10 +103,13 @@ and details for a database reviewer:
need to fit comfortably within
`15s`
- preferably much less than that - on GitLab.com.
-
For column removals, make sure the column has been
[
ignored in a previous release
](
what_requires_downtime.md#dropping-columns
)
-
Check
[
background migrations
](
background_migrations.md
)
:
-
Establish a time estimate for execution on GitLab.com.
-
They should only be used when migrating data in larger tables
.
-
If a single
`update`
is below than
`1s`
the query can be placed
-
Establish a time estimate for execution on GitLab.com.
For historical purposes,
it's highly recommended to include this estimation on the merge request description
.
-
If a single
`update`
is below than
`1s`
the query can be placed
directly in a regular migration (inside
`db/migrate`
).
-
Background migrations are normally used, but not limited to:
-
Migrating data in larger tables.
-
Making numerous SQL queries per record in a dataset.
-
Review queries (for example, make sure batch sizes are fine)
-
Because execution time can be longer than for a regular migration,
it's suggested to treat background migrations as post migrations:
...
...
此差异已折叠。
点击以展开。
预览
0%
加载中
请重试
或
添加新附件
.
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
保存评论
取消
想要评论请
注册
或
登录