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 45BB1200BB1 for ; Thu, 3 Nov 2016 23:38:42 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 447F7160AFF; Thu, 3 Nov 2016 22:38:42 +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 64C25160AE5 for ; Thu, 3 Nov 2016 23:38:41 +0100 (CET) Received: (qmail 56864 invoked by uid 500); 3 Nov 2016 22:38:40 -0000 Mailing-List: contact commits-help@trafodion.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: commits@trafodion.apache.org Delivered-To: mailing list commits@trafodion.apache.org Received: (qmail 56855 invoked by uid 99); 3 Nov 2016 22:38:40 -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; Thu, 03 Nov 2016 22:38:40 +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 2B1A9C0750 for ; Thu, 3 Nov 2016 22:38:40 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id oSp4UmLGdHJu for ; Thu, 3 Nov 2016 22:38:38 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id CF4905F5A1 for ; Thu, 3 Nov 2016 22:38:37 +0000 (UTC) Received: (qmail 54044 invoked by uid 99); 3 Nov 2016 22:37:38 -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; Thu, 03 Nov 2016 22:37:38 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 19EAFE09DE; Thu, 3 Nov 2016 22:37:38 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: dbirdsall@apache.org To: commits@trafodion.incubator.apache.org Date: Thu, 03 Nov 2016 22:37:38 -0000 Message-Id: <9fa7174472974a55bd442bbb13471cee@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] incubator-trafodion git commit: [TRAFODION-2331] UPD STATS sometimes fails silently after some other failure archived-at: Thu, 03 Nov 2016 22:38:42 -0000 Repository: incubator-trafodion Updated Branches: refs/heads/master cc296281f -> 294b8c6d6 [TRAFODION-2331] UPD STATS sometimes fails silently after some other failure Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/9e37d9c2 Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/9e37d9c2 Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/9e37d9c2 Branch: refs/heads/master Commit: 9e37d9c22c74daee32399dac42f84c43f7141c5e Parents: 9c712a4 Author: Dave Birdsall Authored: Thu Nov 3 16:46:05 2016 +0000 Committer: Dave Birdsall Committed: Thu Nov 3 16:46:05 2016 +0000 ---------------------------------------------------------------------- core/sql/ustat/hs_cli.cpp | 50 +++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 22 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/9e37d9c2/core/sql/ustat/hs_cli.cpp ---------------------------------------------------------------------- diff --git a/core/sql/ustat/hs_cli.cpp b/core/sql/ustat/hs_cli.cpp index 26e5958..75bf673 100644 --- a/core/sql/ustat/hs_cli.cpp +++ b/core/sql/ustat/hs_cli.cpp @@ -391,8 +391,17 @@ Lng32 HSFuncExecDDL( const char *dml HSTranMan *TM; NABoolean startedTrans = FALSE; TM = HSTranMan::Instance(); - startedTrans = (((retcode = TM->Begin("DDL")) == 0) ? TRUE : FALSE); - HSHandleError(retcode); + { + // This HSErrorCatcher is in its own block so we'll report a + // diagnostic in case the TM->Begin call fails. Note that + // HSFuncExecQuery contains its own HSErrorCatcher, so that + // code is outside this block. (If we included it in this + // block then any error encountered there would be reported + // twice.) + HSErrorCatcher errorCatcher(retcode, sqlcode, errorToken, TRUE); + startedTrans = (((retcode = TM->Begin("DDL")) == 0) ? TRUE : FALSE); + HSHandleError(retcode); + } //Special parser flags needed to use the NO AUDIT option. retcode = HSFuncExecQuery(dml, sqlcode, rowsAffected, errorToken, @@ -964,14 +973,9 @@ Lng32 HSTranMan::Begin(const char *title) if (NOT transStarted_ && NOT (extTrans_ = ((SQL_EXEC_Xact(SQLTRANS_STATUS, 0) == 0) ? TRUE : FALSE))) { -#ifdef NA_USTAT_USE_STATIC - HSCliStatement begn(HSCliStatement::BEGINWORK); - retcode_ = begn.execFetch("BEGIN WORK;"); -#else NAString stmtText = "BEGIN WORK"; retcode_ = HSFuncExecQuery(stmtText.data(), - UERR_INTERNAL_ERROR, NULL, HS_QUERY_ERROR, NULL, NULL, TRUE); -#endif // NA_USTAT_USE_STATIC if (retcode_ >= 0) { transStarted_ = TRUE; @@ -1024,15 +1028,9 @@ Lng32 HSTranMan::Commit() { if (transStarted_) /*== COMMIT TRANSACTION ==*/ { -#ifdef NA_USTAT_USE_STATIC - HSCliStatement comt(HSCliStatement::COMMITWORK); - //logXactCode("before COMMIT WORK"); - retcode_ = comt.execFetch("COMMIT WORK;"); -#else NAString stmtText = "COMMIT WORK"; retcode_ = HSFuncExecQuery(stmtText.data(), - UERR_INTERNAL_ERROR, NULL, HS_QUERY_ERROR, NULL, NULL, TRUE); -#endif // NA_USTAT_USE_STATIC // transaction has ended transStarted_ = FALSE; @@ -1097,20 +1095,28 @@ Lng32 HSTranMan::Rollback() { if (transStarted_) /*==ROLLBACK TRANSACTION==*/ { -#ifdef NA_USTAT_USE_STATIC - HSCliStatement robk(HSCliStatement::ROBACKWORK); - retcode_ = robk.execFetch("ROLLBACK WORK"); -#else NAString stmtText = "ROLLBACK WORK"; retcode_ = HSFuncExecQuery(stmtText.data(), - UERR_INTERNAL_ERROR, NULL, HS_QUERY_ERROR, NULL, NULL, TRUE); -#endif // NA_USTAT_USE_STATIC // transaction has ended transStarted_ = FALSE; - if (retcode_ >= 0) { - retcode_ = 0; - LM->Log("ROLLBACK()"); - } + if (retcode_ < 0) + { + // The rollback may have failed because the Executor already + // aborted the transaction. + if (!InTransaction()) + retcode_ = 0; // just ignore the error + else + { + snprintf(LM->msg, sizeof(LM->msg), "ROBACKWORK failed, retcode_: %d)", retcode_); + LM->Log(LM->msg); + } + } + if (retcode_ >= 0) + { + retcode_ = 0; + LM->Log("ROLLBACK()"); + } } else { /*==NO TRANSACTION RUNNING==*/