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



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/segment/processing/framework/MergeRollupSegmentProcessorFramework.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 MergeRollupSegmentProcessorFramework {
+  private List<File> _originalIndexDirs;
+  private final File _workingDir;
+  private final String _inputSegmentDir;
+  private final String _outputSegmentDir;
+  private final SegmentProcessorConfig _segmentProcessorConfig;
+
+  private MergeRollupSegmentProcessorFramework(TableConfig tableConfig, Schema 
schema, String mergeType,

Review comment:
       Let's rename this to `MergeRollupSegmentProcessor`. 

##########
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:
       Does this mean that we will always modify the segmentZKMetadata? 
   
   How do we control when to modify when not to modify? (e.g. based on our 
design, there are some cases that we should not mark the granularity)

##########
File path: 
pinot-plugins/pinot-minion-tasks/pinot-minion-builtin-tasks/src/main/java/org/apache/pinot/plugin/minion/tasks/purge/PurgeTaskExecutor.java
##########
@@ -68,7 +68,7 @@ protected SegmentConversionResult convert(PinotTaskConfig 
pinotTaskConfig, File
 
   @Override
   protected SegmentZKMetadataCustomMapModifier 
getSegmentZKMetadataCustomMapModifier() {
-    return new 
SegmentZKMetadataCustomMapModifier(SegmentZKMetadataCustomMapModifier.ModifyMode.REPLACE,
 Collections
+    return new 
SegmentZKMetadataCustomMapModifier(SegmentZKMetadataCustomMapModifier.ModifyMode.UPDATE,
 Collections

Review comment:
       Let's add the test for `SegmentZKMetadataCustomMapModifier` in the 
future PR when we add the integration test for segment merge/roll-up task.




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