You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Ron T <ro...@gmail.com> on 2019/08/09 18:45:30 UTC

Recommended method to keep an svn mirror in sync per commit?

Hi, What is the recommended method to keep an svn mirror in sync each time
a user commits? I have about 20 users posting commits throughout the day
and I would like to have the svn mirror duplicate or copy the current
commit from the source repo. I've tried putting this line in the source
repo post-commit file.
*svnsync sync file:///mnt/svn_mirror/* where svn_mirror is the target repo
but end up getting this error.

svnsync sync file:///mnt/svn_mirror/
Transmitting file data .....svnsync: E160004: Corrupt representation
'366133 106082 55 1620 4bd1fbfd9712b0660edfb5f56e9ef672'
svnsync: E160004: Malformed representation header

If I run the *svnsync sync file:///mnt/svn_mirror/* manually it works fine
and if I run it on a less frequently used repository it works fine, but I'm
guessing that when there are more users committing at a time or commits are
taking a longer period of time it may cause an issue? Could it also be a
date/time issue where if the date of the last synced revision on the target
is too far behind the source, the next svnsync will fail?

Both the source repo and the mirror target repo are on the same server.

Other recommended methods to accomplish this? Maybe svn notify?
Thanks!


My environment is:
- svn 1.11.0
- httpd-2.4.6
- CentOS 7 64bit

Re: Recommended method to keep an svn mirror in sync per commit?

Posted by Branko Čibej <br...@apache.org>.
On 10.08.2019 21:57, Ryan Schmidt wrote:
> And you'll want the spawned task to be a wrapper script around svnsync that somehow ensures (with some kind of lock?) that only one copy of the script is running at a time.

'svnadmin freeze' on the target repository would do that.

-- Brane


Re: Recommended method to keep an svn mirror in sync per commit?

Posted by Ryan Schmidt <su...@ryandesign.com>.

On Aug 9, 2019, at 13:45, Ron T wrote:

> Hi, What is the recommended method to keep an svn mirror in sync each time a user commits? I have about 20 users posting commits throughout the day and I would like to have the svn mirror duplicate or copy the current commit from the source repo. I've tried putting this line in the source repo post-commit file.
> svnsync sync file:///mnt/svn_mirror/ where svn_mirror is the target repo but end up getting this error.
> 
> svnsync sync file:///mnt/svn_mirror/
> Transmitting file data .....svnsync: E160004: Corrupt representation '366133 106082 55 1620 4bd1fbfd9712b0660edfb5f56e9ef672'
> svnsync: E160004: Malformed representation header

That would have been my suggestion. I'm not sure why it doesn't work. I'm sure someone else will chime in with suggestions for diagnosing that. What kind of file system is this?

In the mean time, though, as a workaround, you could try delaying for a few seconds before running svnsync.

Remember also that the user's svn command does not return a successful result until after your post-commit hook finishes running. The user doesn't really need to be around for the svnsync operation, so you could spawn the sync off into a background task using "&". There are a couple things to keep in mind with that: You need to redirect the stdin, stdout and stderr of that spawned-off background task to /dev/null, otherwise the post-commit won't end until the spawned task does. And you'll want the spawned task to be a wrapper script around svnsync that somehow ensures (with some kind of lock?) that only one copy of the script is running at a time.