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 4F66B200BF6 for ; Tue, 6 Dec 2016 07:12:54 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 4E1B1160B18; Tue, 6 Dec 2016 06:12:54 +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 C40E6160B21 for ; Tue, 6 Dec 2016 07:12:53 +0100 (CET) Received: (qmail 40163 invoked by uid 500); 6 Dec 2016 06:12:52 -0000 Mailing-List: contact dev-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 dev@drill.apache.org Received: (qmail 38288 invoked by uid 99); 6 Dec 2016 06:12:51 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Dec 2016 06:12:51 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 526E6F1754; Tue, 6 Dec 2016 06:12:51 +0000 (UTC) From: paul-rogers To: dev@drill.apache.org Reply-To: dev@drill.apache.org References: In-Reply-To: Subject: [GitHub] drill pull request #666: DRILL-4956: Temporary tables support Content-Type: text/plain Message-Id: <20161206061251.526E6F1754@git1-us-west.apache.org> Date: Tue, 6 Dec 2016 06:12:51 +0000 (UTC) archived-at: Tue, 06 Dec 2016 06:12:54 -0000 Github user paul-rogers commented on a diff in the pull request: https://github.com/apache/drill/pull/666#discussion_r91012485 --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/rpc/user/UserSession.java --- @@ -55,13 +61,37 @@ private OptionManager sessionOptions; private final AtomicInteger queryCount; + /** Unique session identifier used as suffix in temporary table names. */ + private final String uuid; + /** Cache that stores all temporary tables by schema names. */ + private final TemporaryTablesCache temporaryTablesCache; + + /** On session close drops all temporary tables from their schemas and clears temporary tables cache. */ + @Override + public void close() { + temporaryTablesCache.removeAll(new BiConsumer() { + @Override + public void accept(AbstractSchema schema, String tableName) { + try { + if (schema.isAccessible() && schema.getTable(tableName) != null) { + schema.dropTable(tableName); --- End diff -- Shouldn't the schema handle the not-found case so we don't have to check above? There is, at least, a race condition: we created the table in our name space, but the nefarious user removed it from the file system before we get here. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastructure@apache.org or file a JIRA ticket with INFRA. ---