You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by GitBox <gi...@apache.org> on 2022/06/02 23:19:09 UTC

[GitHub] [pinot] npawar opened a new pull request, #8823: Allow moveToFinalLocation in METADATA push based on config

npawar opened a new pull request, #8823:
URL: https://github.com/apache/pinot/pull/8823

   TBD: tests


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] Jackie-Jiang commented on a diff in pull request #8823: Allow moveToFinalLocation in METADATA push based on config

Posted by GitBox <gi...@apache.org>.
Jackie-Jiang commented on code in PR #8823:
URL: https://github.com/apache/pinot/pull/8823#discussion_r891808769


##########
pinot-common/src/main/java/org/apache/pinot/common/utils/FileUploadDownloadClient.java:
##########
@@ -73,6 +73,8 @@ public static class CustomHeaders {
     public static final String UPLOAD_TYPE = "UPLOAD_TYPE";
     public static final String REFRESH_ONLY = "REFRESH_ONLY";
     public static final String DOWNLOAD_URI = "DOWNLOAD_URI";
+
+    public static final String MOVE_SEGMENT_TO_DEEP_STORE = "MOVE_SEGMENT_TO_DEEP_STORE";

Review Comment:
   Consider changing it to `COPY_SEGMENT_TO_DEEP_STORE` and add some comments stating that is is for metadata push only



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java:
##########
@@ -310,9 +313,34 @@ private void processNewSegment(String tableNameWithType, SegmentMetadata segment
     }
   }
 
+  private void segmentToFinalLocation(String tableNameWithType, String segmentName, FileUploadType uploadType,
+      File segmentFile, String sourceDownloadURIStr, URI finalSegmentLocationURI)
+      throws Exception {
+    if (uploadType == FileUploadType.METADATA) {
+      // In Metadata push, local segmentFile only contains metadata.
+      // Copy segment over from sourceDownloadURI to final location.
+      copySegmentToPermanentDirectory(new URI(sourceDownloadURIStr), finalSegmentLocationURI);
+      LOGGER.info("Copied segment: {} of table: {} to final location: {}", segmentName, tableNameWithType,
+          finalSegmentLocationURI);
+    } else {
+      // In push types other than METADATA, local segmentFile contains the complete segment.
+      // Move local segment to final location
+      moveSegmentToPermanentDirectory(segmentFile, finalSegmentLocationURI);
+      LOGGER.info("Moved segment: {} of table: {} to final location: {}", segmentName, tableNameWithType,
+          finalSegmentLocationURI);
+    }
+  }
+
   private void moveSegmentToPermanentDirectory(File segmentFile, URI finalSegmentLocationURI)
       throws Exception {
     LOGGER.info("Copying segment from: {} to: {}", segmentFile.getAbsolutePath(), finalSegmentLocationURI);
     PinotFSFactory.create(finalSegmentLocationURI.getScheme()).copyFromLocalFile(segmentFile, finalSegmentLocationURI);
   }
+
+  private void copySegmentToPermanentDirectory(URI sourceDownloadURI, URI finalSegmentLocationURI)
+      throws Exception {
+    Preconditions.checkState(sourceDownloadURI.getScheme().equals(finalSegmentLocationURI.getScheme()));
+    LOGGER.info("Copying segment from: {} to: {}", sourceDownloadURI, finalSegmentLocationURI);

Review Comment:
   Let's also check if they are the same URI before copying



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java:
##########
@@ -310,9 +313,34 @@ private void processNewSegment(String tableNameWithType, SegmentMetadata segment
     }
   }
 
