public TSStatus setThrottleQuota(TSetThrottleQuotaReq req) {
    try {
      TSStatus response =
          configManager
              .getConsensusManager()
              .write(new SetThrottleQuotaPlan(req.getUserName(), req.getThrottleQuota()));
      if (response.getCode() == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
        Map<Integer, TDataNodeLocation> dataNodeLocationMap =
            configManager.getNodeManager().getRegisteredDataNodeLocations();
        DataNodeAsyncRequestContext<TSetThrottleQuotaReq, TSStatus> clientHandler =
            new DataNodeAsyncRequestContext<>(
                CnToDnAsyncRequestType.SET_THROTTLE_QUOTA, req, dataNodeLocationMap);
        CnToDnInternalServiceAsyncRequestManager.getInstance()
            .sendAsyncRequestWithRetry(clientHandler);
        return RpcUtils.squashResponseStatusList(clientHandler.getResponseList());
      }
      return response;
    } catch (ConsensusException e) {
      LOGGER.warn(
          String.format(
              "Unexpected error happened while setting throttle quota on user: %s ",
              req.getUserName()),
          e);
      // consensus layer related errors
      TSStatus res = new TSStatus(TSStatusCode.EXECUTE_STATEMENT_ERROR.getStatusCode());
      res.setMessage(e.getMessage());
      return res;
    }
  }
If the new quota is smaller than the quota already used, the setting fails.
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/ClusterQuotaManager.java