Recently a user sent me a puzzling bit of output from vmkdir:
Creating directory /vesta/example.com/foo/bar at vesta2.example.com:21776
vmkdir: /vesta/example.com/foo/bar: Not master replica
At first I didn't understand this, as vmkdir searches for the master repository of the parent directory and should have located the correct one. I considered all sorts of strange possibilities like a race with mastership transfer or some sort of hostname resolution problem, but it turned out to be much simpler than that: the directory the user was trying to create already existed in the master repository. vmkdir really needs to test for this case and not try to create the directory. It should probably replicate it locally as a favor to the user in that case, though it should try to replicate a real copy of it rather than a ghost or a stub.
The existing directory was not master at the repository with mastership of the parent directory, because it had previously had its mastership transferred to another repository. Because vmkdir was trying to insert a master appendable directory and the existing object was non-master, the operation returned VestaSource::notMaster. This just added to the confusion.