GitLab: Is the backup rake task atomic?

夙愿已清 提交于 2020-01-01 09:35:31

问题


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?

Is it necessary to shutdown GitLab before doing the backup?


回答1:


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

That uses the gem activerecord:

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

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


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.



来源:https://stackoverflow.com/questions/15825735/gitlab-is-the-backup-rake-task-atomic

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!