You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by db...@apache.org on 2017/01/31 16:39:32 UTC

[1/2] incubator-trafodion git commit: [TRAFODION-2465] Fix two bugs

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master d66ffad92 -> c47d84ff4


[TRAFODION-2465] Fix two bugs


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/a47d4540
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/a47d4540
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/a47d4540

Branch: refs/heads/master
Commit: a47d454033bdd63a5089a8f41051a0743547e1ae
Parents: ad6e752
Author: Dave Birdsall <db...@apache.org>
Authored: Mon Jan 30 18:59:33 2017 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Mon Jan 30 18:59:33 2017 +0000

----------------------------------------------------------------------
 core/sql/ustat/hs_cli.cpp    | 21 ++++++++++++++++-----
 core/sql/ustat/hs_parser.cpp | 13 +++++++++++++
 2 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a47d4540/core/sql/ustat/hs_cli.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_cli.cpp b/core/sql/ustat/hs_cli.cpp
index 77984f7..ab3385c 100644
--- a/core/sql/ustat/hs_cli.cpp
+++ b/core/sql/ustat/hs_cli.cpp
@@ -401,8 +401,10 @@ Lng32 HSFuncExecTransactionalQueryWithRetry( const char *dml
     return retcode;
   }
 
-  // The HSErrorCatcher captures any diagnostics when it goes out-of-scope.
-  HSErrorCatcher errorCatcher(retcode, sqlcode, errorToken, TRUE);
+  // Note: We don't use the HSErrorCatcher object to capture diagnostic
+  // information here. The reason is, HSErrorCatcher works by lexical scope,
+  // but the place where diagnostics are available to us does not nicely
+  // match lexical scope. Instead, we call HSFuncMergeDiags directly.
  
   // On very busy system, some "update statistics" implementation steps like
   // "COLLECT FILE STATISTICS" step in HSTableDef::collectFileStatistics()
@@ -452,6 +454,15 @@ Lng32 HSFuncExecTransactionalQueryWithRetry( const char *dml
       }
     }
 
+    // If we are on our last retry, capture any diagnostics from
+    // the begin or statement failure. (If we don't capture them
+    // now, they will be cleared out of the CLI when we do the
+    // ROLLBACK below.)
+    if (retcode && (retry >= limit))
+    {
+      HSFuncMergeDiags(sqlcode, errorToken, NULL, TRUE /* get CLI diags */);
+    }
+
     // If we had an error (on the begin, the statement or the commit),
     // try rolling back the transaction. It might have already been
     // rolled back, in which case the Rollback method just ignores
@@ -1036,7 +1047,7 @@ Lng32 HSTranMan::Begin(const char *title,NABoolean inactivateErrorCatcher)
           {
             NAString stmtText = "BEGIN WORK";
             retcode_ = HSFuncExecQuery(stmtText.data(), - UERR_INTERNAL_ERROR, NULL,
-                                       HS_QUERY_ERROR, NULL, NULL, inactivateErrorCatcher);
+                                       HS_QUERY_ERROR, NULL, NULL, 0, FALSE, inactivateErrorCatcher);
             if (retcode_ >= 0)
               {
                 transStarted_ = TRUE;
@@ -1091,7 +1102,7 @@ Lng32 HSTranMan::Commit(NABoolean inactivateErrorCatcher)
           {
             NAString stmtText = "COMMIT WORK";
             retcode_ = HSFuncExecQuery(stmtText.data(), - UERR_INTERNAL_ERROR, NULL,
-                                       HS_QUERY_ERROR, NULL, NULL, inactivateErrorCatcher);
+                                       HS_QUERY_ERROR, NULL, NULL, 0, FALSE, inactivateErrorCatcher);
 
             // transaction has ended
             transStarted_ = FALSE;
@@ -1173,7 +1184,7 @@ Lng32 HSTranMan::Rollback(NABoolean inactivateErrorCatcher)
           {
             NAString stmtText = "ROLLBACK WORK";
             retcode_ = HSFuncExecQuery(stmtText.data(), - UERR_INTERNAL_ERROR, NULL,
-                                       HS_QUERY_ERROR, NULL, NULL, inactivateErrorCatcher);
+                                       HS_QUERY_ERROR, NULL, NULL, 0, FALSE, inactivateErrorCatcher);
             // transaction has ended
             transStarted_ = FALSE;
             if (retcode_ < 0)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a47d4540/core/sql/ustat/hs_parser.cpp
----------------------------------------------------------------------
diff --git a/core/sql/ustat/hs_parser.cpp b/core/sql/ustat/hs_parser.cpp
index dfc2927..32732dd 100644
--- a/core/sql/ustat/hs_parser.cpp
+++ b/core/sql/ustat/hs_parser.cpp
@@ -1188,11 +1188,24 @@ Lng32 AddExistingColumns()
         if (groupList)
           groupList->prev = NULL;
         group->next = NULL;
+
         // Set oldHistid to 0 so hist id will be reread during FlushStatistics.
         // Reading it in the same transaction that writes the histograms keeps
         // 2 or more concurrent Update Stats statements from coming up with the
         // same new hist id.
         group->oldHistid = 0;
+
+        // Look through the columns in this group for any oversized columns.
+        for (UInt32 i = 0; i < group->colSet.entries(); i++)
+          {
+            bool isOverSized = DFS2REC::isAnyCharacter(group->colSet[i].datatype) &&
+              (group->colSet[i].length > hs_globals->maxCharColumnLengthInBytes);
+            if (isOverSized)
+              {
+                hs_globals->hasOversizedColumns = TRUE;
+              }
+          }
+
         hs_globals->addGroup(group);
       }
     return retcode;


[2/2] incubator-trafodion git commit: Merge [TRAFODION-2465] PR 938 Fix two UPDATE STATISTICS bugs

Posted by db...@apache.org.
Merge [TRAFODION-2465] PR 938 Fix two UPDATE STATISTICS bugs


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/c47d84ff
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/c47d84ff
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/c47d84ff

Branch: refs/heads/master
Commit: c47d84ff44b99113b88cff057fdeec4c60a81be3
Parents: d66ffad a47d454
Author: Dave Birdsall <db...@apache.org>
Authored: Tue Jan 31 16:38:15 2017 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Tue Jan 31 16:38:15 2017 +0000

----------------------------------------------------------------------
 core/sql/ustat/hs_cli.cpp    | 21 ++++++++++++++++-----
 core/sql/ustat/hs_parser.cpp | 13 +++++++++++++
 2 files changed, 29 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c47d84ff/core/sql/ustat/hs_cli.cpp
----------------------------------------------------------------------