This is an automated email from the ASF dual-hosted git repository.

tingchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new 017e813213 Update Segment Download URL Even When CRC Matches (#11536)
017e813213 is described below

commit 017e8132136695ec9ecc964df04348bf14679c08
Author: Ankit Sultana <ankitsult...@uber.com>
AuthorDate: Thu Sep 7 11:59:00 2023 -0500

    Update Segment Download URL Even When CRC Matches (#11536)
    
    * Update Segment Download URL Even When CRC Matches
    
    * Fix UT
---
 .../main/java/org/apache/pinot/controller/api/upload/ZKOperator.java | 5 +++++
 .../java/org/apache/pinot/controller/api/upload/ZKOperatorTest.java  | 5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java
 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java
index 4229d6c433..38cf2919e7 100644
--- 
a/pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java
+++ 
b/pinot-controller/src/main/java/org/apache/pinot/controller/api/upload/ZKOperator.java
@@ -211,6 +211,11 @@ public class ZKOperator {
           // If no modifier is provided, use the custom map from the segment 
metadata
           segmentZKMetadata.setCustomMap(segmentMetadata.getCustomMap());
         }
+        if (!segmentZKMetadata.getDownloadUrl().equals(segmentDownloadURIStr)) 
{
+          LOGGER.info("Updating segment download url from: {} to: {} even 
though crc is the same",
+                  segmentZKMetadata.getDownloadUrl(), segmentDownloadURIStr);
+          segmentZKMetadata.setDownloadUrl(segmentDownloadURIStr);
+        }
         if (!_pinotHelixResourceManager.updateZkMetadata(tableNameWithType, 
segmentZKMetadata, expectedVersion)) {
           throw new RuntimeException(
               String.format("Failed to update ZK metadata for segment: %s, 
table: %s, expected version: %d",
diff --git 
a/pinot-controller/src/test/java/org/apache/pinot/controller/api/upload/ZKOperatorTest.java
 
b/pinot-controller/src/test/java/org/apache/pinot/controller/api/upload/ZKOperatorTest.java
index e54f62b81c..89adf60096 100644
--- 
a/pinot-controller/src/test/java/org/apache/pinot/controller/api/upload/ZKOperatorTest.java
+++ 
b/pinot-controller/src/test/java/org/apache/pinot/controller/api/upload/ZKOperatorTest.java
@@ -292,8 +292,9 @@ public class ZKOperatorTest {
     assertEquals(segmentZKMetadata.getCreationTime(), 456L);
     long refreshTime = segmentZKMetadata.getRefreshTime();
     assertTrue(refreshTime > 0);
-    // DownloadURL and crypter should not unchanged
-    assertEquals(segmentZKMetadata.getDownloadUrl(), "downloadUrl");
+    // Download URL should change. Refer: 
https://github.com/apache/pinot/issues/11535
+    assertEquals(segmentZKMetadata.getDownloadUrl(), "otherDownloadUrl");
+    // crypter should not be changed
     assertEquals(segmentZKMetadata.getCrypterName(), "crypter");
     assertEquals(segmentZKMetadata.getSegmentUploadStartTime(), -1);
     assertEquals(segmentZKMetadata.getSizeInBytes(), 10);


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

Reply via email to