shounakmk219 commented on code in PR #13584:
URL: https://github.com/apache/pinot/pull/13584#discussion_r1686745580


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java:
##########
@@ -1696,6 +1705,32 @@ private IdealState updatePauseStatusInIdealState(String 
tableNameWithType, boole
     return updatedIdealState;
   }
 
+  /**
+   * Updates the table IS property 'isQuotaExceeded' based on provided 
'quotaExceeded'.
+   * Will be a no op in case the IS already has the same value.
+   * @param tableNameWithType table on which to update the IS
+   * @param quotaExceeded boolean indicating whether table has exceeded the 
quota limits
+   * @return true if the IS was successfully updated for the table. Returns 
false in case of no op or the update fails.
+   */
+  public boolean updateStorageQuotaExceededInIdealState(String 
tableNameWithType, boolean quotaExceeded) {
+    IdealState is = getIdealState(tableNameWithType);
+    if (is.getRecord().getBooleanField(IS_QUOTA_EXCEEDED, false) != 
quotaExceeded) {
+      is = HelixHelper.updateIdealState(_helixManager, tableNameWithType, 
idealState -> {
+        ZNRecord znRecord = idealState.getRecord();
+        znRecord.setSimpleField(IS_QUOTA_EXCEEDED, 
Boolean.valueOf(quotaExceeded).toString());
+        return new IdealState(znRecord);
+      }, RetryPolicies.noDelayRetryPolicy(1));
+      if (is == null) {
+        LOGGER.error("Failed to set 'isQuotaExceeded' to {} in the Ideal State 
for table {}.", quotaExceeded,

Review Comment:
   That's right.



-- 
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-unsubscr...@pinot.apache.org

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


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

Reply via email to