[GitHub] carbondata pull request #2406: [CARBONDATA-2640][CARBONDATA-2642] Added conf...

classic Classic list List threaded Threaded
98 messages Options
12345
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2406: [CARBONDATA-2642] Added configurable Lock path prope...

qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/2406
 
    SDV Build Fail , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5632/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2406: [CARBONDATA-2642] Added configurable Lock path prope...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2406
 
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5626/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2406: [CARBONDATA-2642] Added configurable Lock path prope...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2406
 
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6840/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2406: [CARBONDATA-2642] Added configurable Lock path prope...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user brijoobopanna commented on the issue:

    https://github.com/apache/carbondata/pull/2406
 
    retest sdv please


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2406: [CARBONDATA-2642] Added configurable Lock path prope...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/2406
 
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5644/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2406: [CARBONDATA-2642] Added configurable Lock path prope...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2406
 
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5635/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2406: [CARBONDATA-2642] Added configurable Lock pat...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user kunal642 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2406#discussion_r200553521
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/filesystem/S3CarbonFile.java ---
    @@ -0,0 +1,136 @@
    +/*
    + * 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.carbondata.core.datastore.filesystem;
    +
    +import java.io.DataInputStream;
    +import java.io.DataOutputStream;
    +import java.io.IOException;
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +import org.apache.carbondata.common.logging.LogService;
    +import org.apache.carbondata.common.logging.LogServiceFactory;
    +import org.apache.carbondata.core.constants.CarbonCommonConstants;
    +import org.apache.carbondata.core.datastore.impl.FileFactory;
    +import org.apache.carbondata.core.util.CarbonUtil;
    +
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.hadoop.fs.FSDataOutputStream;
    +import org.apache.hadoop.fs.FileStatus;
    +import org.apache.hadoop.fs.FileSystem;
    +import org.apache.hadoop.fs.LocatedFileStatus;
    +import org.apache.hadoop.fs.Path;
    +import org.apache.hadoop.fs.RemoteIterator;
    +
    +public class S3CarbonFile extends HDFSCarbonFile {
    +
    +  private static final LogService LOGGER =
    +      LogServiceFactory.getLogService(HDFSCarbonFile.class.getName());
    +
    +  public S3CarbonFile(String filePath) {
    +    super(filePath);
    +  }
    +
    +  public S3CarbonFile(String filePath, Configuration hadoopConf) {
    +    super(filePath, hadoopConf);
    +  }
    +
    +  public S3CarbonFile(Path path) {
    +    super(path);
    +  }
    +
    +  public S3CarbonFile(Path path, Configuration hadoopConf) {
    +    super(path, hadoopConf);
    +  }
    +
    +  public S3CarbonFile(FileStatus fileStatus) {
    +    super(fileStatus);
    +  }
    +
    +  @Override
    +  public boolean renameForce(String changetoName) {
    +    FileSystem fs;
    --- End diff --
   
    This is done because majority of our existing code uses rename force. To handle we will delete the destination directory and then recreate with new name.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2406: [CARBONDATA-2642] Added configurable Lock pat...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user kunal642 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2406#discussion_r200553686
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/datastore/filesystem/S3CarbonFile.java ---
    @@ -0,0 +1,136 @@
    +/*
    + * 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.carbondata.core.datastore.filesystem;
    +
    +import java.io.DataInputStream;
    +import java.io.DataOutputStream;
    +import java.io.IOException;
    +import java.util.ArrayList;
    +import java.util.List;
    +
    +import org.apache.carbondata.common.logging.LogService;
    +import org.apache.carbondata.common.logging.LogServiceFactory;
    +import org.apache.carbondata.core.constants.CarbonCommonConstants;
    +import org.apache.carbondata.core.datastore.impl.FileFactory;
    +import org.apache.carbondata.core.util.CarbonUtil;
    +
    +import org.apache.hadoop.conf.Configuration;
    +import org.apache.hadoop.fs.FSDataOutputStream;
    +import org.apache.hadoop.fs.FileStatus;
    +import org.apache.hadoop.fs.FileSystem;
    +import org.apache.hadoop.fs.LocatedFileStatus;
    +import org.apache.hadoop.fs.Path;
    +import org.apache.hadoop.fs.RemoteIterator;
    +
    +public class S3CarbonFile extends HDFSCarbonFile {
    +
    +  private static final LogService LOGGER =
    +      LogServiceFactory.getLogService(HDFSCarbonFile.class.getName());
    +
    +  public S3CarbonFile(String filePath) {
    +    super(filePath);
    +  }
    +
    +  public S3CarbonFile(String filePath, Configuration hadoopConf) {
    +    super(filePath, hadoopConf);
    +  }
    +
    +  public S3CarbonFile(Path path) {
    +    super(path);
    +  }
    +
    +  public S3CarbonFile(Path path, Configuration hadoopConf) {
    +    super(path, hadoopConf);
    +  }
    +
    +  public S3CarbonFile(FileStatus fileStatus) {
    +    super(fileStatus);
    +  }
    +
    +  @Override
    +  public boolean renameForce(String changetoName) {
    +    FileSystem fs;
    +    try {
    +      fs = fileStatus.getPath().getFileSystem(hadoopConf);
    +      return fs.rename(fileStatus.getPath(), new Path(changetoName));
    +    } catch (IOException e) {
    +      LOGGER.error("Exception occured: " + e.getMessage());
    +      return false;
    +    }
    +  }
    +
    +  @Override
    +  public DataOutputStream getDataOutputStreamUsingAppend(String path, FileFactory.FileType fileType)
    +      throws IOException {
    +    return getDataOutputStream(path, fileType, CarbonCommonConstants.BYTEBUFFER_SIZE, true);
    +  }
    +
    +  @Override public DataOutputStream getDataOutputStream(String path, FileFactory.FileType fileType,
    +      int bufferSize, boolean append) throws IOException {
    +    Path pt = new Path(path);
    +    FileSystem fileSystem = pt.getFileSystem(FileFactory.getConfiguration());
    +    FSDataOutputStream stream;
    +    if (append) {
    --- End diff --
   
    HDFS client only takes care of append mode in case of DistributedFileSystem for other it will create with overwrite. Therefore we need to read the file and keep the contents in memory for overwriting the file.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2406: [CARBONDATA-2642] Added configurable Lock pat...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user kunal642 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2406#discussion_r200553901
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/locks/CarbonLockFactory.java ---
    @@ -52,44 +55,56 @@
        */
       public static ICarbonLock getCarbonLockObj(AbsoluteTableIdentifier absoluteTableIdentifier,
           String lockFile) {
    -
    -    String tablePath = absoluteTableIdentifier.getTablePath();
    +    String tablePath;
    +    if (lockPath.isEmpty()) {
    +      tablePath = absoluteTableIdentifier.getTablePath();
    +    } else {
    +      if (absoluteTableIdentifier
    +          .getCarbonTableIdentifier().getTableId().isEmpty()) {
    +        throw new RuntimeException("Table id is empty");
    +      }
    +      tablePath = lockPath + CarbonCommonConstants.FILE_SEPARATOR + absoluteTableIdentifier
    +          .getCarbonTableIdentifier().getTableId();
    +    }
         if (lockTypeConfigured.equals(CarbonCommonConstants.CARBON_LOCK_TYPE_ZOOKEEPER)) {
    -      return new ZooKeeperLocking(absoluteTableIdentifier, lockFile);
    -    } else if (tablePath.startsWith(CarbonCommonConstants.S3A_PREFIX) ||
    -        tablePath.startsWith(CarbonCommonConstants.S3N_PREFIX) ||
    -            tablePath.startsWith(CarbonCommonConstants.S3_PREFIX)) {
    +      return new ZooKeeperLocking(tablePath, lockFile);
    +    } else if (tablePath.startsWith(CarbonCommonConstants.S3A_PREFIX) || tablePath
    +        .startsWith(CarbonCommonConstants.S3N_PREFIX) || tablePath
    +        .startsWith(CarbonCommonConstants.S3_PREFIX)) {
           lockTypeConfigured = CarbonCommonConstants.CARBON_LOCK_TYPE_S3;
    -      return new S3FileLock(absoluteTableIdentifier, lockFile);
    +      return new S3FileLock(tablePath,
    --- End diff --
   
    I think it is better to create s3 file lock as default for S3 files. We cannot be sure if HDFS is present or not


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2406: [CARBONDATA-2642] Added configurable Lock pat...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user kunal642 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2406#discussion_r200554007
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/locks/CarbonLockFactory.java ---
    @@ -52,44 +55,56 @@
        */
       public static ICarbonLock getCarbonLockObj(AbsoluteTableIdentifier absoluteTableIdentifier,
           String lockFile) {
    -
    -    String tablePath = absoluteTableIdentifier.getTablePath();
    +    String tablePath;
    +    if (lockPath.isEmpty()) {
    +      tablePath = absoluteTableIdentifier.getTablePath();
    +    } else {
    +      if (absoluteTableIdentifier
    +          .getCarbonTableIdentifier().getTableId().isEmpty()) {
    +        throw new RuntimeException("Table id is empty");
    +      }
    +      tablePath = lockPath + CarbonCommonConstants.FILE_SEPARATOR + absoluteTableIdentifier
    +          .getCarbonTableIdentifier().getTableId();
    +    }
         if (lockTypeConfigured.equals(CarbonCommonConstants.CARBON_LOCK_TYPE_ZOOKEEPER)) {
    -      return new ZooKeeperLocking(absoluteTableIdentifier, lockFile);
    -    } else if (tablePath.startsWith(CarbonCommonConstants.S3A_PREFIX) ||
    -        tablePath.startsWith(CarbonCommonConstants.S3N_PREFIX) ||
    -            tablePath.startsWith(CarbonCommonConstants.S3_PREFIX)) {
    +      return new ZooKeeperLocking(tablePath, lockFile);
    +    } else if (tablePath.startsWith(CarbonCommonConstants.S3A_PREFIX) || tablePath
    +        .startsWith(CarbonCommonConstants.S3N_PREFIX) || tablePath
    +        .startsWith(CarbonCommonConstants.S3_PREFIX)) {
           lockTypeConfigured = CarbonCommonConstants.CARBON_LOCK_TYPE_S3;
    -      return new S3FileLock(absoluteTableIdentifier, lockFile);
    +      return new S3FileLock(tablePath,
    --- End diff --
   
    currently lock type is only used for Zookeeper locking other directly create the desired lock based on the path URI.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2406: [CARBONDATA-2642] Added configurable Lock pat...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user kunal642 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2406#discussion_r200554022
 
    --- Diff: core/src/main/java/org/apache/carbondata/core/locks/CarbonLockFactory.java ---
    @@ -105,4 +120,10 @@ private static void getLockTypeConfigured() {
         LOGGER.info("Configured lock type is: " + lockTypeConfigured);
       }
     
    +  private static void getLockpath() {
    +    lockPath = CarbonProperties.getInstance()
    +        .getProperty(CarbonCommonConstants.LOCK_PATH, "")
    +        .toUpperCase();
    --- End diff --
   
    done


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2406: [CARBONDATA-2642] Added configurable Lock pat...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user kunal642 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2406#discussion_r200554062
 
    --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/hive/CarbonFileMetastore.scala ---
    @@ -386,7 +386,8 @@ class CarbonFileMetastore extends CarbonMetaStore {
         val schemaMetadataPath = CarbonTablePath.getFolderContainingFile(schemaFilePath)
         val fileType = FileFactory.getFileType(schemaMetadataPath)
         if (!FileFactory.isFileExist(schemaMetadataPath, fileType)) {
    -      val isDirCreated = FileFactory.mkdirs(schemaMetadataPath, fileType)
    +      val isDirCreated = FileFactory
    --- End diff --
   
    removed


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2406: [CARBONDATA-2642] Added configurable Lock pat...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user kunal642 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2406#discussion_r200554082
 
    --- Diff: processing/src/test/java/org/apache/carbondata/lcm/locks/LocalFileLockTest.java ---
    @@ -68,4 +80,18 @@
         Assert.assertTrue(localLock2.unlock());
       }
     
    +  @Test public void testConfigurablePathForLock() throws Exception {
    +    Field f = secretClass.getDeclaredField("lockPath");
    +    f.setAccessible(true);
    +    f.set(secretClass, rootPath + "/target/");
    +    AbsoluteTableIdentifier absoluteTableIdentifier = AbsoluteTableIdentifier
    +        .from(CarbonProperties.getInstance().getProperty("carbon.storelocation"), "databaseName",
    +            "tableName", "1");
    --- End diff --
   
    done


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2406: [CARBONDATA-2642] Added configurable Lock path prope...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2406
 
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder1/6879/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2406: [CARBONDATA-2642] Added configurable Lock path prope...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/2406
 
    SDV Build Success , Please check CI http://144.76.159.231:8080/job/ApacheSDVTests/5658/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2406: [CARBONDATA-2642] Added configurable Lock path prope...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user gvramana commented on the issue:

    https://github.com/apache/carbondata/pull/2406
 
    LGTM


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #2406: [CARBONDATA-2642] Added configurable Lock pat...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user kunal642 closed the pull request at:

    https://github.com/apache/carbondata/pull/2406


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #2406: [CARBONDATA-2642] Added configurable Lock path prope...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/2406
 
    Build Success with Spark 2.2.1, Please check CI http://88.99.58.216:8080/job/ApacheCarbonPRBuilder/5682/



---
12345