From issues-return-3921-archive-asf-public=cust-asf.ponee.io@phoenix.apache.org Thu Jan 10 00:10:14 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx-eu-01.ponee.io (Postfix) with SMTP id CAD78180669 for ; Thu, 10 Jan 2019 00:10:13 +0100 (CET) Received: (qmail 77626 invoked by uid 500); 9 Jan 2019 23:10:12 -0000 Mailing-List: contact issues-help@phoenix.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@phoenix.apache.org Delivered-To: mailing list issues@phoenix.apache.org Received: (qmail 77617 invoked by uid 99); 9 Jan 2019 23:10:12 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 Jan 2019 23:10:12 +0000 From: GitBox To: issues@phoenix.apache.org Subject: =?utf-8?q?=5BGitHub=5D_karanmehta93_commented_on_a_change_in_pull_request?= =?utf-8?q?_=23419=3A_PHOENIX-4009_Run_UPDATE_STATISTICS_command_by_using_?= =?utf-8?q?MR_integration_on=E2=80=A6?= Message-ID: <154707541239.29917.4416042304581577961.gitbox@gitbox.apache.org> Date: Wed, 09 Jan 2019 23:10:12 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit karanmehta93 commented on a change in pull request #419: PHOENIX-4009 Run UPDATE STATISTICS command by using MR integration on… URL: https://github.com/apache/phoenix/pull/419#discussion_r246581386 ########## File path: phoenix-core/src/main/java/org/apache/phoenix/schema/stats/UpdateStatisticsTool.java ########## @@ -0,0 +1,212 @@ +/* + * 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.phoenix.schema.stats; + +import org.antlr.runtime.CharStream; +import org.apache.commons.cli.CommandLine; +import org.apache.commons.cli.CommandLineParser; +import org.apache.commons.cli.HelpFormatter; +import org.apache.commons.cli.Option; +import org.apache.commons.cli.Options; +import org.apache.commons.cli.ParseException; +import org.apache.commons.cli.PosixParser; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.conf.Configured; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.hbase.HBaseConfiguration; +import org.apache.hadoop.hbase.mapreduce.TableMapReduceUtil; +import org.apache.hadoop.hbase.metrics.Gauge; +import org.apache.hadoop.hbase.metrics.impl.MetricRegistriesImpl; +import org.apache.hadoop.io.NullWritable; +import org.apache.hadoop.mapreduce.Job; +import org.apache.hadoop.mapreduce.Mapper; +import org.apache.hadoop.mapreduce.lib.output.NullOutputFormat; +import org.apache.hadoop.util.Tool; +import org.apache.hadoop.util.ToolRunner; +import org.apache.htrace.SpanReceiver; +import org.apache.phoenix.jdbc.PhoenixConnection; +import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil; +import org.apache.phoenix.mapreduce.util.PhoenixConfigurationUtil.SchemaType; +import org.apache.phoenix.mapreduce.util.PhoenixMapReduceUtil; +import org.apache.phoenix.query.QueryServices; +import org.apache.tephra.TransactionNotInProgressException; +import org.apache.tephra.TransactionSystemClient; +import org.apache.tephra.hbase.coprocessor.TransactionProcessor; +import org.apache.thrift.transport.TTransportException; +import org.apache.twill.common.Cancellable; +import org.apache.twill.discovery.DiscoveryServiceClient; +import org.apache.twill.discovery.ZKDiscoveryService; +import org.apache.twill.zookeeper.ZKClient; +import org.joda.time.Chronology; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Tool to collect table level statistics on HBase snapshot + */ +public class UpdateStatisticsTool extends Configured implements Tool { + + private static final Logger LOG = LoggerFactory.getLogger(UpdateStatisticsTool.class); + + private static final Option TABLE_NAME_OPTION = new Option("t", "table", true, + "Phoenix Table Name"); + private static final Option SNAPSHOT_NAME_OPTION = new Option("s", "snapshot", true, + "HBase Snapshot Name"); + private static final Option RESTORE_DIR_OPTION = new Option("d", "restore-dir", true, Review comment: So we cannot use any path relative to `hbase.rootDir` according to the code. However after digging in, I figured out that we can use `fs.defaultFS` config to find the `hdfs.rootDir` and append `/tmp` to it, thus ensuring that we restore it in that directory always. This will help ease operationalization. Does this seem fine? Relevant code from `RestoreSnapshotHelper` class ``` } else if (restoreDir.toUri().getPath().startsWith(rootDir.toUri().getPath())) { throw new IllegalArgumentException("Restore directory cannot be a sub directory of HBase root directory. RootDir: " + rootDir + ", restoreDir: " + restoreDir); ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: users@infra.apache.org With regards, Apache Git Services