KKcorps commented on code in PR #15495:
URL: https://github.com/apache/pinot/pull/15495#discussion_r2036418450


##########
pinot-controller/src/main/java/org/apache/pinot/controller/helix/core/realtime/PinotLLCRealtimeSegmentManager.java:
##########
@@ -2573,66 +2573,37 @@ public Set<String> getSegmentsYetToBeCommitted(String 
tableNameWithType, Set<Str
    * @param committingSegments List of new segment names that are currently in 
COMMITTING state.
    *                          If null, returns true without making any changes 
to the existing list
    * @return true if the synchronization succeeds, false if there's a failure 
in updating ZooKeeper
-   * @see #getCommittingSegments for the logic that filters out segments no 
longer in COMMITTING state
    */
-  public boolean syncCommittingSegments(String realtimeTableName, @NotNull 
List<String> committingSegments) {
+  public boolean syncCommittingSegments(String realtimeTableName, List<String> 
committingSegments) {
+    String pauselessDebugMetadataPath =
+        
ZKMetadataProvider.constructPropertyStorePathForPauselessDebugMetadata(realtimeTableName);
     return updateCommittingSegmentsList(realtimeTableName, () -> {
-      String committingSegmentsListPath =
-          
ZKMetadataProvider.constructPropertyStorePathForPauselessDebugMetadata(realtimeTableName);
-
       // Fetch the committing segments record from the property store.
       Stat stat = new Stat();
-      ZNRecord znRecord = _propertyStore.get(committingSegmentsListPath, stat, 
AccessOption.PERSISTENT);
+      ZNRecord znRecord = _propertyStore.get(pauselessDebugMetadataPath, stat, 
AccessOption.PERSISTENT);
 
-      // empty ZN record for the table
+      // Create ZN record if it doesn't exist
       if (znRecord == null) {
         znRecord = new ZNRecord(realtimeTableName);
         znRecord.setListField(COMMITTING_SEGMENTS, committingSegments);
-        return _propertyStore.create(committingSegmentsListPath, znRecord, 
AccessOption.PERSISTENT);
+        return _propertyStore.create(pauselessDebugMetadataPath, znRecord, 
AccessOption.PERSISTENT);
       }
 
-      Set<String> mergedSegments = new HashSet<>(committingSegments);
-      // Get segments that are present in the list and are still in COMMITTING 
status
-      List<String> existingSegments =
-          getCommittingSegments(realtimeTableName, 
znRecord.getListField(COMMITTING_SEGMENTS));
-      if (existingSegments != null) {
-        mergedSegments.addAll(existingSegments);
+      // Check ZK metadata again to get the latest list of committing segments
+      List<String> committingSegmentsFromPropertyStore = 
znRecord.getListField(COMMITTING_SEGMENTS);

Review Comment:
   nit: maybe we can rename it from `committingSegmentsFromPropertyStore` to  
`commitSegmentsSnapshot`



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