code: void waitForSyncEnd(String peerId)
        throws TimeoutException, IOException, InterruptedException {
      MessageTuple tuple = filter.getExpectedMessage(MessageType.SYNC_END,
                                                     peerId,
                                                     getSyncTimeoutMs());
      ClusterConfiguration cnf
        = ClusterConfiguration.fromProto(tuple.getMessage().getConfig(),
                                         this.serverId);
      LOG.debug("Got SYNC_END {} from {}", cnf, peerId);
      this.persistence.setLastSeenConfig(cnf);
      if (persistence.isInStateTransfer()) {
        persistence.endStateTransfer();
      }
      // If the synchronization is performed by truncation, then it's possible
      // the content of cluster_config has been truncated in log, then we'll
      // delete these invalid cluster_config files.
      persistence.cleanupClusterConfigFiles();
    }
docs: Waits for the end of the synchronization and updates last seen config
  file.
  
  @param peerId the id of the peer.
  @throws TimeoutException in case of timeout.
  @throws IOException in case of IOException.
  @throws InterruptedException if it's interrupted.