Joey Hess: difficulties in backing up live git repositories
But you can t just tar.gz up the bare repositories on the server and hope for the best. Maybe a given repository will be in a valid state; maybe it won t.-- Jeff Mitchell in a followup to the recent KDE near git disaster This was a surprising statement to me. I seem to remember that one of (many) selling points for git talked about back in the day was that it avoided the problem that making a simple
cp (or backup) of a repository
could lead to an inconsistent result. A problem that subversion
repositories had, and required annoying commands to work around.
(svnadmin $something -- iirc the backend FSFS fixed or avoided most of
this issue.)
This prompted me to check how I handle it in
ikiwiki-hosting. I must have
anticipated a problem at some point, since ikisite backup takes care
to lock the git repository in a way that prevents eg, incoming pushes
while a backup is running. Probably, like the KDE developers, I was
simply exercising reasonable caution.
The following analysis has probably been written up before (train; limited
network availability; can't check), but here are some scenarios to consider:
- A non-bare repository has two parts that can clearly get out of sync
during a backup: The work tree and the
.gitdirectory.- The
.gitdirectory will likely be backed up first, sincegetdirentwill typically return it first, since it gets created first . If a change is made to the work tree during that backup, and committed while the work tree is being backed up, the backup won't include that commit -- which is no particular problem and would not be surprising upon restore. Make commit again and get on with life. - However, if (part of) the work tree is backed up before
.git, then any changes that are committed to git during the backup would not be reflected in the restored work tree, andgit diffwould show a reversion of those changes. After restore, care would need to be taken to reset the work tree (without losing any legitimate uncommitted changes).
- The
- A non-bare repository can also become broken in other ways if just
the wrong state is snapshotted. For example, if a commit is in progress
during a backup,
.git/index.lockmay exist, and prevent future commits from happening, until it's deleted. These problems can also occur if the machine dies at just the right time during a commit. Git tells you how to recover. (git could go further to avoid these problems than it does; for example it could check if.git/index.lockis actually locked using fcntl. Something I do in git-annex to make the.git/annex/index.lockfile crash safe.) - A bare repository could be receiving a push (or a non-bare repository
a pull) while the backup occurs. These are fairly similar cases,
with the main difference being that a non-bare repository has the reflog,
which can be used to recover from some inconsist states that could be
backed up. Let's concentrate on pushes to bare repositories.
- A pack could be in the process of being uploaded during a backup. The KDE developers apparently worried that this could result in a corrupt or inconsistent repository, but TTBOMK it cannot; git transfers the pack to a temp file and atomically renames it into place once the transfer is complete. A backup may include an excess temp file, but this can also happen if the system goes down while a push is in progress. Git cleans these things up.
- A push first transfers the
.git/objects, and then updates.git/refs. A backup might first back up the refs, and then the objects. In this case, it would lose the record that refs were pushed. After being restored, any push from another repository would update the refs, even using the objects that did get backed up. So git recovers from this, and it's not really a concern. - Perhaps a backup chooses to first back up the objects, and then the
refs. In this case, it could back up a newly changed ref, without
having backed up the referenced objects (because they arrived
after the backup had finished with the objects). When this happens,
your bare repository is inconsistent; you have to somehow hunt down
the correct ref for the objects you do have.
This is a bad failure mode. git could improve this, perhaps, by
maintaining a reflog for bare repositories. (Update:
core.logAllRefUpdatescan be set to true for bare repositories, but is disabled by default.)
- A "backup" of a git repository can consist of other clones of it.
Which do not include
.git/hooks/scripts,.git/configsettings, and potentially other valuable information, that strangely, we do not check into revision control despite having this nice revision control system available. This is the most likely failure mode with "git backups". :P
PS: git-annex is itself entirely crash-safe, to the best of my abilities, and also safe for naive backups. But inherits any problems with naive backups of git repositories.
there are not many RC bugs left (yeah!), this also means that my work in
this area was rather minimal last week:
On wednesday 7. of November I gave a talk at EPFSUG in Brussels about
FreedomBox.
EPFSUG is an interest group of Free Software users working inside the
European Parliament.
The FreedomBox is a project to help non-geeks care about their
personal privacy when online, same ways as geeks have practiced for a
decade or more.
The goal is a small, cheap physical box looking like and operating like
an internet gateway or wifi router many are accustomed to nowadays - but
with three additions:
The following is what I usually do when I want to debianize a Haskell stuff from Hackage. This is a personal recipe, by no means official procedure or such. I may be wrong, badly at that.
Some time ago, the
Given how Debian and Ubuntu nowadays enable IPv6 support by default, the routing table includes some IPv6 entries by standard. However, this has the unpleasant side-effect that lib C tries to connect to public IPv6 addresses, even in a case when the only IPv6 entries are for loopback and local link. Apparently, libc incorrectly assumes that the mere presence of any IPv6 means that there is a usable default IPv6 route. This results in, among other things, APT failing at fetching packages from the Debian repository if the DNS rotation returned the IPv6 address for the server first. I was thus wondering whether libc6 could be made to reject public IPv6 addresses, in cases when the host has no IPv6 gateway in its routing table? Or would there be a smarter way to prevent applications from failing at contacting IPv6 addresses whenever there is no IPv6 connection to the outside world?
People often ask me why I invest in low-tech, old-school investments like gold and silver bullion.
Surely for somebody working with technology every day, I would have some advantage in the world of investment?
The events of Cyprus this week should provide a clear answer: we've all been told that there is nothing safer than cash in the bank, protected by a Government deposit insurance scheme.
Yet it appears that in a pattern reminiscent of the
The 2008 British film
Back to the gold and silver. A recent report in 
Dear users and supporters of the backports service!
The Backports Team is pleased to announce the next important step on getting backports more integrated. People who are reading
I
After one week of campaign on -vote@, many subjects have been mentioned already. I m trying here to list the concrete, actionable ideas I found interesting (does not necessarily mean that I agree with all of them) and that may be worth further discussion at a less busy time. There s obviously some amount of subjectivity in such a list, and I m also slightly biased ;) . Feel free to point to missing ideas or references (when an idea appeared in several emails, I ve generally tried to use the first reference).
On the campaign itself, and having general discussions inside Debian:
A boy died.
He knew he was dying. He tried to get help. We don't know if it
occurred to him to switch off the modem and make a phone call, or
if he was too weak to get up and do it. We know he sent an email.
He didn't type perfect English at the best of times, and as his
life slipped away from him, he misspelled many things. He
misspelled ambulance . He may have misspelled diabetes .
That was all fine the meaning was clear enough but the bit where
it gets tragic is that he misspelled .net in the To: line.
So instead of arriving at its destination, the NOC of his employer,
where it would have opened up a ticket and been seen by a human
at some point, the email bounced.
We will never know whether they could have or would have done
anything in time. We will never know if, had whoever been on
postmaster duty at his ISP at the time been paying attention,
he could have been saved.
These things were debated angrily, by people struggling to
make sense of something, but it changes nothing. The email
bounced, and he died.
The XDG standard says user-specific data files should be written [in] $XDG_DATA_HOME which defaults to $HOME/.local/share.
The classic
While working on fixing a few encoding problems that I managed to
introduce to the BTS almost half a year ago, I took a side bit of
coding, and introduced