sajjad-moradi commented on code in PR #13803:
URL: https://github.com/apache/pinot/pull/13803#discussion_r1714153541


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java:
##########
@@ -1671,12 +1694,20 @@ public PauseStatus resumeConsumption(String 
tableNameWithType, @Nullable String
         + "Consuming segments are being created. Use /pauseStatus endpoint in 
a few moments to double check.");
   }
 
-  private IdealState updatePauseStatusInIdealState(String tableNameWithType, 
boolean pause) {
+  private IdealState updatePauseStatusInIdealState(String tableNameWithType, 
boolean pause, String comment) {
     IdealState updatedIdealState = HelixHelper.updateIdealState(_helixManager, 
tableNameWithType, idealState -> {
       ZNRecord znRecord = idealState.getRecord();
+      TablePauseStatus pauseStatus;

Review Comment:
   We need to set the timestamp on the object.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java:
##########
@@ -1671,12 +1694,20 @@ public PauseStatus resumeConsumption(String 
tableNameWithType, @Nullable String
         + "Consuming segments are being created. Use /pauseStatus endpoint in 
a few moments to double check.");
   }
 
-  private IdealState updatePauseStatusInIdealState(String tableNameWithType, 
boolean pause) {
+  private IdealState updatePauseStatusInIdealState(String tableNameWithType, 
boolean pause, String comment) {
     IdealState updatedIdealState = HelixHelper.updateIdealState(_helixManager, 
tableNameWithType, idealState -> {
       ZNRecord znRecord = idealState.getRecord();
+      TablePauseStatus pauseStatus;
+      if (pause) {
+        pauseStatus = new 
TablePauseStatus(TablePauseStatus.ReasonCode.ADMINISTRATIVE, comment);
+      } else {
+        pauseStatus = new TablePauseStatus();
+        pauseStatus.setPaused(false);
+      }
       znRecord.setSimpleField(IS_TABLE_PAUSED, 
Boolean.valueOf(pause).toString());
+      znRecord.setSimpleField(PAUSE_STATUS, pauseStatus.toJsonString());
       return new IdealState(znRecord);
-    }, RetryPolicies.noDelayRetryPolicy(1));
+    }, RetryPolicies.noDelayRetryPolicy(3));
     LOGGER.info("Set 'isTablePaused' to {} in the Ideal State for table {}.", 
pause, tableNameWithType);

Review Comment:
   Please update log statement.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java:
##########
@@ -1671,12 +1694,20 @@ public PauseStatus resumeConsumption(String 
tableNameWithType, @Nullable String
         + "Consuming segments are being created. Use /pauseStatus endpoint in 
a few moments to double check.");
   }
 
-  private IdealState updatePauseStatusInIdealState(String tableNameWithType, 
boolean pause) {
+  private IdealState updatePauseStatusInIdealState(String tableNameWithType, 
boolean pause, String comment) {
     IdealState updatedIdealState = HelixHelper.updateIdealState(_helixManager, 
tableNameWithType, idealState -> {
       ZNRecord znRecord = idealState.getRecord();
+      TablePauseStatus pauseStatus;
+      if (pause) {
+        pauseStatus = new 
TablePauseStatus(TablePauseStatus.ReasonCode.ADMINISTRATIVE, comment);
+      } else {
+        pauseStatus = new TablePauseStatus();
+        pauseStatus.setPaused(false);

Review Comment:
   I think it's better if we add reason for resume case as well. 
   For example, a pause can be like this:
   ```json
   "pauseStatus": {
     "isPaused": true,
     "reasonCode": "ADMINISTRATIVE",
     "comment": "Need to change the underlying topic",
     "time": "2024-08-01T09:30:00Z"
   }
   ```
   And then resume will be something like this:
   ```json
   "pauseStatus": {
     "isPaused": false,
     "reasonCode": "ADMINISTRATIVE",
     "comment": "Topic swapped from PageViewEvent to PageActionEvent",
     "time": "2024-08-01T09:45:00Z"
   }
   ```
   WDYT?



##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java:
##########
@@ -1671,12 +1694,20 @@ public PauseStatus resumeConsumption(String 
tableNameWithType, @Nullable String
         + "Consuming segments are being created. Use /pauseStatus endpoint in 
a few moments to double check.");
   }
 
-  private IdealState updatePauseStatusInIdealState(String tableNameWithType, 
boolean pause) {
+  private IdealState updatePauseStatusInIdealState(String tableNameWithType, 
boolean pause, String comment) {
     IdealState updatedIdealState = HelixHelper.updateIdealState(_helixManager, 
tableNameWithType, idealState -> {
       ZNRecord znRecord = idealState.getRecord();
+      TablePauseStatus pauseStatus;
+      if (pause) {
+        pauseStatus = new 
TablePauseStatus(TablePauseStatus.ReasonCode.ADMINISTRATIVE, comment);
+      } else {
+        pauseStatus = new TablePauseStatus();
+        pauseStatus.setPaused(false);

Review Comment:
   @mcvsubbu what's your thoughts on this?



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