vvivekiyer commented on code in PR #16018:
URL: https://github.com/apache/pinot/pull/16018#discussion_r2232169363


##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java:
##########
@@ -199,6 +203,18 @@ public BrokerResponse handleRequest(JsonNode request, 
@Nullable SqlNodeAndOption
         return new BrokerResponseNative(QueryErrorCode.TOO_MANY_REQUESTS, 
errorMessage);
       }
 
+      String workloadName = 
sqlNodeAndOptions.getOptions().get(Broker.Request.QueryOptionKey.WORKLOAD_NAME);
+      boolean isSecondary = Boolean.parseBoolean(sqlNodeAndOptions.getOptions()
+          .getOrDefault(Broker.Request.QueryOptionKey.IS_SECONDARY_WORKLOAD, 
"false"));
+      if (workloadName != null && _workloadBudgetManager != null
+          && !_workloadBudgetManager.canAdmitQuery(workloadName, isSecondary)) 
{
+        String errorMessage = "Request " + requestId + ": " + query + " 
exceeds query quota for workload: "
+            + workloadName;
+        LOGGER.info(errorMessage);
+        requestContext.setErrorCode(QueryErrorCode.WORKLOAD_QUOTA_EXCEEDED);
+        return new 
BrokerResponseNative(QueryErrorCode.WORKLOAD_QUOTA_EXCEEDED, errorMessage);

Review Comment:
   At this point the accountant is also enforcing budget. So this is not needed 
as discussed offline. 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to