You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by je...@apache.org on 2018/11/26 22:42:37 UTC

[incubator-pinot] branch slashdata created (now 255a4ab)

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

jenniferdai pushed a change to branch slashdata
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git.


      at 255a4ab  Cleaning data dir so URI construction works as expected

This branch includes the following new commits:

     new 255a4ab  Cleaning data dir so URI construction works as expected

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



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


[incubator-pinot] 01/01: Cleaning data dir so URI construction works as expected

Posted by je...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jenniferdai pushed a commit to branch slashdata
in repository https://gitbox.apache.org/repos/asf/incubator-pinot.git

commit 255a4abbc07db08282ac8d7cffb836c085f4048e
Author: Jennifer Dai <jd...@linkedin.com>
AuthorDate: Mon Nov 26 14:42:25 2018 -0800

    Cleaning data dir so URI construction works as expected
---
 .../controller/api/resources/FileUploadPathProvider.java  | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/pinot-controller/src/main/java/com/linkedin/pinot/controller/api/resources/FileUploadPathProvider.java b/pinot-controller/src/main/java/com/linkedin/pinot/controller/api/resources/FileUploadPathProvider.java
index c761b65..cba311a 100644
--- a/pinot-controller/src/main/java/com/linkedin/pinot/controller/api/resources/FileUploadPathProvider.java
+++ b/pinot-controller/src/main/java/com/linkedin/pinot/controller/api/resources/FileUploadPathProvider.java
@@ -47,6 +47,7 @@ public class FileUploadPathProvider {
 
   public FileUploadPathProvider(ControllerConf controllerConf) throws InvalidControllerConfigException {
     String dataDir = controllerConf.getDataDir();
+    dataDir = cleanDataDir(dataDir);
     try {
       // URIs that are allowed to be remote
       _baseDataDirURI = ControllerConf.getUriFromPath(dataDir);
@@ -134,4 +135,18 @@ public class FileUploadPathProvider {
   public File getSchemasTmpDir() {
     return new File(_schemasTmpDirURI);
   }
+
+  /**
+   * Cleans dataDir by getting rid of unnecessary slashes at the end of dataDir. Needed so other URIs are constructed
+   * as expected.
+   * @param dataDir data directory of pinot segments
+   * @return cleaned data directory
+   */
+  private String cleanDataDir(String dataDir) {
+    if (dataDir != null && dataDir.endsWith("/")) {
+      return dataDir.substring(0, dataDir.length() - 1);
+    } else {
+      return dataDir;
+    }
+  }
 }


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