private boolean localStoreHasTheKey(ReplicateBlobRequest replicateBlobRequest) throws Exception {
    BlobId blobId = replicateBlobRequest.getBlobId();
    final String remoteHostName = replicateBlobRequest.getSourceHostName();
    final int remoteHostPort = replicateBlobRequest.getSourceHostPort();
    final DataNodeId remoteDataNode = clusterMap.getDataNodeId(remoteHostName, remoteHostPort);
    // the source replica happens to be this node.
    if (remoteDataNode.equals(currentNode)) {
      return true;
    }

    // ReplicateBlob has two modes:
    // 1. write repair mode:
    //   Even the local store has the Blob, we still run the ReplicateBlob.
    //   Depending on the final state of the source and local replica, we may applyTtlUpdate or applyDelete to the local store.
    // 2. non write repair mode:
    //   If the local store has the Blob, do nothing.
    // ON_DEMAND_REPLICATION_TODO: add one configuration to switch between write repair mode and non-write repair mode.

    // Currently we don't enable the write repair. As long as the local store has the Blob, return success immediately.
    // check if local store has the key already
    StoreKey convertedKey = getConvertedStoreKeys(Collections.singletonList(blobId)).get(0);
    Store store = storeManager.getStore(((BlobId) convertedKey).getPartition());
    try {
      store.findKey(convertedKey);
      return true;
    } catch (StoreException e) {
      // it throws e.getErrorCode() == StoreErrorCodes.ID_Not_Found if it doesn't exist.
      return false;
    }
  }
If the replicateBlob is replicating from this node or the local store has the key already, return true.
@param replicateBlobRequest the {@link ReplicateBlobRequest}
@return true if replicates from this node or the local store has the key
ambry-server/src/main/java/com/github/ambry/server/AmbryRequests.java