+  private void segmentToFinalLocation(String tableNameWithType, String segmentName, FileUploadType uploadType,
+      File segmentFile, String sourceDownloadURIStr, URI finalSegmentLocationURI)
+      throws Exception {
+    if (uploadType == FileUploadType.METADATA) {
+      // In Metadata push, local segmentFile only contains metadata.
+      // Copy segment over from sourceDownloadURI to final location.
+      copySegmentToPermanentDirectory(new URI(sourceDownloadURIStr), finalSegmentLocationURI);
+      LOGGER.info("Copied segment: {} of table: {} to final location: {}", segmentName, tableNameWithType,
+          finalSegmentLocationURI);
+    } else {
+      // In push types other than METADATA, local segmentFile contains the complete segment.
+      // Move local segment to final location
+      moveSegmentToPermanentDirectory(segmentFile, finalSegmentLocationURI);
+      LOGGER.info("Moved segment: {} of table: {} to final location: {}", segmentName, tableNameWithType,
+          finalSegmentLocationURI);
+    }
+  }
+
   private void moveSegmentToPermanentDirectory(File segmentFile, URI finalSegmentLocationURI)
       throws Exception {
     LOGGER.info("Copying segment from: {} to: {}", segmentFile.getAbsolutePath(), finalSegmentLocationURI);
     PinotFSFactory.create(finalSegmentLocationURI.getScheme()).copyFromLocalFile(segmentFile, finalSegmentLocationURI);
   }
+
+  private void copySegmentToPermanentDirectory(URI sourceDownloadURI, URI finalSegmentLocationURI)
+      throws Exception {
+    Preconditions.checkState(sourceDownloadURI.getScheme().equals(finalSegmentLocationURI.getScheme()));
+    LOGGER.info("Copying segment from: {} to: {}", sourceDownloadURI, finalSegmentLocationURI);

Review Comment:
   Let's also check if they are the same URI before copying



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java:
##########
@@ -230,20 +232,22 @@ private SuccessResponse uploadSegment(@Nullable String tableName, TableType tabl
                 "Segment file (as multipart/form-data) is required for SEGMENT upload mode",
                 Response.Status.BAD_REQUEST);
           }
