somandal commented on code in PR #10534:
URL: https://github.com/apache/pinot/pull/10534#discussion_r1160416531


##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/MultiStageBrokerRequestHandler.java:
##########
@@ -221,6 +255,51 @@ private BrokerResponse handleRequest(long requestId, 
String query,
     return brokerResponse;
   }
 
+  /**
+   * Validates whether the requester has access to all the tables.
+   */
+  private boolean hasTableAccess(RequesterIdentity requesterIdentity, 
Set<String> tableNames, long requestId,
+      RequestContext requestContext) {
+    boolean hasAccess = 
_accessControlFactory.create().hasAccess(requesterIdentity, tableNames);
+    if (!hasAccess) {
+      
_brokerMetrics.addMeteredGlobalValue(BrokerMeter.REQUEST_DROPPED_DUE_TO_ACCESS_ERROR,
 1);
+      LOGGER.info("Access denied for requestId {}", requestId);
+      requestContext.setErrorCode(QueryException.ACCESS_DENIED_ERROR_CODE);
+      return false;
+    }
+
+    return true;
+  }
+
+  /**
+   * Returns true if the QPS quota of the tables has exceeded.
+   */
+  private boolean hasExceededQPSQuota(Set<String> tableNames, long requestId, 
RequestContext requestContext) {
+    for (String tableName : tableNames) {
+      if (!_queryQuotaManager.acquire(tableName)) {
+        LOGGER.info("Request {}: query exceeds quota for table: {}", 
requestId, tableName);

Review Comment:
   nit: log this as a warn instead?



-- 
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