SVN Mirror forgets to sync

SVN Mirror worked well in our tests. Now we have many repositories in sync and from time to time in some repositories the following behavior appears:

New Commits (created hours or days ago) from SVN do not appear in Bitbucket.
If we open the repository’s “SVN Mirror” configuration page, the synchronization starts directly and after a few seconds everything is up-to-date again.

Does anyone else sees this behavior? Is there anything we can do about it?

Hello Simon,
when you create a new SVN revision, indeed, sync doesn’t happen immediately periodically. By default, SVN Mirror app checks SVN for new revision once a minute, this value can be set up in “Poll interval” option:

Once SVN Mirror add-on checks for new SVN revisions, it schedules another check in a minute from that moment. If you create a new SVN revision moments before that scheduled check, you’ll experience immediate synchronization, while if you create that revision moments after the last check, the next sync will happen in approximately a minute.

The second thing influencing sync interval is threads pool size. By default, SVN Mirror add-on uses 8 threads for synchronization. This means that if you have e.g. 9 repositories with periodic sync scheduled to the same time, when that moment comes, 8 syncs will happen while the remaining 1 repository will wait in a queue until some of these 8 syncs finishes and some thread will become free again. So if you have hundreds of repositories, due to this effect, the effective “poll interval” might become much larger than the value you have in “Connection settings”. To overcome it, you can increase the number of sync threads. You can do that on “Global SVN Mirror setting page” (Administration [Gear icon] | SVN Mirror | Add-on Settings | Thread Pool Size).

Also on “Mirror Repositories” tab (Administration [Gear icon] | SVN Mirror | Mirror Repositories) of the same page you can see the list of all repositories and when the next sync is scheduled for each of them. Thus you can get understanding when the new SVN revisions will be translated.

Finally, if you want even more control over when the sync is scheduled. You can read SVN Mirror REST API documentation. Section 1 of this document is dedicated to a REST API call that would force sync (still, if there’s no free thread, it will be queued until a thread becomes available) immediately, without waiting for the “poll interval”. You can run this script, e.g. from SVN post-commit hook if you have access to the SVN server. Some of SubGit users even disable periodic poll, 100% relying on SVN hook and this mechanism.

If you experience behaviour that cannot be explained by anything above, please send us “svnmirror.log” from BITBUCKET_HOME/log/svnmirror.log. It would be nice if you could point, which part of the log corresponds to sync happening just because you’ve opened settings page. Before collecting the log, I would recommend you to set to to “debug” level: (Administration [Gear icon] | SVN Mirror | Add-on Settings | Troubleshooting | Enable Debug Logging). Though for normal day-to-day activities I would recommend you to keep debug logging disabled, otherwise the log could be too detailed and take too much space.

1 Like