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



##########
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);

Review comment:
       I think that we should pass `SegmentConversionResult` instead of 
`resultSegmentName`.

##########
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);

Review comment:
       I think that we should pass `SegmentConversionResult` instead of 
`resultSegmentName`. There's a `customProperties` and we can probably use that 
field.

##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/segment/processing/framework/MergeRollupSegmentProcessor.java
##########
@@ -0,0 +1,183 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.core.segment.processing.framework;
+
+import com.google.common.base.Preconditions;
+import java.io.File;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.apache.commons.io.FileUtils;
+import org.apache.pinot.core.common.MinionConstants;
+import org.apache.pinot.core.segment.processing.collector.CollectorConfig;
+import org.apache.pinot.core.segment.processing.collector.CollectorFactory;
+import 
org.apache.pinot.core.segment.processing.collector.ValueAggregatorFactory;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.data.Schema;
+
+
+/**
+ * Merge rollup segment processor framework takes a list of segments and 
concatenates/rolls up segments based on
+ * the configuration.
+ *
+ * TODO:
+ *   1. Add the support for roll-up
+ *   2. Add the support to make result segments time aligned
+ *   3. Add merge/roll-up prefixes for result segments
+ */
+public class MergeRollupSegmentProcessor {

Review comment:
       Let's actually put this under `org.apche.pinot.core.minion` and Rename 
it to `MergeRollupConverter`.
   
   We can delete `org.apche.pinot.core.minion.rollup` and 
`org.apche.pinot.core.minion.segment` in the following PR as a clean-up.

##########
File path: 
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/BaseMultipleSegmentsConversionExecutor.java
##########
@@ -64,6 +70,12 @@
       File workingDir)
       throws Exception;
 
+  /**
+   * Returns the segment ZK metadata custom map modifier.
+   */
+  protected abstract SegmentZKMetadataCustomMapModifier 
getSegmentZKMetadataCustomMapModifier(

Review comment:
       Can we move this to `BaseTaskExecutor`?
   
   We have the same abstract function defined in 
`BaseSingleSegmentConversionExecutor`. After we move this to 
`BaseTaskExecutor`, we can remove this from both 
`BaseSingleSegmentConversionExecutor` and 
`BaseMultipleSegmentsConversionExecutor`




-- 
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to