Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 36867200B8E for ; Mon, 26 Sep 2016 23:53:24 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 35C0C160AE5; Mon, 26 Sep 2016 21:53:24 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 551CE160AE9 for ; Mon, 26 Sep 2016 23:53:23 +0200 (CEST) Received: (qmail 22770 invoked by uid 500); 26 Sep 2016 21:53:22 -0000 Mailing-List: contact issues-help@drill.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@drill.apache.org Delivered-To: mailing list issues@drill.apache.org Received: (qmail 22619 invoked by uid 99); 26 Sep 2016 21:53:22 -0000 Received: from arcas.apache.org (HELO arcas) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 26 Sep 2016 21:53:22 +0000 Received: from arcas.apache.org (localhost [127.0.0.1]) by arcas (Postfix) with ESMTP id 1EC502C2A64 for ; Mon, 26 Sep 2016 21:53:22 +0000 (UTC) Date: Mon, 26 Sep 2016 21:53:22 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: issues@drill.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DRILL-4726) Dynamic UDFs support MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Mon, 26 Sep 2016 21:53:24 -0000 [ https://issues.apache.org/jira/browse/DRILL-4726?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15524280#comment-15524280 ] ASF GitHub Bot commented on DRILL-4726: --------------------------------------- Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/574#discussion_r80534600 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/coord/zk/ZookeeperClient.java --- @@ -257,14 +263,47 @@ public void put(final String path, final byte[] data, DataChangeVersion version) } if (hasNode) { if (version != null) { - curator.setData().withVersion(version.getVersion()).forPath(target, data); + try { + curator.setData().withVersion(version.getVersion()).forPath(target, data); + } catch (final KeeperException.BadVersionException e) { + throw new VersionMismatchException("Unable to put data. Version mismatch is detected.", version.getVersion(), e); + } } else { curator.setData().forPath(target, data); } } getCache().rebuildNode(target); - } catch (final KeeperException.BadVersionException e) { - throw new VersionMismatchException(e); + } catch (final VersionMismatchException e) { + throw e; + } catch (final Exception e) { + throw new DrillRuntimeException("unable to put ", e); + } + } + + /** + * Puts the given byte sequence into the given path if path is does not exist. + * + * @param path target path + * @param data data to store + * @return null if path was created, else data stored for the given path + */ + public byte[] putIfAbsent(final String path, final byte[] data) { + Preconditions.checkNotNull(path, "path is required"); + Preconditions.checkNotNull(data, "data is required"); + + final String target = PathUtils.join(root, path); + try { + boolean hasNode = hasPath(path, true); --- End diff -- Isn't this a race condition? What if some other client creates the node between the check for hasPath and the create call below? The ZK documentation is sparse here, but my tests show that create( ) will fail if the node exists; you'll get a NodeExistsException, so no need to do the hasPath check. > Dynamic UDFs support > -------------------- > > Key: DRILL-4726 > URL: https://issues.apache.org/jira/browse/DRILL-4726 > Project: Apache Drill > Issue Type: New Feature > Affects Versions: 1.6.0 > Reporter: Arina Ielchiieva > Assignee: Arina Ielchiieva > Fix For: Future > > > Allow register UDFs without restart of Drillbits. > Design is described in document below: > https://docs.google.com/document/d/1FfyJtWae5TLuyheHCfldYUpCdeIezR2RlNsrOTYyAB4/edit?usp=sharing -- This message was sent by Atlassian JIRA (v6.3.4#6332)