This commit adds a check to verify that the remote database is up-to-date before proceeding to repair the remote storage.
Without this check it is possible to start repairs with an old database, and this will cause the remote data to be deleted.
This fixes#4579