Jackie-Jiang commented on code in PR #19838:
URL: https://github.com/apache/pinot/pull/19838#discussion_r4300733345


##########
pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java:
##########
@@ -235,13 +239,43 @@ private QuotaConfig 
getQuotaConfigFromPropertyStore(String tableNameWithType) {
     return tableConfig.getQuotaConfig();
   }
 
+  @Override
+  public QuotaEnforcementMode getQueryQuotaEnforcementMode(String tableName) {
+    List<String> entityNames = 
TableNameBuilder.getTableTypeFromTableName(tableName) != null ? 
List.of(tableName)
+        : List.of(tableName, 
TableNameBuilder.OFFLINE.tableNameWithType(tableName),
+            TableNameBuilder.REALTIME.tableNameWithType(tableName));
+    QuotaEnforcementMode result = null;
+    for (String entityName : entityNames) {
+      // Entries without a QPS quota have a null rate limiter but are still 
listed, so their mode is included here. This
+      // is safe because the mode is only consulted after acquire() reported a 
breach, which such a table cannot cause.
+      if (!_rateLimiterMap.containsKey(entityName)) {
+        continue;
+      }
+      QuotaEnforcementMode mode = 
_enforcementModeOverrideMap.getOrDefault(entityName, 
QuotaEnforcementMode.ENFORCED);
+      if (result == null || mode.isStricterThan(result)) {

Review Comment:
   [P2] Exclude unlimited siblings from hybrid quota mode resolution
   
   If `foo_OFFLINE` has a `SHADOW` or `DISABLED` QPS quota and `foo_REALTIME` 
has no QPS quota or enforcement mode, both still have entries in 
`_rateLimiterMap`: `buildEmptyOrResetRateLimiterInQueryQuotaEntity()` creates 
an entry with a null limiter for the unlimited table. When a raw-name `foo` 
query exceeds the OFFLINE quota, `acquire()` returns false, but this loop 
includes the unlimited REALTIME entry's default `ENFORCED` mode and rejects the 
query. No enforced quota was breached.
   
   Please skip entries whose rate limiter is null when combining modes, and add 
a regression test covering one limited SHADOW/DISABLED side and one unlimited 
sibling. The current hybrid tests configure QPS quotas on both sides, so they 
miss this case.



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