This means that if you're using replication to mirror a repo that
you're planning on failing over to for Gerrit use, and not just git,
you'll want to add "push = +refs/changes/*" to your replication config.
zach
> --~--~---------~--~----~------------~-------~--~----~
> To unsubscribe, email repo-discuss...@googlegroups.com
> More info at http://groups.google.com/group/repo-discuss?hl=en
> -~----------~----~----~----~------~----~------~--~---
>
Changesets that haven't been merged in yet are stored in refs/changes. Those don't get replicated by default. (I think refs/heads/* and refs/tags/* are the defaults for replication.)
The same SHA-1 hashes are present on the slave, so yes, fail over will
work with no loss.
The difference is due to the on-disk storage. There are two areas
where there will be differences:
- $GIT_DIR/refs/logs
These are different because Gerrit is writing to them on the master...
but the slave is writing to them with different timestamps and
different groups. The timestamps differ because there is a slight lag
between when Gerrit updates its local ref, and when it starts the push
to the slave. That lag means the slave's log will record a slightly
later time for the same change. The slave's log will also record the
user identity of the Gerrit replication user, not the user identity of
the end-user who originally pushed something to Gerrit. Also, the
slave log may differ slightly in its records, as Gerrit might batch up
multiple changes to a local ref within the same replication delay
window into a single push to the slave... so what was 3 records in the
Gerrit log file may be only 1 record in the slave's log file.
- $GIT_DIR/objects/...
Gerrit records every incoming object in a pack file. The standard C
git implementation might explode the incoming pack file into loose
objects. Its two different means of storing the same information, but
is still a difference to rsync. The pack files between the server and
the master could also still be different due to the batching I just
mentioned above. If two different users push to the same project
within the replication delay window, their 2 packs will be combined
into one when pushed to the slave. That means the slave will get only
1 pack file instead of 2, and will thus appear different to rsync, but
still have the same Git data.
I actually repack my master, and then rsync it to the slaves every so
often. The rsync to the slaves looks like this:
--<8--
#!/bin/sh
TOP=/srv/gerrit/repositories
RC=/srv/gerrit/replication.config
GERRIT_PORT=29418
DEST=$(git config --file "$RC" --list |
grep remote.*.url |
cut -d= -f2 |
grep -v :29418 |
sed 's,${name}.git,,')
for u in $DEST
do
echo $u
rsync -a --delete-after $TOP $u
ssh -q -p $GERRIT_PORT localhost gerrit replicate --all --url $u
done
-->8--
The reason for the replicate --all after the rsync is to ensure that
any replication which happened during the rsync isn't lost. Without
this line there is a tiny race condition during the rsync where rsync
may delete or overwrite data which Gerrit has tried to push to the
slave during the rsync. Asking gerrit to replicate all projects back
to the slave after the rsync is done means gerrit will fix up anything
which got missed.