[ 
https://issues.apache.org/jira/browse/KYLIN-4833?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17254548#comment-17254548
 ] 

ASF GitHub Bot commented on KYLIN-4833:
---------------------------------------

nyshthefantastic commented on a change in pull request #1494:
URL: https://github.com/apache/kylin/pull/1494#discussion_r548532199



##########
File path: 
storage-hbase/src/main/java/org/apache/kylin/storage/hbase/steps/HBaseJobSteps.java
##########
@@ -72,6 +80,26 @@ public HadoopShellExecutable createCreateHTableStep(String 
jobId, CuboidModeEnum
         return createHtableStep;
     }
 
+    public AbstractExecutable createDistcpHFileStep(String jobId){
+        String inputPath = getRealizationRootPath(jobId) + "/hfile";
+        MapReduceExecutable createHFilesStep = new MapReduceExecutable();
+        createHFilesStep.setName(ExecutableConstants.STEP_NAME_HFILE_DISTCP);
+        StringBuilder cmd = new StringBuilder();
+
+        appendMapReduceParameters(cmd);
+        appendExecCmdParameters(cmd, BatchConstants.ARG_CUBE_NAME, 
seg.getRealization().getName());
+//        appendExecCmdParameters(cmd, BatchConstants.ARG_PARTITION, 
getRowkeyDistributionOutputPath(jobId) + "/part-r-00000_hfile");

Review comment:
       remove commented code if not needed , will help in code readability 
going forward.

##########
File path: 
storage-hbase/src/main/java/org/apache/kylin/storage/hbase/steps/HDFSPathGarbageCollectionStep.java
##########
@@ -91,7 +91,8 @@ private void dropHdfsPathOnCluster(List<String> oldHdfsPaths, 
FileSystem fileSys
                 }
                 // If hbase was deployed on another cluster, the job dir is 
empty and should be dropped,
                 // because of rowkey_stats and hfile dirs are both dropped.
-                if (fileSystem.listStatus(oldPath.getParent()).length == 0) {
+                Path parentPath = oldPath.getParent();

Review comment:
       good to use final if variable is not mutated : final Path parentPath

##########
File path: 
storage-hbase/src/main/java/org/apache/kylin/storage/hbase/steps/HFileDistcpJob.java
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.kylin.storage.hbase.steps;
+
+import com.google.common.collect.Lists;
+import org.apache.commons.cli.Options;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.Path;
+import org.apache.hadoop.mapred.JobContext;
+import org.apache.hadoop.tools.DistCp;
+import org.apache.hadoop.tools.DistCpOptions;
+import org.apache.hadoop.util.ToolRunner;
+import org.apache.kylin.common.KylinConfig;
+import org.apache.kylin.common.util.HadoopUtil;
+import org.apache.kylin.cube.CubeInstance;
+import org.apache.kylin.cube.CubeManager;
+import org.apache.kylin.engine.mr.common.AbstractHadoopJob;
+import org.apache.kylin.engine.mr.common.BatchConstants;
+import org.apache.kylin.storage.hbase.HBaseConnection;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+
+/**
+ * @author fengpod
+ */
+public class HFileDistcpJob extends AbstractHadoopJob {
+
+    protected static final Logger logger = 
LoggerFactory.getLogger(HFileDistcpJob.class);
+
+    public int run(String[] args) throws Exception {
+        Options options = new Options();
+
+        try {
+            options.addOption(OPTION_CUBE_NAME);
+            options.addOption(OPTION_JOB_NAME);
+            options.addOption(OPTION_INPUT_PATH);
+            options.addOption(OPTION_OUTPUT_PATH);
+            options.addOption(OPTION_HTABLE_NAME);
+            parseOptions(options, args);
+
+            // use current hbase configuration
+            Configuration configuration = new Configuration();
+            HBaseConnection.addHBaseClusterNNHAConfiguration(configuration);
+
+            Path input = new Path(getOptionValue(OPTION_INPUT_PATH));

Review comment:
       good to change to final




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


> use distcp to control the speed of writting hfile data to hbase cluster
> -----------------------------------------------------------------------
>
>                 Key: KYLIN-4833
>                 URL: https://issues.apache.org/jira/browse/KYLIN-4833
>             Project: Kylin
>          Issue Type: Improvement
>          Components: Storage - HBase
>    Affects Versions: v3.1.1
>            Reporter: fengpod
>            Assignee: fengpod
>            Priority: Minor
>             Fix For: v3.1.2
>
>
> When a large data is written to hbase cluster at the same time,the cluster 
> load will become very high,which will affect the query performance. This pr 
> allows data to be written data to hadoop hdfs when doing step “Convert Cuboid 
> Data to HFile”,and then hfile will be transferred to the hbase cluster by 
> DistCp。DistCp controls the speed of write data so as to reduce the pressure 
> of cluster。 This pr adds a new step " HFile Distcp To HBase" between “Convert 
> Cuboid Data to HFile” and "Load HFile to HBase Table" 。As look like this:
> !https://user-images.githubusercontent.com/4843586/100835711-013fae00-34a9-11eb-8de8-e69228ba0991.png!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to