-          if (!moveSegmentToFinalLocation && StringUtils.isEmpty(downloadURI)) {
+          if (!moveSegmentToFinalLocation && StringUtils.isEmpty(sourceDownloadURIStr)) {

Review Comment:
   Not introduced in this PR, but consider changing `moveSegmentToFinalLocation` to `copySegmentToDeepStore`



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java:
##########
@@ -60,8 +62,9 @@ public ZKOperator(PinotHelixResourceManager pinotHelixResourceManager, Controlle
   }
 
   public void completeSegmentOperations(String tableNameWithType, SegmentMetadata segmentMetadata,
-      @Nullable URI finalSegmentLocationURI, File segmentFile, String downloadUrl, @Nullable String crypterName,
-      long segmentSizeInBytes, boolean enableParallelPushProtection, boolean allowRefresh, HttpHeaders headers)
+      FileUploadType uploadType, @Nullable URI finalSegmentLocationURI, File segmentFile, String sourceDownloadURIStr,

Review Comment:
   `sourceDownloadURIStr` should be nullable



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java:
##########
@@ -60,8 +62,9 @@ public ZKOperator(PinotHelixResourceManager pinotHelixResourceManager, Controlle
   }
 
   public void completeSegmentOperations(String tableNameWithType, SegmentMetadata segmentMetadata,
-      @Nullable URI finalSegmentLocationURI, File segmentFile, String downloadUrl, @Nullable String crypterName,
-      long segmentSizeInBytes, boolean enableParallelPushProtection, boolean allowRefresh, HttpHeaders headers)
+      FileUploadType uploadType, @Nullable URI finalSegmentLocationURI, File segmentFile, String sourceDownloadURIStr,

Review Comment:
   Suggest not introducing upload type into this module. When it is configured to copy the segment to the deep store, we can check if `sourceDownloadURIStr` is provided, and copy accordingly.



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java:
##########
@@ -230,20 +232,22 @@ private SuccessResponse uploadSegment(@Nullable String tableName, TableType tabl
                 "Segment file (as multipart/form-data) is required for SEGMENT upload mode",
                 Response.Status.BAD_REQUEST);
           }
-          if (!moveSegmentToFinalLocation && StringUtils.isEmpty(downloadURI)) {
+          if (!moveSegmentToFinalLocation && StringUtils.isEmpty(sourceDownloadURIStr)) {

Review Comment:
   Not introduced in this PR, but consider changing `moveSegmentToFinalLocation` to `copySegmentToDeepStore`



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java:
##########
@@ -310,9 +313,34 @@ private void processNewSegment(String tableNameWithType, SegmentMetadata segment
     }
   }
 
+  private void segmentToFinalLocation(String tableNameWithType, String segmentName, FileUploadType uploadType,

Review Comment:
   Consider changing it to `copySegmentToDeepStore()`



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java:
##########
@@ -60,8 +62,9 @@ public ZKOperator(PinotHelixResourceManager pinotHelixResourceManager, Controlle
   }
 
   public void completeSegmentOperations(String tableNameWithType, SegmentMetadata segmentMetadata,
-      @Nullable URI finalSegmentLocationURI, File segmentFile, String downloadUrl, @Nullable String crypterName,
-      long segmentSizeInBytes, boolean enableParallelPushProtection, boolean allowRefresh, HttpHeaders headers)
+      FileUploadType uploadType, @Nullable URI finalSegmentLocationURI, File segmentFile, String sourceDownloadURIStr,

Review Comment:
   Suggest not introducing upload type into this module. When it is configured to copy the segment to the deep store, we can check if `sourceDownloadURIStr` is provided, and copy accordingly.



##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/SegmentMetadataPushIntegrationTest.java:
##########
@@ -0,0 +1,229 @@
+/**
+ * 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.integration.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nullable;
+import org.apache.commons.io.FileUtils;
+import org.apache.pinot.plugin.ingestion.batch.standalone.SegmentMetadataPushJobRunner;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.data.Schema;
+import org.apache.pinot.spi.ingestion.batch.spec.PinotClusterSpec;
+import org.apache.pinot.spi.ingestion.batch.spec.PinotFSSpec;
+import org.apache.pinot.spi.ingestion.batch.spec.PushJobSpec;
+import org.apache.pinot.spi.ingestion.batch.spec.SegmentGenerationJobSpec;
+import org.apache.pinot.spi.ingestion.batch.spec.TableSpec;
+import org.apache.pinot.spi.utils.JsonUtils;
+import org.apache.pinot.util.TestUtils;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+
+/**
+ * Test for advanced push types.
+ * Currently only tests METADATA push type.
+ * todo: add test for URI push
+ */
+public class SegmentMetadataPushIntegrationTest extends BaseClusterIntegrationTest {

Review Comment:
   Suggest changing it to `SegmentUploadIntegrationTest` and we can add more tests to cover all upload types in the future



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java:
##########
@@ -310,9 +313,34 @@ private void processNewSegment(String tableNameWithType, SegmentMetadata segment
     }
   }
 
+  private void segmentToFinalLocation(String tableNameWithType, String segmentName, FileUploadType uploadType,

Review Comment:
   Consider changing it to `copySegmentToDeepStore()`



##########
pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/SegmentMetadataPushIntegrationTest.java:
##########
@@ -0,0 +1,229 @@
+/**
+ * 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.integration.tests;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.google.common.base.Function;
+import com.google.common.collect.Lists;
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import javax.annotation.Nullable;
+import org.apache.commons.io.FileUtils;
+import org.apache.pinot.plugin.ingestion.batch.standalone.SegmentMetadataPushJobRunner;
+import org.apache.pinot.spi.config.table.TableConfig;
+import org.apache.pinot.spi.config.table.TableType;
+import org.apache.pinot.spi.data.Schema;
+import org.apache.pinot.spi.ingestion.batch.spec.PinotClusterSpec;
+import org.apache.pinot.spi.ingestion.batch.spec.PinotFSSpec;
+import org.apache.pinot.spi.ingestion.batch.spec.PushJobSpec;
+import org.apache.pinot.spi.ingestion.batch.spec.SegmentGenerationJobSpec;
+import org.apache.pinot.spi.ingestion.batch.spec.TableSpec;
+import org.apache.pinot.spi.utils.JsonUtils;
+import org.apache.pinot.util.TestUtils;
+import org.testng.Assert;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+
+/**
+ * Test for advanced push types.
+ * Currently only tests METADATA push type.
+ * todo: add test for URI push
+ */
+public class SegmentMetadataPushIntegrationTest extends BaseClusterIntegrationTest {

Review Comment:
   Suggest changing it to `SegmentUploadIntegrationTest` and we can add more tests to cover all upload types in the future



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java:
##########
@@ -60,8 +62,9 @@ public ZKOperator(PinotHelixResourceManager pinotHelixResourceManager, Controlle
   }
 
   public void completeSegmentOperations(String tableNameWithType, SegmentMetadata segmentMetadata,
-      @Nullable URI finalSegmentLocationURI, File segmentFile, String downloadUrl, @Nullable String crypterName,
-      long segmentSizeInBytes, boolean enableParallelPushProtection, boolean allowRefresh, HttpHeaders headers)
+      FileUploadType uploadType, @Nullable URI finalSegmentLocationURI, File segmentFile, String sourceDownloadURIStr,

Review Comment:
   `sourceDownloadURIStr` should be nullable



-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] npawar merged pull request #8823: Allow moveToFinalLocation in METADATA push based on config

Posted by GitBox <gi...@apache.org>.
npawar merged PR #8823:
URL: https://github.com/apache/pinot/pull/8823


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] npawar commented on a diff in pull request #8823: Allow moveToFinalLocation in METADATA push based on config

Posted by GitBox <gi...@apache.org>.
npawar commented on code in PR #8823:
URL: https://github.com/apache/pinot/pull/8823#discussion_r897445846


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java:
##########
@@ -60,8 +62,9 @@ public ZKOperator(PinotHelixResourceManager pinotHelixResourceManager, Controlle
   }
 
   public void completeSegmentOperations(String tableNameWithType, SegmentMetadata segmentMetadata,
-      @Nullable URI finalSegmentLocationURI, File segmentFile, String downloadUrl, @Nullable String crypterName,
-      long segmentSizeInBytes, boolean enableParallelPushProtection, boolean allowRefresh, HttpHeaders headers)
+      FileUploadType uploadType, @Nullable URI finalSegmentLocationURI, File segmentFile, String sourceDownloadURIStr,

Review Comment:
   Addressed all other comments. For this one, I kinda prefer keeping the uploadType, so it is very clear when reading. Don't want to rely on `sourceDownloadURIStr` as it can be non-null even in URI push case, but we want to use segment file in that case.



-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] npawar commented on a diff in pull request #8823: Allow moveToFinalLocation in METADATA push based on config

Posted by GitBox <gi...@apache.org>.
npawar commented on code in PR #8823:
URL: https://github.com/apache/pinot/pull/8823#discussion_r898327735


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/SegmentPushUtils.java:
##########
@@ -264,6 +264,10 @@ public static void sendSegmentUriAndMetadata(SegmentGenerationJobSpec spec, Pino
               headers.add(new BasicHeader(FileUploadDownloadClient.CustomHeaders.DOWNLOAD_URI, segmentUriPath));
               headers.add(new BasicHeader(FileUploadDownloadClient.CustomHeaders.UPLOAD_TYPE,
                   FileUploadDownloadClient.FileUploadType.METADATA.toString()));
+              if (spec.getPushJobSpec() != null) {
+                headers.add(new BasicHeader(FileUploadDownloadClient.CustomHeaders.COPY_SEGMENT_TO_DEEP_STORE,
+                    String.valueOf(spec.getPushJobSpec().getMoveToDeepStoreForMetadataPush())));

Review Comment:
   good catch! it started off being "move" everywhere because of some other reason, and when I made it "copy" i missed updating it in PushJobSpec. Fixed



-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] codecov-commenter commented on pull request #8823: Allow moveToFinalLocation in METADATA push based on config

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #8823:
URL: https://github.com/apache/pinot/pull/8823#issuecomment-1145535988

   # [Codecov](https://codecov.io/gh/apache/pinot/pull/8823?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#8823](https://codecov.io/gh/apache/pinot/pull/8823?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (9e6cea8) into [master](https://codecov.io/gh/apache/pinot/commit/07b3ee639c6ff75b13465088208287d3297afca1?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (07b3ee6) will **decrease** coverage by `35.90%`.
   > The diff coverage is `47.61%`.
   
   ```diff
   @@              Coverage Diff              @@
   ##             master    #8823       +/-   ##
   =============================================
   - Coverage     62.93%   27.03%   -35.91%     
   + Complexity     4609        1     -4608     
   =============================================
     Files          1689     1729       +40     
     Lines         89307    91133     +1826     
     Branches      13415    13636      +221     
   =============================================
   - Hits          56209    24636    -31573     
   - Misses        29053    64158    +35105     
   + Partials       4045     2339     -1706     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | integration1 | `27.03% <47.61%> (?)` | |
   | unittests1 | `?` | |
   | unittests2 | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/pinot/pull/8823?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...e/pinot/common/utils/FileUploadDownloadClient.java](https://codecov.io/gh/apache/pinot/pull/8823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9jb21tb24vdXRpbHMvRmlsZVVwbG9hZERvd25sb2FkQ2xpZW50LmphdmE=) | `46.28% <ø> (+28.00%)` | :arrow_up: |
   | [...he/pinot/segment/local/utils/SegmentPushUtils.java](https://codecov.io/gh/apache/pinot/pull/8823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3Qtc2VnbWVudC1sb2NhbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3Qvc2VnbWVudC9sb2NhbC91dGlscy9TZWdtZW50UHVzaFV0aWxzLmphdmE=) | `0.00% <0.00%> (-12.71%)` | :arrow_down: |
   | [...he/pinot/spi/ingestion/batch/spec/PushJobSpec.java](https://codecov.io/gh/apache/pinot/pull/8823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvaW5nZXN0aW9uL2JhdGNoL3NwZWMvUHVzaEpvYlNwZWMuamF2YQ==) | `0.00% <0.00%> (-59.10%)` | :arrow_down: |
   | [...ces/PinotSegmentUploadDownloadRestletResource.java](https://codecov.io/gh/apache/pinot/pull/8823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29udHJvbGxlci9hcGkvcmVzb3VyY2VzL1Bpbm90U2VnbWVudFVwbG9hZERvd25sb2FkUmVzdGxldFJlc291cmNlLmphdmE=) | `50.00% <52.63%> (+9.07%)` | :arrow_up: |
   | [...apache/pinot/controller/api/upload/ZKOperator.java](https://codecov.io/gh/apache/pinot/pull/8823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3QtY29udHJvbGxlci9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcGlub3QvY29udHJvbGxlci9hcGkvdXBsb2FkL1pLT3BlcmF0b3IuamF2YQ==) | `55.78% <58.82%> (-3.93%)` | :arrow_down: |
   | [...in/java/org/apache/pinot/spi/utils/StringUtil.java](https://codecov.io/gh/apache/pinot/pull/8823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvdXRpbHMvU3RyaW5nVXRpbC5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [.../java/org/apache/pinot/spi/utils/BooleanUtils.java](https://codecov.io/gh/apache/pinot/pull/8823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvdXRpbHMvQm9vbGVhblV0aWxzLmphdmE=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...java/org/apache/pinot/spi/trace/BaseRecording.java](https://codecov.io/gh/apache/pinot/pull/8823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvdHJhY2UvQmFzZVJlY29yZGluZy5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...java/org/apache/pinot/spi/trace/NoOpRecording.java](https://codecov.io/gh/apache/pinot/pull/8823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvdHJhY2UvTm9PcFJlY29yZGluZy5qYXZh) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [...ava/org/apache/pinot/spi/config/table/FSTType.java](https://codecov.io/gh/apache/pinot/pull/8823/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cGlub3Qtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9waW5vdC9zcGkvY29uZmlnL3RhYmxlL0ZTVFR5cGUuamF2YQ==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | ... and [1402 more](https://codecov.io/gh/apache/pinot/pull/8823/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/pinot/pull/8823?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/pinot/pull/8823?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [07b3ee6...9e6cea8](https://codecov.io/gh/apache/pinot/pull/8823?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org


[GitHub] [pinot] walterddr commented on a diff in pull request #8823: Allow moveToFinalLocation in METADATA push based on config

Posted by GitBox <gi...@apache.org>.
walterddr commented on code in PR #8823:
URL: https://github.com/apache/pinot/pull/8823#discussion_r898080999


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/SegmentPushUtils.java:
##########
@@ -264,6 +264,10 @@ public static void sendSegmentUriAndMetadata(SegmentGenerationJobSpec spec, Pino
               headers.add(new BasicHeader(FileUploadDownloadClient.CustomHeaders.DOWNLOAD_URI, segmentUriPath));
               headers.add(new BasicHeader(FileUploadDownloadClient.CustomHeaders.UPLOAD_TYPE,
                   FileUploadDownloadClient.FileUploadType.METADATA.toString()));
+              if (spec.getPushJobSpec() != null) {
+                headers.add(new BasicHeader(FileUploadDownloadClient.CustomHeaders.COPY_SEGMENT_TO_DEEP_STORE,
+                    String.valueOf(spec.getPushJobSpec().getMoveToDeepStoreForMetadataPush())));

Review Comment:
   I guess I was a bit confused with the PushJobSpec definition name "move" and the CustomHeader field "copy". so it actually resembles a fils system "copy" but not a "move" correct? maybe renaming to avoid confusion?



##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java:
##########
@@ -260,14 +264,23 @@ private SuccessResponse uploadSegment(@Nullable String tableName, TableType tabl
                 "Segment metadata file (as multipart/form-data) is required for METADATA upload mode",
                 Response.Status.BAD_REQUEST);
           }
-          if (StringUtils.isEmpty(downloadURI)) {
-            throw new ControllerApplicationException(LOGGER, "Download URI is required for METADATA upload mode",
+          if (StringUtils.isEmpty(sourceDownloadURIStr)) {
+            throw new ControllerApplicationException(LOGGER,
+                "Source download URI is required in header field 'DOWNLOAD_URI' for METADATA upload mode",
                 Response.Status.BAD_REQUEST);
           }
-          moveSegmentToFinalLocation = false;
+          // override copySegmentToFinalLocation if override provided in headers:COPY_SEGMENT_TO_DEEP_STORE
+          // else set to false for backward compatibility
+          String copySegmentToDeepStore =
+              extractHttpHeader(headers, FileUploadDownloadClient.CustomHeaders.COPY_SEGMENT_TO_DEEP_STORE);
+          if (copySegmentToDeepStore != null) {
+            copySegmentToFinalLocation = Boolean.parseBoolean(copySegmentToDeepStore);
+          } else {
+            copySegmentToFinalLocation = false;
+          }

Review Comment:
   ```suggestion
             copySegmentToFinalLocation = Boolean.parseBoolean(copySegmentToDeepStore);
   ```
   should do the trick. null is mapped to false. 



-- 
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-unsubscribe@pinot.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org