0

I want to sync 2 svn repos bi-directional. The files stored in svn are small xml files, something like notes/sketches. The two repos are separated by a corporate firewall which limits my choices (e.g. no externals).

Even if i'm aware that this is not recommended by redbook & co i'm thinking about the following: - implement a post-commit hook that is set on both repos that - exports the commited files and commits them to the "other" repo (except the triggering commit is a sync commit itself)

I'm aware that there is the possibility of a conflicting situation, but in the given scenario that's very unlikely and can be detected and fixed manually.

What's really(:-)) worries me, is the fact that i cannot find such a solution online. Is it just because svn says "don't to this, it's dangerous" or am i missing something even more fundamental?

br woecki

woecki
  • 121
  • 2
  • Do you plan to support tags, svn copy, move, attribute changes etc etc? – Johan Lundberg Feb 06 '12 at 12:28
  • good questions! no moving and no attribute changes (at least no usecase comes into my mind). and if i'll throw a tag on one of the repos in the future it doesn't need to be synced. – woecki Feb 06 '12 at 12:39
  • You miss at least one thing. Exported **unversioned** files can not be commited to side-repo *easy, directly* – Lazy Badger Feb 07 '12 at 00:36

1 Answers1

0

Bidirectional write issues are more complex then they seem. Imagine a scenario where both sites are sitting at revision #1. A commit occurs at site1 and site2 at the same time. Site1 will using post-commit trigger will send revision #2 to site2, at site2 meanwhile it sends it's version of revision #2 via post-commit trigger to site1 create revision #3.

Now two very bad things happen, first you get into an infinite loop, each post-commit trigger will spawn another one, as site2 sends revision #3 than site1 will send it back as revision #4 and so on.

Second, you get into split-brain scenario. Meaning you have two very different revision #2's at each site. So the technology to do this ends up being very complicated which is why the simple solution is the master-slave approach where you only write to one spot.

If you need something more complex which can do bi-directional writing (active-active, versus active-passive) there is software to do that, try http://www.wandisco.com.

Alexander
  • 2,320
  • 2
  • 25
  • 33
Meep
  • 1