From issues-return-122268-archive-asf-public=cust-asf.ponee.io@hive.apache.org Tue Jun 5 13:09:06 2018 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 3401E180625 for ; Tue, 5 Jun 2018 13:09:06 +0200 (CEST) Received: (qmail 2890 invoked by uid 500); 5 Jun 2018 11:09:05 -0000 Mailing-List: contact issues-help@hive.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hive.apache.org Delivered-To: mailing list issues@hive.apache.org Received: (qmail 2880 invoked by uid 99); 5 Jun 2018 11:09:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 05 Jun 2018 11:09:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id D812CC0231 for ; Tue, 5 Jun 2018 11:09:04 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -109.501 X-Spam-Level: X-Spam-Status: No, score=-109.501 tagged_above=-999 required=6.31 tests=[ENV_AND_HDR_SPF_MATCH=-0.5, KAM_ASCII_DIVIDERS=0.8, RCVD_IN_DNSWL_MED=-2.3, SPF_PASS=-0.001, USER_IN_DEF_SPF_WL=-7.5, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id sWTXA81XrFc8 for ; Tue, 5 Jun 2018 11:09:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTP id 91A505F612 for ; Tue, 5 Jun 2018 11:09:02 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id B691FE0EFA for ; Tue, 5 Jun 2018 11:09:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id B7D832109B for ; Tue, 5 Jun 2018 11:09:00 +0000 (UTC) Date: Tue, 5 Jun 2018 11:09:00 +0000 (UTC) From: "Marta Kuczora (JIRA)" To: issues@hive.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (HIVE-19046) Refactor the common parts of the HiveMetastore add_partition_core and add_partitions_pspec_core methods MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HIVE-19046?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:all-tabpanel ] Marta Kuczora updated HIVE-19046: --------------------------------- Attachment: HIVE-19046.6.patch > Refactor the common parts of the HiveMetastore add_partition_core and add= _partitions_pspec_core methods > -------------------------------------------------------------------------= ------------------------------ > > Key: HIVE-19046 > URL: https://issues.apache.org/jira/browse/HIVE-19046 > Project: Hive > Issue Type: Improvement > Components: Metastore > Reporter: Marta Kuczora > Assignee: Marta Kuczora > Priority: Minor > Attachments: HIVE-19046.1.patch, HIVE-19046.2.patch, HIVE-19046.3= .patch, HIVE-19046.4.patch, HIVE-19046.5.patch, HIVE-19046.6.patch > > > This is a follow-up Jira of the [HIVE-18696|https://issues.apache.org/jir= a/browse/HIVE-18696]=C2=A0[review|https://reviews.apache.org/r/65716/]. > The biggest part of these methods use the same code. It would make sense = to move this code part to a common method. > This code is almost the same in the two methods: > {code} > List> partFutures =3D Lists.newArrayList(); > final Table table =3D tbl; > for (final Partition part : parts) { > if (!part.getTableName().equals(tblName) || !part.getDbName().e= quals(dbName)) { > throw new MetaException("Partition does not belong to target = table " > + dbName + "." + tblName + ": " + part); > } > boolean shouldAdd =3D startAddPartition(ms, part, ifNotExists); > if (!shouldAdd) { > existingParts.add(part); > LOG.info("Not adding partition " + part + " as it already exi= sts"); > continue; > } > final UserGroupInformation ugi; > try { > ugi =3D UserGroupInformation.getCurrentUser(); > } catch (IOException e) { > throw new RuntimeException(e); > } > partFutures.add(threadPool.submit(new Callable() { > @Override > public Partition call() throws Exception { > ugi.doAs(new PrivilegedExceptionAction() { > @Override > public Object run() throws Exception { > try { > boolean madeDir =3D createLocationForAddedPartition(t= able, part); > if (addedPartitions.put(new PartValEqWrapper(part), m= adeDir) !=3D null) { > // Technically, for ifNotExists case, we could inse= rt one and discard the other > // because the first one now "exists", but it seems= better to report the problem > // upstream as such a command doesn't make sense. > throw new MetaException("Duplicate partitions in th= e list: " + part); > } > initializeAddedPartition(table, part, madeDir); > } catch (MetaException e) { > throw new IOException(e.getMessage(), e); > } > return null; > } > }); > return part; > } > })); > } > try { > for (Future partFuture : partFutures) { > Partition part =3D partFuture.get(); > if (part !=3D null) { > newParts.add(part); > } > } > } catch (InterruptedException | ExecutionException e) { > // cancel other tasks > for (Future partFuture : partFutures) { > partFuture.cancel(true); > } > throw new MetaException(e.getMessage()); > } > {code} -- This message was sent by Atlassian JIRA (v7.6.3#76005)