GitLab:备份 rake 任务是原子的吗? [英] GitLab: Is the backup rake task atomic?

查看:9
本文介绍了GitLab:备份 rake 任务是原子的吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用 进行 GitLab 备份gitlab:backup:create rake 任务就像有人推送到仓库一样,备份过程会不会受到影响?

If I make a GitLab backup using the gitlab:backup:create rake task just as someone is pushing to the repositories, will the backup process be affected?

在进行备份之前是否需要关闭 GitLab?

Is it necessary to shutdown GitLab before doing the backup?

推荐答案

任务 gitlab/backup.rake 本身看起来不是原子的.
它调用:

The task gitlab/backup.rake itself doesn't look atomic.
It calls:

  Rake::Task["gitlab:backup:db:create"].invoke
  Rake::Task["gitlab:backup:repo:create"].invoke

使用 gem activerecord:

    puts "Dumping database tables ... ".blue
    ActiveRecord::Base.connection.tables.each do |tbl|
    ...

与 ActiveRecord 的其他操作一样(请参阅this question),好像不是全局原子操作.

Like other operations with ActiveRecord (see this question), it doesn't seem to be a global atomic operation.

等一下,几个小时前,randx (Dmitriy Zaporozhets),GitLab 的主要开发人员,刚刚重构转储数据库:

Hold on, a few hours ago, randx (Dmitriy Zaporozhets), main developer for GitLab, just refactored the dumping a database:

  • commit 38d23c0e5f816937047c9326f9dd33fb10490032 shows the use of the system call mysqldump:
    system("mysqldump #{mysql_args} #{config['database']} > #{db_file_name}")
  • commit c33d5e16fe5f5dde4f270adaf7fb6fe5b9552018 add GRANT SELECT, LOCK TABLES, ...

所以转储数据库的部分现在更加原子;)
但是备份本身,包括备份裸仓库在内的其他步骤,并不是原子的.

So the part dumping the database is now more atomic ;)
But the backup itself, which involves other steps including backing up the bare repos, is not atomic.

这篇关于GitLab:备份 rake 任务是原子的吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