9

We have GitLab CE 9.1.2 installed on our server where a backup is scheduled to run every 8:00 PM Mon-Fri. So far things are fine but yesterday we started using the Wiki. I double checked the backup file and somehow it had the exact same size as the backup the previous day (nothing was done in the system other than creating Wiki pages).

Because of that I suspected that the Wiki wasn't included in the backup process so I opened up a VM and tried to restore the backup file. After the successful operation I went over to the Wiki section of the project and it was empty.

I was reading some resources and they say the repo shouldn't be empty for the Wiki to be included but our repo is full of codes, commits, branches, issues, etc. I followed the backup instructions for the Omnibus installation because that's what we have.

0 20 * * 1-5 /opt/gitlab/bin/gitlab-rake gitlab:backup:create CRON=1

As you could see I didn't include any SKIP environment variable so it shouldn't skip anything. Am I missing something? I followed the instructions properly. I need a full backup of the system.

halfer
  • 19,824
  • 17
  • 99
  • 186
dokgu
  • 4,957
  • 3
  • 39
  • 77
  • 2
    There is a bug files just 3 months ago: [Some repositories (esp. wikis) are skipped from backup but they aren't empty](https://gitlab.com/gitlab-org/gitlab-ce/issues/28854) – fedorqui Jun 05 '17 at 13:50
  • So I wonder why this bug isn't being considered a critical bug? 3 months in and still no fix? – dokgu Jun 05 '17 at 13:53
  • 2
    Agreed and in fact it is not the first time: 3 years ago in [$repo.wiki is not backed up, when $repo is empty and skipped](https://gitlab.com/gitlab-org/gitlab-ce/issues/20) someone said _This should be high priority and not be present 3 months after reporting with 3 versions coming out since_. – fedorqui Jun 05 '17 at 13:56

1 Answers1

6

From the link @fedorqui provided it looks like this is an issue with the cache not being flushed out when you create a Wiki and so the backup process sees the Wiki as being empty therefore skipped.

To fix this it looks like we manually have to flush the cache ourselves.

sudo gitlab-rails console
p = Project.find_by_full_path 'namespace_path/project_path'
wiki = ProjectWiki.new p
wiki.repository.empty?
wiki.repository.expire_all_method_caches
wiki.repository.empty?

The first time you run wiki.repository.empty? it will return true which is why the backup process skips the Wiki. After running wiki.repository.expire_all_method_caches you should be good to go (I tried this and our Wiki is now being backed up). If you'd like to confirm that everything does look good, simply run the wiki.repository.empty? again and it should return false this time.

As of June 5, 2017 it seems like the bug hasn't been fixed yet.


Update (August 22, 2017)

GitLab CE 9.5.0 has been released (changelog) which has the fix for this issue. If you don't want to manually have to expire the cache I recommend that you upgrade your GitLab installation to at least v9.5.0 and you should be fine.

dokgu
  • 4,957
  • 3
  • 39
  • 77