jtao15 commented on a change in pull request #6975:
URL: https://github.com/apache/incubator-pinot/pull/6975#discussion_r641685492



##########
File path: 
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/BaseMultipleSegmentsConversionExecutor.java
##########
@@ -138,11 +149,32 @@ protected void postProcess(PinotTaskConfig 
pinotTaskConfig) {
             taskType + " on table: " + tableNameWithType + ", segments: " + 
inputSegmentNames + " got cancelled");
       }
 
+      // Update the segment lineage to indicate that the segment replacement 
is in progress.
+      String lineageEntryId = null;
+      if (replaceSegmentsEnabled) {
+        List<String> segmentsFrom =
+            
Arrays.stream(inputSegmentNames.split(",")).map(String::trim).collect(Collectors.toList());
+        List<String> segmentsTo =
+            
segmentConversionResults.stream().map(SegmentConversionResult::getSegmentName).collect(Collectors.toList());
+        lineageEntryId = SegmentConversionUtils
+            .startSegmentReplace(tableNameWithType, uploadURL, new 
StartReplaceSegmentsRequest(segmentsFrom, segmentsTo));
+      }
+
       // Upload the tarred segments
       for (int i = 0; i < numOutputSegments; i++) {
         File convertedTarredSegmentFile = tarredSegmentFiles.get(i);
         String resultSegmentName = 
segmentConversionResults.get(i).getSegmentName();
 
+        // Set segment ZK metadata custom map modifier into HTTP header to 
modify the segment ZK metadata
+        SegmentZKMetadataCustomMapModifier segmentZKMetadataCustomMapModifier 
= getSegmentZKMetadataCustomMapModifier(pinotTaskConfig);
+        Header segmentZKMetadataCustomMapModifierHeader =
+            new 
BasicHeader(FileUploadDownloadClient.CustomHeaders.SEGMENT_ZK_METADATA_CUSTOM_MAP_MODIFIER,
+                segmentZKMetadataCustomMapModifier.toJsonString());
+
+        List<Header> httpHeaders = new ArrayList<>();
+        httpHeaders.add(segmentZKMetadataCustomMapModifierHeader);
+        httpHeaders.addAll(FileUploadDownloadClient.makeAuthHeader(authToken));

Review comment:
       I'm adding the SegmentZKMetadataCustomMapModifier to the header, so 
upload segment api will update the custom map accordingly. For merged segments, 
we want to mark their bucket granularity in custom map, so the scheduler can 
differentiate which segments are merged already.




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

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