[rancid] control_rancid slow start

Robert Drake rdrake at direcpath.com
Mon Nov 10 06:10:15 UTC 2014


has anyone looked at the control_rancid script recently?   Here are some 
timestamps from an example run from me (with a couple of added date 
stamps to show where the time goes).  I'm only running rancid against 
one file, but there are 1400 total devices in the group.

rancid-run -r <gw1-test-node> <testgroup>

starting: Mon Nov 10 00:33:34 EST 2014
begin control_rancid: Mon Nov 10 00:33:34 EST 2014

Trying to get all of the configs. Mon Nov 10 00:35:33 EST 2014
All routers sucessfully completed.

cvs diff: Diffing .
cvs diff: Diffing configs
cvs commit: Examining .
cvs commit: Examining configs

ending: Mon Nov 10 00:35:37 EST 2014


If I comment the following code out it runs in less than 3 seconds:

# check for 'up' routers missing in RCS.  no idea how this happens to 
some folks
for router in `cut -d\; -f1 ../routers.up` ; do
     if [ $RCSSYS = cvs ] ; then
     cvs status $router | grep -i 'status: unknown' > /dev/null 2>&1
     else
     svn status $router | grep '^?' > /dev/null 2>&1
     fi
     if [ $? -eq 0 ] ; then
     touch $router
     if [ $RCSSYS = cvs ] ; then
         cvs add -ko $router
     else
         svn add $router
     fi
     echo "$RCSSYS added missing router $router"
     fi
done

Possible better option would be this (I think this will work with svn 
but I don't have a tree to test it on):

  cut -d: -f1 ../routers.up | xargs cvs status | grep -i 'status: unknown'

Example test case:

  (echo test ; cut -d: -f1 ../routers.up) | xargs cvs status | grep -i 
'status: unknown'
cvs status: nothing known about test
File: no file test              Status: Unknown


Another option might be to have a CLI argument that says "skip 
rebuilding router.db.* and checking CVS stuff because we're reasonably 
certain that is fine right now".  Finally, I would recommend abstracting 
most of the router.db.* rebuild into another script and rewriting it in 
perl because it's almost unreadable now.

I can submit patches if this is too much for informal email.

Thanks,
Robert


More information about the Rancid-discuss mailing list