void checkAndMaybeComplete() {
      if (progressTracker.isDone()) {
        if (progressTracker.hasSucceeded() && !retainChunkExceptionOnSuccess) {
          chunkException = null;
        } else {
          if (chunkOperationTracker.hasFailedOnNotFound()) {
            chunkException =
                buildChunkException("Get Chunk failed because of BlobNotFound", RouterErrorCode.BlobDoesNotExist);
            if (!chunkBlobId.equals(blobId) && chunkBlobId.getBlobDataType() == BlobId.BlobDataType.DATACHUNK) {
              // Metadata exist but missing a data chunk
              routerMetrics.missingDataChunkErrorCount.inc();
            }
          } else if (chunkOperationTracker.hasSomeUnavailability()) {
            setChunkException(
                buildChunkException("Get Chunk failed because of offline replicas", RouterErrorCode.AmbryUnavailable));
          }
        }
        if (shouldRetry(chunkException)) {
          resetForRetry();
        } else {
          chunkCompleted = true;
        }
      }
      if (chunkCompleted) {
        if (state != ChunkState.Complete && QuotaUtils.postProcessCharge(quotaChargeCallback)
            && chunkException == null) {
          try {
            if (chunkSize != -1) {
              quotaChargeCallback.checkAndCharge(false, true, chunkSize);
            } else {
              if (this instanceof FirstGetChunk && ((FirstGetChunk) this).blobType == BlobType.DataBlob) {
                quotaChargeCallback.checkAndCharge(false, true, totalSize);
              }
              // other cases mean that either this was a metadata blob, or there was an error.
            }
          } catch (QuotaException quotaException) {
            logger.info("Exception {} occurred during the quota charge event of blob {}", quotaException,
                blobId.getID());
          }
        }
        setOperationException(chunkException);
        state = ChunkState.Complete;
      }
    }
Check if the operation on the chunk is eligible for completion, if so complete it.
ambry-router/src/main/java/com/github/ambry/router/GetBlobOperation.java