Each repository has an address which other repositories use to contact it. These addresses are made up of a host and a port and are written "host:port". They're used with vrepl's -s flag and the -R flag used with many of the repository tools.
These addresses are automatically recorded by the repository in the master-repository attributes which are used by peer repositories to locate the repository with the master copy of an object. They're also used in the #replicate-from, #replicate-from-noac, #mastership-from, and #mastership-to attributes which control which peer repositories your repository can interact with. (See RemoteCheckoutSetup.)
In some cases your repository may need to change its address.
- Perhaps your company gets acquired or just changes its domain name.
- Perhaps you need to retire an old server and don't have enough control over your DNS infrastructure to preserve the old hostname.
- Maybe you've decided to switch from using the actual hostname of the server to a DNS CNAME (a hostname alias) to make it easier to move to a new server in the future.
If this happens, you'll need to update the attributes which contain repository addresses.
fixup-master-repos.pl is a script which can correct the master-repository attributes for you. There are two ways to use it:
"fixup-master-repos.pl" by itself will find all the objects mastered in the local repository and correct their master-repository attributes. This is how you should use it on the repository which is having its address changed.
"fixup-master-repos.pl -o oldhost[:oldport] -n newhost[:newport]" will find any master-repository attributes which contain the address "oldhost[:oldport]" and replace it with "newhost[:newport]". This is how you should use it on peer repositories which contain replicas of objects mastered in the repository having its address changed.
There are a few things which this script does not do which perhaps it should:
Propagate the updated master-repository attributes to peer repositories. The purpose of those attributes are to allow non-master replicas to locate the master replica, so updating them solely in the local repository doesn't help the peers at all.
Update the #replicate-from, #replicate-from-noac, #mastership-from, and #mastership-to attributes with the new repository address. (This could probably only work with the -o/-n options, as without those the script doesn't know the old address to replace.) Maybe this should be optional, or ask for confirmation, as automatically modifying access controls could be a security risk.
Update the checkout-from and checkout-to attributes on the version reservation stubs of active checkouts. checkout-from is used by vcheckin to replicate new versions back to the remote master repository. checkout-to is used in informational messages generated by some tools.