You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "Tarun-kishore (via GitHub)" <gi...@apache.org> on 2026/10/13 07:05:41 UTC

[PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Tarun-kishore opened a new pull request, #19838:
URL: https://github.com/apache/pinot/pull/19838

   ## Summary
   
   Adds support for `SHADOW` and `DISABLED` enforcement modes for storage and query QPS quotas, allowing operators to evaluate quota limits before enforcing them.
   
   Currently, Pinot enforces quotas as soon as they are configured. This makes it difficult to roll out quotas to existing tables without risking rejected queries, failed segment uploads, or paused realtime consumption.
   
   This change introduces a `QuotaEnforcementMode` enum with three modes:
   
   | Mode | Behavior |
   |---|---|
   | `ENFORCED` | Existing behavior. Quota breaches are recorded and enforced. |
   | `SHADOW` | Quota breaches are recorded, but queries, uploads, and realtime consumption are not blocked. |
   | `DISABLED` | Quota enforcement is skipped and no breach metrics are emitted. |
   
   `ENFORCED` remains the default when no enforcement mode is configured.
   
   ## Changes
   
   ### Configuration
   
   Added two optional fields to `QuotaConfig` to control storage and query quota enforcement independently:
   
   ```json
   {
     "quota": {
       "storage": "10G",
       "maxQueriesPerSecond": "100",
       "storageQuotaEnforcementMode": "SHADOW",
       "queryQuotaEnforcementMode": "SHADOW"
     }
   }
   ```
   
   ### Storage Quota (Controller)
   
   - Updated storage quota checks to respect the configured enforcement mode.
   - In `SHADOW` mode, segment uploads are allowed even when the storage quota is exceeded.
   - Realtime consumption is not paused for storage quota breaches, and tables already paused due to quota can resume when switched to `SHADOW`.
   - The existing `controller.enable.storage.quota.check=false` flag continues to disable storage quota checks globally.
   
   ### Query Quota (Broker)
   
   - Updated broker-side QPS enforcement to support the new modes.
   - In `SHADOW` mode, queries exceeding the configured QPS limit are still executed, while breaches are recorded.
   - For queries using a raw table name with both OFFLINE and REALTIME tables, the strictest enforcement mode among the existing tables is applied.
   
   ### Metrics
   
   - Reuses `BrokerMeter.QUERY_QUOTA_EXCEEDED` for query quota breaches.
   - Adds `ControllerMeter.STORAGE_QUOTA_EXCEEDED` for storage quota breaches.
   - Both `SHADOW` and `ENFORCED` emit the same breach meters, allowing operators to compare observed violations before enabling enforcement.
   - The existing `TableStorageQuotaUtilization` gauge remains unchanged.
   - `DISABLED` does not emit quota breach metrics.
   
   ## Backward Compatibility
   
   - Existing table configurations without the new fields continue using `ENFORCED`, with no change to their serialized representation.
   - Older Pinot binaries ignore the new fields. If an older binary rewrites a table config, the fields may be dropped, causing enforcement to fall back to `ENFORCED`.
   - Controllers and brokers should be upgraded before configuring the new enforcement modes on tables.
   
   ## Testing
   
   ### Unit Tests
   
   Added unit tests covering:
   - Config serialization and default enforcement mode.
   - Storage quota checker, segment upload validation, and realtime consumption validation.
   - Broker QPS enforcement and quota manager behavior.
   
   ### Integration Tests
   
   - `QueryQuotaClusterIntegrationTest`: **16/16 passing**, including `SHADOW`, `DISABLED`, and unset/default enforcement modes.
   
   ### Local Quick-Start Validation
   
   | Scenario | ENFORCED | SHADOW | DISABLED |
   |---|---|---|---|
   | Query quota (40 rapid queries) | 38 rejected | 0 rejected | 0 rejected |
   | Segment upload exceeding storage quota | HTTP 403 | HTTP 200 | HTTP 200 |
   | Quota breach metrics | Emitted | Emitted | Not emitted |
   
   Verified that `SHADOW` allows requests while still recording quota breaches, and that existing enforcement behavior is preserved when the new fields are not configured.
   
   Instructions:
   1. The PR has to be tagged with at least one of the following labels (*):
      1. `feature`
      2. `bugfix`
      3. `performance`
      4. `ui`
      5. `backward-incompat`
      6. `release-notes` (**)
   2. Remove these instructions before publishing the PR.
    
   (*) Other labels to consider:
   - `testing`
   - `dependencies`
   - `docker`
   - `kubernetes`
   - `observability`
   - `security`
   - `code-style`
   - `extension-point`
   - `refactor`
   - `cleanup`
   
   (**) Use `release-notes` label for scenarios like:
   - New configuration options
   - Deprecation of configurations
   - Signature changes to public methods/interfaces
   - New plugins added or old plugins removed
   


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #19838:
URL: https://github.com/apache/pinot/pull/19838#discussion_r4289844061


##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java:
##########
@@ -536,7 +536,7 @@ protected BrokerResponse doHandleRequest(long requestId, String query, SqlNodeAn
         requestContext.setErrorCode(QueryErrorCode.TOO_MANY_REQUESTS);
         return new BrokerResponseNative(QueryErrorCode.TOO_MANY_REQUESTS, errorMessage);
       }
-      if (!_queryQuotaManager.acquireLogicalTable(tableName)) {
+      if (isLogicalTableQpsQuotaBreachEnforced(tableName)) {

Review Comment:
   Small behavior change worth confirming is intentional: the logical-table path now emits `QUERY_QUOTA_EXCEEDED` on a breach (via `isQpsQuotaBreachEnforced`), whereas before this meter was only emitted for physical tables. It's arguably a fix, but it's new metering for logical tables, so flagging it so nobody is surprised by the new series.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/SegmentValidationUtils.java:
##########
@@ -143,6 +144,12 @@ public static void checkStorageQuota(String segmentName, long tarSegmentSizeInBy
               tableConfig.getTableName()), Response.Status.INTERNAL_SERVER_ERROR);
     }
     if (!response._isSegmentWithinQuota) {
+      QuotaEnforcementMode enforcementMode = quotaChecker.getEnforcementMode(tableConfig);

Review Comment:
   Nit: `getEnforcementMode(tableConfig)` is now called twice per upload (once inside `isSegmentStorageWithinQuota` and again here). It's cheap (just reads config), so not worth restructuring, but you could have `isSegmentStorageWithinQuota` return the resolved mode if you want to avoid the second lookup.



##########
pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java:
##########
@@ -46,6 +47,7 @@
 import org.apache.pinot.common.utils.helix.HelixHelper;
 import org.apache.pinot.spi.config.DatabaseConfig;
 import org.apache.pinot.spi.config.table.QuotaConfig;

Review Comment:
   Minor: a table can live in `_rateLimiterMap` with a null rate limiter (no QPS quota configured), and `containsKey` counts it here. That's harmless today because the mode is only consulted after `acquire()` reports a breach, and a null-limiter table can't breach, so it never influences the strictest-mode result. Just noting the subtlety in case the resolution gets reused elsewhere later.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/SegmentValidationUtils.java:
##########
@@ -143,6 +144,12 @@ public static void checkStorageQuota(String segmentName, long tarSegmentSizeInBy
               tableConfig.getTableName()), Response.Status.INTERNAL_SERVER_ERROR);
     }
     if (!response._isSegmentWithinQuota) {
+      QuotaEnforcementMode enforcementMode = quotaChecker.getEnforcementMode(tableConfig);

Review Comment:
   Nit: `getEnforcementMode(tableConfig)` is now called twice per upload (once inside `isSegmentStorageWithinQuota` and again here). It's cheap (just reads config), so not worth restructuring, but you could have `isSegmentStorageWithinQuota` return the resolved mode if you want to avoid the second lookup.



##########
pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java:
##########
@@ -46,6 +47,7 @@
 import org.apache.pinot.common.utils.helix.HelixHelper;
 import org.apache.pinot.spi.config.DatabaseConfig;
 import org.apache.pinot.spi.config.table.QuotaConfig;

Review Comment:
   Minor: a table can live in `_rateLimiterMap` with a null rate limiter (no QPS quota configured), and `containsKey` counts it here. That's harmless today because the mode is only consulted after `acquire()` reports a breach, and a null-limiter table can't breach, so it never influences the strictest-mode result. Just noting the subtlety in case the resolution gets reused elsewhere later.



##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java:
##########
@@ -536,7 +536,7 @@ protected BrokerResponse doHandleRequest(long requestId, String query, SqlNodeAn
         requestContext.setErrorCode(QueryErrorCode.TOO_MANY_REQUESTS);
         return new BrokerResponseNative(QueryErrorCode.TOO_MANY_REQUESTS, errorMessage);
       }
-      if (!_queryQuotaManager.acquireLogicalTable(tableName)) {
+      if (isLogicalTableQpsQuotaBreachEnforced(tableName)) {

Review Comment:
   Small behavior change worth confirming is intentional: the logical-table path now emits `QUERY_QUOTA_EXCEEDED` on a breach (via `isQpsQuotaBreachEnforced`), whereas before this meter was only emitted for physical tables. It's arguably a fix, but it's new metering for logical tables, so flagging it so nobody is surprised by the new series.



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "tarun11Mavani (via GitHub)" <gi...@apache.org>.
tarun11Mavani merged PR #19838:
URL: https://github.com/apache/pinot/pull/19838


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "Tarun-kishore (via GitHub)" <gi...@apache.org>.
Tarun-kishore commented on PR #19838:
URL: https://github.com/apache/pinot/pull/19838#issuecomment-6186358995

   Thanks @xiangfu0 for reviewing. I've addressed the comments.


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on PR #19838:
URL: https://github.com/apache/pinot/pull/19838#issuecomment-6525983348

   📝 Documentation for this change has been published: pinot-contrib/pinot-docs#1157 (merged).
   
   It documents the new per-table `storageQuotaEnforcementMode` and `queryQuotaEnforcementMode` quota fields (`DISABLED` / `SHADOW` / `ENFORCED`, default `ENFORCED`), the SHADOW metering/logging behavior, the controller-wide storage-check gate, and the strictest-mode resolution for hybrid tables referenced without a type suffix.
   
   - Table config reference: Quota section
   - Query quotas guide: new *Enforcement mode* subsection


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #19838:
URL: https://github.com/apache/pinot/pull/19838#issuecomment-6204178781

   ## [Codecov](https://app.codecov.io/gh/apache/pinot/pull/19838?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :white_check_mark: All modified and coverable lines are covered by tests.
   :white_check_mark: Project coverage is 100.00%. Comparing base ([`fff3de6`](https://app.codecov.io/gh/apache/pinot/commit/fff3de65d01b8aeb9d667cad854df6f928526f8b?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`f70381e`](https://app.codecov.io/gh/apache/pinot/commit/f70381e9b28ed19d8567f3dd848aad6a7f0e23ac?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 47 commits behind head on master.
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@              Coverage Diff               @@
   ##             master    #19838       +/-   ##
   ==============================================
   + Coverage     68.76%   100.00%   +31.23%     
   + Complexity     1491         6     -1485     
   ==============================================
     Files          3529         3     -3526     
     Lines        231124         6   -231118     
     Branches      36796         0    -36796     
   ==============================================
   - Hits         158941         6   -158935     
   + Misses        59743         0    -59743     
   + Partials      12440         0    -12440     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/pinot/pull/19838/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [integration](https://app.codecov.io/gh/apache/pinot/pull/19838/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ø> (ø)` | |
   | [integration1](https://app.codecov.io/gh/apache/pinot/pull/19838/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ø> (ø)` | |
   | [integration2](https://app.codecov.io/gh/apache/pinot/pull/19838/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [java-25](https://app.codecov.io/gh/apache/pinot/pull/19838/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ø> (+31.23%)` | :arrow_up: |
   | [lane-a](https://app.codecov.io/gh/apache/pinot/pull/19838/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ø> (ø)` | |
   | [lane-b](https://app.codecov.io/gh/apache/pinot/pull/19838/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `0.00% <ø> (ø)` | |
   | [temurin](https://app.codecov.io/gh/apache/pinot/pull/19838/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ø> (+31.23%)` | :arrow_up: |
   | [unittests](https://app.codecov.io/gh/apache/pinot/pull/19838/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unittests1](https://app.codecov.io/gh/apache/pinot/pull/19838/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [unittests2](https://app.codecov.io/gh/apache/pinot/pull/19838/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/pinot/pull/19838?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #19838:
URL: https://github.com/apache/pinot/pull/19838#discussion_r4291038279


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

Review Comment:
   Thanks for adding this — it captures exactly the subtlety I raised last time. The reasoning is correct: such a table is in the map but cannot breach, so including its mode here never changes the strictest-mode result. Resolved from my side.



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "Jackie-Jiang (via GitHub)" <gi...@apache.org>.
Jackie-Jiang commented on code in PR #19838:
URL: https://github.com/apache/pinot/pull/19838#discussion_r4364754125


##########
pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java:
##########
@@ -91,6 +93,7 @@ public class HelixExternalViewBasedQueryQuotaManager implements ClusterChangeHan
   private final String _instanceId;
   private final AtomicInteger _lastKnownBrokerResourceVersion = new AtomicInteger(-1);
   private final Map<String, QueryQuotaEntity> _rateLimiterMap = new ConcurrentHashMap<>();
+  private final Map<String, QuotaEnforcementMode> _enforcementModeOverrideMap = new ConcurrentHashMap<>();

Review Comment:
   Optional simplification: consider storing the effective enforcement mode on `QueryQuotaEntity`, defaulting to `ENFORCED` and using a `volatile` field for visibility to concurrent readers. This would remove the parallel `_enforcementModeOverrideMap`, its update helper and test-only size accessor, and duplicated cleanup at each table removal/reset path. The limiter and its enforcement policy would then share one lifecycle.



##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseBrokerRequestHandler.java:
##########
@@ -311,17 +313,44 @@ protected boolean hasExceededQPSQuota(@Nullable String database, Set<String> tab
       return true;
     }
     for (String tableName : tableNames) {
-      if (!_queryQuotaManager.acquire(tableName)) {
+      if (isTableQpsQuotaBreachEnforced(tableName)) {
         LOGGER.warn("Request {}: query exceeds quota for table: {}", requestContext.getRequestId(), tableName);
         requestContext.setErrorCode(QueryErrorCode.TOO_MANY_REQUESTS);
-        String rawTableName = TableNameBuilder.extractRawTableName(tableName);
-        _brokerMetrics.addMeteredTableValue(rawTableName, BrokerMeter.QUERY_QUOTA_EXCEEDED, 1);
         return true;
       }
     }
     return false;
   }
 
+  ///  Acquires the QPS quota of the given table (name with or without type suffix) and returns true only if the quota
+  ///  is breached and the table's enforcement mode requires rejecting the query.
+  protected boolean isTableQpsQuotaBreachEnforced(String tableName) {
+    return isQpsQuotaBreachEnforced(tableName, _queryQuotaManager::acquire);
+  }
+
+  ///  Same as [#isTableQpsQuotaBreachEnforced(String)] for a logical table.
+  protected boolean isLogicalTableQpsQuotaBreachEnforced(String logicalTableName) {
+    return isQpsQuotaBreachEnforced(logicalTableName, _queryQuotaManager::acquireLogicalTable);
+  }
+
+  private boolean isQpsQuotaBreachEnforced(String tableName, Predicate<String> acquire) {

Review Comment:
   Optional simplification: the two wrappers could call `acquire()` / `acquireLogicalTable()` directly and share only the breach handling, removing the `Predicate<String>` parameter and method-reference indirection. For example:
   
   ```java
   return !_queryQuotaManager.acquire(tableName) && shouldEnforceQuotaBreach(tableName);
   ```
   
   The shared helper would start with mode resolution. Short-circuiting preserves the current behavior of looking up the mode only after acquisition fails.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/validation/RealtimeSegmentValidationManager.java:
##########
@@ -196,6 +197,16 @@ boolean shouldEnsureConsuming(String tableNameWithType) {
     // Perform storage quota checks.
     TableConfig tableConfig = _pinotHelixResourceManager.getTableConfig(tableNameWithType);
     boolean isQuotaExceeded = _storageQuotaChecker.isTableStorageQuotaExceeded(tableConfig);
+    QuotaEnforcementMode enforcementMode = _storageQuotaChecker.getEnforcementMode(tableConfig);
+    if (isQuotaExceeded && enforcementMode != QuotaEnforcementMode.ENFORCED) {
+      if (enforcementMode == QuotaEnforcementMode.SHADOW) {
+        // The breach meter is already emitted by StorageQuotaChecker
+        LOGGER.warn("Storage quota exceeded for table: {}, but enforcement mode is SHADOW, not pausing consumption",
+            tableNameWithType);
+      }
+      // DISABLED or SHADOW: don't treat the breach as exceeded for pause/resume purposes
+      isQuotaExceeded = false;

Review Comment:
   Optional simplification: keep `isQuotaExceeded` as the raw breach result and derive the enforcement decision separately:
   
   ```java
   boolean shouldPauseForQuota = isQuotaExceeded && enforcementMode == QuotaEnforcementMode.ENFORCED;
   ```
   
   Use `shouldPauseForQuota` for the pause-state comparison, transition and return, while retaining the SHADOW log. This avoids changing the meaning of `isQuotaExceeded` midway through the method and preserves breach metering in the checker.



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "Tarun-kishore (via GitHub)" <gi...@apache.org>.
Tarun-kishore commented on PR #19838:
URL: https://github.com/apache/pinot/pull/19838#issuecomment-6497824351

   @xiangfu0 @Jackie-Jiang Is this good to merge?


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "Tarun-kishore (via GitHub)" <gi...@apache.org>.
Tarun-kishore commented on code in PR #19838:
URL: https://github.com/apache/pinot/pull/19838#discussion_r4279973955


##########
pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java:
##########
@@ -222,6 +225,7 @@ public void dropTableQueryQuota(String physicalOrLogicalTable) {
   /// @param physicalOrLogicalTable physical or logical table name.
   private void removeRateLimiter(String physicalOrLogicalTable) {
     _rateLimiterMap.remove(physicalOrLogicalTable);
+    _enforcementModeOverrideMap.remove(physicalOrLogicalTable);

Review Comment:
   Fixed, the three sites now remove the override map along with rate limiter.



##########
pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java:
##########
@@ -235,13 +239,41 @@ 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) {
+      if (!_rateLimiterMap.containsKey(entityName)) {
+        continue;
+      }
+      QuotaEnforcementMode mode = _enforcementModeOverrideMap.getOrDefault(entityName, QuotaEnforcementMode.ENFORCED);
+      if (result == null || mode.ordinal() > result.ordinal()) {

Review Comment:
    Done. QuotaEnforcementMode now carries an explicit strictness and exposes isStricterThan(...); the broker uses that instead of ordinal(), so reordering the enum constants can't change behavior. Added QuotaEnforcementModeTest asserting DISABLED < SHADOW < ENFORCED



##########
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/QuotaConfig.java:
##########
@@ -42,9 +42,27 @@ public class QuotaConfig extends BaseJsonConfig {
   private transient final long _storageInBytes;
   private transient final double _maxQPS;
 
+  // Optional per-table enforcement modes. Null means ENFORCED. They are omitted from the serialized form when null,
+  // so configs that do not use them are unchanged and stay readable by binaries that predate these fields.
+  @JsonPropertyDescription("How the storage quota is enforced: DISABLED, SHADOW (breaches are metered and logged but "
+      + "not acted on) or ENFORCED. Defaults to ENFORCED")
+  private final QuotaEnforcementMode _storageQuotaEnforcementMode;
+
+  @JsonPropertyDescription("How the query QPS quota is enforced: DISABLED, SHADOW (breaches are metered and logged "
+      + "but queries are not rejected) or ENFORCED. Defaults to ENFORCED")
+  private final QuotaEnforcementMode _queryQuotaEnforcementMode;
+
+  public QuotaConfig(@Nullable String storage, @Nullable String maxQueriesPerSecond) {
+    this(storage, maxQueriesPerSecond, null, null);

Review Comment:
   Thanks for catching that. This was the only place that was reconstructing `QuotaConfig`. Updated the constructor call to use 4 args.



##########
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/QuotaEnforcementMode.java:
##########
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.spi.config.table;
+
+/// Controls how a configured table quota (e.g. storage, query QPS) is enforced. Declared in increasing order of
+/// strictness; code that has to pick one of several modes relies on the ordinal.

Review Comment:
   Addressed. Enums now have explicit strictness



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "Tarun-kishore (via GitHub)" <gi...@apache.org>.
Tarun-kishore commented on code in PR #19838:
URL: https://github.com/apache/pinot/pull/19838#discussion_r4306453199


##########
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:
   Thanks for catching this, the null-limiter sibling's default ENFORCED mode was winning the resolution for the raw name. getQueryQuotaEnforcementMode now skips entries whose rate limiter is null (they cannot breach), and I replaced the comment I added earlier, which didn't hold for hybrid tables



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "Tarun-kishore (via GitHub)" <gi...@apache.org>.
Tarun-kishore commented on PR #19838:
URL: https://github.com/apache/pinot/pull/19838#issuecomment-6248051367

   Thanks @Jackie-Jiang @xiangfu0 for the review. I've addressed the comments. Can you please help with running CI too as it requires maintainer permissions?


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #19838:
URL: https://github.com/apache/pinot/pull/19838#discussion_r4293255654


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

Review Comment:
   Thanks for adding this — the explanation is accurate and exactly captures why listing null-limiter entries here is harmless. Resolves my earlier note.



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "Tarun-kishore (via GitHub)" <gi...@apache.org>.
Tarun-kishore commented on code in PR #19838:
URL: https://github.com/apache/pinot/pull/19838#discussion_r4290722766


##########
pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java:
##########
@@ -46,6 +47,7 @@
 import org.apache.pinot.common.utils.helix.HelixHelper;
 import org.apache.pinot.spi.config.DatabaseConfig;
 import org.apache.pinot.spi.config.table.QuotaConfig;

Review Comment:
   Agreed, this is intentional. A table with a mode but no QPS quota stays in `_rateLimiterMap` with a null limiter, and its mode is still reported. This is covered by `testQueryQuotaEnforcementModeOverrideTracksTableConfig`.
   
   It shouldn't cause any issues since the mode is only checked after `acquire()` reports a breach, which can't happen with a null limiter. I've added a comment explaining this at the check to avoid confusion if this logic is reused later.



##########
pinot-broker/src/main/java/org/apache/pinot/broker/requesthandler/BaseSingleStageBrokerRequestHandler.java:
##########
@@ -536,7 +536,7 @@ protected BrokerResponse doHandleRequest(long requestId, String query, SqlNodeAn
         requestContext.setErrorCode(QueryErrorCode.TOO_MANY_REQUESTS);
         return new BrokerResponseNative(QueryErrorCode.TOO_MANY_REQUESTS, errorMessage);
       }
-      if (!_queryQuotaManager.acquireLogicalTable(tableName)) {
+      if (isLogicalTableQpsQuotaBreachEnforced(tableName)) {

Review Comment:
    Yes, intentional. Before this change the logical-table path rejected with 429 but never emitted `QUERY_QUOTA_EXCEEDED`, which would have made SHADOW mode invisible for logical tables. Both paths now go through the same `isQpsQuotaBreachEnforced`, so physical and logical tables emit the same meter in ENFORCED and SHADOW (and neither in DISABLED). The series is keyed by the logical table name, as it is for physical tables by raw table name.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/SegmentValidationUtils.java:
##########
@@ -143,6 +144,12 @@ public static void checkStorageQuota(String segmentName, long tarSegmentSizeInBy
               tableConfig.getTableName()), Response.Status.INTERNAL_SERVER_ERROR);
     }
     if (!response._isSegmentWithinQuota) {
+      QuotaEnforcementMode enforcementMode = quotaChecker.getEnforcementMode(tableConfig);

Review Comment:
   Right, it's just two cheap config reads. I'd prefer to keep `isSegmentStorageWithinQuota`'s return type unchanged since other callers depend on it, rather than change the API for such a small optimization. Let me know if you see a reason to do it differently.



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "Tarun-kishore (via GitHub)" <gi...@apache.org>.
Tarun-kishore commented on PR #19838:
URL: https://github.com/apache/pinot/pull/19838#issuecomment-6207631353

   Addressed the nits


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "xiangfu0 (via GitHub)" <gi...@apache.org>.
xiangfu0 commented on code in PR #19838:
URL: https://github.com/apache/pinot/pull/19838#discussion_r4278299289


##########
pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java:
##########
@@ -222,6 +225,7 @@ public void dropTableQueryQuota(String physicalOrLogicalTable) {
   /// @param physicalOrLogicalTable physical or logical table name.
   private void removeRateLimiter(String physicalOrLogicalTable) {
     _rateLimiterMap.remove(physicalOrLogicalTable);
+    _enforcementModeOverrideMap.remove(physicalOrLogicalTable);

Review Comment:
   Nice that `removeRateLimiter()` keeps the override map in sync. The three `it.remove()` sites in `processQueryRateLimitingExternalViewChange` (no broker resource / deleted config / invalid quota) drop from `_rateLimiterMap` but not from `_enforcementModeOverrideMap`. It's harmless today since reads are gated on `_rateLimiterMap.containsKey(...)`, but it leaves stale override entries that grow with table churn — worth removing from both maps there (and in the test-only `cleanUpRateLimiterMap()`) for consistency.



##########
pinot-broker/src/main/java/org/apache/pinot/broker/queryquota/HelixExternalViewBasedQueryQuotaManager.java:
##########
@@ -235,13 +239,41 @@ 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) {
+      if (!_rateLimiterMap.containsKey(entityName)) {
+        continue;
+      }
+      QuotaEnforcementMode mode = _enforcementModeOverrideMap.getOrDefault(entityName, QuotaEnforcementMode.ENFORCED);
+      if (result == null || mode.ordinal() > result.ordinal()) {

Review Comment:
   The "strictest wins" logic leans on `ordinal()` ordering, and the contract for that lives on the SPI enum in another module. It's documented there, but a future reorder/insert would break this silently with no compile-time or test signal. A tiny test asserting `DISABLED < SHADOW < ENFORCED` (or an explicit strictness mapping) would make the coupling safe.



##########
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/QuotaEnforcementMode.java:
##########
@@ -0,0 +1,31 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.spi.config.table;
+
+/// Controls how a configured table quota (e.g. storage, query QPS) is enforced. Declared in increasing order of
+/// strictness; code that has to pick one of several modes relies on the ordinal.

Review Comment:
   Good that the ordinal dependency is called out here. Since the actual consumer is in pinot-broker (`getQueryQuotaEnforcementMode`), consider a guard test so the two don't drift — serialization is name-based so reordering is safe for persistence, but the strictness comparison would break quietly.



##########
pinot-spi/src/main/java/org/apache/pinot/spi/config/table/QuotaConfig.java:
##########
@@ -42,9 +42,27 @@ public class QuotaConfig extends BaseJsonConfig {
   private transient final long _storageInBytes;
   private transient final double _maxQPS;
 
+  // Optional per-table enforcement modes. Null means ENFORCED. They are omitted from the serialized form when null,
+  // so configs that do not use them are unchanged and stay readable by binaries that predate these fields.
+  @JsonPropertyDescription("How the storage quota is enforced: DISABLED, SHADOW (breaches are metered and logged but "
+      + "not acted on) or ENFORCED. Defaults to ENFORCED")
+  private final QuotaEnforcementMode _storageQuotaEnforcementMode;
+
+  @JsonPropertyDescription("How the query QPS quota is enforced: DISABLED, SHADOW (breaches are metered and logged "
+      + "but queries are not rejected) or ENFORCED. Defaults to ENFORCED")
+  private final QuotaEnforcementMode _queryQuotaEnforcementMode;
+
+  public QuotaConfig(@Nullable String storage, @Nullable String maxQueriesPerSecond) {
+    this(storage, maxQueriesPerSecond, null, null);

Review Comment:
   Heads up: this 2-arg constructor now drops the two enforcement modes (delegates with `null, null`). That's fine here, but `TableConfigUtils.ensureStorageQuotaConstraints()` reconstructs dimension-table quota configs through this constructor and so silently loses a configured mode — see the MAJOR note in the review summary. Worth a quick check of any other call site that rebuilds a QuotaConfig from an existing one.



-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


Re: [PR] Add per-table SHADOW enforcement mode for storage and query quotas [pinot]

Posted by "Tarun-kishore (via GitHub)" <gi...@apache.org>.
Tarun-kishore commented on PR #19838:
URL: https://github.com/apache/pinot/pull/19838#issuecomment-6408373067

   Addressed the comments, and rebased with latest main


-- 
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: commits-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org