James Stocks wrote on Thu, 10 Sep 2020 15:01 +0100:
> [...], this wrongly asserts that the mirror is out of
> sync during the brief window when the mirror hasn't caught up.
>
> We would like to find a way of inspecting the time of a given commit
> being successfully synchronised to a mirror as opposed to the
> timestamp of the commit itself. We think that this might be stored as
> metadata in the subversion filesystem.
No, that timestamp isn't stored. However, you could write a simple
post-commit hook to record it.
> Alternatively, is it possible
> to inspect the SVN repo on the mirror and determine the time of the
> most recent successful svnsync?
Yes, it's possible. However, before I say how, I'll stress the
post-commit solution is preferable to the following one.
The following solution relies on implementation details: Check
$REPOS_DIR/{format,db/fs-type,db/format} in this order, then check the
timestamp of $REPOS_DIR/db/current. That file is updated whenever and
only when $REPOS_DIR is committed to (revprop changes don't count).
> I am aware that we could check the
> return code of svnsync running on the master, however, we need to be
> able to check this on the mirror end of the process.
>
What you can do is inspect the svn:sync-* revprops on r0 of the mirror —
svn:sync-lock, svn:sync-last-merged-rev, & svn:sync-currently-copying —
and cross-reference them with `svnlook youngest` on the mirror, and
with whether there's an active TCP connection to whichever IP svnsync
runs on. (The last part is needed in case svnsync exits abnormally,
leaving a stale svn:sync-currently-copying behind. The next «svnsync
sync» run will DTRT in such cases, but your monitoring will
nevertheless want to detect them.)
> We would appreciate advice anyone has with this situation, or tips
> from anyone who has dealt with anything similar.
Yet another solution is to push commit notifications (using svnpubsub,
post-commit emails, or anything else) to the the host that runs svnsync
(in your case it's the master, but svnsync can also be run from the
mirror or from a third host) and _then_ monitor the exit code of svnsync.
Cheers,
Daniel
Received on 2020-09-11 04:55:37 CEST