Return-Path: Delivered-To: apmail-hive-dev-archive@www.apache.org Received: (qmail 97742 invoked from network); 29 Oct 2010 22:57:41 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 29 Oct 2010 22:57:41 -0000 Received: (qmail 97261 invoked by uid 500); 29 Oct 2010 22:57:41 -0000 Delivered-To: apmail-hive-dev-archive@hive.apache.org Received: (qmail 97236 invoked by uid 500); 29 Oct 2010 22:57:40 -0000 Mailing-List: contact dev-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 dev@hive.apache.org Received: (qmail 97228 invoked by uid 500); 29 Oct 2010 22:57:40 -0000 Delivered-To: apmail-hadoop-hive-dev@hadoop.apache.org Received: (qmail 97225 invoked by uid 99); 29 Oct 2010 22:57:40 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Oct 2010 22:57:40 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Oct 2010 22:57:40 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o9TMvKcm001682 for ; Fri, 29 Oct 2010 22:57:20 GMT Message-ID: <22420958.151791288393040236.JavaMail.jira@thor> Date: Fri, 29 Oct 2010 18:57:20 -0400 (EDT) From: "Paul Yang (JIRA)" To: hive-dev@hadoop.apache.org Subject: [jira] Updated: (HIVE-1760) Mismatched open/commit transaction calls in case of connection retry In-Reply-To: <28229443.151751288393039288.JavaMail.jira@thor> 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/HIVE-1760?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Paul Yang updated HIVE-1760: ---------------------------- Component/s: Metastore > Mismatched open/commit transaction calls in case of connection retry > -------------------------------------------------------------------- > > Key: HIVE-1760 > URL: https://issues.apache.org/jira/browse/HIVE-1760 > Project: Hive > Issue Type: Bug > Components: Metastore > Affects Versions: 0.7.0 > Reporter: Paul Yang > Assignee: Paul Yang > > Consider the create table function (parts removed for simplicity): > {code} > private void create_table_core(final RawStore ms, final Table tbl) > throws AlreadyExistsException, MetaException, InvalidObjectException { > Path tblPath = null; > boolean success = false, madeDir = false; > try { > ms.openTransaction(); > // get_table checks whether database exists, it should be moved here > if (is_table_exists(tbl.getDbName(), tbl.getTableName())) { > throw new AlreadyExistsException("Table " + tbl.getTableName() > + " already exists"); > } > ms.createTable(tbl); > success = ms.commitTransaction(); > } finally { > if (!success) { > ms.rollbackTransaction(); > if (madeDir) { > wh.deleteDir(tblPath, true); > } > } > } > } > {code} > A potential openTransaction() / commitTransaction() mismatch can occur if the is_table_exits() method call experiences a connection failure. > Since get_table() in is_table_exists() uses executeWithRetry(), the transaction will be rolled back and get_table() will be called again if the is a connection problem. However, this rollback and retry will reset the global openTransactionCalls counter back to 0, effectively canceling out the openTransaction() call. > Then later in the method when commitTransaction() is called, Hive will throw an error similar to the following: > Caused by: java.lang.RuntimeException: commitTransaction was called but openTransactionCalls = 0. This probably indicates that there are unbalanced calls to openTransaction/commitTransaction > A similar problem exists with create_type_core() -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.