rohityadav1993 commented on code in PR #13107:
URL: https://github.com/apache/pinot/pull/13107#discussion_r1619935544


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/upsert/ConcurrentMapPartitionUpsertMetadataManager.java:
##########
@@ -158,6 +158,44 @@ protected void addOrReplaceSegment(ImmutableSegmentImpl 
segment, ThreadSafeMutab
     }
   }
 
+  /**
+   * <li> When the replacing segment and current segment are of {@link 
LLCSegmentName} then the PK should resolve to
+   * row in segment with higher sequence id.
+   * <li> When the replacing segment and current segment are of {@link 
UploadedRealtimeSegmentName} then the PK
+   * should resolve to row in segment with higher sequence id, creation time.
+   * <li> When either is of type {@link UploadedRealtimeSegmentName} then 
resolve on creation time, if same(rare
+   * scenario) then give preference to uploaded time
+   *
+   * @param segmentName replacing segment
+   * @param currentSegmentName current segment having the record for the given 
primary key
+   * @param segmentCreationTimeMs creation time of replacing segment
+   * @param currentSegmentCreationTimeMs creation time of current segment
+   * @return true if the record in replacing segment should replace the record 
in current segment
+   */
+  private boolean shouldReplaceOnComparisonTie(String segmentName, String 
currentSegmentName,
+      long segmentCreationTimeMs, long currentSegmentCreationTimeMs) {
+
+    if (LLCSegmentName.isLLCSegment(segmentName) && 
LLCSegmentName.isLLCSegment(currentSegmentName)

Review Comment:
   Thanks, the correction and optimization sounds good. Will update.



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