You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by jl...@apache.org on 2021/05/26 18:00:54 UTC

[incubator-pinot] 01/01: Fix deep store directory structure (#6976)

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

jlli pushed a commit to branch deep.store.dir.structure
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 63c8c3a9a057dfff033796391a36c000faca6939
Author: Sajjad Moradi <mo...@gmail.com>
AuthorDate: Tue May 25 22:13:32 2021 -0700

    Fix deep store directory structure (#6976)
    
    * Fix deep store directory strucure
    
    * tableName -> rawTableName
    
    * extract raw table name
    
    * fix integration test
---
 .../api/resources/PinotSegmentUploadDownloadRestletResource.java  | 8 ++++----
 .../pinot/controller/helix/ControllerRequestURLBuilder.java       | 4 ++--
 .../pinot/integration/tests/BasicAuthRealtimeIntegrationTest.java | 2 +-
 3 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java
index 35a3e07..98383ca 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotSegmentUploadDownloadRestletResource.java
@@ -292,7 +292,7 @@ public class PinotSegmentUploadDownloadRestletResource {
                 tableNameWithType);
         zkDownloadUri = downloadUri;
       } else {
-        zkDownloadUri = getZkDownloadURIForSegmentUpload(tableNameWithType, segmentName);
+        zkDownloadUri = getZkDownloadURIForSegmentUpload(rawTableName, segmentName);
       }
 
       // Zk operations
@@ -389,9 +389,9 @@ public class PinotSegmentUploadDownloadRestletResource {
       String tableNameWithType, SegmentMetadata segmentMetadata, String segmentName, String zkDownloadURI,
       boolean moveSegmentToFinalLocation, String crypter)
       throws Exception {
-    URI finalSegmentLocationURI = URIUtils
-        .getUri(ControllerFilePathProvider.getInstance().getDataDirURI().toString(), tableNameWithType,
-            URIUtils.encode(segmentName));
+    String basePath = ControllerFilePathProvider.getInstance().getDataDirURI().toString();
+    String rawTableName = TableNameBuilder.extractRawTableName(tableNameWithType);
+    URI finalSegmentLocationURI = URIUtils.getUri(basePath, rawTableName, URIUtils.encode(segmentName));
     ZKOperator zkOperator = new ZKOperator(_pinotHelixResourceManager, _controllerConf, _controllerMetrics);
     zkOperator.completeSegmentOperations(tableNameWithType, segmentMetadata, finalSegmentLocationURI, uploadedSegmentFile,
         enableParallelPushProtection, headers, zkDownloadURI, moveSegmentToFinalLocation, crypter);
diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/ControllerRequestURLBuilder.java b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/ControllerRequestURLBuilder.java
index cea7582..9d3b362 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/helix/ControllerRequestURLBuilder.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/helix/ControllerRequestURLBuilder.java
@@ -255,8 +255,8 @@ public class ControllerRequestURLBuilder {
     return StringUtil.join("/", _baseUrl, "tableConfigs", "validate");
   }
 
-  public String forSegmentDownload(String tableNameWithType, String segmentName) {
-    return URIUtils.constructDownloadUrl(_baseUrl, tableNameWithType, segmentName);
+  public String forSegmentDownload(String tableName, String segmentName) {
+    return URIUtils.constructDownloadUrl(_baseUrl, tableName, segmentName);
   }
 
   public String forSegmentDelete(String tableName, String segmentName) {
diff --git a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/BasicAuthRealtimeIntegrationTest.java b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/BasicAuthRealtimeIntegrationTest.java
index 87eafb6..aa5868b 100644
--- a/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/BasicAuthRealtimeIntegrationTest.java
+++ b/pinot-integration-tests/src/test/java/org/apache/pinot/integration/tests/BasicAuthRealtimeIntegrationTest.java
@@ -183,7 +183,7 @@ public class BasicAuthRealtimeIntegrationTest extends BaseClusterIntegrationTest
     for (int i = 0; i < offlineSegments.size(); i++) {
       String segment = offlineSegments.get(i).asText();
       Assert.assertTrue(sendGetRequest(_controllerRequestURLBuilder
-          .forSegmentDownload(TableNameBuilder.OFFLINE.tableNameWithType(getTableName()), segment), AUTH_HEADER)
+          .forSegmentDownload(getTableName(), segment), AUTH_HEADER)
           .length() > 200000); // download segment
     }
   }

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