@Override
  protected ServerErrorCode validateRequest(PartitionId partition, RequestOrResponseType requestType,
      boolean skipPartitionAndDiskAvailableCheck) {
    ServerErrorCode errorCode = super.validateRequest(partition, requestType, skipPartitionAndDiskAvailableCheck);
    if (errorCode != ServerErrorCode.NoError) {
      return errorCode;
    }
    if (!skipPartitionAndDiskAvailableCheck) {
      // Ensure the disk for the partition/replica is available
      ReplicaId localReplica = storeManager.getReplica(partition.toPathString());
      if (localReplica != null && localReplica.getDiskId().getState() == HardwareState.UNAVAILABLE) {
        metrics.diskUnavailableError.inc();
        return ServerErrorCode.DiskUnavailable;
      }
      // Check if partition exists on this node and that the store for this partition is available
      errorCode = storeManager.checkLocalPartitionStatus(partition, localReplica);
      switch (errorCode) {
        case DiskUnavailable:
          metrics.diskUnavailableError.inc();
          localReplica.markDiskDown();
          return errorCode;
        case ReplicaUnavailable:
          metrics.replicaUnavailableError.inc();
          return errorCode;
        case PartitionUnknown:
          metrics.partitionUnknownError.inc();
          return errorCode;
      }
    }
    // Ensure the partition is writable
    if (requestType.equals(RequestOrResponseType.PutRequest)
        && partition.getPartitionState() == PartitionState.READ_ONLY) {
      metrics.partitionReadOnlyError.inc();
      return ServerErrorCode.PartitionReadOnly;
    }
    // Ensure the request is enabled.
    if (!isRequestEnabled(requestType, partition)) {
      metrics.temporarilyDisabledError.inc();
      return ServerErrorCode.TemporarilyDisabled;
    }
    return ServerErrorCode.NoError;
  }
Check that the provided partition is valid, on the disk, and can be written to.
@param partition the partition to validate.
@param requestType the {@link RequestOrResponseType} being validated.
@param skipPartitionAndDiskAvailableCheck whether to skip ({@code true}) conditions check for the availability of
                                          partition and disk.
@return {@link ServerErrorCode#NoError} error if the partition can be written to, or the corresponding error code
        if it cannot.
ambry-server/src/main/java/com/github/ambry/server/AmbryServerRequests.java