Vamsi-klu commented on code in PR #19084:
URL: https://github.com/apache/pinot/pull/19084#discussion_r4648309580


##########
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/upsertcompaction/UpsertCompactionTaskExecutor.java:
##########
@@ -137,6 +144,104 @@ protected SegmentConversionResult convert(PinotTaskConfig 
pinotTaskConfig, File
     return result;
   }
 
+  /// Check B: task-generation (ZK) segment CRC must match the downloaded 
deepstore/on-disk copy, with the same
+  /// data-CRC fallback used by server matching ([MinionTaskUtils#crcMatches]).
+  @VisibleForTesting
+  void validateDeepStoreCrc(String tableNameWithType, String segmentName, long 
expectedSegmentCrc,
+      long deepstoreSegmentCrc, long deepstoreDataCrc, boolean 
ignoreCrcMismatch) {
+    if (ignoreCrcMismatch) {
+      return;
+    }
+    long zkDataCrc = getZkDataCrc(tableNameWithType, segmentName);
+    if (MinionTaskUtils.crcMatches(expectedSegmentCrc, zkDataCrc, 
deepstoreSegmentCrc, deepstoreDataCrc)) {
+      return;
+    }
+    String message = "Crc mismatched between ZK and deepstore copy of segment: 
" + segmentName
+        + ". Expected crc from ZK: " + expectedSegmentCrc + ", crc from 
deepstore: " + deepstoreSegmentCrc
+        + ", zkDataCrc: " + zkDataCrc + ", deepstoreDataCrc: " + 
deepstoreDataCrc;
+    LOGGER.error(message);
+    _minionMetrics.addMeteredTableValue(tableNameWithType, 
MinionMeter.CRC_MISMATCH_DEEPSTORE, 1L);
+    throw new IllegalStateException(message);
+  }
+
+  /// Check C with a short bounded retry so transient server reload races 
(segment uploaded while a replica is still
+  /// rebuilding upsert metadata) do not fail the task on the first attempt. 
Does not re-download the segment.
+  @VisibleForTesting
+  RoaringBitmap fetchValidDocIdsWithRetry(PinotTaskConfig pinotTaskConfig, 
String tableNameWithType, String segmentName,

Review Comment:
   A retry helps when a replica is briefly unavailable during reload.
   
   Both responses are still 404s. The server adds a header when it knows the 
snapshot is missing. `EQUAL` and `MOST_VALID_DOCS` stop on that response. 
`UNSAFE` can try another replica and stops if every replica confirms the 
snapshot is missing. A 404 without the header gets up to three attempts.
   
   I tested both responses over HTTP and verified that a later generator run 
schedules the segment once the snapshot exists.
   
   Drafted-by: OpenAI Codex (GPT-6); reviewed by @Vamsi-klu before posting



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