Return-Path: X-Original-To: apmail-phoenix-dev-archive@minotaur.apache.org Delivered-To: apmail-phoenix-dev-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 8851F185DD for ; Wed, 10 Jun 2015 19:04:07 +0000 (UTC) Received: (qmail 88250 invoked by uid 500); 10 Jun 2015 19:04:07 -0000 Delivered-To: apmail-phoenix-dev-archive@phoenix.apache.org Received: (qmail 88201 invoked by uid 500); 10 Jun 2015 19:04:07 -0000 Mailing-List: contact dev-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 dev@phoenix.apache.org Received: (qmail 88190 invoked by uid 99); 10 Jun 2015 19:04:07 -0000 Received: from Unknown (HELO spamd3-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2015 19:04:07 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd3-us-west.apache.org (ASF Mail Server at spamd3-us-west.apache.org) with ESMTP id BA6D21827EA for ; Wed, 10 Jun 2015 19:04:06 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd3-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 0.97 X-Spam-Level: X-Spam-Status: No, score=0.97 tagged_above=-999 required=6.31 tests=[KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, T_RP_MATCHES_RCVD=-0.01] autolearn=disabled Received: from mx1-eu-west.apache.org ([10.40.0.8]) by localhost (spamd3-us-west.apache.org [10.40.0.10]) (amavisd-new, port 10024) with ESMTP id a-wfDcb2ONGx for ; Wed, 10 Jun 2015 19:04:05 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-eu-west.apache.org (ASF Mail Server at mx1-eu-west.apache.org) with SMTP id CFCA921240 for ; Wed, 10 Jun 2015 19:04:04 +0000 (UTC) Received: (qmail 86830 invoked by uid 99); 10 Jun 2015 19:04:02 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 10 Jun 2015 19:04:02 +0000 Date: Wed, 10 Jun 2015 19:04:02 +0000 (UTC) From: "Thomas D'Silva (JIRA)" To: dev@phoenix.incubator.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (PHOENIX-1812) Only sync table metadata when necessary MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/PHOENIX-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14580958#comment-14580958 ] Thomas D'Silva commented on PHOENIX-1812: ----------------------------------------- [~jamestaylor] I have uploaded a second patch. I modified PTableRef to include resolvedTimeStamp. The extra RPC call to getTable for queries was happening because in QueryCompiler.compileSingleFlatQuery the following if statement was evaluating to false event though both TableRefs references the same table, one of them had a null alias. {code} // Don't pass groupBy when building where clause expression, because we do not want to wrap these // expressions as group by key expressions since they're pre, not post filtered. if (innerPlan == null && !tableRef.equals(resolver.getTables().get(0))) { context.setResolver(FromCompiler.getResolverForQuery(select, this.statement.getConnection())); } {code} it works correctly when I modified TableRef.equals to not compare the alias if one of them is null: {code} - // FIXME: a null alias on either side should mean a wildcard and should not fail the equals check - if ((alias == null && other.alias != null) || (alias != null && !alias.equals(other.alias))) return false; + // a null alias on either side should mean a wildcard and should not fail the equals check + if ((alias != null && other.alias != null && !alias.equals(other.alias))) return false; {code} In UpdateCacheIT testUpdateCacheForTxnTable() For transactional tables in PhoenixStatment.executeQuery() since the plan is compiled before a transaction is started, the first call to connection.getTable() will not have a valid txn timestamp, the second call will have a valid txn timestamp, and the third will use the table cached at the txn timestamp for a total of two rpcs. I think we can't change executeQuery() to start a transaction before compiling the plan, because then it will always make a rpc call to the txn manager (even if the query doesnt have any transactional tables). > Only sync table metadata when necessary > --------------------------------------- > > Key: PHOENIX-1812 > URL: https://issues.apache.org/jira/browse/PHOENIX-1812 > Project: Phoenix > Issue Type: Sub-task > Reporter: James Taylor > Assignee: Thomas D'Silva > Attachments: PHOENIX-1812.patch > > > With transactions, we hold the timestamp at the point when the transaction was opened. We can prevent the MetaDataEndpoint getTable RPC in MetaDataClient.updateCache() to check that the client has the latest table if we've already checked at the current transaction ID timestamp. We can keep track of which tables we've already updated in PhoenixConnection. -- This message was sent by Atlassian JIRA (v6.3.4#6332)