master: Fix buggy handling of lost connections in shadow master

Shadow master shouldn't unload its metadata when it loses connection
with the active master server, because it may be useful for future
failover.

This commit postpones unloading metadata in the shadow master to the
moment when it receives a change that is not compatible with the
loaded metadata, eg. it's version is bigger than expected.

Master server is modified to send cached metachanges to a metalogger
or shadow master if it asks for them during registration in case when
the active master doesn't have all the changes (some of them were
removed as too old). This should make the shadow master notice that
it's metadata is outdated just after the registration. It will work
similar in the metalogger, but it doesn't have to unload its metadata.

Change-Id: Id221dec3f1067bc702b94d84fd51f495b21a74bf
tests: Add a test of reconnecting shadow to master

This test verifies if shadow master is able to reload its metadata if
it connects to a master server which has metadata in newer version and
does not have changelogs from shadow's version.

Change-Id: I2afc3731ba829754d91f23b766dc7dec33a5d0bb