Should a call to SVNSYNC be blocking or not in a post-commit hook?
I've set up mirroring of my repository and it works nicely but I've had an issue recently.
The target repository was left with an unreleased lock somehow - from what I read this may be caused by an abort to the svnsync operation and I suspect it may be because in my post-commit hook I'm executing svnsync 开发者_如何学编程in blocking mode rather then pushing it into the background via &.
I do this so that the user can be sure that if the commit finished then it's in all repositories now but maybe it introduces a risk of them hitting cancel and stopping the commit hook?
I can't find clear guidelines or suggestions on which is better or what the best practice is or even if hitting cancel can cause an abort of the post commit hook and the sync executed from it - in most places I see people using & to kick of the sync in the background - does this prevent the lock corruption in case a user presses cancel to his commit while the sync is in progress? How do you make sure both repositories are really in sync or report issues? Do you need a separate notification mechanism for that?
Update:
From the two above options I decided to chose the third ;)
I'm calling svnsync in the background but at the same time I make the hook wait for it to finish:
svnsync ... &
wait $!
I think this nicely joins the best of both worlds but time will show how effective it'll be - please let me know what you think about the whole issue and what suggestions you might have to share about it.
The post commit hook as the name implies runs after the complete commit and new revision in the source repository has been created. So the questions is: Who should how press the "abort" button? On the other hand why do you do a blocking operation? I would synchronize e.g. every 15 Minutes etc. independant of the commit...If you really new the other way what about Write-Through-Proxy ? The most important questions is why do you need a such synchronization with every commit?
精彩评论