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 2016/07/18 16:20:26 UTC

[01/16] incubator-trafodion git commit: Merge branch 'master' of github.com:apache/incubator-trafodion into wrkbrnch

Repository: incubator-trafodion
Updated Branches:
  refs/heads/master e9d7ba448 -> 08be5c164


Merge branch 'master' of github.com:apache/incubator-trafodion into wrkbrnch


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

Branch: refs/heads/master
Commit: 973bdcec14c35ad473bebee46caa302bbb5a49d2
Parents: 2e6e354 dcfc8e6
Author: Anuradha Hegde <an...@esgyn.com>
Authored: Thu May 12 17:44:19 2016 +0000
Committer: Anuradha Hegde <an...@esgyn.com>
Committed: Thu May 12 17:44:19 2016 +0000

----------------------------------------------------------------------
 core/sqf/monitor/linux/shell.cxx                |  30 +--
 core/sqf/sql/scripts/makemsg.ksh                |   5 -
 core/sql/bin/SqlciErrors.txt                    |   2 +
 core/sql/common/Ipc.cpp                         |  12 +
 core/sql/common/Ipc.h                           |   1 +
 core/sql/executor/HBaseClient_JNI.cpp           | 223 +------------------
 core/sql/executor/HBaseClient_JNI.h             |  70 +-----
 core/sql/generator/GenPreCode.cpp               |  13 --
 core/sql/nskgmake/udr_predef/Makefile           |   2 -
 core/sql/optimizer/ValueDesc.cpp                |   5 +
 core/sql/regress/executor/EXPECTED130           | 117 ++++++----
 core/sql/regress/executor/TEST130               |  51 ++---
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp         |   3 +-
 core/sql/sqludr/sqludr.cpp                      | 107 ++++++++-
 .../java/org/trafodion/sql/udr/TupleInfo.java   |  86 ++++++-
 .../java/org/trafodion/sql/udr/TypeInfo.java    |   6 +
 core/sql/ustat/hs_const.h                       |   1 +
 core/sql/ustat/hs_la.cpp                        |  13 ++
 core/sql/ustat/hs_parser.cpp                    |   5 +-
 19 files changed, 328 insertions(+), 424 deletions(-)
----------------------------------------------------------------------



[02/16] incubator-trafodion git commit: Merge branch 'master' of github.com:apache/incubator-trafodion into wrkbrnch

Posted by db...@apache.org.
Merge branch 'master' of github.com:apache/incubator-trafodion into wrkbrnch


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

Branch: refs/heads/master
Commit: 86d78805f38ecbcc83d9d936a89880df2b7901bb
Parents: 973bdce b3d3531
Author: Anuradha Hegde <an...@esgyn.com>
Authored: Fri May 13 16:27:25 2016 +0000
Committer: Anuradha Hegde <an...@esgyn.com>
Committed: Fri May 13 16:27:25 2016 +0000

----------------------------------------------------------------------
 core/sql/bin/SqlciErrors.txt          |  1 +
 core/sql/exp/ExpLOB.cpp               | 10 ++++
 core/sql/generator/GenPreCode.cpp     | 14 +++---
 core/sql/regress/executor/EXPECTED130 | 77 +++++++++++++++++++-----------
 core/sql/regress/executor/TEST130     |  6 ++-
 5 files changed, 72 insertions(+), 36 deletions(-)
----------------------------------------------------------------------



[16/16] incubator-trafodion git commit: Merge [TRAFODION-2037] PR 565 Improve DDL concurrency + repos/metadt upgrade

Posted by db...@apache.org.
Merge [TRAFODION-2037] PR 565 Improve DDL concurrency + repos/metadt upgrade


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

Branch: refs/heads/master
Commit: 08be5c1648f7a2be854c48748e9150a05385383d
Parents: e9d7ba4 3d2bceb
Author: Dave Birdsall <db...@apache.org>
Authored: Mon Jul 18 16:18:32 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Mon Jul 18 16:18:32 2016 +0000

----------------------------------------------------------------------
 core/conn/odbc/src/odbc/Common/Global.h         |   5 +-
 core/conn/odbc/src/odbc/Common/PubQueryStats.h  |  11 +-
 core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp | 141 +++---
 .../odbc/nsksrvrcore/ResStatisticsSession.cpp   |  95 ++--
 .../src/odbc/nsksrvrcore/ResStatisticsSession.h |   1 +
 .../odbc/nsksrvrcore/ResStatisticsStatement.cpp |   3 +-
 core/sqf/sql/scripts/restcheck                  |   1 -
 core/sql/comexe/ComTdb.h                        |   5 +-
 core/sql/common/ComSmallDefs.h                  |   8 +-
 core/sql/optimizer/RelExeUtil.h                 |   7 +
 core/sql/parser/ParKeyWords.cpp                 |   1 +
 core/sql/parser/sqlparser.y                     |  41 +-
 core/sql/regress/compGeneral/EXPECTED004.SB     |   4 +-
 core/sql/regress/core/EXPECTED000.SB            |   2 +-
 core/sql/regress/core/TEST000                   |   2 +-
 core/sql/regress/seabase/EXPECTED011            |   9 +-
 core/sql/sqlcomp/CmpSeabaseDDL.h                |  12 +-
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp        |  79 ++-
 core/sql/sqlcomp/CmpSeabaseDDLincludes.h        |  10 +-
 core/sql/sqlcomp/CmpSeabaseDDLmd.h              | 493 ++++++++++++++++++-
 core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp         | 238 +++++++--
 core/sql/sqlcomp/CmpSeabaseDDLrepos.h           | 492 ++++++++++++++++--
 core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp       |   6 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp         |  15 +
 core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp       | 235 +++++++--
 core/sql/sqlcomp/CmpSeabaseDDLupgrade.h         | 270 +++++++++-
 26 files changed, 1880 insertions(+), 306 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/08be5c16/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------


[15/16] incubator-trafodion git commit: Reworks

Posted by db...@apache.org.
Reworks


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

Branch: refs/heads/master
Commit: 3d2bceb7d49ed751be3415c8104cdc7a5ac26011
Parents: 301e22b
Author: Dave Birdsall <db...@apache.org>
Authored: Fri Jul 15 20:47:59 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Fri Jul 15 20:47:59 2016 +0000

----------------------------------------------------------------------
 core/sql/comexe/ComTdb.h                 |  2 ++
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp | 18 +++++++++++++++---
 2 files changed, 17 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/3d2bceb7/core/sql/comexe/ComTdb.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdb.h b/core/sql/comexe/ComTdb.h
index 3d63372..080ea45 100644
--- a/core/sql/comexe/ComTdb.h
+++ b/core/sql/comexe/ComTdb.h
@@ -957,6 +957,8 @@ class ComTdbVirtTableKeyInfo : public ComTdbVirtTableBase
   const char * colName;
   Lng32   keySeqNum;
   Lng32   tableColNum;
+
+  enum { ASCENDING_ORDERING = 0, DESCENDING_ORDERING = 1 };
   Lng32   ordering;  // 0 means ascending, 1 means descending
                      // (see, for example, CmpSeabaseDDL::buildKeyInfoArray)
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/3d2bceb7/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
index 4ecb097..5b4cc2f 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
@@ -70,6 +70,7 @@
 #include "CmpSeabaseDDLroutine.h"
 #include "hdfs.h"
 #include "StmtDDLAlterLibrary.h"
+#include "logmxevent_traf.h"
 
 void cleanupLOBDataDescFiles(const char*, int, const char *);
 
@@ -437,7 +438,7 @@ short CmpSeabaseDDL::convertColAndKeyInfoArrays(
           ComTdbVirtTableKeyInfo &ki = btKeyInfoArray[ii];
           if (strcmp(ci.colName, ki.colName) == 0)
             {
-              if (ki.ordering == 0)
+              if (ki.ordering == ComTdbVirtTableKeyInfo::ASCENDING_ORDERING)
                 nac->setClusteringKey(ASCENDING);
               else // ki.ordering should be 1
                 nac->setClusteringKey(DESCENDING);
@@ -667,7 +668,7 @@ short CmpSeabaseDDL::processDDLandCreateDescs(
 
           ki.tableColNum = colNumber;
           ki.keySeqNum = i+1;
-          ki.ordering = 0;
+          ki.ordering = ComTdbVirtTableKeyInfo::ASCENDING_ORDERING;
           ki.nonKeyCol = 1;
           
           ki.hbaseColFam = new(CTXTHEAP) char[strlen(SEABASE_DEFAULT_COL_FAMILY) + 1];
@@ -908,6 +909,11 @@ short CmpSeabaseDDL::createMDdescs(MDDescsInfo *&trafMDDescsInfo)
   if (trafMDDescsInfo)
     NADELETEBASIC(trafMDDescsInfo, CTXTHEAP);
   trafMDDescsInfo = NULL;
+
+  char msg[80];
+  str_sprintf(msg,"CmpSeabaseDDL::createMDdescs failed, breadCrumb = %d",breadCrumb);
+  SQLMXLoggingArea::logSQLMXDebugEvent(msg, -1, __LINE__);
+
   return -1;
 }
                                               
@@ -5926,7 +5932,9 @@ short CmpSeabaseDDL::buildKeyInfoArray(
         }
         
       keyInfoArray[index].ordering = 
-        ((*keyArray)[index]->getColumnOrdering() == COM_ASCENDING_ORDER ? 0 : 1);
+        ((*keyArray)[index]->getColumnOrdering() == COM_ASCENDING_ORDER ? 
+          ComTdbVirtTableKeyInfo::ASCENDING_ORDERING : 
+          ComTdbVirtTableKeyInfo::DESCENDING_ORDERING);
       keyInfoArray[index].nonKeyCol = 0;
 
       if ((colInfoArray) &&
@@ -7016,6 +7024,10 @@ void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns, NABoolean minimal)
 
   endXnIfStartedHere(&cliInterface, xnWasStartedHere, -1);
 
+  char msg[80];
+  str_sprintf(msg,"CmpSeabaseDDL::initSeabaseMD failed, breadCrumb = %d",breadCrumb);
+  SQLMXLoggingArea::logSQLMXDebugEvent(msg, -1, __LINE__);
+
   return;
 }
 


[08/16] incubator-trafodion git commit: minor fix

Posted by db...@apache.org.
minor fix


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

Branch: refs/heads/master
Commit: 463a699de3a45ff56e0c5b176f248827cbb09a7e
Parents: ee53fc3
Author: Anuradha Hegde <an...@esgyn.com>
Authored: Fri Jun 24 21:42:57 2016 +0000
Committer: Anuradha Hegde <an...@esgyn.com>
Committed: Fri Jun 24 21:42:57 2016 +0000

----------------------------------------------------------------------
 core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/463a699d/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp b/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp
index c5d09fa..7623da1 100644
--- a/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp
@@ -1880,6 +1880,8 @@ odbc_SQLSvc_InitializeDialogue_ame_(
 	bzero(srvrGlobal->QSUserName, sizeof(srvrGlobal->QSUserName));
 	bzero(srvrGlobal->QSDBUserName, sizeof(srvrGlobal->QSDBUserName));
 	bzero(srvrGlobal->ApplicationName, sizeof(srvrGlobal->ApplicationName));
+        bzero(srvrGlobal->mappedProfileName, sizeof(srvrGlobal->mappedProfileName));
+        bzero(srvrGlobal->mappedSLAName, sizeof(srvrGlobal->mappedSLAName));
 	bzero(&outContext, sizeof(outContext));
 	srvrGlobal->bSpjEnableProxy = FALSE;
 	srvrGlobal->bspjTxnJoined = FALSE;
@@ -6753,7 +6755,7 @@ bool getSQLInfo(E_GetSQLInfoType option, long stmtHandle, char *stmtLabel )
                                     delete explainData;
                                   explainData = 0;
                                 }
-				else if (iqqcode < 0)
+				if (iqqcode < 0)
 				{
 					char errStr[256];
 					sprintf( errStr, "Error retrieving packed explain. SQL_EXEC_GetExplainData() returned: %d", iqqcode );


[09/16] incubator-trafodion git commit: [TRAFODION-2037] Improve DDL concurrency

Posted by db...@apache.org.
[TRAFODION-2037] Improve DDL concurrency


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

Branch: refs/heads/master
Commit: 2605440bee754ff60192656f330d0851d8046f17
Parents: 9dff321
Author: Dave Birdsall <db...@apache.org>
Authored: Mon Jun 27 18:32:44 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Mon Jun 27 18:32:44 2016 +0000

----------------------------------------------------------------------
 core/sql/comexe/ComTdb.h                    |   3 +-
 core/sql/common/ComSmallDefs.h              |   1 +
 core/sql/regress/compGeneral/EXPECTED004.SB |   4 +-
 core/sql/regress/core/EXPECTED000.SB        |   2 +-
 core/sql/regress/core/TEST000               |   2 +-
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp    |  40 +-
 core/sql/sqlcomp/CmpSeabaseDDLincludes.h    |  10 +-
 core/sql/sqlcomp/CmpSeabaseDDLmd.h          | 489 ++++++++++++++++++++++-
 core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp   |   6 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp     |  15 +
 core/sql/sqlcomp/CmpSeabaseDDLupgrade.h     |  54 ++-
 11 files changed, 589 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2605440b/core/sql/comexe/ComTdb.h
----------------------------------------------------------------------
diff --git a/core/sql/comexe/ComTdb.h b/core/sql/comexe/ComTdb.h
index 689bded..ae2bd64 100644
--- a/core/sql/comexe/ComTdb.h
+++ b/core/sql/comexe/ComTdb.h
@@ -975,7 +975,8 @@ class ComTdbVirtTableKeyInfo : public ComTdbVirtTableBase
   const char * colName;
   Lng32   keySeqNum;
   Lng32   tableColNum;
-  Lng32   ordering;
+  Lng32   ordering;  // 0 means ascending, 1 means descending
+                     // (see, for example, CmpSeabaseDDL::buildKeyInfoArray)
 
   Lng32 nonKeyCol; // if 1, this is a base table pkey col for unique indexes
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2605440b/core/sql/common/ComSmallDefs.h
----------------------------------------------------------------------
diff --git a/core/sql/common/ComSmallDefs.h b/core/sql/common/ComSmallDefs.h
index 8055e22..4c5e19c 100644
--- a/core/sql/common/ComSmallDefs.h
+++ b/core/sql/common/ComSmallDefs.h
@@ -149,6 +149,7 @@ typedef NABoolean               ComBoolean;
 #define SEABASE_SEQ_GEN          "SEQ_GEN"
 #define SEABASE_TABLES            "TABLES"
 #define SEABASE_TABLE_CONSTRAINTS "TABLE_CONSTRAINTS"
+#define SEABASE_TABLE_CONSTRAINTS_IDX "TABLE_CONSTRAINTS_IDX"
 #define SEABASE_TEXT            "TEXT"
 #define SEABASE_UNIQUE_REF_CONSTR_USAGE "UNIQUE_REF_CONSTR_USAGE"
 #define SEABASE_VIEWS              "VIEWS"

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2605440b/core/sql/regress/compGeneral/EXPECTED004.SB
----------------------------------------------------------------------
diff --git a/core/sql/regress/compGeneral/EXPECTED004.SB b/core/sql/regress/compGeneral/EXPECTED004.SB
index 1948245..3a5348e 100644
--- a/core/sql/regress/compGeneral/EXPECTED004.SB
+++ b/core/sql/regress/compGeneral/EXPECTED004.SB
@@ -1127,8 +1127,8 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 4    .    5    root                                                  1.00E+002
 1    3    4    nested_join                                           1.00E+002
 2    .    3    probe_cache                                           1.00E+000
-.    .    2    trafodion_index_scan            OBJECTS_UNIQ_IDX               1.00E+000
-.    .    1    trafodion_scan                  TABLE_CONSTRAINTS     1.00E+002
+.    .    2    trafodion_index_scan            OBJECTS_UNIQ_IDX      1.00E+000
+.    .    1    trafodion_index_scan            TABLE_CONSTRAINTS_I   1.00E+002
 
 --- SQL operation complete.
 >>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2605440b/core/sql/regress/core/EXPECTED000.SB
----------------------------------------------------------------------
diff --git a/core/sql/regress/core/EXPECTED000.SB b/core/sql/regress/core/EXPECTED000.SB
index cdadb69..e1a28dd 100644
--- a/core/sql/regress/core/EXPECTED000.SB
+++ b/core/sql/regress/core/EXPECTED000.SB
@@ -1,7 +1,7 @@
 >>
 >>upsert into TRAFODION."_MD_".DEFAULTS
 +>     values
-+>     ('SCHEMA ', 'TRAFODION.SCH ', 'inserted during seabase regressions run');
++>     ('SCHEMA ', 'TRAFODION.SCH ', 'inserted during seabase regressions run', 0);
 
 --- 1 row(s) inserted.
 >>

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2605440b/core/sql/regress/core/TEST000
----------------------------------------------------------------------
diff --git a/core/sql/regress/core/TEST000 b/core/sql/regress/core/TEST000
index 2839301..eb24d0b 100755
--- a/core/sql/regress/core/TEST000
+++ b/core/sql/regress/core/TEST000
@@ -25,7 +25,7 @@ log LOG000 clear;
 
 upsert into TRAFODION."_MD_".DEFAULTS
      values
-     ('SCHEMA ', 'TRAFODION.SCH ', 'inserted during seabase regressions run');
+     ('SCHEMA ', 'TRAFODION.SCH ', 'inserted during seabase regressions run', 0);
 
 log;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2605440b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
index 0df3d58..e1257a4 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
@@ -435,6 +435,10 @@ short CmpSeabaseDDL::convertColAndKeyInfoArrays(
           ComTdbVirtTableKeyInfo &ki = btKeyInfoArray[ii];
           if (strcmp(ci.colName, ki.colName) == 0)
             {
+              if (ki.ordering == 0)
+                nac->setClusteringKey(ASCENDING);
+              else // ki.ordering should be 1
+                nac->setClusteringKey(DESCENDING);
               naKeyArr->insert(nac);
             }
         } // for
@@ -729,6 +733,8 @@ short CmpSeabaseDDL::processDDLandCreateDescs(
 // ----------------------------------------------------------------------------
 short CmpSeabaseDDL::createMDdescs(MDDescsInfo *&trafMDDescsInfo)
 {
+  int breadCrumb = -1;  // useful for debugging purposes
+
   // if structure is already allocated, just return
   // Question - will trafMDDescsInfo ever be NOT NULL?
   if (trafMDDescsInfo)
@@ -770,6 +776,7 @@ short CmpSeabaseDDL::createMDdescs(MDDescsInfo *&trafMDDescsInfo)
       ComTdbVirtTableKeyInfo * keyInfoArray = NULL;
       ComTdbVirtTableIndexInfo * indexInfo = NULL;
 
+      breadCrumb = 1;
       if (processDDLandCreateDescs(parser,
                                    mdti.newDDL, mdti.sizeOfnewDDL,
                                    (mdti.isIndex ? TRUE : FALSE),
@@ -787,6 +794,7 @@ short CmpSeabaseDDL::createMDdescs(MDDescsInfo *&trafMDDescsInfo)
       
       if (oldDDL)
         {
+          breadCrumb = 2;
           if (processDDLandCreateDescs(parser,
                                        oldDDL, sizeOfoldDDL,
                                        (mdti.isIndex ? TRUE : FALSE),
@@ -818,6 +826,7 @@ short CmpSeabaseDDL::createMDdescs(MDDescsInfo *&trafMDDescsInfo)
           ComTdbVirtTableColumnInfo * indexColInfoArray = NULL;
           ComTdbVirtTableKeyInfo * indexKeyInfoArray = NULL;
           
+          breadCrumb = 3;
           if (processDDLandCreateDescs(parser,
                                        mdti.indexDDL, mdti.sizeOfIndexDDL,
                                        FALSE,
@@ -856,6 +865,7 @@ short CmpSeabaseDDL::createMDdescs(MDDescsInfo *&trafMDDescsInfo)
       QString ddlString; 
       ddlString.str = tableDDL.data();
 
+      breadCrumb = 4;
       if (processDDLandCreateDescs(parser,
                                    &ddlString, sizeof(QString),
                                    FALSE,
@@ -889,6 +899,10 @@ short CmpSeabaseDDL::createMDdescs(MDDescsInfo *&trafMDDescsInfo)
   return 0;
 
  label_error:
+
+  // When debugging, you can look at the breadCrumb variable to figure out
+  // why you got here.
+
   if (trafMDDescsInfo)
     NADELETEBASIC(trafMDDescsInfo, CTXTHEAP);
   trafMDDescsInfo = NULL;
@@ -4938,7 +4952,7 @@ short CmpSeabaseDDL::updateSeabaseMDSPJ(
       return -1;
     }
 
-  str_sprintf(buf, "insert into %s.\"%s\".%s values (%Ld, '%s', %d)",
+  str_sprintf(buf, "insert into %s.\"%s\".%s values (%Ld, '%s', %d, 0)",
               getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_LIBRARIES,
               libObjUID, libPath, routineInfo->library_version);
   
@@ -4991,7 +5005,7 @@ short CmpSeabaseDDL::updateSeabaseMDSPJ(
     return -1;
                                  
 
-  str_sprintf(buf, "insert into %s.\"%s\".%s values (%Ld, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', %Ld, '%s' )",
+  str_sprintf(buf, "insert into %s.\"%s\".%s values (%Ld, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', %Ld, '%s', 0 )",
               getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_ROUTINES,
               spjObjUID,
               routineInfo->UDR_type,
@@ -5019,7 +5033,7 @@ short CmpSeabaseDDL::updateSeabaseMDSPJ(
       return -1;
     }
 
-  str_sprintf(buf, "insert into %s.\"%s\".%s values (%Ld, %Ld)",
+  str_sprintf(buf, "insert into %s.\"%s\".%s values (%Ld, %Ld, 0)",
               getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_LIBRARIES_USAGE,
               libObjUID, spjObjUID);
 
@@ -6650,6 +6664,7 @@ short CmpSeabaseDDL::updateSeabaseAuths(
 
 void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns)
 {
+  int breadCrumb = -1;  // useful for debugging
   Lng32 retcode = 0;
   Lng32 cliRC = 0;
   NABoolean xnWasStartedHere = FALSE;
@@ -6758,15 +6773,17 @@ void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns)
   NAString installJar(getenv("MY_SQROOT"));
   installJar += "/export/lib/trafodion-sql-currversion.jar";
 
+  breadCrumb = 1;
   if (beginXnIfNotInProgress(&cliInterface, xnWasStartedHere))
     goto label_error;
 
   cliRC = cliInterface.holdAndSetCQD("traf_bootstrap_md_mode", "ON");
   if (cliRC < 0)
     {
+      breadCrumb = 2;
       goto label_error;
     }
-
+  breadCrumb = 3;
 
   // Create Seabase system schema
   if (updateSeabaseMDObjectsTable(&cliInterface,sysCat,SEABASE_SYSTEM_SCHEMA,
@@ -6776,6 +6793,7 @@ void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns)
   {
     goto label_error;
   }
+  breadCrumb = 4;
   
   // Create Seabase metadata schema
   schemaUID = -1;
@@ -6810,6 +6828,7 @@ void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns)
                                mddi.indexInfo,
                                objUID))
         {
+          breadCrumb = 5;
           goto label_error;
         }
 
@@ -6850,6 +6869,7 @@ void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns)
                                0, NULL,
                                objUID))
         {
+          breadCrumb = 6;
           goto label_error;
         }
     } // for
@@ -6862,6 +6882,7 @@ void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns)
                          sizeof(seabaseMDValidateRoutineColInfo) / sizeof(ComTdbVirtTableColumnInfo),
                          seabaseMDValidateRoutineColInfo))
     {
+      breadCrumb = 7;
       goto label_error;
     }
 
@@ -6876,26 +6897,31 @@ void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns)
 
   if (createSchemaObjects(&cliInterface))
     {
+      breadCrumb = 8;
       goto label_error;
     }
  
  if (createMetadataViews(&cliInterface))
     {
+      breadCrumb = 9;
       goto label_error;
     }
 
  if (createRepos(&cliInterface))
    {
+     breadCrumb = 10;
      goto label_error;
    }
 
  if (createPrivMgrRepos(&cliInterface, ddlXns))
    {
+     breadCrumb = 11;
      goto label_error;
    }
 
  if (createSeabaseLibmgr (&cliInterface))
-   {
+   {   
+     breadCrumb = 12;
      goto label_error;
    }
 
@@ -6904,6 +6930,10 @@ void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns)
   return;
 
  label_error:
+
+  // When debugging, the breadCrumb variable is useful to tell you
+  // how you got here.
+
   endXnIfStartedHere(&cliInterface, xnWasStartedHere, -1);
 
   return;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2605440b/core/sql/sqlcomp/CmpSeabaseDDLincludes.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLincludes.h b/core/sql/sqlcomp/CmpSeabaseDDLincludes.h
index b97149e..80fed40 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLincludes.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDLincludes.h
@@ -97,14 +97,14 @@
 #define SOFTWARE_UPDATE_VERSION TRAF_SOFTWARE_VERS_UPDATE
 #define HBASE_OPTIONS_MAX_LENGTH 6000
 
-// new metadata version 1.1.0 changed for release 1.1.0.
-// Old metadata version 3.0.
+// new metadata version 2.1.0 changed for release 2.1.0.
+// Old metadata version 1.1.
 enum { 
-  METADATA_MAJOR_VERSION = 1,
-  METADATA_OLD_MAJOR_VERSION = 3,
+  METADATA_MAJOR_VERSION = 2,
+  METADATA_OLD_MAJOR_VERSION = 1,
   METADATA_MINOR_VERSION = 1,
   METADATA_UPDATE_VERSION = 0,
-  METADATA_OLD_MINOR_VERSION = 0,
+  METADATA_OLD_MINOR_VERSION = 1,
   METADATA_OLD_UPDATE_VERSION = 0,
   DATAFORMAT_MAJOR_VERSION = 1,
   DATAFORMAT_MINOR_VERSION = 1

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2605440b/core/sql/sqlcomp/CmpSeabaseDDLmd.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLmd.h b/core/sql/sqlcomp/CmpSeabaseDDLmd.h
index 6f12ac9..cf50951 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLmd.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDLmd.h
@@ -33,8 +33,8 @@
  *               The remaining sections contain metadata definitions for prior
  *               versions.
  *
- *               Version definitions are defined in CmpSeabaseDDL.h and are
- *               persistent in the VERSIONS metadata table.
+ *               Version definitions are defined in CmpSeabaseDDLincludes.h and
+ *               are persistent in the VERSIONS metadata table.
  *
  * *****************************************************************************
  */
@@ -132,7 +132,8 @@ static const QString seabaseDefaultsDDL[] =
   {" ( "},
   {"   attribute varchar(100 bytes) character set utf8 not null not serialized, "},
   {"   attr_value varchar(1000 bytes) character set utf8 not null not serialized, "},
-  {"   attr_comment varchar(1000 bytes) character set utf8 not null not serialized "},
+  {"   attr_comment varchar(1000 bytes) character set utf8 not null not serialized, "},
+  {"   flags largeint not null not serialized "},
   {" ) "},
   {" primary key (attribute) "},
   {" ; "}
@@ -177,7 +178,8 @@ static const QString seabaseLibrariesDDL[] =
   {" ( "},
   {"   library_uid largeint not null not serialized, "},
   {"   library_filename varchar(512) character set iso88591 not null not serialized, "},
-  {"   version int not null not serialized "},
+  {"   version int not null not serialized, "},
+  {"   flags largeint not null not serialized "},
   {" ) "},
   {" primary key (library_uid) "},
   {" ; "}
@@ -188,7 +190,8 @@ static const QString seabaseLibrariesUsageDDL[] =
   {" create table "SEABASE_LIBRARIES_USAGE" "},
   {" ( "},
   {"   using_library_uid largeint not null not serialized, "},
-  {"   used_udr_uid largeint not null not serialized "},
+  {"   used_udr_uid largeint not null not serialized, "},
+  {"   flags largeint not null not serialized "},
   {" ) "},
   {" primary key (using_library_uid, used_udr_uid) "},
   {" ; "}
@@ -284,7 +287,8 @@ static const QString seabaseRoutinesDDL[] =
   {"   external_security char(2) character set iso88591 not null not serialized, "},
   {"   execution_mode char(2) character set iso88591 not null not serialized, "},
   {"   library_uid largeint not null not serialized, "},
-  {"   signature varchar(8192 bytes) character set utf8 not null not serialized "},
+  {"   signature varchar(8192 bytes) character set utf8 not null not serialized, "},
+  {"   flags largeint not null not serialized "},
   {" ) "},
   {" primary key (udr_uid) "},
   {" ; "}
@@ -357,6 +361,27 @@ static const QString seabaseTableConstraintsDDL[] =
   {" ; "}
 };
 
+static const QString seabaseTableConstraintsIdxIndexDDL[] =
+{
+  {" create index "SEABASE_TABLE_CONSTRAINTS_IDX" on "TRAFODION_SYSCAT_LIT".\""SEABASE_MD_SCHEMA"\"."SEABASE_TABLE_CONSTRAINTS" "},
+  {" ( "},
+  {"   constraint_uid "},
+  {" ) "},
+  {" ; "}
+};
+
+static const QString seabaseTableConstraintsIdxDDL[] =
+{
+  {" create table "SEABASE_TABLE_CONSTRAINTS_IDX" "},
+  {" ( "},
+  {"   \"CONSTRAINT_UID@\" largeint not null not serialized, "},
+  {"   table_uid largeint not null not serialized, "},
+  {"   constraint_type char(2) character set iso88591 not null not serialized "},
+  {" ) "},
+  {" primary key (\"CONSTRAINT_UID@\", table_uid, constraint_type) "},
+  {" ; "}
+};
+
 static const QString seabaseTextDDL[] =
 {
   {" create table "SEABASE_TEXT" "},
@@ -574,7 +599,11 @@ static const MDTableInfo allMDtablesInfo[] = {
 
   {SEABASE_TABLE_CONSTRAINTS, 
    seabaseTableConstraintsDDL, sizeof(seabaseTableConstraintsDDL),
-   NULL, 0, FALSE},
+   seabaseTableConstraintsIdxIndexDDL, sizeof(seabaseTableConstraintsIdxIndexDDL), FALSE},
+
+  {SEABASE_TABLE_CONSTRAINTS_IDX,
+   seabaseTableConstraintsIdxDDL, sizeof(seabaseTableConstraintsIdxDDL),
+   NULL, 0, TRUE},
 
   {SEABASE_TEXT, 
    seabaseTextDDL, sizeof(seabaseTextDDL),
@@ -653,6 +682,452 @@ static const MDTableInfo allMDHistInfo[] = {
 #define SEABASE_VALIDATE_LIBRARY_OLD_MD  SEABASE_VALIDATE_LIBRARY"_OLD_MD"
 
 ////////////////////////////////////////////////////////////////////////
+//// START_OLD_MD_v11: 
+////        OLD metadata Version 1.1 (Major version = 1, Minor version = 1).
+//////////////////////////////////////////////////////////////////////////
+
+static const QString seabaseOldTrafMDv11AuthsDDL[] =
+{
+  {" create table "SEABASE_AUTHS_OLD_MD" "},
+  {" ( "},
+  {"  auth_id int unsigned not null not serialized, "},
+  {"  auth_db_name varchar(256 bytes) character set utf8 not null not serialized, "},
+  {"  auth_ext_name varchar(256 bytes) character set utf8 not null not serialized, "},
+  {"  auth_type char(2) character set iso88591 not null not serialized, "},
+  {"  auth_creator int unsigned not null not serialized, "},
+  {"  auth_is_valid char(2) character set iso88591 not null not serialized, "},
+  {"  auth_create_time largeint not null not serialized, "},
+  {"  auth_redef_time largeint not null not serialized, "},
+  {"  flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (auth_id) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11ColumnsDDL[] =
+{
+  {" create table "SEABASE_COLUMNS_OLD_MD" "},
+  {" ( "},
+  {"   object_uid largeint not null not serialized, "},
+  {"   column_name varchar(256 bytes) character set utf8 not null not serialized, "},
+  {"   column_number int not null not serialized, "},
+  {"   column_class char(2) character set iso88591 not null not serialized, "},
+  {"   fs_data_type int not null not serialized, "},
+  {"   sql_data_type char(32) character set iso88591 not null not serialized, "},
+  {"   column_size int not null not serialized, "},
+  {"   column_precision int not null not serialized, "},
+  {"   column_scale int not null not serialized, "},
+  {"   datetime_start_field int not null not serialized, "},
+  {"   datetime_end_field int not null not serialized, "},
+  {"   is_upshifted char(2) character set iso88591 not null not serialized, "},
+  {"   column_flags int unsigned not null not serialized, "},
+  {"   nullable int not null not serialized, "},
+  {"   character_set char(40) character set iso88591 not null not serialized, "},
+  {"   default_class int not null not serialized, "},
+  {"   default_value varchar(1024 bytes) character set utf8 not null not serialized, "},
+  {"   column_heading varchar(256 bytes) character set utf8 not null not serialized, "},
+  {"   hbase_col_family varchar(40) character set iso88591 not null not serialized, "},
+  {"   hbase_col_qualifier varchar(40) character set iso88591 not null not serialized, "},
+  {"   direction char(2) character set iso88591 not null not serialized, "},
+  {"   is_optional char(2) character set iso88591 not null not serialized, "},
+  {"   flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (object_uid, column_name) "},
+  {" ; "}
+};
+
+enum SeabaseOldTrafMDv11ColumnsFlags {
+  SEABASE_COLUMN_IS_SALT_V11   = 0x0000000000000001, // don't rely on this quite yet,
+                                                     // since some older tables
+                                                     // don't have this flag set
+  SEABASE_COLUMN_IS_DIVISION_V11 = 0x0000000000000002
+};
+
+static const QString seabaseOldTrafMDv11DefaultsDDL[] =
+{
+  {" create table "SEABASE_DEFAULTS_OLD_MD" "},
+  {" ( "},
+  {"   attribute varchar(100 bytes) character set utf8 not null not serialized, "},
+  {"   attr_value varchar(1000 bytes) character set utf8 not null not serialized, "},
+  {"   attr_comment varchar(1000 bytes) character set utf8 not null not serialized "},
+  {" ) "},
+  {" primary key (attribute) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11KeysDDL[] =
+{
+  {" create table "SEABASE_KEYS_OLD_MD" "},
+  {" ( "},
+  {"   object_uid largeint not null not serialized, "},
+  {"   column_name varchar( 256 bytes ) character set utf8 not null not serialized, "},
+  {"   keyseq_number int not null not serialized, "},
+  {"   column_number int not null not serialized, "},
+  {"   ordering int not null not serialized, "},
+  {"   nonkeycol int not null not serialized, "},
+  {"   flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (object_uid, keyseq_number) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11IndexesDDL[] =
+{
+  {" create table "SEABASE_INDEXES_OLD_MD" "},
+  {" ( "},
+  {"   base_table_uid largeint not null not serialized, "},
+  {"   keytag int not null not serialized, "},
+  {"   is_unique int not null not serialized, "},
+  {"   key_colcount int not null not serialized, "},
+  {"   nonkey_colcount int not null not serialized, "},
+  {"   is_explicit int not null not serialized, "},
+  {"   index_uid largeint not null not serialized, "},
+  {"   flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (base_table_uid, index_uid) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11LibrariesDDL[] =
+{
+  {" create table "SEABASE_LIBRARIES_OLD_MD" "},
+  {" ( "},
+  {"   library_uid largeint not null not serialized, "},
+  {"   library_filename varchar(512) character set iso88591 not null not serialized, "},
+  {"   version int not null not serialized "},
+  {" ) "},
+  {" primary key (library_uid) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11LibrariesUsageDDL[] =
+{
+  {" create table "SEABASE_LIBRARIES_USAGE_OLD_MD" "},
+  {" ( "},
+  {"   using_library_uid largeint not null not serialized, "},
+  {"   used_udr_uid largeint not null not serialized "},
+  {" ) "},
+  {" primary key (using_library_uid, used_udr_uid) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11ObjectsDDL[] =
+{
+  {" create table "SEABASE_OBJECTS_OLD_MD" "},
+  {" ( "},
+  {"   catalog_name varchar ( 256 bytes ) character set utf8 not null not serialized, "},
+  {"   schema_name varchar ( 256 bytes ) character set utf8 not null not serialized, "},
+  {"   object_name varchar ( 256 bytes ) character set utf8 not null not serialized, "},
+  {"   object_type char(2) character set iso88591 not null not serialized, "},
+  {"   object_uid largeint not null not serialized, "},
+  {"   create_time largeint not null not serialized, "},
+  {"   redef_time largeint not null not serialized, "},
+  {"   valid_def char(2) character set iso88591 not null not serialized, "},
+  {"   droppable char(2) character set iso88591 not null not serialized, "},
+  {"   object_owner int not null not serialized, "},
+  {"   schema_owner int not null not serialized, "},
+  {"   flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (catalog_name, schema_name, object_name, object_type) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11ObjectsUniqIdxIndexDDL[] =
+{
+  {" create unique index "SEABASE_OBJECTS_UNIQ_IDX_OLD_MD" on "TRAFODION_SYSCAT_LIT".\""SEABASE_MD_SCHEMA"\"."SEABASE_OBJECTS_OLD_MD" "},
+  {" ( "},
+  {"   object_uid "},
+  {" ) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11ObjectsUniqIdxDDL[] =
+{
+  {" create table "SEABASE_OBJECTS_UNIQ_IDX_OLD_MD" "},
+  {" ( "},
+  {"   \"OBJECT_UID@\" largeint not null not serialized, "},
+  {"   catalog_name varchar(256 bytes) character set utf8 not null not serialized, "},
+  {"   schema_name varchar(256 bytes) character set utf8 not null not serialized, "},
+  {"   object_name varchar(256 bytes) character set utf8 not null not serialized, "},
+  {"   object_type char(2) character set iso88591 not null not serialized "},
+  {" ) "},
+  {" primary key (\"OBJECT_UID@\") "},
+  {" ; "}
+};
+
+enum SeabaseOldTrafMDv11ObjectsFlags {
+  SEABASE_OBJECT_IS_EXTERNAL_HIVE_V11 = 0x0000000000000001, // set if this object
+                                                         // references external
+                                                         // HIVE table
+  SEABASE_OBJECT_IS_EXTERNAL_HBASE_V11 = 0x0000000000000002 // set if this object
+                                                         // references external
+                                                         // HBASE table
+
+};
+
+static const QString seabaseOldTrafMDv11RefConstraintsDDL[] =
+{
+  {" create table "SEABASE_REF_CONSTRAINTS_OLD_MD" "},
+  {" ( "},
+  {"   ref_constraint_uid largeint not null not serialized, "},
+  {"   unique_constraint_uid largeint not null not serialized, "},
+  {"   match_option char(2) not null not serialized, "},
+  {"   update_rule char(2) character set iso88591 not null not serialized, "},
+  {"   delete_rule char(2) character set iso88591 not null not serialized, "},
+  {"   flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (ref_constraint_uid, unique_constraint_uid) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11RoutinesDDL[] =
+{
+  {" create table "SEABASE_ROUTINES_OLD_MD" "},
+  {" ( "},
+  {"   udr_uid largeint not null not serialized, "},
+  {"   udr_type char(2) not  null, "},
+  {"   language_type char(2) character set iso88591 not null not serialized, "},
+  {"   deterministic_bool char(2) character set iso88591 not null not serialized, "},
+  {"   sql_access char(2) character set iso88591 not null not serialized, "},
+  {"   call_on_null char(2) character set iso88591 not null not serialized, "},
+  {"   isolate_bool char(2) character set iso88591 not null not serialized, "},
+  {"   param_style char(2) character set iso88591 not null not serialized, "},
+  {"   transaction_attributes char(2) character set iso88591 not null not serialized, "},
+  {"   max_results int not null not serialized, "},
+  {"   state_area_size int not null not serialized, "},
+  {"   external_name varchar(1024 bytes) character set utf8 not null not serialized, "},
+  {"   parallelism char(2) character set iso88591 not null not serialized, "},
+  {"   user_version varchar(32) character set iso88591 not null not serialized, "},
+  {"   external_security char(2) character set iso88591 not null not serialized, "},
+  {"   execution_mode char(2) character set iso88591 not null not serialized, "},
+  {"   library_uid largeint not null not serialized, "},
+  {"   signature varchar(8192 bytes) character set utf8 not null not serialized "},
+  {" ) "},
+  {" primary key (udr_uid) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11SeqGenDDL[] =
+{
+  {" create table "SEABASE_SEQ_GEN_OLD_MD" "},
+  {" ( "},
+  {"   seq_type char(2) character set iso88591 not null not serialized, "},
+  {"   seq_uid largeint not null not serialized, "},
+  {"   fs_data_type integer not null not serialized, "},
+  {"   start_value largeint not null not serialized, "},
+  {"   increment largeint not null not serialized, "},
+  {"   max_value largeint not null not serialized, "},
+  {"   min_value largeint not null not serialized, "},
+  {"   cycle_option char(2) character set iso88591 not null not serialized, "},
+  {"   cache_size largeint not null not serialized, "},
+
+  // next value that seq generator will return
+  {"   next_value largeint not null not serialized, "},
+
+  // number of seq generator calls accessing this metadata table
+  {"   num_calls largeint not null not serialized, "},
+
+  {"   redef_ts largeint not null serialized, "},
+  {"   upd_ts largeint not null serialized, "},
+
+  {"   flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (seq_uid) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11TablesDDL[] =
+{
+  {" create table "SEABASE_TABLES_OLD_MD" "},
+  {" ( "},
+  {"   table_uid largeint not null not serialized, "},
+  {"   row_format char(2) character set iso88591 not null not serialized, "},
+  {"   is_audited char(2) character set iso88591 not null not serialized, "},
+  {"   row_data_length int not null not serialized, "},
+  {"   row_total_length int not null not serialized, "},
+  {"   key_length int not null not serialized, "},
+  {"   num_salt_partns int not null not serialized, "},
+  {"   flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (table_uid) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11TableConstraintsDDL[] =
+{
+  {" create table "SEABASE_TABLE_CONSTRAINTS_OLD_MD" "},
+  {" ( "},
+  {"   table_uid largeint not null not serialized, "},
+  {"   constraint_uid largeint not null not serialized, "},
+  {"   constraint_type char(2) character set iso88591 not null not serialized, "},
+  {"   disabled char(2) character set iso88591 not null not serialized, "},
+  {"   droppable char(2) character set iso88591 not null not serialized, "},
+  {"   is_deferrable char(2) character set iso88591 not null not serialized, "},
+  {"   enforced char(2) character set iso88591 not null not serialized, "},
+  {"   validated char(2) character set iso88591 not null not serialized, "},
+  {"   last_validated largeint not null not serialized, "},
+  {"   col_count int not null not serialized, "},
+  {"   index_uid largeint not null not serialized, "},
+  {"   flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (table_uid, constraint_uid, constraint_type) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11TextDDL[] =
+{
+  {" create table "SEABASE_TEXT_OLD_MD" "},
+  {" ( "},
+  {"   text_uid largeint not null not serialized, "},
+  {"   text_type int not null not serialized, "},
+  {"   sub_id int not null not serialized, "},
+  {"   seq_num int not null not serialized, "},
+  {"   flags largeint not null not serialized, "},
+  {"   text varchar(10000 bytes) character set utf8 not null not serialized "},
+  {" ) "},
+  {" primary key (text_uid, text_type, sub_id, seq_num) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11UniqueRefConstrUsageDDL[] =
+{
+  {" create table "SEABASE_UNIQUE_REF_CONSTR_USAGE_OLD_MD" "},
+  {" ( "},
+  {"   unique_constraint_uid largeint not null not serialized, "},
+  {"   foreign_constraint_uid largeint not null not serialized, "},
+  {"   flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (unique_constraint_uid, foreign_constraint_uid) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11VersionsDDL[] =
+{
+  {" create table "SEABASE_VERSIONS_OLD_MD" "},
+  {" ( "},
+  {"   version_type char(50 bytes) character set utf8 not null not serialized, "},
+  {"   major_version largeint not null not serialized, "},
+  {"   minor_version largeint not null not serialized, "},
+  {"   init_time largeint not null not serialized, "},
+  {"   comment varchar(1000 bytes) character set utf8 not null not serialized "},
+  {" ) "},
+  {" primary key (version_type) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11ViewsDDL[] =
+{
+  {" create table "SEABASE_VIEWS_OLD_MD" "},
+  {" ( "},
+  {"   view_uid largeint not null not serialized, "},
+  {"   check_option char(2) character set iso88591 not null not serialized, "},
+  {"   is_updatable int not null not serialized, "},
+  {"   is_insertable int not null not serialized, "},
+  {"   flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (view_uid) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11ViewsUsageDDL[] =
+{
+  {" create table "SEABASE_VIEWS_USAGE_OLD_MD" "},
+  {" ( "},
+  {"   using_view_uid largeint not null not serialized, "},
+  {"   used_object_uid largeint not null not serialized, "},
+  {"   used_object_type char(2) character set iso88591 not null not serialized, "},
+  {"   flags largeint not null not serialized "},
+  {" ) "},
+  {" primary key (using_view_uid, used_object_uid) "},
+  {" ; "}
+};
+
+static const ComTdbVirtTableRoutineInfo seabaseOldTrafMDv11MDValidateRoutineInfo =
+  {
+    "VALIDATEROUTINE", COM_PROCEDURE_TYPE_LIT,  COM_LANGUAGE_JAVA_LIT, 1, COM_NO_SQL_LIT, 0, 0, COM_STYLE_JAVA_CALL_LIT, COM_NO_TRANSACTION_REQUIRED_LIT, 0, 0, "org.trafodion.sql.udr.LmUtility.validateMethod", COM_ROUTINE_NO_PARALLELISM_LIT, " ", COM_ROUTINE_EXTERNAL_SECURITY_INVOKER_LIT, COM_ROUTINE_SAFE_EXECUTION_LIT, " ", 1, "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;III[Ljava/lang/String;[I[Ljava/lang/String;)V", " "
+  };
+
+static const ComTdbVirtTableColumnInfo seabaseOldTrafMDv11MDValidateRoutineColInfo[] =
+  {        
+    { "CLASSNAME", 0,  COM_USER_COLUMN, REC_BYTE_V_ASCII, 256, FALSE , SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",SEABASE_DEFAULT_COL_FAMILY,"1", COM_INPUT_COLUMN_LIT, 0},
+    { "METHODNAME", 1,  COM_USER_COLUMN, REC_BYTE_V_ASCII, 256, FALSE , SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",SEABASE_DEFAULT_COL_FAMILY,"2", COM_INPUT_COLUMN_LIT, 0},
+    { "EXTERNALPATH", 2,  COM_USER_COLUMN, REC_BYTE_V_ASCII, 256, FALSE , SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",SEABASE_DEFAULT_COL_FAMILY,"3", COM_INPUT_COLUMN_LIT, 0},
+    { "SIGNATURE", 3,  COM_USER_COLUMN, REC_BYTE_V_ASCII, 8192, FALSE , SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",SEABASE_DEFAULT_COL_FAMILY,"4", COM_INPUT_COLUMN_LIT, 0},
+    { "NUMPARAM", 4,  COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE , SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",SEABASE_DEFAULT_COL_FAMILY,"5", COM_INPUT_COLUMN_LIT, 0},
+    { "MAXRESULTSETS", 5,  COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE , SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",SEABASE_DEFAULT_COL_FAMILY,"6", COM_INPUT_COLUMN_LIT, 0},
+    { "OPTIONALSIG", 6,  COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE , SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",SEABASE_DEFAULT_COL_FAMILY,"7", COM_INPUT_COLUMN_LIT, 0},
+     { "RETSIG", 7,  COM_USER_COLUMN, REC_BYTE_V_ASCII, 8192, FALSE , SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",SEABASE_DEFAULT_COL_FAMILY,"8", COM_OUTPUT_COLUMN_LIT, 0},
+    { "ERRCODE", 8,  COM_USER_COLUMN, REC_BIN32_SIGNED, 4, FALSE , SQLCHARSETCODE_UNKNOWN, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",SEABASE_DEFAULT_COL_FAMILY,"9", COM_OUTPUT_COLUMN_LIT, 0},
+     { "ERRDETAIL", 9,  COM_USER_COLUMN, REC_BYTE_V_ASCII, 8192, FALSE , SQLCHARSETCODE_ISO88591, 0, 0, 0, 0, 0, 0, 0, COM_NO_DEFAULT, "",SEABASE_DEFAULT_COL_FAMILY,"10", COM_OUTPUT_COLUMN_LIT, 0}
+  };
+
+static const QString seabaseOldTrafMDv11HistogramsDDL[] =
+{
+  {" create table "HBASE_HIST_NAME"_OLD_MD "},
+  {" ( "},
+  {"   table_uid largeint not null not serialized, "},
+  {"   histogram_id int unsigned not null not serialized, "},
+  {"   col_position int not null not serialized, "},
+  {"   column_number int not null not serialized, "},
+  {"   colcount int not null not serialized, "},
+  {"   interval_count smallint not null not serialized, "},
+  {"   rowcount largeint not null not serialized, "},
+  {"   total_uec largeint not null not serialized, "},
+  {"   stats_time timestamp(0) not null not serialized, "},
+  {"   low_value varchar(250) character set ucs2 not null not serialized, "},
+  {"   high_value varchar(250) character set ucs2 not null not serialized, "},
+  {"   read_time timestamp(0) not null not serialized, "},
+  {"   read_count smallint not null not serialized, "},
+  {"   sample_secs largeint not null not serialized, "},
+  {"   col_secs largeint not null not serialized, "},
+  {"   sample_percent smallint not null not serialized, "},
+  {"   cv double precision not null not serialized, "},
+  {"   reason char(1) character set iso88591 not null not serialized, "},
+  {"   v1 largeint not null not serialized, "},
+  {"   v2 largeint not null not serialized, "},
+  {"   v3 largeint not null not serialized, "},
+  {"   v4 largeint not null not serialized, "},
+  {"   v5 varchar(250) character set ucs2 not null not serialized, "},
+  {"   v6 varchar(250) character set ucs2 not null not serialized "},
+  {" , constraint "HBASE_HIST_PK" primary key "},
+  {"     (table_uid, histogram_id, col_position) "},
+  {" ) "},
+  {" ; "}
+};
+
+static const QString seabaseOldTrafMDv11HistogramIntervalsDDL[] =
+{
+  {" create table "HBASE_HISTINT_NAME"_OLD_MD "},
+  {" ( "},
+  {"   table_uid largeint not null not serialized, "},
+  {"   histogram_id int unsigned not null not serialized, "},
+  {"   interval_number smallint not null not serialized, "},
+  {"   interval_rowcount largeint not null not serialized, "},
+  {"   interval_uec largeint not null not serialized, "},
+  {"   interval_boundary varchar(250) character set ucs2 not null not serialized, "},
+  {"   std_dev_of_freq numeric(12,3) not null not serialized, "},
+  {"   v1 largeint not null not serialized, "},
+  {"   v2 largeint not null not serialized, "},
+  {"   v3 largeint not null not serialized, "},
+  {"   v4 largeint not null not serialized, "},
+  {"   v5 varchar(250) character set ucs2 not null not serialized, "},
+  {"   v6 varchar(250) character set ucs2 not null not serialized"},
+  {" , constraint "HBASE_HISTINT_PK" primary key "},
+  {"    (table_uid, histogram_id, interval_number) "},
+  {" ) "},
+  {" ; "}
+};
+
+////////////////////////////////////////////////////////////////////////
+//// END_OLD_MD_v11: 
+////        OLD metadata Version 1.1  (Major version = 1, Minor version = 1).
+//////////////////////////////////////////////////////////////////////////
+
+// Note: The older metadata definitions below were from before we
+// reset the version to 1.1 with the early Trafodion releases. (We
+// went backwards to match the Trafodion release number.)
+
+////////////////////////////////////////////////////////////////////////
 //// START_OLD_MD_v23: 
 ////        OLD metadata Version 2.3  (Major version = 2, Minor version = 3).
 //////////////////////////////////////////////////////////////////////////

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2605440b/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp b/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
index 7285c37..5b22307 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
@@ -390,7 +390,7 @@ void CmpSeabaseDDL::createSeabaseLibrary(
     }
  
   char * query = new(STMTHEAP) char[1000];
-  str_sprintf(query, "insert into %s.\"%s\".%s values (%Ld, '%s', %d)",
+  str_sprintf(query, "insert into %s.\"%s\".%s values (%Ld, '%s', %d, 0)",
 	      getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_LIBRARIES,
 	      objUID,
               libFileName.data(),
@@ -1102,7 +1102,7 @@ void CmpSeabaseDDL::createSeabaseRoutine(
   
 
   char * query = new(STMTHEAP) char[2000+MAX_SIGNATURE_LENGTH];
-  str_sprintf(query, "insert into %s.\"%s\".%s values (%Ld, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', %Ld, '%s' )",
+  str_sprintf(query, "insert into %s.\"%s\".%s values (%Ld, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s', %Ld, '%s', 0)",
 	      getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_ROUTINES,
 	      objUID,
               udrType.data(),
@@ -1133,7 +1133,7 @@ void CmpSeabaseDDL::createSeabaseRoutine(
     }
 
   char * query1 = new(STMTHEAP) char[1000];
-  str_sprintf(query1, "insert into %s.\"%s\".%s values (%Ld, %Ld)",
+  str_sprintf(query1, "insert into %s.\"%s\".%s values (%Ld, %Ld, 0)",
 	      getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_LIBRARIES_USAGE,
 	      libUID, objUID);
   

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2605440b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 5a2c1d7..4037afc 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -10585,6 +10585,17 @@ desc_struct * CmpSeabaseDDL::getSeabaseUserTableDesc(const NAString &catName,
       if ((strcmp(constrType, COM_UNIQUE_CONSTRAINT_LIT) == 0) ||
           (strcmp(constrType, COM_PRIMARY_KEY_CONSTRAINT_LIT) == 0))
         {
+          // force the query plan; without this we tend to do full scans of
+          // TABLE_CONSTRAINTS which reduces DDL concurrency
+          str_sprintf(query,"control query shape sort(nested_join(nested_join(nested_join(scan('U'),scan('O')), scan('T','TRAFODION.\"_MD_\".TABLE_CONSTRAINTS_IDX')),cut))");
+          cliRC = cliInterface.setCQS(query);
+          if (cliRC < 0)
+            {
+              cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());             
+              processReturn();
+              return NULL;
+            }
+
           str_sprintf(query, "select trim(O.catalog_name || '.' || '\"' || O.schema_name || '\"' || '.' || '\"' || O.object_name || '\"' ) constr_name, trim(O2.catalog_name || '.' || '\"' || O2.schema_name || '\"' || '.' || '\"' || O2.object_name || '\"' ) table_name from %s.\"%s\".%s U, %s.\"%s\".%s O, %s.\"%s\".%s O2, %s.\"%s\".%s T where  O.object_uid = U.foreign_constraint_uid and O2.object_uid = T.table_uid and T.constraint_uid = U.foreign_constraint_uid and U.unique_constraint_uid = %Ld order by 2, 1",
                       getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_UNIQUE_REF_CONSTR_USAGE,
                       getSystemCatalog(), SEABASE_MD_SCHEMA, SEABASE_OBJECTS,
@@ -10600,9 +10611,13 @@ desc_struct * CmpSeabaseDDL::getSeabaseUserTableDesc(const NAString &catName,
               cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
               
               processReturn();
+
+              cliInterface.resetCQS();
               
               return NULL;
             }
+      
+          cliInterface.resetCQS();
 
           ComTdbVirtTableRefConstraints * ringInfoArray = NULL;
           if (ringInfoQueue->numEntries() > 0)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/2605440b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
index 1316101..4e7111c 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
@@ -38,6 +38,9 @@ CmpSeabaseDDLmd.h
      to START_OLD_MD_v23 section. 
    -- Change name to *_OLD_MD.  (Ex: SEABASE_COLUMNS_OLD_MD)
    -- Change definition name to seabaseOldMDv23* (Ex: seabaseOldMDv23ColumnsDDL)
+      (Note: There was a reset in version numbers when Trafodion Release 1.1
+      went out. So, use "OldTrafMDvxx" now instead of "OldMDvxx", to avoid
+      conflicts should those numbering schemes overlap.)
    -- modify current definition to reflect new definition(Ex: seabaseColumnsDDL)
 
 CmpSeabaseDDLupgrade.h
@@ -46,7 +49,7 @@ CmpSeabaseDDLupgrade.h
        -- add old defn, insert/select col list, added/dropped col flag, etc.
   -- see struct MDUpgradeInfo for details on what fields need to be modified.
 
-CmpSeabaseDDL.h
+CmpSeabaseDDLincludes.h
 -- modify enum METADATA_MAJOR/MINOR, OLD_MAJOR/MINOR versions
 
 CmpSeabaseDDLcommon.cpp and other files:
@@ -129,8 +132,8 @@ struct MDDescsInfo
 // This section should reflect the upgrade steps needed to go from
 // previous to current version.
 // Modify it as needed.
-// Currently it is set to upgrade from V30(source major version 3, minor version 0)
-// to V31.
+// Currently it is set to upgrade from V11(source major version 1, minor version 1)
+// to V21.
 //////////////////////////////////////////////////////////////
 static const MDUpgradeInfo allMDupgradeInfo[] = {
   {SEABASE_AUTHS, SEABASE_AUTHS_OLD_MD,
@@ -147,9 +150,12 @@ static const MDUpgradeInfo allMDupgradeInfo[] = {
 
   {SEABASE_DEFAULTS, SEABASE_DEFAULTS_OLD_MD,
    seabaseDefaultsDDL, sizeof(seabaseDefaultsDDL),
+   seabaseOldTrafMDv11DefaultsDDL, sizeof(seabaseOldTrafMDv11DefaultsDDL),
    NULL, 0,
-   NULL, 0,
-   FALSE, NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
+   TRUE, 
+   "attribute,attr_value,attr_comment,flags",
+   "attribute,attr_value,attr_comment,0",
+   NULL, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE},
 
   {SEABASE_INDEXES, SEABASE_INDEXES_OLD_MD,
    seabaseIndexesDDL, sizeof(seabaseIndexesDDL),
@@ -165,15 +171,21 @@ static const MDUpgradeInfo allMDupgradeInfo[] = {
 
   {SEABASE_LIBRARIES, SEABASE_LIBRARIES_OLD_MD,
    seabaseLibrariesDDL, sizeof(seabaseLibrariesDDL),
+   seabaseOldTrafMDv11LibrariesDDL, sizeof(seabaseOldTrafMDv11LibrariesDDL),
    NULL, 0,
-   NULL, 0,
-   FALSE, NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
+   TRUE, 
+   "library_uid,library_filename,version,flags",
+   "library_uid,library_filename,version,0", 
+   NULL, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE},
 
   {SEABASE_LIBRARIES_USAGE, SEABASE_LIBRARIES_USAGE_OLD_MD,
    seabaseLibrariesUsageDDL, sizeof(seabaseLibrariesUsageDDL),
+   seabaseOldTrafMDv11LibrariesUsageDDL, sizeof(seabaseOldTrafMDv11LibrariesUsageDDL),
    NULL, 0,
-   NULL, 0,
-   FALSE, NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
+   TRUE, 
+   "using_library_uid,used_udr_uid,flags",
+   "using_library_uid,used_udr_uid,0",
+   NULL, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE},
 
   {SEABASE_OBJECTS, SEABASE_OBJECTS_OLD_MD,
    seabaseObjectsDDL, sizeof(seabaseObjectsDDL),
@@ -195,9 +207,20 @@ static const MDUpgradeInfo allMDupgradeInfo[] = {
 
   {SEABASE_ROUTINES, SEABASE_ROUTINES_OLD_MD,
    seabaseRoutinesDDL, sizeof(seabaseRoutinesDDL),
+   seabaseOldTrafMDv11RoutinesDDL, sizeof(seabaseOldTrafMDv11RoutinesDDL),
    NULL, 0,
-   NULL, 0,
-   FALSE, NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
+   TRUE,
+   "udr_uid,udr_type,language_type,deterministic_bool,sql_access,"
+   "call_on_null,isolate_bool,param_style,transaction_attributes,"
+   "max_results,state_area_size,external_name,parallelism,"
+   "user_version,external_security,execution_mode,library_uid,"
+   "signature,flags",
+   "udr_uid,udr_type,language_type,deterministic_bool,sql_access,"
+   "call_on_null,isolate_bool,param_style,transaction_attributes,"
+   "max_results,state_area_size,external_name,parallelism,"
+   "user_version,external_security,execution_mode,library_uid,"
+   "signature,0",   
+   NULL, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE},
 
   {SEABASE_SEQ_GEN, SEABASE_SEQ_GEN_OLD_MD,
    seabaseSeqGenDDL, sizeof(seabaseSeqGenDDL),
@@ -217,6 +240,13 @@ static const MDUpgradeInfo allMDupgradeInfo[] = {
    NULL, 0,
    FALSE, NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
 
+   // For next metadata upgrade, replace NULL with SEABASE_TABLE_CONSTRAINTS_IDX_OLD_MD below
+  {SEABASE_TABLE_CONSTRAINTS_IDX, NULL /* index didn't exist before Trafodion 2.1 */,
+   seabaseTableConstraintsIdxDDL, sizeof(seabaseTableConstraintsIdxDDL),
+   NULL, 0,
+   NULL, 0,
+   FALSE, NULL, NULL, NULL, FALSE, FALSE, TRUE, FALSE, TRUE, FALSE},
+
   {SEABASE_TEXT, SEABASE_TEXT_OLD_MD,
    seabaseTextDDL, sizeof(seabaseTextDDL),
    NULL, 0,
@@ -251,7 +281,7 @@ static const MDUpgradeInfo allMDupgradeInfo[] = {
    NULL, 0,
    NULL, 0,
    NULL, 0,
-   FALSE, NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
+   FALSE, NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE},
 
   {SEABASE_VALIDATE_LIBRARY, SEABASE_VALIDATE_LIBRARY_OLD_MD,
    NULL, 0,



[07/16] incubator-trafodion git commit: cleaned up the commented code

Posted by db...@apache.org.
cleaned up the commented code


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

Branch: refs/heads/master
Commit: ee53fc30ff0e30ab704bf61f86261b04451ff26f
Parents: 85783bf
Author: Anuradha Hegde <an...@esgyn.com>
Authored: Fri Jun 24 19:23:46 2016 +0000
Committer: Anuradha Hegde <an...@esgyn.com>
Committed: Fri Jun 24 19:23:46 2016 +0000

----------------------------------------------------------------------
 .../odbc/nsksrvrcore/ResStatisticsSession.cpp   | 48 --------------------
 1 file changed, 48 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ee53fc30/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.cpp
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.cpp b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.cpp
index c33c4b7..4fd85e5 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.cpp
@@ -204,53 +204,6 @@ void ResStatisticsSession::end()
 
 	endTime_ts = endTime;
 
-/*
-	string session_status = "END";
-       
-	std::tr1::shared_ptr<SESSION_INFO> pSession_info = std::tr1::shared_ptr<SESSION_INFO>(new SESSION_INFO);
-	*pSession_info = {0};
-
-	pSession_info->m_process_id = srvrGlobal->process_id;
-	pSession_info->m_thread_id = srvrGlobal->receiveThrId;
-	pSession_info->m_node_id = srvrGlobal->m_NodeId;
-	pSession_info->m_ip_address_id = srvrGlobal->IpAddress;
-	pSession_info->m_process_name = srvrGlobal->m_ProcName;
-	pSession_info->m_sessionId = srvrGlobal->sessionId;
-	pSession_info->m_session_status = "END";
-	pSession_info->m_session_start_utc_ts = startTime_ts;
-	pSession_info->m_session_end_utc_ts = endTime_ts;
-	pSession_info->m_user_id = srvrGlobal->userID;
-	pSession_info->m_user_name = srvrGlobal->userSID;
-	pSession_info->m_role_name = srvrGlobal->QSRoleName;
-	pSession_info->m_client_name = srvrGlobal->ClientComputerName;
-	pSession_info->m_client_user_name = resCollectinfo.clientUserName;
-	pSession_info->m_application_name = srvrGlobal->ApplicationName;
-        UpdateStringText(pSession_info->m_application_name);
-	pSession_info->m_profile_name = srvrGlobal->mappedProfileName;
-	pSession_info->m_sla_name= srvrGlobal->mappedSLAName;
-	pSession_info->m_total_odbc_exection_time = totalOdbcExecutionTime;
-	pSession_info->m_total_odbc_elapsed_time = totalOdbcElapseTime;
-	pSession_info->m_total_insert_stmts_executed = totalInsertStatements;
-	pSession_info->m_total_delete_stmts_executed = totalDeleteStatements;
-	pSession_info->m_total_update_stmts_executed = totalUpdateStatements;
-	pSession_info->m_total_select_stmts_executed = totalSelectStatements;
-	pSession_info->m_total_catalog_stmts = totalCatalogStatements;
-	pSession_info->m_total_prepares = totalPrepares;
-	pSession_info->m_total_executes = totalExecutes;
-	pSession_info->m_total_fetches = totalFetches;
-	pSession_info->m_total_closes = totalCloses;
-	pSession_info->m_total_execdirects = totalExecDirects;
-	pSession_info->m_total_errors = totalErrors;
-	pSession_info->m_total_warnings = totalWarnings;
-	pSession_info->m_total_login_elapsed_time_mcsec = resCollectinfo.totalLoginTime;
-	pSession_info->m_ldap_login_elapsed_time_mcsec = resCollectinfo.ldapLoginTime;
-	pSession_info->m_sql_user_elapsed_time_mcsec = resCollectinfo.sqlUserTime;
-	pSession_info->m_search_connection_elapsed_time_mcsec = resCollectinfo.searchConnectionTime;
-	pSession_info->m_search_elapsed_time_mcsec = resCollectinfo.searchTime;
-	pSession_info->m_authentication_connection_elapsed_time_mcsec = resCollectinfo.authenticationConnectionTime;
-	pSession_info->m_authentication_elapsed_time_mcsec =  resCollectinfo.authenticationTime;
-
-*/
 	if ( srvrGlobal->m_bStatisticsEnabled )
 	{
 		if( srvrGlobal->m_statisticsPubType == STATISTICS_AGGREGATED )
@@ -258,7 +211,6 @@ void ResStatisticsSession::end()
 			std::tr1::shared_ptr<SESSION_AGGREGATION> pAggr_info = getAggrStats();
 			sendAggrStats(PUB_TYPE_SESSION_END_AGGREGATION, pAggr_info);
 		}
-		//sendSessionStats(pSession_info);
                 sendSessionInfo("END", startTime_ts, endTime_ts);
 	}
 }


[05/16] incubator-trafodion git commit: New columns for repository tables and related changes

Posted by db...@apache.org.
New columns for repository tables and related changes


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

Branch: refs/heads/master
Commit: 0b7663e4051eeaa37ee8c58e9df8ac1df5a0cb04
Parents: 2b111fd
Author: Anuradha Hegde <an...@esgyn.com>
Authored: Fri Jun 24 17:33:53 2016 +0000
Committer: Anuradha Hegde <an...@esgyn.com>
Committed: Fri Jun 24 17:33:53 2016 +0000

----------------------------------------------------------------------
 core/conn/odbc/src/odbc/Common/Global.h         |   5 +-
 core/conn/odbc/src/odbc/Common/PubQueryStats.h  |  11 +-
 core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp | 137 ++++++++++---------
 .../odbc/nsksrvrcore/ResStatisticsSession.cpp   |  65 ++++++++-
 .../src/odbc/nsksrvrcore/ResStatisticsSession.h |   1 +
 .../odbc/nsksrvrcore/ResStatisticsStatement.cpp |   3 +-
 core/sqf/sql/scripts/restcheck                  |   1 -
 core/sql/common/ComSmallDefs.h                  |   4 +-
 core/sql/regress/seabase/EXPECTED011            |   9 +-
 core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp         |  22 ++-
 core/sql/sqlcomp/CmpSeabaseDDLrepos.h           |  59 ++++----
 11 files changed, 203 insertions(+), 114 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0b7663e4/core/conn/odbc/src/odbc/Common/Global.h
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/Common/Global.h b/core/conn/odbc/src/odbc/Common/Global.h
index 8b18912..72e0cef 100644
--- a/core/conn/odbc/src/odbc/Common/Global.h
+++ b/core/conn/odbc/src/odbc/Common/Global.h
@@ -66,8 +66,6 @@ struct hash<std::string> {
 
 class CDataSourceList ;
 class ODBCMXTraceMsg;
-//class ResStatisticsStatement;
-//class ResStatisticsSession;
 
 
 #define	MAX_IP_ADDRESS_LEN		128
@@ -89,7 +87,6 @@ class ODBCMXTraceMsg;
 #include "QSGlobal.h"
 #include "PubInterface.h"
 #define DEFAULT_QS_PROCESS_NAME		"$ZWMGR"
-//define DEFAULT_QS_PROCESS_NAME	"$QSMGR"
 #define DEFAULT_SYNC_PROCESS_NAME	"$ZWSYN"
 
 #define DEFAULT_QS_POLLING			2
@@ -1024,6 +1021,8 @@ typedef struct _SRVR_GLOBAL_Def
 //
 	char				ClientComputerName[MAX_COMPUTER_NAME_LEN + 1];
 	char				ApplicationName[MAX_APPLICATION_NAME_LEN + 1];
+	char				mappedProfileName[MAX_APPLICATION_NAME_LEN + 1];
+	char				mappedSLAName[MAX_APPLICATION_NAME_LEN + 1];
 	int		                CreatorAccessId;
 	int		                ProcessAccessId;
 	char				RoleName[MAX_ROLE_LEN + 1];		// ROLE Name

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0b7663e4/core/conn/odbc/src/odbc/Common/PubQueryStats.h
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/Common/PubQueryStats.h b/core/conn/odbc/src/odbc/Common/PubQueryStats.h
index a175661..6b16cf7 100644
--- a/core/conn/odbc/src/odbc/Common/PubQueryStats.h
+++ b/core/conn/odbc/src/odbc/Common/PubQueryStats.h
@@ -29,6 +29,7 @@ using namespace std;
 enum pub_struct_type
 {
 	PUB_TYPE_INIT = 0,
+	PUB_TYPE_SESSION_START,
 	PUB_TYPE_SESSION_END,
 	PUB_TYPE_STATEMENT_NEW_QUERYEXECUTION,
 	PUB_TYPE_STATEMENT_UPDATE_QUERYEXECUTION,
@@ -43,7 +44,7 @@ enum statistics_type
 	STATISTICS_SESSION	
 };
 
-typedef struct _SESSION_END
+typedef struct _SESSION_INFO
 {
 	unsigned int m_instance_id;
 	unsigned int m_tenant_id;
@@ -66,6 +67,8 @@ typedef struct _SESSION_END
 	string m_client_name;
 	string m_client_user_name;
 	string m_application_name;
+        string m_profile_name;
+        string m_sla_name;
 	long long m_total_odbc_exection_time;
 	long long m_total_odbc_elapsed_time;
 	long m_total_insert_stmts_executed;
@@ -87,7 +90,7 @@ typedef struct _SESSION_END
 	long long m_search_elapsed_time_mcsec;
 	long long m_authentication_connection_elapsed_time_mcsec;
 	long long m_authentication_elapsed_time_mcsec;
-}SESSION_END, *pSESSION_END;
+}SESSION_INFO, *pSESSION_INFO;
 
 typedef struct _STATEMENT_QUERYEXECUTION
 {
@@ -109,6 +112,7 @@ typedef struct _STATEMENT_QUERYEXECUTION
 	string m_process_name;
 	long long m_exec_start_utc_ts;
 	string m_query_id;
+	string m_query_signature_id;
 	string m_user_name;
 	string m_role_name;
 	unsigned int m_start_priority;
@@ -222,6 +226,7 @@ typedef struct _STATEMENT_QUERYEXECUTION
 	long m_num_nodes;
 	long long m_udr_process_busy_time;
 	int m_pertable_stats;
+        long long m_last_updated_time;
 }STATEMENT_QUERYEXECUTION, *pSTATEMENT_QUERYEXECUTION;
 
 typedef struct _SESSION_AGGREGATION
@@ -288,6 +293,8 @@ typedef struct _SESSION_AGGREGATION
 	long m_delta_util_errors;
 	long m_delta_catalog_errors;
 	long m_delta_other_errors;
+	long m_average_response_time;
+	long m_throughput_per_sec;
 }SESSION_AGGREGATION, *pSESSION_AGGREGATION;
 
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0b7663e4/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp b/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp
index 2ad8422..c5d09fa 100644
--- a/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp
@@ -86,7 +86,6 @@
 #include "ResStatisticsSession.h"
 #include "ResStatisticsStatement.h"
 #include "ComDllload.h"
-//#include "QSExceptions.h"
 #include <dlfcn.h>
 #include "secsrvrmxo.h"
 
@@ -102,7 +101,6 @@ PerformanceMeasure *perf = 0;
 #include <arpa/inet.h>
 #include <netinet/in.h>
 #include "zookeeper/zookeeper.h"
-//extern ZK_GLOBAL_Def zkGlobals;
 
 #include <tr1/memory>
 #include <pthread.h>
@@ -140,6 +138,7 @@ int interval_count=0;
 int interval_max=1;
 int limit_count=0;
 int limit_max=-1;
+long long lastUpdatedTime = 0;
 
 bool updateZKState(DCS_SERVER_STATE currState, DCS_SERVER_STATE newState);
 
@@ -188,17 +187,15 @@ short qrysrvc_ExecuteFinished(
 		);
 
 extern char zkHost[256];
-//extern void sendAggrStats(pub_struct_type pub_type, pSESSION_AGGREGATION pAggr_info);
 extern void sendAggrStats(pub_struct_type pub_type, std::tr1::shared_ptr<SESSION_AGGREGATION> pAggr_info);
-//extern void sendSessionEnd(pSESSION_END pSession_info);
-extern void sendSessionEnd(std::tr1::shared_ptr<SESSION_END> pSession_info);
+extern void sendSessionStats(std::tr1::shared_ptr<SESSION_INFO> pSession_info);
 extern void sendQueryStats(pub_struct_type pub_type, std::tr1::shared_ptr<STATEMENT_QUERYEXECUTION> pQuery_info);
 CEE_handle_def StatisticsTimerHandle;
 SRVR_STMT_HDL * pQueryStmt = NULL;
 
 typedef struct _REPOS_STATS
 {
-	std::tr1::shared_ptr<SESSION_END> m_pSessionStats;
+	std::tr1::shared_ptr<SESSION_INFO> m_pSessionStats;
 	std::tr1::shared_ptr<STATEMENT_QUERYEXECUTION> m_pQuery_stats;
 	std::tr1::shared_ptr<SESSION_AGGREGATION> m_pAggr_stats;
 	pub_struct_type m_pub_type;
@@ -535,10 +532,10 @@ static void* SessionWatchDog(void* arg)
 			ss.str("");
 			ss.clear();
 
-			if (repos_stats.m_pub_type == PUB_TYPE_SESSION_END)
+			if (repos_stats.m_pub_type == PUB_TYPE_SESSION_START || repos_stats.m_pub_type == PUB_TYPE_SESSION_END)
 			{
-				std::tr1::shared_ptr<SESSION_END> pSessionEnd = repos_stats.m_pSessionStats;
-				if(NULL == pSessionEnd)
+				std::tr1::shared_ptr<SESSION_INFO> pSessionInfo = repos_stats.m_pSessionStats;
+				if(NULL == pSessionInfo)
 				{
 					SendEventMsg(MSG_ODBC_NSK_ERROR, EVENTLOG_ERROR_TYPE,
 							0, ODBCMX_SERVER, srvrGlobal->srvrObjRef,
@@ -546,49 +543,54 @@ static void* SessionWatchDog(void* arg)
 					break;
 				}
 
-				ss << "insert into Trafodion.\"_REPOS_\".metric_session_table values(";
-				ss << pSessionEnd->m_instance_id << ",";
-				ss << pSessionEnd->m_tenant_id << ",";
-				ss << pSessionEnd->m_component_id << ",";
-				ss << pSessionEnd->m_process_id << ",";
-				ss << pSessionEnd->m_thread_id << ",";
-				ss << pSessionEnd->m_node_id << ",";
-				ss << pSessionEnd->m_pnid_id << ",";
-				ss << pSessionEnd->m_host_id << ",'";
-				ss << pSessionEnd->m_ip_address_id.c_str() << "',";
-				ss << pSessionEnd->m_sequence_number << ",'";
-				ss << pSessionEnd->m_process_name.c_str() << "','";
-				ss << pSessionEnd->m_sessionId.c_str() << "','";
-				ss << pSessionEnd->m_session_status.c_str() << "',CONVERTTIMESTAMP(";
-				ss << pSessionEnd->m_session_start_utc_ts << "),CONVERTTIMESTAMP(";
-				ss << pSessionEnd->m_session_end_utc_ts << "),";
-				ss << pSessionEnd->m_user_id << ",'";
-				ss << pSessionEnd->m_user_name.c_str() << "','";
-				ss << pSessionEnd->m_role_name.c_str() << "','";
-				ss << pSessionEnd->m_client_name.c_str() << "','";
-				ss << pSessionEnd->m_client_user_name.c_str() << "','";
-				ss << pSessionEnd->m_application_name.c_str() << "',";
-				ss << pSessionEnd->m_total_odbc_exection_time << ",";
-				ss << pSessionEnd->m_total_odbc_elapsed_time << ",";
-				ss << pSessionEnd->m_total_insert_stmts_executed << ",";
-				ss << pSessionEnd->m_total_delete_stmts_executed << ",";
-				ss << pSessionEnd->m_total_update_stmts_executed << ",";
-				ss << pSessionEnd->m_total_select_stmts_executed << ",";
-				ss << pSessionEnd->m_total_catalog_stmts << ",";
-				ss << pSessionEnd->m_total_prepares << ",";
-				ss << pSessionEnd->m_total_executes << ",";
-				ss << pSessionEnd->m_total_fetches << ",";
-				ss << pSessionEnd->m_total_closes << ",";
-				ss << pSessionEnd->m_total_execdirects << ",";
-				ss << pSessionEnd->m_total_errors << ",";
-				ss << pSessionEnd->m_total_warnings << ",";
-				ss << pSessionEnd->m_total_login_elapsed_time_mcsec << ",";
-				ss << pSessionEnd->m_ldap_login_elapsed_time_mcsec << ",";
-				ss << pSessionEnd->m_sql_user_elapsed_time_mcsec << ",";
-				ss << pSessionEnd->m_search_connection_elapsed_time_mcsec << ",";
-				ss << pSessionEnd->m_search_elapsed_time_mcsec << ",";
-				ss << pSessionEnd->m_authentication_connection_elapsed_time_mcsec << ",";
-				ss << pSessionEnd->m_authentication_elapsed_time_mcsec << ")";
+				ss << "upsert into Trafodion.\"_REPOS_\".metric_session_table values(";
+				ss << pSessionInfo->m_instance_id << ",";
+				ss << pSessionInfo->m_tenant_id << ",";
+				ss << pSessionInfo->m_component_id << ",";
+				ss << pSessionInfo->m_process_id << ",";
+				ss << pSessionInfo->m_thread_id << ",";
+				ss << pSessionInfo->m_node_id << ",";
+				ss << pSessionInfo->m_pnid_id << ",";
+				ss << pSessionInfo->m_host_id << ",'";
+				ss << pSessionInfo->m_ip_address_id.c_str() << "',";
+				ss << pSessionInfo->m_sequence_number << ",'";
+				ss << pSessionInfo->m_process_name.c_str() << "','";
+				ss << pSessionInfo->m_sessionId.c_str() << "','";
+				ss << pSessionInfo->m_session_status.c_str() << "',CONVERTTIMESTAMP(";
+				ss << pSessionInfo->m_session_start_utc_ts << "),";
+                                if (pSessionInfo->m_session_end_utc_ts > 0)
+                                        ss << "CONVERTTIMESTAMP(" << pSessionInfo->m_session_end_utc_ts << "),";
+                                else
+                                        ss << "NULL,";
+				ss << pSessionInfo->m_user_id << ",'";
+				ss << pSessionInfo->m_user_name.c_str() << "','";
+				ss << pSessionInfo->m_role_name.c_str() << "','";
+				ss << pSessionInfo->m_client_name.c_str() << "','";
+				ss << pSessionInfo->m_client_user_name.c_str() << "','";
+				ss << pSessionInfo->m_application_name.c_str() << "','";
+ 				ss << pSessionInfo->m_profile_name.c_str() << "','";
+                                ss << pSessionInfo->m_sla_name.c_str() << "',";
+				ss << pSessionInfo->m_total_odbc_exection_time << ",";
+				ss << pSessionInfo->m_total_odbc_elapsed_time << ",";
+				ss << pSessionInfo->m_total_insert_stmts_executed << ",";
+				ss << pSessionInfo->m_total_delete_stmts_executed << ",";
+				ss << pSessionInfo->m_total_update_stmts_executed << ",";
+				ss << pSessionInfo->m_total_select_stmts_executed << ",";
+				ss << pSessionInfo->m_total_catalog_stmts << ",";
+				ss << pSessionInfo->m_total_prepares << ",";
+				ss << pSessionInfo->m_total_executes << ",";
+				ss << pSessionInfo->m_total_fetches << ",";
+				ss << pSessionInfo->m_total_closes << ",";
+				ss << pSessionInfo->m_total_execdirects << ",";
+				ss << pSessionInfo->m_total_errors << ",";
+				ss << pSessionInfo->m_total_warnings << ",";
+				ss << pSessionInfo->m_total_login_elapsed_time_mcsec << ",";
+				ss << pSessionInfo->m_ldap_login_elapsed_time_mcsec << ",";
+				ss << pSessionInfo->m_sql_user_elapsed_time_mcsec << ",";
+				ss << pSessionInfo->m_search_connection_elapsed_time_mcsec << ",";
+				ss << pSessionInfo->m_search_elapsed_time_mcsec << ",";
+				ss << pSessionInfo->m_authentication_connection_elapsed_time_mcsec << ",";
+				ss << pSessionInfo->m_authentication_elapsed_time_mcsec << ")";
 
 			}
 			else if (repos_stats.m_pub_type == PUB_TYPE_STATEMENT_NEW_QUERYEXECUTION)
@@ -601,6 +603,7 @@ static void* SessionWatchDog(void* arg)
                                                         1, "Invalid data pointer founded in SessionWatchDog()");
 					break;
 				}
+                                lastUpdatedTime = JULIANTIMESTAMP();
 
 				ss << "insert into Trafodion.\"_REPOS_\".metric_query_table values(";
 				ss << pQueryAdd->m_instance_id << ",";
@@ -616,6 +619,7 @@ static void* SessionWatchDog(void* arg)
 				ss << pQueryAdd->m_process_name.c_str() << "',CONVERTTIMESTAMP(";
 				ss << pQueryAdd->m_exec_start_utc_ts << "),'";
 				ss << pQueryAdd->m_query_id.c_str() << "','";
+				ss << pQueryAdd->m_query_signature_id.c_str() << "','";
 				ss << pQueryAdd->m_user_name.c_str() << "','";
 				ss << pQueryAdd->m_role_name.c_str() << "',";
 				ss << pQueryAdd->m_start_priority << ",'";
@@ -742,7 +746,14 @@ static void* SessionWatchDog(void* arg)
 				ss << pQueryAdd->m_ovf_buffer_bytes_read << ",";
 				ss << pQueryAdd->m_num_nodes << ",";
 				ss << pQueryAdd->m_udr_process_busy_time << ",";
-				ss << pQueryAdd->m_pertable_stats << ")";
+				ss << pQueryAdd->m_pertable_stats << ",";
+				if ( lastUpdatedTime > 0)
+                                        ss << "CONVERTTIMESTAMP(" << lastUpdatedTime << ")";
+                                else
+                                        ss << "NULL";
+
+                                ss <<")";
+
 			}
 			else if (repos_stats.m_pub_type == PUB_TYPE_STATEMENT_UPDATE_QUERYEXECUTION)
 			{
@@ -755,6 +766,7 @@ static void* SessionWatchDog(void* arg)
 					break;
 				}
 
+                                lastUpdatedTime = JULIANTIMESTAMP();
 				ss << "update Trafodion.\"_REPOS_\".metric_query_table ";
 				ss << "set STATEMENT_TYPE= '" << pQueryUpdate->m_statement_type.c_str() << "',";
 				ss << "STATEMENT_SUBTYPE= '" << pQueryUpdate->m_statement_subtype.c_str() << "',";
@@ -811,6 +823,7 @@ static void* SessionWatchDog(void* arg)
 				ss << "NUM_NODES= " << pQueryUpdate->m_num_nodes << ",";
 				ss << "UDR_PROCESS_BUSY_TIME= " << pQueryUpdate->m_udr_process_busy_time << ",";
 				ss << "PERTABLE_STATS= " << pQueryUpdate->m_pertable_stats;
+                                ss << "LAST_UPDATED_TIME= CONVERTTIMESTAMP(" << lastUpdatedTime << ")";
 				ss << " where QUERY_ID = '" << pQueryUpdate->m_query_id.c_str() << "'";
 				ss << " and EXEC_START_UTC_TS = CONVERTTIMESTAMP(" << pQueryUpdate->m_exec_start_utc_ts << ")";
 			}
@@ -887,7 +900,9 @@ static void* SessionWatchDog(void* arg)
 				ss << pAggrStat->m_delta_ddl_errors << ",";
 				ss << pAggrStat->m_delta_util_errors << ",";
 				ss << pAggrStat->m_delta_catalog_errors << ",";
-				ss << pAggrStat->m_delta_other_errors << ")";
+				ss << pAggrStat->m_delta_other_errors << ",";
+				ss << pAggrStat->m_average_response_time << ",";
+				ss << pAggrStat->m_throughput_per_sec << ")";
 			}
 			else if (repos_stats.m_pub_type == PUB_TYPE_SESSION_UPDATE_AGGREGATION || repos_stats.m_pub_type == PUB_TYPE_SESSION_END_AGGREGATION)
 			{
@@ -944,7 +959,9 @@ static void* SessionWatchDog(void* arg)
 				ss << "DELTA_DDL_ERRORS = " << pAggrStat->m_delta_ddl_errors << ",";
 				ss << "DELTA_UTIL_ERRORS = " << pAggrStat->m_delta_util_errors << ",";
 				ss << "DELTA_CATALOG_ERRORS = " << pAggrStat->m_delta_catalog_errors << ",";
-				ss << "DELTA_OTHER_ERRORS = " << pAggrStat->m_delta_other_errors;
+				ss << "DELTA_OTHER_ERRORS = " << pAggrStat->m_delta_other_errors << ",";
+				ss << "AVERAGE_RESPONSE_TIME = " << pAggrStat->m_average_response_time << ",";
+				ss << "THROUGHPUT_PER_SECOND = " << pAggrStat->m_throughput_per_sec;
 				ss << " where SESSION_START_UTC_TS = CONVERTTIMESTAMP(" << pAggrStat->m_session_start_utc_ts << ")";
 				ss << " and SESSION_ID = '" << pAggrStat->m_sessionId.c_str() << "'";
 
@@ -9477,17 +9494,17 @@ short qrysrvc_ExecuteFinished(
 	return 0;
 }
 
-void sendSessionEnd(std::tr1::shared_ptr<SESSION_END> pSession_info)
+void sendSessionStats(std::tr1::shared_ptr<SESSION_INFO> pSession_info)
 {
 	REPOS_STATS session_stats;
 	session_stats.m_pSessionStats = pSession_info;
-	session_stats.m_pub_type = PUB_TYPE_SESSION_END;
 	if (record_session_done)
 	{
-		//boost::thread thrd(&SessionWatchDog);
+	        session_stats.m_pub_type = PUB_TYPE_SESSION_END;
 		pthread_t thrd;
 		pthread_create(&thrd, NULL, SessionWatchDog, NULL);
-	}
+	} else
+                session_stats.m_pub_type = PUB_TYPE_SESSION_START;
 	repos_queue.push_task(session_stats);
 }
 
@@ -9498,7 +9515,6 @@ void sendAggrStats(pub_struct_type pub_type, std::tr1::shared_ptr<SESSION_AGGREG
 	aggr_stats.m_pub_type = pub_type;
 	if (record_session_done)
 	{
-		//boost::thread thrd(&SessionWatchDog);
 		pthread_t thrd;
 		pthread_create(&thrd, NULL, SessionWatchDog, NULL);
 	}
@@ -9512,7 +9528,6 @@ void sendQueryStats(pub_struct_type pub_type, std::tr1::shared_ptr<STATEMENT_QUE
 	query_stats.m_pub_type = pub_type;
 	if (record_session_done)
 	{
-		//boost::thread thrd(&SessionWatchDog);
 		pthread_t thrd;
 		pthread_create(&thrd, NULL, SessionWatchDog, NULL);
 	}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0b7663e4/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.cpp
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.cpp b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.cpp
index c82ea80..c33c4b7 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.cpp
@@ -30,7 +30,7 @@
 #include "ResStatisticsStatement.h"
 
 void sendAggrStats(pub_struct_type pub_type, std::tr1::shared_ptr<SESSION_AGGREGATION> pAggr_info);
-void sendSessionEnd(std::tr1::shared_ptr<SESSION_END> pSession_info);
+void sendSessionStats(std::tr1::shared_ptr<SESSION_INFO> pSession_info);
 
 using namespace SRVR;
 void ResStatisticsSession::start(struct collect_info *setinit)
@@ -102,12 +102,61 @@ void ResStatisticsSession::start(struct collect_info *setinit)
 		entryTime_ts = entryTime;
 		if( srvrGlobal->m_bStatisticsEnabled && srvrGlobal->m_statisticsPubType == STATISTICS_AGGREGATED )
 		{
+                        sendSessionInfo(session_status, startTime_ts, endTime_ts);
 			std::tr1::shared_ptr<SESSION_AGGREGATION> pAggr_info = getAggrStats();
 			sendAggrStats(PUB_TYPE_SESSION_START_AGGREGATION, pAggr_info);
 		}
 	}
 }
 
+void ResStatisticsSession::sendSessionInfo(string session_status, long long startTime, long long endTime)
+{
+        std::tr1::shared_ptr<SESSION_INFO> pSession_info = std::tr1::shared_ptr<SESSION_INFO>(new SESSION_INFO);
+        *pSession_info = {0};
+        
+	pSession_info->m_process_id = srvrGlobal->process_id;
+	pSession_info->m_thread_id = srvrGlobal->receiveThrId;
+	pSession_info->m_node_id = srvrGlobal->m_NodeId;
+	pSession_info->m_ip_address_id = srvrGlobal->IpAddress;
+	pSession_info->m_process_name = srvrGlobal->m_ProcName;
+	pSession_info->m_sessionId = srvrGlobal->sessionId;
+	pSession_info->m_session_status = session_status;
+	pSession_info->m_session_start_utc_ts = startTime;
+	pSession_info->m_session_end_utc_ts = endTime;
+	pSession_info->m_user_id = srvrGlobal->userID;
+	pSession_info->m_user_name = srvrGlobal->userSID;
+	pSession_info->m_role_name = srvrGlobal->QSRoleName;
+	pSession_info->m_client_name = srvrGlobal->ClientComputerName;
+	pSession_info->m_client_user_name = resCollectinfo.clientUserName;
+	pSession_info->m_application_name = srvrGlobal->ApplicationName;
+        UpdateStringText(pSession_info->m_application_name);
+	pSession_info->m_profile_name = srvrGlobal->mappedProfileName;
+	pSession_info->m_sla_name= srvrGlobal->mappedSLAName;
+	pSession_info->m_total_odbc_exection_time = totalOdbcExecutionTime;
+	pSession_info->m_total_odbc_elapsed_time = totalOdbcElapseTime;
+	pSession_info->m_total_insert_stmts_executed = totalInsertStatements;
+	pSession_info->m_total_delete_stmts_executed = totalDeleteStatements;
+	pSession_info->m_total_update_stmts_executed = totalUpdateStatements;
+	pSession_info->m_total_select_stmts_executed = totalSelectStatements;
+	pSession_info->m_total_catalog_stmts = totalCatalogStatements;
+	pSession_info->m_total_prepares = totalPrepares;
+	pSession_info->m_total_executes = totalExecutes;
+	pSession_info->m_total_fetches = totalFetches;
+	pSession_info->m_total_closes = totalCloses;
+	pSession_info->m_total_execdirects = totalExecDirects;
+	pSession_info->m_total_errors = totalErrors;
+	pSession_info->m_total_warnings = totalWarnings;
+	pSession_info->m_total_login_elapsed_time_mcsec = resCollectinfo.totalLoginTime;
+	pSession_info->m_ldap_login_elapsed_time_mcsec = resCollectinfo.ldapLoginTime;
+	pSession_info->m_sql_user_elapsed_time_mcsec = resCollectinfo.sqlUserTime;
+	pSession_info->m_search_connection_elapsed_time_mcsec = resCollectinfo.searchConnectionTime;
+	pSession_info->m_search_elapsed_time_mcsec = resCollectinfo.searchTime;
+	pSession_info->m_authentication_connection_elapsed_time_mcsec = resCollectinfo.authenticationConnectionTime;
+	pSession_info->m_authentication_elapsed_time_mcsec =  resCollectinfo.authenticationTime;
+
+        sendSessionStats(pSession_info);
+}
+
 void ResStatisticsSession::end()
 {
 	char ts[25];
@@ -151,12 +200,14 @@ void ResStatisticsSession::end()
 	}
 	stringstream ss;
  	ss << "File: " << __FILE__ << ", Fuction: " << __FUNCTION__ << ", Line: " << __LINE__ << ", SESSIONID: " << srvrGlobal->sessionId;
-	string session_status = "END";
 	int64 endTime = JULIANTIMESTAMP();
 
 	endTime_ts = endTime;
 
-	std::tr1::shared_ptr<SESSION_END> pSession_info = std::tr1::shared_ptr<SESSION_END>(new SESSION_END);
+/*
+	string session_status = "END";
+       
+	std::tr1::shared_ptr<SESSION_INFO> pSession_info = std::tr1::shared_ptr<SESSION_INFO>(new SESSION_INFO);
 	*pSession_info = {0};
 
 	pSession_info->m_process_id = srvrGlobal->process_id;
@@ -174,7 +225,9 @@ void ResStatisticsSession::end()
 	pSession_info->m_client_name = srvrGlobal->ClientComputerName;
 	pSession_info->m_client_user_name = resCollectinfo.clientUserName;
 	pSession_info->m_application_name = srvrGlobal->ApplicationName;
-    UpdateStringText(pSession_info->m_application_name);
+        UpdateStringText(pSession_info->m_application_name);
+	pSession_info->m_profile_name = srvrGlobal->mappedProfileName;
+	pSession_info->m_sla_name= srvrGlobal->mappedSLAName;
 	pSession_info->m_total_odbc_exection_time = totalOdbcExecutionTime;
 	pSession_info->m_total_odbc_elapsed_time = totalOdbcElapseTime;
 	pSession_info->m_total_insert_stmts_executed = totalInsertStatements;
@@ -197,6 +250,7 @@ void ResStatisticsSession::end()
 	pSession_info->m_authentication_connection_elapsed_time_mcsec = resCollectinfo.authenticationConnectionTime;
 	pSession_info->m_authentication_elapsed_time_mcsec =  resCollectinfo.authenticationTime;
 
+*/
 	if ( srvrGlobal->m_bStatisticsEnabled )
 	{
 		if( srvrGlobal->m_statisticsPubType == STATISTICS_AGGREGATED )
@@ -204,7 +258,8 @@ void ResStatisticsSession::end()
 			std::tr1::shared_ptr<SESSION_AGGREGATION> pAggr_info = getAggrStats();
 			sendAggrStats(PUB_TYPE_SESSION_END_AGGREGATION, pAggr_info);
 		}
-		sendSessionEnd(pSession_info);
+		//sendSessionStats(pSession_info);
+                sendSessionInfo("END", startTime_ts, endTime_ts);
 	}
 }
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0b7663e4/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.h
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.h b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.h
index a9050e6..bc84c82 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.h
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsSession.h
@@ -419,6 +419,7 @@ public:
                                        
 		SessionWlStats							sessWlStats;
 public:
+        void sendSessionInfo(string, long long,long long);
         void start(struct collect_info  *setInit);
         void end();
         void accumulateStatistics(passSession *ps);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0b7663e4/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.cpp
----------------------------------------------------------------------
diff --git a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.cpp b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.cpp
index bbaf9b8..3293f54 100644
--- a/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.cpp
+++ b/core/conn/odbc/src/odbc/nsksrvrcore/ResStatisticsStatement.cpp
@@ -2392,7 +2392,7 @@ void ResStatisticsStatement::SendQueryStats(bool bStart, SRVR_STMT_HDL *pSrvrStm
 	pQuery_info->m_session_id = srvrGlobal->sessionId;
 	pQuery_info->m_client_name = srvrGlobal->ClientComputerName;
 	pQuery_info->m_application_name = srvrGlobal->ApplicationName;
-    UpdateStringText(pQuery_info->m_application_name);
+        UpdateStringText(pQuery_info->m_application_name);
 	pQuery_info->m_statement_id = statementId;
 	pQuery_info->m_statement_type = getStatementType(pSrvrStmt->sqlQueryType);
 	//SUBMIT_UTC_TS=EXEC_START_UTC_TS for now
@@ -2523,6 +2523,7 @@ void ResStatisticsStatement::SendQueryStats(bool bStart, SRVR_STMT_HDL *pSrvrStm
 	//pQuery_info->m_num_nodes = ;
 	pQuery_info->m_udr_process_busy_time = ProcessBusyTime;
 	pQuery_info->m_pertable_stats = perTableRowSize;
+        pQuery_info->m_last_updated_time = pQuery_info->m_last_updated_time;
 
 	if (!pubStarted)
 		sendQueryStats(PUB_TYPE_STATEMENT_NEW_QUERYEXECUTION, pQuery_info);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0b7663e4/core/sqf/sql/scripts/restcheck
----------------------------------------------------------------------
diff --git a/core/sqf/sql/scripts/restcheck b/core/sqf/sql/scripts/restcheck
index a49c730..f427d0b 100755
--- a/core/sqf/sql/scripts/restcheck
+++ b/core/sqf/sql/scripts/restcheck
@@ -62,7 +62,6 @@ if [[ $actual_restserver_cnt > 0 ]]; then
    echo "TrafodionRest is up on node: "$restserver_node",pid: "$restserver_pid
 fi
 
-echo
 echo -e "Process\t\tActual\t"
 echo -e "---------\t------\t"
 echo -e "TrafodionRest\t$actual_restserver_cnt\t"

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0b7663e4/core/sql/common/ComSmallDefs.h
----------------------------------------------------------------------
diff --git a/core/sql/common/ComSmallDefs.h b/core/sql/common/ComSmallDefs.h
index 19c7dde..74480e1 100644
--- a/core/sql/common/ComSmallDefs.h
+++ b/core/sql/common/ComSmallDefs.h
@@ -187,8 +187,8 @@ typedef NABoolean               ComBoolean;
 // length of explain_plan column in metric_query_table.
 // explain_plan greater than this length are chunked and store in multiple
 // rows in metric_text_table
-#define REPOS_MAX_EXPLAIN_PLAN_LEN 200000
-#define REPOS_MAX_EXPLAIN_PLAN_LEN_STR "200000"
+#define REPOS_MAX_EXPLAIN_PLAN_LEN 1000000
+#define REPOS_MAX_EXPLAIN_PLAN_LEN_STR "1000000"
 
 /******    *****/
 enum ComActivationTime { COM_UNKNOWN_TIME, COM_BEFORE , COM_AFTER };

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0b7663e4/core/sql/regress/seabase/EXPECTED011
----------------------------------------------------------------------
diff --git a/core/sql/regress/seabase/EXPECTED011 b/core/sql/regress/seabase/EXPECTED011
index 6f88f5a..83d1a68 100644
--- a/core/sql/regress/seabase/EXPECTED011
+++ b/core/sql/regress/seabase/EXPECTED011
@@ -1292,6 +1292,8 @@ METRIC_TEXT_TABLE
       DROPPABLE
   , QUERY_ID                         CHAR(160) CHARACTER SET ISO88591 COLLATE
       DEFAULT NO DEFAULT NOT NULL NOT DROPPABLE
+  , QUERY_SIGNATURE_ID               CHAR(160) CHARACTER SET ISO88591 COLLATE
+      DEFAULT DEFAULT NULL
   , USER_NAME                        CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
       DEFAULT DEFAULT NULL
   , ROLE_NAME                        CHAR(256 BYTES) CHARACTER SET UTF8 COLLATE
@@ -1398,7 +1400,7 @@ METRIC_TEXT_TABLE
       COLLATE DEFAULT DEFAULT NULL
   , QUERY_TEXT                       VARCHAR(50000 CHARS) CHARACTER SET UTF8
       COLLATE DEFAULT DEFAULT NULL
-  , EXPLAIN_PLAN                     VARCHAR(200000) CHARACTER SET ISO88591
+  , EXPLAIN_PLAN                     VARCHAR(1000000) CHARACTER SET ISO88591
       COLLATE DEFAULT DEFAULT NULL
   , LAST_ERROR_BEFORE_AQR            INT DEFAULT NULL
   , DELAY_TIME_BEFORE_AQR_SEC        LARGEINT DEFAULT NULL
@@ -1424,6 +1426,7 @@ METRIC_TEXT_TABLE
   , NUM_NODES                        LARGEINT DEFAULT NULL
   , UDR_PROCESS_BUSY_TIME            LARGEINT DEFAULT NULL
   , PERTABLE_STATS                   INT DEFAULT NULL
+  , LAST_UPDATED_TIME                TIMESTAMP(6) DEFAULT NULL
   , "_SALT_"                         INT UNSIGNED NO DEFAULT NOT NULL NOT
       DROPPABLE
   )
@@ -1661,9 +1664,7 @@ LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD
 --- SQL command prepared.
 >>store explain for explstmt4 in repository;
 
-*** ERROR[8033] Explain information is too large to be stored in repository.
-
---- SQL operation failed with errors.
+--- SQL operation complete.
 >>explain options 'f' explstmt4;
 
 LC   RC   OP   OPERATOR              OPT       DESCRIPTION           CARD

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0b7663e4/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp b/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
index 43fd8d3..89b2f8c 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
@@ -47,8 +47,17 @@ short CmpSeabaseDDL::createRepos(ExeCliInterface * cliInterface)
 
   NABoolean xnWasStartedHere = FALSE;
 
+  cliRC = cliInterface->holdAndSetCQD
+    ("TRAF_MAX_CHARACTER_COL_LENGTH", "1000000");
+
+  if (cliRC < 0)
+    {
+      cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
+      return -1;
+    }
+
   if (beginXnIfNotInProgress(cliInterface, xnWasStartedHere))
-    return -1;
+    goto label_error;
 
   // Create the _REPOS_ schema
   str_sprintf(queryBuf, "create schema %s.\"%s\" ; ",
@@ -66,7 +75,7 @@ short CmpSeabaseDDL::createRepos(ExeCliInterface * cliInterface)
     }
 
   if (endXnIfStartedHere(cliInterface, xnWasStartedHere, cliRC) < 0)
-    return -1;
+    goto label_error;
 
   for (Int32 i = 0; i < sizeof(allReposUpgradeInfo)/sizeof(MDUpgradeInfo); i++)
     {
@@ -100,7 +109,7 @@ short CmpSeabaseDDL::createRepos(ExeCliInterface * cliInterface)
       NADELETEBASIC(gluedQuery, STMTHEAP);
 
       if (beginXnIfNotInProgress(cliInterface, xnWasStartedHere))
-        return -1;
+        goto label_error;
       
       cliRC = cliInterface->executeImmediate(queryBuf);
       if (cliRC == -1390)  // table already exists
@@ -114,11 +123,16 @@ short CmpSeabaseDDL::createRepos(ExeCliInterface * cliInterface)
 	}
 
       if (endXnIfStartedHere(cliInterface, xnWasStartedHere, cliRC) < 0)
-        return -1;
+        goto label_error;
       
     } // for
   
+  cliRC = cliInterface->restoreCQD("TRAF_MAX_CHARACTER_COL_LENGTH");
   return 0;
+
+  label_error:
+   cliRC = cliInterface->restoreCQD("TRAF_MAX_CHARACTER_COL_LENGTH");
+   return -1;
 }
 
 short CmpSeabaseDDL::dropRepos(ExeCliInterface * cliInterface,

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/0b7663e4/core/sql/sqlcomp/CmpSeabaseDDLrepos.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLrepos.h b/core/sql/sqlcomp/CmpSeabaseDDLrepos.h
index c4c8da4..f546f2c 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLrepos.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDLrepos.h
@@ -53,6 +53,7 @@ static const QString createMetricQueryTable[] =
  {" process_name                           char(32) character set iso88591 casespecific default null serialized, "},
  {" exec_start_utc_ts                      timestamp(6) no default not null not droppable not serialized, "}, 
  {" query_id                               char("MAX_QUERY_ID_LEN_STR") character set iso88591 casespecific no default not null not droppable serialized, "},
+ {" query_signature_id                     char("MAX_QUERY_ID_LEN_STR") character set iso88591 casespecific default null serialized, "},
  {" user_name                              char(256 bytes) character set utf8 casespecific default null serialized, "},
  {" role_name                              char(256 bytes) character set utf8 casespecific default null serialized, "},
  {" start_priority                         integer unsigned default null serialized, "},
@@ -164,7 +165,8 @@ static const QString createMetricQueryTable[] =
  {" ovf_buffer_bytes_read                  largeint                          default null serialized, "},
  {" num_nodes                              largeint                          default null serialized, "},
  {" udr_process_busy_time                  largeint                          default null serialized, "},
- {" pertable_stats                         integer                           default null serialized "},
+ {" pertable_stats                         integer                           default null serialized, "},
+ {" last_updated_time                      timestamp(6)                      default null not serialized"},
  {" "},
  {" ) "},
  {" primary key ( exec_start_utc_ts, query_id ) salt using 8 partitions on ( query_id ) "},
@@ -200,6 +202,8 @@ static const QString createMetricSessionTable[] =
  {" client_name                            varchar(256) character set utf8 casespecific  default null serialized, "},
  {" client_user_name                       char(256 bytes)     character set utf8 casespecific  default null serialized, "},
  {" application_name                       char(130)     character set iso88591 casespecific  default null serialized, "},
+ {" profile_name                           varchar(130) character set utf8 casespecific  default null serialized, "},
+ {" sla_name                               varchar(130) character set utf8 casespecific  default null serialized, "},
  {" total_execution_time                   largeint                          default null serialized, "},
  {" total_elapsed_time                     largeint                          default null serialized, "},
  {" total_insert_stmts_executed            largeint                          default null serialized, "},
@@ -246,7 +250,7 @@ static const QString createMetricQueryAggrTable[] =
  {" sequence_number                        integer unsigned default null serialized, "},                 
  {" process_name                           char(32) character set iso88591 casespecific default null serialized, "},
  {" session_id                             char(108)     character set iso88591 casespecific no default not null not droppable serialized, "},
- {" session_start_utc_ts               timestamp(6) no default not null not droppable not serialized, "},
+ {" session_start_utc_ts                   timestamp(6) no default not null not droppable not serialized, "},
  {" aggregation_last_update_utc_ts         timestamp(6)                      default null not serialized, "},
  {" aggregation_last_elapsed_time          largeint                          default null serialized, "},
  {" user_id                                largeint                          default null serialized, "},
@@ -255,56 +259,49 @@ static const QString createMetricQueryAggrTable[] =
  {" client_name                            varchar(256) character set utf8 casespecific  default null serialized, "},
  {" client_user_name                       char(256 bytes)     character set utf8 casespecific  default null serialized, "},
  {" application_name                       char(130)     character set iso88591 casespecific  default null serialized, "},
- {" total_est_rows_accessed			   largeint default null serialized, "},
+ {" total_est_rows_accessed		   largeint default null serialized, "},
  {" total_est_rows_used			   largeint default null serialized, "},
- {" total_rows_retrieved			   largeint default null serialized, "},
+ {" total_rows_retrieved		   largeint default null serialized, "},
  {" total_num_rows_iud			   largeint default null serialized, "},
- {" total_selects			   	   largeint default null serialized, "},
+ {" total_selects			   largeint default null serialized, "},
  {" total_inserts			   largeint default null serialized, "},
  {" total_updates			   largeint default null serialized, "},
  {" total_deletes			   largeint default null serialized, "},
-
  {" total_ddl_stmts			   largeint default null serialized, "},
  {" total_util_stmts			   largeint default null serialized, "},
  {" total_catalog_stmts			   largeint default null serialized, "},
  {" total_other_stmts			   largeint default null serialized, "},
-
- {" total_insert_errors			          largeint default null serialized, "},
- {" total_delete_errors			          largeint default null serialized, "},
+ {" total_insert_errors			   largeint default null serialized, "},
+ {" total_delete_errors			   largeint default null serialized, "},
  {" total_update_errors			   largeint default null serialized, "},
  {" total_select_errors			   largeint default null serialized, "},
-
- {" total_ddl_errors			          largeint default null serialized, "},
- {" total_util_errors			          largeint default null serialized, "},
- {" total_catalog_errors			   largeint default null serialized, "},
+ {" total_ddl_errors			   largeint default null serialized, "},
+ {" total_util_errors			   largeint default null serialized, "},
+ {" total_catalog_errors		   largeint default null serialized, "},
  {" total_other_errors			   largeint default null serialized, "},
-
- {" delta_estimated_rows_accessed			   largeint default null serialized, "},
- {" delta_estimated_rows_used			   largeint default null serialized, "},
+ {" delta_estimated_rows_accessed	   largeint default null serialized, "},
+ {" delta_estimated_rows_used		   largeint default null serialized, "},
  {" delta_rows_accessed			   largeint default null serialized, "},
- {" delta_rows_retrieved			   largeint default null serialized, "},
+ {" delta_rows_retrieved	           largeint default null serialized, "},
  {" delta_num_rows_iud			   largeint default null serialized, "},
-
  {" delta_selects			   largeint default null serialized, "},
  {" delta_inserts			   largeint default null serialized, "},
  {" delta_updates			   largeint default null serialized, "},
  {" delta_deletes			   largeint default null serialized, "},
-
- {" delta_ddl_stmts			          largeint default null serialized, "},
- {" delta_util_stmts			          largeint default null serialized, "},
+ {" delta_ddl_stmts			   largeint default null serialized, "},
+ {" delta_util_stmts			   largeint default null serialized, "},
  {" delta_catalog_stmts			   largeint default null serialized, "},
  {" delta_other_stmts			   largeint default null serialized, "},
-
- {" delta_insert_errors			          largeint default null serialized, "},
- {" delta_delete_errors			          largeint default null serialized, "},
+ {" delta_insert_errors			   largeint default null serialized, "},
+ {" delta_delete_errors			   largeint default null serialized, "},
  {" delta_update_errors			   largeint default null serialized, "},
  {" delta_select_errors			   largeint default null serialized, "},
-
- {" delta_ddl_errors			          largeint default null serialized, "},
- {" delta_util_errors			          largeint default null serialized, "},
- {" delta_catalog_errors			   largeint default null serialized, "},
- {" delta_other_errors			   largeint default null serialized "},
-
+ {" delta_ddl_errors			   largeint default null serialized, "},
+ {" delta_util_errors			   largeint default null serialized, "},
+ {" delta_catalog_errors		   largeint default null serialized, "},
+ {" delta_other_errors			   largeint default null serialized, "},
+ {" average_response_time                  largeint default null serialized, "},
+ {" throughput_per_second                  largeint default null serialized "},
  {" ) "},
  {" primary key ( session_start_utc_ts, session_id ) salt using 8 partitions on ( session_id ) "},
  {" hbase_options ( DATA_BLOCK_ENCODING = 'FAST_DIFF', COMPRESSION = 'GZ' ) "},
@@ -318,7 +315,7 @@ static const QString createMetricTextTable[] =
   {
     {" create table %s.\"%s\"."REPOS_METRIC_TEXT_TABLE" "},
     {" ( "},
-    {"  query_id                               char("MAX_QUERY_ID_LEN_STR") character set iso88591 casespecific no default not null not droppable serialized, "},
+    {"  query_id     char("MAX_QUERY_ID_LEN_STR") character set iso88591 casespecific no default not null not droppable serialized, "},
     {"   text_type int not null serialized, "},
     {"   sub_id int not null serialized, "},
     {"   seq_num int not null serialized, "},



[14/16] incubator-trafodion git commit: Merge in latest origin/master

Posted by db...@apache.org.
Merge in latest origin/master


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

Branch: refs/heads/master
Commit: 301e22b367d81c6fdbe0e69a3bfba6b92555b6b7
Parents: 1cfc0ed ea20874
Author: Dave Birdsall <db...@apache.org>
Authored: Wed Jul 13 18:48:40 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Wed Jul 13 18:48:40 2016 +0000

----------------------------------------------------------------------
 core/conn/jdbcT4/pom.xml                        |    6 +
 .../trafodion/jdbc/t4/InterfaceResultSet.java   |   20 +-
 .../trafodion/jdbc/t4/InterfaceUtilities.java   |   11 +-
 .../trafodion/jdbc/t4/T4DatabaseMetaData.java   |    8 +-
 core/conn/jdbc_type2/Makefile                   |    2 +-
 core/conn/odb/Makefile                          |    2 +-
 core/conn/odb/src/odb.c                         |    7 +-
 .../odbc/src/odbc/nsksrvrcore/sqlinterface.cpp  |   41 +
 .../odbc/src/odbc/nsksrvrcore/srvrothers.cpp    |  277 ++-
 core/conn/trafci/.gitignore                     |    1 +
 .../sql/scripts/install_hadoop_regr_test_env    |  372 +++-
 core/sqf/sql/scripts/install_local_hadoop       |   33 +-
 core/sqf/sql/scripts/sqcheck                    |   68 +-
 .../hbase/client/transactional/TmDDL.java       |   65 +-
 .../transactional/TrxRegionEndpoint.java.tmpl   |    4 +-
 .../trafodion/dtm/HBaseAuditControlPoint.java   |  150 +-
 .../main/java/org/trafodion/dtm/HBaseTmZK.java  |   22 +-
 .../java/org/trafodion/dtm/HBaseTxClient.java   |  535 +++---
 .../java/org/trafodion/dtm/TmAuditTlog.java     |  332 +---
 .../main/java/org/trafodion/dtm/TrafInfo.java   |   12 +-
 core/sql/bin/SqlciErrors.txt                    |    8 +-
 core/sql/cli/Cli.cpp                            |   18 +-
 core/sql/cli/Cli.h                              |    3 +-
 core/sql/cli/CliExtern.cpp                      |    3 +-
 core/sql/cli/Context.cpp                        |   61 +-
 core/sql/cli/Context.h                          |   17 +-
 core/sql/cli/Descriptor.cpp                     |    8 +
 core/sql/cli/Statement.cpp                      |    4 +
 core/sql/cli/sqlcli.h                           |    5 +
 core/sql/common/BaseTypes.cpp                   |   37 +
 core/sql/common/BigNumHelper.cpp                |   27 +-
 core/sql/common/BigNumHelper.h                  |    6 +-
 core/sql/common/ComSmallDefs.h                  |   12 +-
 core/sql/common/ComSysUtils.h                   |   21 +
 core/sql/common/Int64.cpp                       |   20 +
 core/sql/common/Int64.h                         |   12 +
 core/sql/common/MiscType.cpp                    |  150 +-
 core/sql/common/MiscType.h                      |  112 +-
 core/sql/common/NAType.cpp                      |   12 +
 core/sql/common/NAType.h                        |    5 +
 core/sql/common/NumericType.cpp                 |  148 +-
 core/sql/common/NumericType.h                   |   54 +-
 core/sql/common/SQLTypeDefs.h                   |    3 +
 core/sql/common/dfs2rec.h                       |   16 +-
 core/sql/common/str.cpp                         |   40 +-
 core/sql/common/str.h                           |   12 +-
 core/sql/executor/ExExeUtil.h                   |    3 +-
 core/sql/executor/ExExeUtilCli.cpp              |    4 +-
 core/sql/executor/ExExeUtilGet.cpp              |    8 +-
 core/sql/executor/ExExeUtilLoad.cpp             |   49 +-
 core/sql/executor/ExExeUtilMisc.cpp             |    5 +-
 core/sql/executor/ExFastTransport.cpp           |    6 +-
 core/sql/executor/ExHbaseIUD.cpp                |   13 +-
 core/sql/executor/ExHdfsScan.cpp                |   56 +-
 core/sql/executor/ExHdfsScan.h                  |    1 -
 core/sql/executor/JavaObjectInterface.cpp       |    4 +-
 core/sql/executor/ex_globals.cpp                |   14 +-
 core/sql/executor/ex_globals.h                  |    4 +-
 core/sql/executor/ex_root.cpp                   |   13 +-
 core/sql/executor/ex_split_bottom.cpp           |    2 +-
 core/sql/exp/ExpError.cpp                       |   25 +
 core/sql/exp/ExpError.h                         |    5 +
 core/sql/exp/ExpErrorEnums.h                    |    1 +
 core/sql/exp/ExpLOB.cpp                         |  107 +-
 core/sql/exp/ExpLOB.h                           |   18 +-
 core/sql/exp/ExpLOBaccess.cpp                   |  115 +-
 core/sql/exp/ExpLOBaccess.h                     |   15 +-
 core/sql/exp/ExpLOBinterface.cpp                |  160 +-
 core/sql/exp/ExpLOBinterface.h                  |    4 +-
 core/sql/exp/ExpPCode.cpp                       |   68 +-
 core/sql/exp/ExpPCodeClauseGen.cpp              |  398 +++--
 core/sql/exp/ExpPCodeExpGen.cpp                 |    5 +-
 core/sql/exp/ExpPCodeInstruction.h              |   41 +-
 core/sql/exp/ExpPCodeOptimizations.cpp          |  103 +-
 core/sql/exp/ExpPCodeOptsConstProp.cpp          |    8 +-
 core/sql/exp/exp_arith.cpp                      |    6 +-
 core/sql/exp/exp_attrs.cpp                      |    3 +
 core/sql/exp/exp_bignum.cpp                     |   12 +-
 core/sql/exp/exp_clause.cpp                     |    3 +-
 core/sql/exp/exp_clause_derived.h               |   86 +-
 core/sql/exp/exp_comp.cpp                       |  151 +-
 core/sql/exp/exp_conv.cpp                       | 1033 +++++++++---
 core/sql/exp/exp_datetime.cpp                   |  178 +-
 core/sql/exp/exp_eval.cpp                       |  222 ++-
 core/sql/exp/exp_expr.cpp                       |    2 -
 core/sql/exp/exp_expr.h                         |   23 +-
 core/sql/exp/exp_fixup.cpp                      |  131 +-
 core/sql/exp/exp_function.cpp                   |   76 +-
 core/sql/exp/exp_math_func.cpp                  |   18 +-
 core/sql/generator/GenExpGenerator.cpp          |   97 +-
 core/sql/generator/GenExpGenerator.h            |    3 +
 core/sql/generator/GenItemExpr.cpp              |   19 +
 core/sql/generator/GenPreCode.cpp               |  152 +-
 core/sql/generator/GenRelJoin.cpp               |    7 +-
 core/sql/generator/GenRelMisc.cpp               |    3 -
 core/sql/generator/Generator.cpp                |   17 +-
 core/sql/generator/Generator.h                  |   21 -
 core/sql/optimizer/BindItemExpr.cpp             |   25 +
 core/sql/optimizer/BindRelExpr.cpp              |  105 +-
 core/sql/optimizer/ControlDB.cpp                |   10 +-
 core/sql/optimizer/EncodedValue.cpp             |    7 +
 core/sql/optimizer/HDFSHook.cpp                 |   31 +-
 core/sql/optimizer/ItemArith.h                  |   32 +
 core/sql/optimizer/ItemExpr.cpp                 |   49 +-
 core/sql/optimizer/NAColumn.cpp                 |   21 +
 core/sql/optimizer/NATable.cpp                  |   26 +
 core/sql/optimizer/NormItemExpr.cpp             |    2 +-
 core/sql/optimizer/OptRange.cpp                 |   24 +-
 core/sql/optimizer/RelExeUtil.cpp               |    6 +
 core/sql/optimizer/SynthType.cpp                |   70 +-
 core/sql/optimizer/UdfDllInteraction.cpp        |   23 +
 core/sql/optimizer/ValueDesc.cpp                |   34 +-
 core/sql/parser/ParKeyWords.cpp                 |    2 +-
 core/sql/parser/SqlParserAux.cpp                |   28 +-
 core/sql/parser/StmtDDLCreate.cpp               |    1 +
 core/sql/parser/sqlparser.y                     |   67 +-
 core/sql/parser/ulexer.cpp                      |    3 +-
 core/sql/regress/compGeneral/EXPECTED042        |   22 +-
 core/sql/regress/compGeneral/EXPECTED071        |    4 +-
 core/sql/regress/core/EXPECTED037.SB            |    4 +-
 core/sql/regress/core/EXPECTED038.LINUX         |   24 +-
 core/sql/regress/core/TEST037                   |    2 +-
 core/sql/regress/executor/EXPECTED002.SB        |   68 +-
 core/sql/regress/executor/EXPECTED012           |   36 +-
 core/sql/regress/executor/EXPECTED022.SB        |  168 +-
 core/sql/regress/executor/EXPECTED050           |    4 +-
 core/sql/regress/executor/EXPECTED063           |  166 +-
 core/sql/regress/executor/EXPECTED140           |   60 +-
 core/sql/regress/executor/TEST012               |   15 +-
 core/sql/regress/hive/EXPECTED005               |   26 +-
 core/sql/regress/hive/EXPECTED009               |   16 +-
 core/sql/regress/hive/EXPECTED015               |   60 +-
 core/sql/regress/hive/EXPECTED018               |  198 +--
 core/sql/regress/hive/TEST005                   |    2 +-
 core/sql/regress/hive/TEST009                   |    2 +-
 core/sql/regress/hive/TEST018                   |   22 +-
 core/sql/regress/qat/eqatdml12                  |   98 +-
 core/sql/regress/qat/eqatdml13                  |   98 +-
 core/sql/regress/seabase/EXPECTED003            | 1583 +++++++++++++++++-
 core/sql/regress/seabase/EXPECTED010            |  378 ++---
 core/sql/regress/seabase/EXPECTED020            |    8 +-
 core/sql/regress/seabase/EXPECTED030            |    6 +-
 core/sql/regress/seabase/TEST003                |  251 ++-
 core/sql/regress/tools/regrhive.ksh             |    2 +-
 core/sql/regress/udr/EXPECTED001                |   30 +-
 core/sql/regress/udr/TEST001                    |    7 +
 core/sql/sqlci/Formatter.cpp                    |   10 +
 core/sql/sqlci/Param.cpp                        |    2 +
 core/sql/sqlci/SqlciEnv.cpp                     |   11 +-
 core/sql/sqlci/SqlciEnv.h                       |    2 +-
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp        |    9 +-
 core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp       |    2 +-
 core/sql/sqlcomp/CmpSeabaseDDLutil.cpp          |    2 +
 core/sql/sqlcomp/DefaultConstants.h             |   17 +
 core/sql/sqlcomp/nadefaults.cpp                 |    9 +
 .../java/org/trafodion/sql/HBaseClient.java     |   14 +-
 .../java/org/trafodion/sql/HBulkLoadClient.java |   31 +-
 .../java/org/trafodion/sql/HTableClient.java    |   21 +-
 .../java/org/trafodion/sql/OrcFileReader.java   |   52 +-
 .../org/trafodion/sql/SequenceFileWriter.java   |   75 +-
 core/sql/ustat/hs_cli.cpp                       |    9 +
 core/sql/ustat/hs_faststats.cpp                 |    9 +-
 core/sql/ustat/hs_globals.cpp                   |   34 +
 docs/client_install/pom.xml                     |    1 +
 docs/command_interface/pom.xml                  |    1 +
 docs/cqd_reference/pom.xml                      |    1 +
 docs/jdbct4ref_guide/pom.xml                    |    1 +
 docs/load_transform/pom.xml                     |    1 +
 docs/messages_guide/pom.xml                     |    1 +
 docs/odb_user/pom.xml                           |    1 +
 docs/provisioning_guide/pom.xml                 |    1 +
 .../src/asciidoc/_chapters/about.adoc           |    6 +-
 .../src/asciidoc/_chapters/activate.adoc        |    1 +
 .../src/asciidoc/_chapters/enable_security.adoc |  251 +--
 .../src/asciidoc/_chapters/introduction.adoc    |  142 +-
 .../src/asciidoc/_chapters/prepare.adoc         |   84 +-
 .../src/asciidoc/_chapters/quickstart.adoc      |  597 +++++++
 .../src/asciidoc/_chapters/requirements.adoc    |   38 +-
 .../src/asciidoc/_chapters/script_install.adoc  |  376 ++---
 .../src/asciidoc/_chapters/script_upgrade.adoc  |  266 ++-
 docs/provisioning_guide/src/asciidoc/index.adoc |    1 +
 docs/shared/license.txt                         |    5 +
 docs/shared/revisions.txt                       |    3 +-
 docs/spj_guide/pom.xml                          |    1 +
 docs/sql_reference/pom.xml                      |    1 +
 .../src/asciidoc/_chapters/sql_statements.adoc  |   14 +-
 docs/src/site/markdown/download.md              |   24 +-
 docs/src/site/markdown/index.md                 |    8 +-
 docs/src/site/markdown/release-notes-2-0-1.md   |   10 +-
 docs/src/site/resources/css/site.css            |    1 +
 docs/src/site/site.xml                          |   12 +-
 install/Makefile                                |    2 +-
 install/installer/traf_apache_mods              |    7 +
 install/installer/traf_cloudera_mods            |   32 +-
 install/installer/traf_hortonworks_mods         |    8 +
 195 files changed, 8889 insertions(+), 3544 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/301e22b3/core/sql/common/ComSmallDefs.h
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/301e22b3/core/sql/parser/ParKeyWords.cpp
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/301e22b3/core/sql/parser/sqlparser.y
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/301e22b3/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/301e22b3/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
----------------------------------------------------------------------


[11/16] incubator-trafodion git commit: Upgrade repository code changes

Posted by db...@apache.org.
Upgrade repository code changes


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

Branch: refs/heads/master
Commit: ff89586c6ce2f4a769f56f439950a735c2556823
Parents: 548f729
Author: Dave Birdsall <db...@apache.org>
Authored: Tue Jun 28 20:36:25 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Tue Jun 28 20:36:25 2016 +0000

----------------------------------------------------------------------
 core/sql/common/ComSmallDefs.h           |   3 +
 core/sql/regress/compGeneral/EXPECTED042 |  32 +-
 core/sql/sqlcomp/CmpSeabaseDDLmd.h       |   4 +-
 core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp  |  56 ++-
 core/sql/sqlcomp/CmpSeabaseDDLrepos.h    | 483 ++++++++++++++++++++++++--
 5 files changed, 524 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ff89586c/core/sql/common/ComSmallDefs.h
----------------------------------------------------------------------
diff --git a/core/sql/common/ComSmallDefs.h b/core/sql/common/ComSmallDefs.h
index 5aa5d57..3b10b16 100644
--- a/core/sql/common/ComSmallDefs.h
+++ b/core/sql/common/ComSmallDefs.h
@@ -188,6 +188,9 @@ typedef NABoolean               ComBoolean;
 // length of explain_plan column in metric_query_table.
 // explain_plan greater than this length are chunked and store in multiple
 // rows in metric_text_table
+// Note: This symbol is used in the DDL for the Repository tables.
+// If you change it, consider whether the Repository tables will need
+// an upgrade. See file sqlcomp/CmpSeabaseDDLrepos.h.
 #define REPOS_MAX_EXPLAIN_PLAN_LEN 1000000
 #define REPOS_MAX_EXPLAIN_PLAN_LEN_STR "1000000"
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ff89586c/core/sql/regress/compGeneral/EXPECTED042
----------------------------------------------------------------------
diff --git a/core/sql/regress/compGeneral/EXPECTED042 b/core/sql/regress/compGeneral/EXPECTED042
index 55fb89e..f8eebdd 100644
--- a/core/sql/regress/compGeneral/EXPECTED042
+++ b/core/sql/regress/compGeneral/EXPECTED042
@@ -1,9 +1,9 @@
 >>showstats for table t042_orderline on ol_o_id detail;
 
 Detailed Histogram data for Table TRAFODION.ORDERENTRY.T042_ORDERLINE
-Table ID: 2761910211648663657
+Table ID: 7880838154057526438
 
-Hist ID:    1309682661
+Hist ID:    1934502880
 Column(s):  OL_O_ID
 Total Rows: 10
 Total UEC:  4
@@ -1788,15 +1788,19 @@ HQC key=SELECT T . VARCHAR0_UNIQ AS T_VARCHAR0_UNIQ , T . CHAR2_2 AS T_CHAR2_2 ,
 >>
 >>-- test compile time
 >>
+>>sh more /proc/loadavg  | cut -d' ' -f 1-3 | sed -e 's/^/System load: /' >> LOG042;
+System load: 0.87 0.49 0.33
+>>sh grep "model name" /proc/cpuinfo | head -1 | cut -d '@' -f 2 | sed -e 's/^/CPU frequency: /' >> LOG042;
+CPU frequency: model name	: Intel Core Processor (Haswell)
 >>set statistics on;
 >>prepare xx from select * from t042_orderline where ol_o_id = 1 ;
 
 --- SQL command prepared.
 
-Start Time             2015/09/24 16:38:19.189001
-End Time               2015/09/24 16:38:19.191810
-Elapsed Time                      00:00:00.002809
-Compile Time                      00:00:00.002809
+Start Time             2016/06/28 15:43:44.041291
+End Time               2016/06/28 15:43:44.043414
+Elapsed Time                      00:00:00.002123
+Compile Time                      00:00:00.002123
 Execution Time                    00:00:00.000000
 
 
@@ -1827,10 +1831,10 @@ HQC key=SELECT * FROM T042_ORDERLINE WHERE OL_O_ID = #NP# ;
 
 --- SQL command prepared.
 
-Start Time             2015/09/24 16:38:19.332484
-End Time               2015/09/24 16:38:19.335346
-Elapsed Time                      00:00:00.002862
-Compile Time                      00:00:00.002862
+Start Time             2016/06/28 15:43:44.260898
+End Time               2016/06/28 15:43:44.263812
+Elapsed Time                      00:00:00.002914
+Compile Time                      00:00:00.002914
 Execution Time                    00:00:00.000000
 
 
@@ -2218,9 +2222,9 @@ NUM_HKEYS   NUM_SKEYS   NUM_MAX_VALUES_PER_KEY  NUM_HASH_TABLE_BUCKETS
 ----------  ----------  -------------  --------------
 
        134           0              1               0
-       134           0              1               0
-       134           1              1               0
        134           1              1               0
+       142           0              1               0
+       142           1              1               0
        150           2              3               0
        150           3              3               0
        187           0              4               0
@@ -2312,9 +2316,9 @@ NUM_HKEYS   NUM_SKEYS   NUM_MAX_VALUES_PER_KEY  NUM_HASH_TABLE_BUCKETS
         90           0              0               3
         98           1              1               0
        134           0              1               0
-       134           0              1               0
-       134           1              1               0
        134           1              1               0
+       142           0              1               0
+       142           1              1               0
        150           2              3               0
        150           3              3               0
        187           0              4               0

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ff89586c/core/sql/sqlcomp/CmpSeabaseDDLmd.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLmd.h b/core/sql/sqlcomp/CmpSeabaseDDLmd.h
index 41a1499..83d72c5 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLmd.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDLmd.h
@@ -65,8 +65,8 @@ public:
 ///////////////////////////////////////////////////////////////////////////////
 // *** Current Definition ***
 //
-// Current metadata tables definition for Metadata Version 2.3
-//  (Major version = 2, Minor version = 3)
+// Current metadata tables definition for Metadata Version 2.1
+//  (Major version = 2, Minor version = 1)
 ///////////////////////////////////////////////////////////////////////////////
 
 static const QString seabaseAuthsDDL[] =

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ff89586c/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp b/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
index 89b2f8c..bc39c8d 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
@@ -140,7 +140,7 @@ short CmpSeabaseDDL::dropRepos(ExeCliInterface * cliInterface,
                                NABoolean dropSchema)
 {
   Lng32 cliRC = 0;
-
+  NABoolean xnWasStartedHere = FALSE;
   char queryBuf[1000];
 
   for (Int32 i = 0; i < sizeof(allReposUpgradeInfo)/sizeof(MDUpgradeInfo); i++)
@@ -153,18 +153,34 @@ short CmpSeabaseDDL::dropRepos(ExeCliInterface * cliInterface,
       str_sprintf(queryBuf, "drop table %s.\"%s\".%s cascade; ",
                   getSystemCatalog(), SEABASE_REPOS_SCHEMA,
                   (oldRepos ? rti.oldName : rti.newName));
-      
+    
+      if (beginXnIfNotInProgress(cliInterface, xnWasStartedHere))
+        {
+          cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
+          return -1;
+        }    
+
       cliRC = cliInterface->executeImmediate(queryBuf);
-      if (cliRC == -1389)  // table doesnt exist
+      if (cliRC == -1389)  // table doesn't exist
 	{
 	  // ignore the error.
-          //          CmpCommon::diags()->clear();
+          cliRC = 0;
 	}
       else if (cliRC < 0)
-	{
-	  cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
-	  return -1;
-	}
+        {
+          cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
+        }
+ 
+      if (endXnIfStartedHere(cliInterface, xnWasStartedHere, cliRC) < 0)
+        {
+          cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
+          return -1;
+        }
+ 
+      if (cliRC < 0)
+        {
+          return -1;  
+        }
 
     }
 
@@ -173,16 +189,34 @@ short CmpSeabaseDDL::dropRepos(ExeCliInterface * cliInterface,
       // Drop the _REPOS_ schema
       str_sprintf(queryBuf, "drop schema %s.\"%s\" cascade; ",
                   getSystemCatalog(),SEABASE_REPOS_SCHEMA);
+
+      if (beginXnIfNotInProgress(cliInterface, xnWasStartedHere))
+        {
+          cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
+          return -1;
+        } 
+
       cliRC = cliInterface->executeImmediate(queryBuf);
       if (cliRC == -1003)  // schema doesnt exist
         {
           // ignore the error.
+          cliRC = 0;
         }
       else if (cliRC < 0)
         {
           cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
+        }
+
+      if (endXnIfStartedHere(cliInterface, xnWasStartedHere, cliRC) < 0)
+        {
+          cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
           return -1;
         }
+ 
+      if (cliRC < 0)
+        {
+          return -1;  
+        }
     }
 
   return 0;
@@ -306,10 +340,10 @@ short CmpSeabaseDDL::copyOldReposToNew(ExeCliInterface * cliInterface)
 
       cliRC = cliInterface->executeImmediate(queryBuf);
       if (cliRC < 0)
-	{
-	  cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
+        {
+          cliInterface->retrieveSQLDiagnostics(CmpCommon::diags());
           return -1;
-	}
+        }
 
     } // for
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/ff89586c/core/sql/sqlcomp/CmpSeabaseDDLrepos.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLrepos.h b/core/sql/sqlcomp/CmpSeabaseDDLrepos.h
index f546f2c..a7df12f 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLrepos.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDLrepos.h
@@ -33,6 +33,13 @@
 
 #define TRAF_METRIC_QUERY_VIEW "METRIC_QUERY_VIEW"
 
+///////////////////////////////////////////////////////////////////////////////
+// *** Current Definition ***
+//
+// Current repository tables definition for Metadata Version 2.1
+//  (Major version = 2, Minor version = 1)
+///////////////////////////////////////////////////////////////////////////////
+
 //----------------------------------------------------------------
 //-- METRIC_QUERY_TABLE
 //----------------------------------------------------------------
@@ -326,11 +333,332 @@ static const QString createMetricTextTable[] =
     {" ; "}
   };
 
+
+/////////////////////////////////////////////////////////////////////
+//
+// Information about changed old metadata tables from which upgrade
+// is being done to the current version.
+// These definitions have changed in the current version of code.
+// 
+// Old definitions have the form (for ex for METRIC_QUERY_TABLE table):
+//            createOldTrafv??MetricQueryTable[]
+// v?? is the old version.
+//
+// When definitions change, make new entries between
+// START_OLD_MD_v?? and END_OLD_MD_v??.
+// Do not remove older entries. We want to keep them around for
+// historical purpose.
+//
+// Change entries in allReposUpgradeInfo[] struct in this file
+// to reflect the 'old' repository tables.
+//
+//////////////////////////////////////////////////////////////////////
+
 #define TRAF_METRIC_QUERY_TABLE_OLD_REPOS REPOS_METRIC_QUERY_TABLE"_OLD_REPOS"
 #define TRAF_METRIC_SESSION_TABLE_OLD_REPOS REPOS_METRIC_SESSION_TABLE"_OLD_REPOS"
 #define TRAF_METRIC_QUERY_AGGR_TABLE_OLD_REPOS REPOS_METRIC_QUERY_AGGR_TABLE"_OLD_REPOS"
 
-static const QString createOldReposMetricQueryTable[] =
+//----------------------------------------------------------------
+//-- METRIC_QUERY_TABLE
+//----------------------------------------------------------------
+static const QString createOldTrafv11MetricQueryTable[] =
+{
+{" create table %s.\"%s\"."TRAF_METRIC_QUERY_TABLE_OLD_REPOS" "},
+ {" ( "},
+ {" instance_id                            integer unsigned no default not null not droppable serialized, "},
+ {" tenant_id                              integer unsigned no default not null not droppable serialized, "},
+ {" component_id                           integer unsigned default null serialized, "},
+ {" process_id                             integer default null serialized, "},
+ {" thread_id                              integer unsigned default null serialized, "},
+ {" node_id                                integer unsigned default null serialized, "},   
+ {" pnid_id                                integer unsigned default null serialized, "}, 
+ {" host_id                                integer unsigned no default not null not droppable serialized, "},
+ {" ip_address_id                          char(32) character set iso88591 casespecific default null serialized, "}, 
+ {" sequence_number                        integer unsigned default null serialized, "},             
+ {" process_name                           char(32) character set iso88591 casespecific default null serialized, "},
+ {" exec_start_utc_ts                      timestamp(6) no default not null not droppable not serialized, "}, 
+ {" query_id                               char("MAX_QUERY_ID_LEN_STR") character set iso88591 casespecific no default not null not droppable serialized, "},
+ {" user_name                              char(256 bytes) character set utf8 casespecific default null serialized, "},
+ {" role_name                              char(256 bytes) character set utf8 casespecific default null serialized, "},
+ {" start_priority                         integer unsigned default null serialized, "},
+ {" master_process_id                      char(64) character set iso88591 casespecific       default null serialized, "},
+ {" session_id                             char(108) character set iso88591 casespecific      default null serialized, "},
+ {" client_name                            varchar(1024) character set iso88591 casespecific  default null serialized, "},
+ {" application_name                       char(130) character set iso88591 casespecific      default null serialized, "},
+ {" statement_id                           char("MAX_QUERY_ID_LEN_STR") character set iso88591 casespecific      default null serialized, "},
+ {" statement_type                         char(36) character set iso88591 casespecific       default null serialized, "},
+ {" statement_subtype                      char(36) character set iso88591 casespecific       default null serialized, "},
+ {" submit_utc_ts				   timestamp(6) default null not serialized, "},
+ {" compile_start_utc_ts			   timestamp(6) default null not serialized, "},
+ {" compile_end_utc_ts			   timestamp(6) default null not serialized, "},
+ {" compile_elapsed_time			   largeint default null serialized, "},
+ {" cmp_affinity_num				   largeint default null serialized, "},
+ {" cmp_dop					   largeint default null serialized, "},
+ {" cmp_txn_needed				   largeint default null serialized, "},
+ {" cmp_mandatory_x_prod			   largeint default null serialized, "},
+ {" cmp_missing_stats				   largeint default null serialized, "},
+ {" cmp_num_joins				   largeint default null serialized, "},
+ {" cmp_full_scan_on_table			   largeint default null serialized, "},
+ {" cmp_rows_accessed_full_scan		   double precision default null not serialized, "},
+ {" est_accessed_rows       		   double precision default null not serialized, "}, 
+ {" est_used_rows				   double precision default null not serialized, "}, 
+ {" cmp_compiler_id				   char(28) character set iso88591 casespecific default null serialized, "},
+ {" cmp_cpu_path_length			   largeint default null serialized, "},
+ {" cmp_cpu_binder				   largeint default null serialized, "},
+ {" cmp_cpu_normalizer			   largeint default null serialized, "},
+ {" cmp_cpu_analyzer				   largeint default null serialized, "},
+ {" cmp_cpu_optimizer				   largeint default null serialized, "},
+ {" cmp_cpu_generator				   largeint default null serialized, "},
+ {" cmp_metadata_cache_hits			   largeint default null serialized, "},
+ {" cmp_metadata_cache_lookups		   largeint default null serialized, "},
+ {" cmp_query_cache_status	largeint                    default null serialized, "},
+ {" cmp_histogram_cache_hits	largeint                default null serialized, "},
+ {" cmp_histogram_cache_lookups	largeint                default null serialized, "},
+ {" cmp_stmt_heap_size	largeint                        default null serialized, "},
+ {" cmp_context_heap_size	largeint                    default null serialized, "},
+ {" cmp_optimization_tasks	largeint                    default null serialized, "},
+ {" cmp_optimization_contexts	largeint                default null serialized, "},
+ {" cmp_is_recompile	smallint                        default null serialized, "},
+ {" est_num_seq_ios	double precision                  	default null not serialized, "},
+ {" est_num_rand_ios	double precision                default null not serialized, "},
+ {" est_cost	double precision                  		default null not serialized, "},
+ {" est_cardinality	double precision                  	default null not serialized, "},
+ {" est_io_time	double precision                  		default null not serialized, "},
+ {" est_msg_time	double precision                  	default null not serialized, "},
+ {" est_idle_time	double precision                  	default null not serialized, "},
+ {" est_cpu_time	double precision                  	default null not serialized, "},
+ {" est_total_time	double precision                  	default null not serialized, "},
+ {" est_total_mem	double precision                  	default null not serialized, "},
+ {" est_resource_usage	largeint                        default null serialized, "},
+ {" aggregate_option	char(3)   character set iso88591 casespecific    	default null serialized, "},
+ {" cmp_number_of_bmos	integer                         default null serialized, "},
+ {" cmp_overflow_mode	char(10) character set iso88591 casespecific      	default null serialized, "},
+ {" cmp_overflow_size	largeint                        default null serialized, "},
+ {" aggregate_total     largeint                        default null serialized, "},
+ {" stats_error_code                       integer                           default null serialized, "},
+ {" query_elapsed_time                     largeint                          default null serialized, "},
+ {" sql_process_busy_time                  largeint                          default null serialized, "},
+ {" disk_process_busy_time                 largeint                          default null serialized, "},
+ {" disk_ios                               largeint                          default null serialized, "},
+ {" num_sql_processes                      largeint                          default null serialized, "},
+ {" sql_space_allocated                    largeint                          default null serialized, "},
+ {" sql_space_used                         largeint                          default null serialized, "},
+ {" sql_heap_allocated                     largeint                          default null serialized, "},
+ {" sql_heap_used                          largeint                          default null serialized, "},
+ {" total_mem_alloc                        largeint                          default null serialized, "},
+ {" max_mem_used                           largeint                          default null serialized, "},
+ {" transaction_id                         char(25) character set iso88591 casespecific       default null serialized, "},
+ {" num_request_msgs                       largeint                          default null serialized, "},
+ {" num_request_msg_bytes                  largeint                          default null serialized, "},
+ {" num_reply_msgs                         largeint                          default null serialized, "},
+ {" num_reply_msg_bytes                    largeint                          default null serialized, "},
+ {" first_result_return_utc_ts             timestamp(6)                      default null not serialized, "},
+ {" rows_returned_to_master                largeint                          default null serialized, "},
+ {" parent_query_id                        char("MAX_QUERY_ID_LEN_STR") character set iso88591 casespecific      default null serialized, "},
+ {" parent_system_name                     char(128) character set iso88591 casespecific      default null serialized, "},
+ {" exec_end_utc_ts                        timestamp(6)                      default null not serialized, "},
+ {" master_execution_time                  largeint                          default null serialized, "},
+ {" master_elapsed_time                    largeint                          default null serialized, "},
+{" query_status                            char(21) character set utf8 casespecific default null serialized, "},
+ {" query_sub_status                       char(30) character set utf8 casespecific default null serialized, "},
+ {" error_code                             integer                           default null serialized, "},
+ {" sql_error_code                         integer                           default null serialized, "},
+ {" error_text                             varchar(2000) character set utf8 casespecific default null serialized, "},
+ {" query_text                             varchar(50000) character set utf8 casespecific default null serialized, "},
+ {" explain_plan                           varchar(200000) character set iso88591 casespecific default null serialized, "},
+ {" last_error_before_aqr                  integer                           default null serialized, "},
+ {" delay_time_before_aqr_sec              largeint                          default null serialized, "},
+ {" total_num_aqr_retries                  largeint                          default null serialized, "},
+ {" msg_bytes_to_disk                      largeint                          default null serialized, "},
+ {" msgs_to_disk                           largeint                          default null serialized, "},
+ {" rows_accessed                          largeint                          default null serialized, "},
+ {" rows_retrieved                         largeint                          default null serialized, "},
+ {" num_rows_iud                           largeint                          default null serialized, "},
+ {" processes_created                      largeint                          default null serialized, "},
+ {" process_create_busy_time               largeint                          default null serialized, "},
+ {" ovf_file_count                         largeint                          default null serialized, "},
+ {" ovf_space_allocated                    largeint                          default null serialized, "},
+ {" ovf_space_used                         largeint                          default null serialized, "},
+ {" ovf_block_size                         largeint                          default null serialized, "},
+ {" ovf_write_read_count                   largeint                          default null serialized, "},
+ {" ovf_write_count                        largeint                          default null serialized, "},
+ {" ovf_buffer_blocks_written              largeint                          default null serialized, "},
+ {" ovf_buffer_bytes_written               largeint                          default null serialized, "},
+ {" ovf_read_count                         largeint                          default null serialized, "},
+ {" ovf_buffer_blocks_read                 largeint                          default null serialized, "},
+ {" ovf_buffer_bytes_read                  largeint                          default null serialized, "},
+ {" num_nodes                              largeint                          default null serialized, "},
+ {" udr_process_busy_time                  largeint                          default null serialized, "},
+ {" pertable_stats                         integer                           default null serialized "},
+ {" "},
+ {" ) "},
+ {" primary key ( exec_start_utc_ts, query_id ) salt using 8 partitions on ( query_id ) "},
+ {" hbase_options ( DATA_BLOCK_ENCODING = 'FAST_DIFF', COMPRESSION = 'GZ' ) "},
+ {" ; "}
+ };
+
+//----------------------------------------------------------------
+// -- METRIC_SESSION_TABLE
+// ----------------------------------------------------------------
+static const QString createOldTrafv11MetricSessionTable[] =
+{
+ {" create table %s.\"%s\"."TRAF_METRIC_SESSION_TABLE_OLD_REPOS"  "},
+ {" ( "},
+ {" instance_id                            integer unsigned no default not null not droppable serialized, "},
+ {" tenant_id                              integer unsigned no default not null not droppable serialized, "},
+ {" component_id                           integer unsigned default null serialized, "},
+ {" process_id                             integer default null serialized, "},
+ {" thread_id                              integer unsigned default null serialized, "},
+ {" node_id                                integer unsigned default null serialized, "},   
+ {" pnid_id                                integer unsigned default null serialized, "}, 
+ {" host_id                                integer unsigned no default not null not droppable serialized, "},
+ {" ip_address_id                          char(32) character set iso88591 casespecific default null serialized, "}, 
+ {" sequence_number                        integer unsigned default null serialized, "},                 
+ {" process_name                           char(32) character set iso88591 casespecific default null serialized, "},
+ {" session_id                             char(108)     character set iso88591 casespecific no default not null not droppable serialized, "},
+ {" session_status                         char(5)       character set iso88591 casespecific  default null serialized, "},
+ {" session_start_utc_ts               timestamp(6) no default not null not droppable not serialized, "},
+ {" session_end_utc_ts                     timestamp(6)                      default null not serialized, "},
+ {" user_id                                largeint                          default null serialized, "},
+ {" user_name                              char(256 bytes)     character set utf8 casespecific  default null serialized, "},
+ {" role_name                              char(256 bytes)     character set utf8 casespecific  default null serialized, "},
+ {" client_name                            varchar(256) character set utf8 casespecific  default null serialized, "},
+ {" client_user_name                       char(256 bytes)     character set utf8 casespecific  default null serialized, "},
+ {" application_name                       char(130)     character set iso88591 casespecific  default null serialized, "},
+ {" total_execution_time                   largeint                          default null serialized, "},
+ {" total_elapsed_time                     largeint                          default null serialized, "},
+ {" total_insert_stmts_executed            largeint                          default null serialized, "},
+ {" total_delete_stmts_executed            largeint                          default null serialized, "},
+ {" total_update_stmts_executed            largeint                          default null serialized, "},
+ {" total_select_stmts_executed            largeint                          default null serialized, "},
+ {" total_catalog_stmts                    largeint                          default null serialized, "},     
+ {" total_prepares                         largeint                          default null serialized, "},
+ {" total_executes                         largeint                          default null serialized, "},
+ {" total_fetches                          largeint                          default null serialized, "},
+ {" total_closes                           largeint                          default null serialized, "},
+ {" total_execdirects                      largeint                          default null serialized, "},
+ {" total_errors                           largeint                          default null serialized, "},
+ {" total_warnings                         largeint                          default null serialized, "},
+ {" total_login_elapsed_time_mcsec         largeint                          default null serialized, "},
+ {" ldap_login_elapsed_time_mcsec          largeint                          default null serialized, "},
+ {" sql_user_elapsed_time_mcsec            largeint                          default null serialized, "},
+ {" search_connection_elapsed_time_mcsec   largeint                          default null serialized, "},
+ {" search_elapsed_time_mcsec              largeint                          default null serialized, "},
+ {" authentication_connection_elapsed_time_mcsec     largeint                default null serialized, "},
+ {" authentication_elapsed_time_mcsec      largeint                          default null serialized "},
+ {" ) "},
+{" primary key (session_start_utc_ts, session_id ) salt using 8 partitions on ( session_id ) "},
+ {" hbase_options ( DATA_BLOCK_ENCODING = 'FAST_DIFF', COMPRESSION = 'GZ' ) "},
+ {" ; "},
+ };
+
+ //----------------------------------------------------------------
+ //- METRIC_QUERY_AGGREGATION_TABLE
+ //----------------------------------------------------------------
+static const QString createOldTrafv11MetricQueryAggrTable[] =
+{
+ {" create table %s.\"%s\"."TRAF_METRIC_QUERY_AGGR_TABLE_OLD_REPOS"  "},
+ {" ( "},
+ {" instance_id                            integer unsigned no default not null not droppable serialized, "},
+ {" tenant_id                              integer unsigned no default not null not droppable serialized, "},
+ {" component_id                           integer unsigned default null serialized, "},
+ {" process_id                             integer default null serialized, "},
+ {" thread_id                              integer unsigned default null serialized, "},
+ {" node_id                                integer unsigned default null serialized, "},   
+ {" pnid_id                                integer unsigned default null serialized, "}, 
+ {" host_id                                integer unsigned no default not null not droppable serialized, "},
+ {" ip_address_id                          char(32) character set iso88591 casespecific default null serialized, "}, 
+ {" sequence_number                        integer unsigned default null serialized, "},                 
+ {" process_name                           char(32) character set iso88591 casespecific default null serialized, "},
+ {" session_id                             char(108)     character set iso88591 casespecific no default not null not droppable serialized, "},
+ {" session_start_utc_ts               timestamp(6) no default not null not droppable not serialized, "},
+ {" aggregation_last_update_utc_ts         timestamp(6)                      default null not serialized, "},
+ {" aggregation_last_elapsed_time          largeint                          default null serialized, "},
+ {" user_id                                largeint                          default null serialized, "},
+ {" user_name                              char(256 bytes)     character set utf8 casespecific  default null serialized, "},
+ {" role_name                              char(256 bytes)     character set utf8 casespecific  default null serialized, "},
+ {" client_name                            varchar(256) character set utf8 casespecific  default null serialized, "},
+ {" client_user_name                       char(256 bytes)     character set utf8 casespecific  default null serialized, "},
+ {" application_name                       char(130)     character set iso88591 casespecific  default null serialized, "},
+ {" total_est_rows_accessed			   largeint default null serialized, "},
+ {" total_est_rows_used			   largeint default null serialized, "},
+ {" total_rows_retrieved			   largeint default null serialized, "},
+ {" total_num_rows_iud			   largeint default null serialized, "},
+ {" total_selects			   	   largeint default null serialized, "},
+ {" total_inserts			   largeint default null serialized, "},
+ {" total_updates			   largeint default null serialized, "},
+ {" total_deletes			   largeint default null serialized, "},
+
+ {" total_ddl_stmts			   largeint default null serialized, "},
+ {" total_util_stmts			   largeint default null serialized, "},
+ {" total_catalog_stmts			   largeint default null serialized, "},
+ {" total_other_stmts			   largeint default null serialized, "},
+
+ {" total_insert_errors			          largeint default null serialized, "},
+ {" total_delete_errors			          largeint default null serialized, "},
+ {" total_update_errors			   largeint default null serialized, "},
+ {" total_select_errors			   largeint default null serialized, "},
+
+ {" total_ddl_errors			          largeint default null serialized, "},
+ {" total_util_errors			          largeint default null serialized, "},
+ {" total_catalog_errors			   largeint default null serialized, "},
+ {" total_other_errors			   largeint default null serialized, "},
+
+ {" delta_estimated_rows_accessed			   largeint default null serialized, "},
+ {" delta_estimated_rows_used			   largeint default null serialized, "},
+ {" delta_rows_accessed			   largeint default null serialized, "},
+ {" delta_rows_retrieved			   largeint default null serialized, "},
+ {" delta_num_rows_iud			   largeint default null serialized, "},
+
+ {" delta_selects			   largeint default null serialized, "},
+ {" delta_inserts			   largeint default null serialized, "},
+ {" delta_updates			   largeint default null serialized, "},
+ {" delta_deletes			   largeint default null serialized, "},
+
+ {" delta_ddl_stmts			          largeint default null serialized, "},
+ {" delta_util_stmts			          largeint default null serialized, "},
+ {" delta_catalog_stmts			   largeint default null serialized, "},
+ {" delta_other_stmts			   largeint default null serialized, "},
+
+ {" delta_insert_errors			          largeint default null serialized, "},
+ {" delta_delete_errors			          largeint default null serialized, "},
+ {" delta_update_errors			   largeint default null serialized, "},
+ {" delta_select_errors			   largeint default null serialized, "},
+
+ {" delta_ddl_errors			          largeint default null serialized, "},
+ {" delta_util_errors			          largeint default null serialized, "},
+ {" delta_catalog_errors			   largeint default null serialized, "},
+ {" delta_other_errors			   largeint default null serialized "},
+
+ {" ) "},
+ {" primary key ( session_start_utc_ts, session_id ) salt using 8 partitions on ( session_id ) "},
+ {" hbase_options ( DATA_BLOCK_ENCODING = 'FAST_DIFF', COMPRESSION = 'GZ' ) "},
+ {" ; "}
+};
+
+//----------------------------------------------------------------
+//-- METRIC_TEXT_TABLE
+//----------------------------------------------------------------
+static const QString createOldTrafv11MetricTextTable[] =
+  {
+    {" create table %s.\"%s\"."REPOS_METRIC_TEXT_TABLE" "},  // table didn't change when moving from 1.1 to 2.1
+    {" ( "},
+    {"  query_id                               char("MAX_QUERY_ID_LEN_STR") character set iso88591 casespecific no default not null not droppable serialized, "},
+    {"   text_type int not null serialized, "},
+    {"   sub_id int not null serialized, "},
+    {"   seq_num int not null serialized, "},
+    {"   flags largeint not null serialized, "},
+    {"   text varchar(50000 bytes) character set iso88591 not null serialized "},
+    {" ) "},
+    {" primary key (query_id, text_type, sub_id, seq_num) "},
+    {" ; "}
+  };
+
+// The following are the repository definitions for Metadata version 2.3 (before we 
+// reset the numbering for Trafodion; 2.3 preceeds Trafodion 1.1). These are
+// kept solely for historical purposes.
+
+static const QString createOldv23ReposMetricQueryTable[] =
 {
  {" create table %s.\"%s\"."TRAF_METRIC_QUERY_TABLE_OLD_REPOS" "},
  {" ( "},
@@ -463,7 +791,7 @@ static const QString createOldReposMetricQueryTable[] =
  {" ; "}
  };
 
-static const QString createOldReposMetricSessionTable[] =
+static const QString createOldv23ReposMetricSessionTable[] =
 {
  {" create table %s.\"%s\"."TRAF_METRIC_SESSION_TABLE_OLD_REPOS"  "},
  {" ( "},
@@ -517,7 +845,7 @@ static const QString createOldReposMetricSessionTable[] =
  //----------------------------------------------------------------
  //- Old METRIC_QUERY_AGGREGATION_TABLE
  //----------------------------------------------------------------
-static const QString createOldReposMetricQueryAggrTable[] =
+static const QString createOldv23ReposMetricQueryAggrTable[] =
 {
  {" create table %s.\"%s\"."TRAF_METRIC_QUERY_AGGR_TABLE_OLD_REPOS"  "},
  {" ( "},
@@ -568,10 +896,11 @@ static const MDUpgradeInfo allReposUpgradeInfo[] = {
   // TRAF_METRIC_QUERY_TABLE
   { REPOS_METRIC_QUERY_TABLE,  TRAF_METRIC_QUERY_TABLE_OLD_REPOS,
     createMetricQueryTable,  sizeof(createMetricQueryTable),
-    createOldReposMetricQueryTable,  sizeof(createOldReposMetricQueryTable),
+    createOldTrafv11MetricQueryTable,  sizeof(createOldTrafv11MetricQueryTable),
     NULL, 0,
-    FALSE, 
+    TRUE, 
 
+    // new table columns
     "instance_id,"
     "tenant_id,"
     "component_id,"
@@ -585,6 +914,7 @@ static const MDUpgradeInfo allReposUpgradeInfo[] = {
     "process_name,"
     "exec_start_utc_ts,"
     "query_id,"
+    "query_signature_id,"
     "user_name,"
     "role_name,"
     "start_priority,"
@@ -696,8 +1026,10 @@ static const MDUpgradeInfo allReposUpgradeInfo[] = {
     "ovf_buffer_bytes_read,"
     "num_nodes,"
     "udr_process_busy_time,"
-    "pertable_stats",
+    "pertable_stats,"
+    "last_updated_time",
 
+    // values from old table to be inserted into new
     "instance_id,"
     "tenant_id,"
     "component_id,"
@@ -711,6 +1043,7 @@ static const MDUpgradeInfo allReposUpgradeInfo[] = {
     "process_name,"
     "exec_start_utc_ts,"
     "query_id,"
+    "NULL,"
     "user_name,"
     "role_name,"
     "start_priority,"
@@ -792,8 +1125,8 @@ static const MDUpgradeInfo allReposUpgradeInfo[] = {
     "exec_end_utc_ts,"
     "master_execution_time,"
     "master_elapsed_time,"
-    "'COMPLETED',"
-    "'COMPLETED',"
+    "query_status,"
+    "query_sub_status,"
     "error_code,"
     "sql_error_code,"
     "error_text,"
@@ -822,25 +1155,118 @@ static const MDUpgradeInfo allReposUpgradeInfo[] = {
     "ovf_buffer_bytes_read,"
     "num_nodes,"
     "udr_process_busy_time,"
-    "pertable_stats",
+    "pertable_stats,"
+    "NULL",
 
     NULL, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE},
  
   // REPOS_METRIC_SESSION_TABLE
   { REPOS_METRIC_SESSION_TABLE,  TRAF_METRIC_SESSION_TABLE_OLD_REPOS,
     createMetricSessionTable,  sizeof(createMetricSessionTable),
-    createOldReposMetricSessionTable,  sizeof(createOldReposMetricSessionTable),
+    createOldTrafv11MetricSessionTable,  sizeof(createOldTrafv11MetricSessionTable),
     NULL, 0,
-    FALSE, NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
+    TRUE, 
+
+    // new table columns
+    "instance_id,"
+    "tenant_id,"
+    "component_id,"
+    "process_id,"
+    "thread_id,"
+    "node_id,"   
+    "pnid_id,"
+    "host_id,"
+    "ip_address_id," 
+    "sequence_number,"                 
+    "process_name,"
+    "session_id,"
+    "session_status,"
+    "session_start_utc_ts,"
+    "session_end_utc_ts,"
+    "user_id,"
+    "user_name,"
+    "role_name,"
+    "client_name,"
+    "client_user_name,"
+    "application_name,"
+    "profile_name,"
+    "sla_name,"
+    "total_execution_time,"
+    "total_elapsed_time,"
+    "total_insert_stmts_executed,"
+    "total_delete_stmts_executed,"
+    "total_update_stmts_executed,"
+    "total_select_stmts_executed,"
+    "total_catalog_stmts,"
+    "total_executes,"
+    "total_fetches,"
+    "total_closes,"
+    "total_execdirects,"
+    "total_errors,"
+    "total_warnings,"
+    "total_login_elapsed_time_mcsec,"
+    "ldap_login_elapsed_time_mcsec,"
+    "sql_user_elapsed_time_mcsec,"
+    "search_connection_elapsed_time_mcsec,"
+    "search_elapsed_time_mcsec,"
+    "authentication_connection_elapsed_time_mcsec,"
+    "authentication_elapsed_time_mcsec",   
+
+    // values from old table to be inserted into new
+    "instance_id,"
+    "tenant_id,"
+    "component_id,"
+    "process_id,"
+    "thread_id,"
+    "node_id,"   
+    "pnid_id,"
+    "host_id,"
+    "ip_address_id," 
+    "sequence_number,"                 
+    "process_name,"
+    "session_id,"
+    "session_status,"
+    "session_start_utc_ts,"
+    "session_end_utc_ts,"
+    "user_id,"
+    "user_name,"
+    "role_name,"
+    "client_name,"
+    "client_user_name,"
+    "application_name,"
+    "NULL,"
+    "NULL,"
+    "total_execution_time,"
+    "total_elapsed_time,"
+    "total_insert_stmts_executed,"
+    "total_delete_stmts_executed,"
+    "total_update_stmts_executed,"
+    "total_select_stmts_executed,"
+    "total_catalog_stmts,"
+    "total_executes,"
+    "total_fetches,"
+    "total_closes,"
+    "total_execdirects,"
+    "total_errors,"
+    "total_warnings,"
+    "total_login_elapsed_time_mcsec,"
+    "ldap_login_elapsed_time_mcsec,"
+    "sql_user_elapsed_time_mcsec,"
+    "search_connection_elapsed_time_mcsec,"
+    "search_elapsed_time_mcsec,"
+    "authentication_connection_elapsed_time_mcsec,"
+    "authentication_elapsed_time_mcsec",  
+
+    NULL, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE},
 
   // REPOS_METRIC_QUERY_AGGR_TABLE
   { REPOS_METRIC_QUERY_AGGR_TABLE,  TRAF_METRIC_QUERY_AGGR_TABLE_OLD_REPOS,
     createMetricQueryAggrTable,  sizeof(createMetricQueryAggrTable),
-    createOldReposMetricQueryAggrTable,  sizeof(createOldReposMetricQueryAggrTable),
+    createOldTrafv11MetricQueryAggrTable,  sizeof(createOldTrafv11MetricQueryAggrTable),
     NULL, 0,
-    FALSE, 
+    TRUE, 
 
-    // INSERTED columns
+    // new table columns
     "instance_id, tenant_id, component_id, process_id, thread_id, node_id, pnid_id, host_id,"
     "ip_address_id, sequence_number, process_name, session_id, "
     "session_start_utc_ts, aggregation_last_update_utc_ts, aggregation_last_elapsed_time," 
@@ -858,28 +1284,31 @@ static const MDUpgradeInfo allReposUpgradeInfo[] = {
 
     "delta_ddl_stmts, delta_util_stmts, delta_catalog_stmts, delta_other_stmts, "
     "delta_insert_errors, delta_delete_errors, delta_update_errors, delta_select_errors, "
-    "delta_ddl_errors, delta_util_errors, delta_catalog_errors, delta_other_errors ",
+    "delta_ddl_errors, delta_util_errors, delta_catalog_errors, delta_other_errors, "
+    
+    "average_response_time, throughput_per_second ",
 
-    // SELECTED columns
+    // values from old table to be inserted into new
     "instance_id, tenant_id, component_id, process_id, thread_id, node_id, pnid_id, host_id,"
     "ip_address_id, sequence_number, process_name, session_id, "
-    " current_timestamp, aggregation_start_utc_ts, cast((aggregation_end_utc_ts - aggregation_start_utc_ts) as largeint),"
+    "session_start_utc_ts, aggregation_last_update_utc_ts, aggregation_last_elapsed_time," 
     "user_id, user_name, role_name, client_name, client_user_name,"
     "application_name, total_est_rows_accessed, total_est_rows_used, total_rows_retrieved,"
+    "total_num_rows_iud, total_selects, total_inserts, total_updates, total_deletes,"
 
-    "total_num_rows_iud, total_selects, total_inserts, total_updates, total_deletes, "
-
-    "0, 0, 0, 0, "
-    "0, 0, 0, 0, "
-    "0, 0, 0, 0, "
+    "total_ddl_stmts, total_util_stmts, total_catalog_stmts, total_other_stmts, "
+    "total_insert_errors, total_delete_errors, total_update_errors, total_select_errors, "
+    "total_ddl_errors, total_util_errors, total_catalog_errors, total_other_errors, "
 
     "delta_estimated_rows_accessed, delta_estimated_rows_used, delta_rows_accessed,"
-    "delta_rows_retrieved, delta_num_rows_uid, delta_total_selects, delta_total_inserts,"
-    "delta_total_updates, delta_total_deletes, "
+    "delta_rows_retrieved, delta_num_rows_iud, "
+    "delta_selects, delta_inserts, delta_updates, delta_deletes,"
+
+    "delta_ddl_stmts, delta_util_stmts, delta_catalog_stmts, delta_other_stmts, "
+    "delta_insert_errors, delta_delete_errors, delta_update_errors, delta_select_errors, "
+    "delta_ddl_errors, delta_util_errors, delta_catalog_errors, delta_other_errors, "
 
-    "0, 0, 0, 0, "
-    "0, 0, 0, 0, "
-    "0, 0, 0, 0",
+    "NULL, NULL",
 
     NULL, TRUE, FALSE, FALSE, FALSE, FALSE, FALSE},
 



[10/16] incubator-trafodion git commit: Merge remote branch 'hegdean/wrkbrnch' into Trafodion2037

Posted by db...@apache.org.
Merge remote branch 'hegdean/wrkbrnch' into Trafodion2037


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

Branch: refs/heads/master
Commit: 548f72977195ac625246b4867c11a04f0e296de4
Parents: 2605440 463a699
Author: Dave Birdsall <db...@apache.org>
Authored: Mon Jun 27 18:32:49 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Mon Jun 27 18:32:49 2016 +0000

----------------------------------------------------------------------
 .../main/java/org/trafodion/jdbc/t4/Bytes.java  |    5 +
 .../trafodion/jdbc/t4/InterfaceResultSet.java   |   18 +
 .../trafodion/jdbc/t4/InterfaceStatement.java   |   25 +
 .../java/org/trafodion/jdbc/t4/TrafT4Desc.java  |    4 +-
 .../jdbc/t4/TrafT4PreparedStatement.java        |    2 +-
 .../java/org/trafodion/jdbc/t4/Utility.java     |   12 +-
 core/conn/odbc/src/odbc/Common/Global.h         |    5 +-
 core/conn/odbc/src/odbc/Common/PubQueryStats.h  |   11 +-
 core/conn/odbc/src/odbc/nsksrvr/SrvrConnect.cpp |  141 ++-
 .../odbc/nsksrvrcore/ResStatisticsSession.cpp   |   95 +-
 .../src/odbc/nsksrvrcore/ResStatisticsSession.h |    1 +
 .../odbc/nsksrvrcore/ResStatisticsStatement.cpp |    3 +-
 .../odbc/src/odbc/nsksrvrcore/sqlinterface.cpp  |   65 +-
 .../odbc/src/odbc/nsksrvrcore/srvrothers.cpp    |   78 ++
 core/dbsecurity/auth/src/ldapcheck.cpp          |    2 +
 core/sqf/sql/scripts/krb5check                  |  133 ++
 core/sqf/sql/scripts/krb5functions              |  128 ++
 core/sqf/sql/scripts/krb5service                |  255 ++++
 core/sqf/sql/scripts/restcheck                  |    1 -
 core/sqf/sql/scripts/sqstart                    |   37 +
 core/sql/bin/SqlciErrors.txt                    |    7 +-
 core/sql/cli/CliExpExchange.cpp                 |   29 +-
 core/sql/cli/Descriptor.cpp                     |    8 +-
 core/sql/cli/sqlcli.h                           |    4 +
 core/sql/comexe/ComTdb.cpp                      |   59 +-
 core/sql/comexe/ComTdb.h                        |   28 +-
 core/sql/comexe/ComTdbExeUtil.cpp               |  137 ++-
 core/sql/comexe/ComTdbExeUtil.h                 |  123 +-
 core/sql/comexe/ComTdbFastTransport.h           |    8 +-
 core/sql/common/BaseTypes.cpp                   |   60 +-
 core/sql/common/CharType.cpp                    |    6 +-
 core/sql/common/CharType.h                      |   10 +-
 core/sql/common/ComSmallDefs.h                  |   14 +-
 core/sql/common/NAType.cpp                      |   89 +-
 core/sql/common/NAType.h                        |    2 +
 core/sql/common/NumericType.cpp                 |  153 ++-
 core/sql/common/NumericType.h                   |  195 ++-
 core/sql/common/SQLTypeDefs.h                   |    5 +
 core/sql/common/dfs2rec.h                       |    8 +-
 core/sql/executor/ExComTdb.cpp                  |    9 +-
 core/sql/executor/ExExeUtil.h                   |   61 +-
 core/sql/executor/ExExeUtilMisc.cpp             |   68 +-
 core/sql/executor/ExFastTransport.cpp           |   16 +-
 core/sql/executor/ExHbaseAccess.cpp             |   26 +
 core/sql/executor/ExHbaseIUD.cpp                |    6 +-
 core/sql/exp/ExpAlignedFormat.h                 |   10 +-
 core/sql/exp/ExpErrorEnums.h                    |    4 +-
 core/sql/exp/ExpHbaseInterface.h                |   16 -
 core/sql/exp/ExpLOBaccess.cpp                   |   81 +-
 core/sql/exp/ExpLOBaccess.h                     |    3 +-
 core/sql/exp/ExpPCodeClauseGen.cpp              |    2 -
 core/sql/exp/exp_arith.cpp                      |   99 +-
 core/sql/exp/exp_attrs.cpp                      |    4 +-
 core/sql/exp/exp_clause_derived.h               |   18 +-
 core/sql/exp/exp_comp.cpp                       |   80 +-
 core/sql/exp/exp_conv.cpp                       |  617 ++++++++--
 core/sql/exp/exp_fixup.cpp                      |   44 +-
 core/sql/exp/exp_function.cpp                   |  165 +--
 core/sql/exp/exp_math_func.cpp                  |  107 +-
 core/sql/exp/exp_tuple_desc.h                   |    2 +-
 core/sql/generator/GenFastTransport.cpp         |   74 +-
 core/sql/generator/GenPreCode.cpp               |  178 ++-
 core/sql/generator/GenRelExeUtil.cpp            |  112 +-
 core/sql/generator/GenRelScan.cpp               |   59 +-
 core/sql/generator/Generator.cpp                |    3 +-
 core/sql/langman/LmJavaType.cpp                 |   21 +-
 core/sql/langman/LmJavaType.h                   |    1 +
 core/sql/langman/LmResultSetJava.cpp            |   56 +-
 core/sql/langman/LmRoutineCSql.cpp              |   27 +
 core/sql/optimizer/BindRelExpr.cpp              |  129 +-
 core/sql/optimizer/BindWA.cpp                   |    3 +-
 core/sql/optimizer/BindWA.h                     |   37 +-
 core/sql/optimizer/EncodedValue.cpp             |   10 +-
 core/sql/optimizer/ItemExpr.cpp                 |   11 +-
 core/sql/optimizer/ItemFunc.h                   |   64 +-
 core/sql/optimizer/NAColumn.cpp                 |   65 +-
 core/sql/optimizer/NAColumn.h                   |    3 +
 core/sql/optimizer/NAFileSet.h                  |    2 +
 core/sql/optimizer/NATable.cpp                  |  182 ++-
 core/sql/optimizer/NATable.h                    |   25 +-
 core/sql/optimizer/OptPhysRelExpr.cpp           |   31 +-
 core/sql/optimizer/OptRange.cpp                 |    2 -
 core/sql/optimizer/RelExeUtil.cpp               |  214 ++--
 core/sql/optimizer/RelExeUtil.h                 |   94 +-
 core/sql/optimizer/SynthType.cpp                |   11 +-
 core/sql/optimizer/ValueDesc.cpp                |   66 +-
 core/sql/parser/ElemDDLLike.cpp                 |    4 +-
 core/sql/parser/ElemDDLLikeCreateTable.h        |    6 +-
 core/sql/parser/ParKeyWords.cpp                 |    3 -
 core/sql/parser/StmtDDLAlterLibrary.h           |   14 +
 core/sql/parser/StmtDDLCreate.cpp               |   43 +-
 core/sql/parser/sqlparser.y                     |  110 +-
 core/sql/regress/charsets/EXPECTED315           |    4 +-
 core/sql/regress/core/EXPECTED116               |  125 +-
 core/sql/regress/core/TEST116                   |   37 +-
 core/sql/regress/executor/EXPECTED022.SB        |  246 ++--
 core/sql/regress/executor/TEST022               |   54 +-
 core/sql/regress/hive/EXPECTED005               |  278 ++++-
 core/sql/regress/hive/EXPECTED009               | 1131 +++++++++++++++---
 core/sql/regress/hive/FILTER009                 |   49 +
 core/sql/regress/hive/TEST005                   |  101 +-
 core/sql/regress/hive/TEST005_a.hive.sql        |    7 +
 core/sql/regress/hive/TEST009                   |   91 +-
 core/sql/regress/hive/TEST020                   |    2 +-
 core/sql/regress/hive/tbl_bad.data              |    2 +-
 core/sql/regress/hive/tbl_type.data             |    2 +-
 core/sql/regress/privs2/EXPECTED129             |   36 +-
 core/sql/regress/seabase/EXPECTED003            |  425 +++++++
 core/sql/regress/seabase/EXPECTED011            |   25 +-
 core/sql/regress/seabase/EXPECTED031            |  237 ++++
 core/sql/regress/seabase/TEST003                |  138 +++
 core/sql/regress/seabase/TEST011                |    2 +-
 core/sql/regress/seabase/TEST031                |   53 +
 core/sql/regress/udr/EXPECTED001                |   22 +-
 core/sql/regress/udr/EXPECTED100.SB             |   53 +-
 core/sql/regress/udr/TEST001                    |    5 +
 core/sql/regress/udr/TEST100                    |   13 +
 core/sql/regress/udr/t100.java                  |    4 +
 core/sql/sqlcat/desc.h                          |    3 +-
 core/sql/sqlci/Formatter.cpp                    |   14 +-
 core/sql/sqlci/Param.cpp                        |    4 +-
 core/sql/sqlci/SqlciEnv.cpp                     |   28 +-
 core/sql/sqlci/SqlciEnv.h                       |    2 +-
 core/sql/sqlci/sqlci_lex.ll                     |    1 +
 core/sql/sqlci/sqlci_yacc.y                     |    2 +
 core/sql/sqlcomp/CmpDescribe.cpp                |  300 +++--
 core/sql/sqlcomp/CmpSeabaseDDL.h                |  139 ++-
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp        |   92 +-
 core/sql/sqlcomp/CmpSeabaseDDLindex.cpp         |   89 +-
 core/sql/sqlcomp/CmpSeabaseDDLmd.h              |    8 +
 core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp         |   22 +-
 core/sql/sqlcomp/CmpSeabaseDDLrepos.h           |   59 +-
 core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp       |  137 ++-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp         |  158 ++-
 core/sql/sqlcomp/DefaultConstants.h             |   40 +-
 core/sql/sqlcomp/DefaultValidator.cpp           |   15 +
 core/sql/sqlcomp/nadefaults.cpp                 |  102 +-
 core/sql/ustat/hs_cli.cpp                       |   42 +-
 core/sql/ustat/hs_faststats.cpp                 |    6 +
 core/sql/ustat/hs_globals.cpp                   |  121 +-
 install/installer/traf_add_kerberos             |  204 ++++
 install/installer/traf_add_ldap                 |   98 ++
 install/installer/traf_cloudera_mods            |   16 +
 install/installer/traf_config_check             |    2 +-
 install/installer/traf_config_setup             |  159 ---
 install/installer/traf_hortonworks_mods         |   32 +-
 install/installer/traf_secure                   |   60 +
 install/installer/traf_secure_setup             |  342 ++++++
 install/installer/traf_sqgen                    |   37 +-
 install/installer/trafodion_config_default      |   36 +-
 install/installer/trafodion_install             |   91 +-
 install/installer/trafodion_secure_install      |  129 ++
 install/installer/trafodion_uninstaller         |   20 +
 153 files changed, 8163 insertions(+), 2653 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/548f7297/core/sql/comexe/ComTdb.h
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/548f7297/core/sql/common/ComSmallDefs.h
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/548f7297/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/548f7297/core/sql/sqlcomp/CmpSeabaseDDLmd.h
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/548f7297/core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp
----------------------------------------------------------------------

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/548f7297/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------


[06/16] incubator-trafodion git commit: Merge branch 'master' of github.com:apache/incubator-trafodion into wrkbrnch

Posted by db...@apache.org.
Merge branch 'master' of github.com:apache/incubator-trafodion into wrkbrnch


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

Branch: refs/heads/master
Commit: 85783bfe445ca63aa089a901d8e407e6226cea7c
Parents: 0b7663e 7ad34b1
Author: Anuradha Hegde <an...@esgyn.com>
Authored: Fri Jun 24 17:37:07 2016 +0000
Committer: Anuradha Hegde <an...@esgyn.com>
Committed: Fri Jun 24 17:37:07 2016 +0000

----------------------------------------------------------------------
 .../odbc/src/odbc/nsksrvrcore/srvrothers.cpp    |   78 ++
 core/dbsecurity/auth/src/ldapcheck.cpp          |    2 +
 core/sqf/sql/scripts/krb5check                  |  133 ++
 core/sqf/sql/scripts/krb5functions              |  128 ++
 core/sqf/sql/scripts/krb5service                |  255 ++++
 core/sqf/sql/scripts/sqstart                    |   37 +
 core/sql/bin/SqlciErrors.txt                    |    7 +-
 core/sql/comexe/ComTdb.cpp                      |    8 +
 core/sql/comexe/ComTdb.h                        |    4 +-
 core/sql/comexe/ComTdbExeUtil.cpp               |  137 ++-
 core/sql/comexe/ComTdbExeUtil.h                 |  123 +-
 core/sql/comexe/ComTdbFastTransport.h           |    8 +-
 core/sql/common/CharType.cpp                    |    6 +-
 core/sql/common/CharType.h                      |   10 +-
 core/sql/common/NAType.cpp                      |   79 ++
 core/sql/common/NAType.h                        |    2 +
 core/sql/executor/ExComTdb.cpp                  |    9 +-
 core/sql/executor/ExExeUtil.h                   |   61 +-
 core/sql/executor/ExExeUtilMisc.cpp             |   68 +-
 core/sql/executor/ExFastTransport.cpp           |   16 +-
 core/sql/executor/ExHbaseAccess.cpp             |   26 +
 core/sql/exp/ExpAlignedFormat.h                 |   10 +-
 core/sql/exp/ExpErrorEnums.h                    |    4 +-
 core/sql/exp/ExpHbaseInterface.h                |   16 -
 core/sql/exp/ExpLOBaccess.cpp                   |   81 +-
 core/sql/exp/ExpLOBaccess.h                     |    3 +-
 core/sql/exp/exp_conv.cpp                       |   88 ++
 core/sql/exp/exp_tuple_desc.h                   |    2 +-
 core/sql/generator/GenFastTransport.cpp         |   74 +-
 core/sql/generator/GenPreCode.cpp               |  101 +-
 core/sql/generator/GenRelExeUtil.cpp            |  112 +-
 core/sql/generator/GenRelScan.cpp               |   59 +-
 core/sql/generator/Generator.cpp                |    3 +-
 core/sql/optimizer/BindRelExpr.cpp              |   40 +-
 core/sql/optimizer/BindWA.cpp                   |    3 +-
 core/sql/optimizer/BindWA.h                     |   37 +-
 core/sql/optimizer/ItemExpr.cpp                 |    1 +
 core/sql/optimizer/ItemFunc.h                   |   28 +-
 core/sql/optimizer/NAColumn.cpp                 |   15 +
 core/sql/optimizer/NAColumn.h                   |    3 +
 core/sql/optimizer/NAFileSet.h                  |    2 +
 core/sql/optimizer/NATable.cpp                  |  125 +-
 core/sql/optimizer/NATable.h                    |   25 +-
 core/sql/optimizer/OptPhysRelExpr.cpp           |   31 +-
 core/sql/optimizer/RelExeUtil.cpp               |  214 ++--
 core/sql/optimizer/RelExeUtil.h                 |   94 +-
 core/sql/optimizer/SynthType.cpp                |   11 +-
 core/sql/parser/ElemDDLLike.cpp                 |    4 +-
 core/sql/parser/ElemDDLLikeCreateTable.h        |    6 +-
 core/sql/parser/StmtDDLAlterLibrary.h           |   14 +
 core/sql/parser/StmtDDLCreate.cpp               |   43 +-
 core/sql/parser/sqlparser.y                     |   55 +-
 core/sql/regress/charsets/EXPECTED315           |    4 +-
 core/sql/regress/core/EXPECTED116               |  125 +-
 core/sql/regress/core/TEST116                   |   37 +-
 core/sql/regress/hive/EXPECTED005               |  278 ++++-
 core/sql/regress/hive/EXPECTED009               | 1131 +++++++++++++++---
 core/sql/regress/hive/FILTER009                 |   49 +
 core/sql/regress/hive/TEST005                   |  101 +-
 core/sql/regress/hive/TEST005_a.hive.sql        |    7 +
 core/sql/regress/hive/TEST009                   |   91 +-
 core/sql/regress/hive/TEST020                   |    2 +-
 core/sql/regress/privs2/EXPECTED129             |   36 +-
 core/sql/regress/seabase/EXPECTED003            |    2 +-
 core/sql/regress/seabase/EXPECTED011            |   16 +-
 core/sql/regress/seabase/EXPECTED031            |  237 ++++
 core/sql/regress/seabase/TEST011                |    2 +-
 core/sql/regress/seabase/TEST031                |   53 +
 core/sql/regress/udr/EXPECTED001                |   22 +-
 core/sql/regress/udr/TEST001                    |    5 +
 core/sql/sqlcat/desc.h                          |    3 +-
 core/sql/sqlci/sqlci_lex.ll                     |    1 +
 core/sql/sqlci/sqlci_yacc.y                     |    2 +
 core/sql/sqlcomp/CmpDescribe.cpp                |  300 +++--
 core/sql/sqlcomp/CmpSeabaseDDL.h                |  139 ++-
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp        |   92 +-
 core/sql/sqlcomp/CmpSeabaseDDLindex.cpp         |   89 +-
 core/sql/sqlcomp/CmpSeabaseDDLmd.h              |    8 +
 core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp       |  135 ++-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp         |  158 ++-
 core/sql/sqlcomp/DefaultConstants.h             |   18 +-
 core/sql/sqlcomp/DefaultValidator.cpp           |   15 +
 core/sql/sqlcomp/nadefaults.cpp                 |   90 +-
 install/installer/traf_add_kerberos             |  204 ++++
 install/installer/traf_add_ldap                 |   98 ++
 install/installer/traf_cloudera_mods            |   16 +
 install/installer/traf_config_check             |    2 +-
 install/installer/traf_config_setup             |  159 ---
 install/installer/traf_hortonworks_mods         |   32 +-
 install/installer/traf_secure                   |   60 +
 install/installer/traf_secure_setup             |  342 ++++++
 install/installer/traf_sqgen                    |   37 +-
 install/installer/trafodion_config_default      |   36 +-
 install/installer/trafodion_install             |   91 +-
 install/installer/trafodion_secure_install      |  129 ++
 install/installer/trafodion_uninstaller         |   20 +
 96 files changed, 5768 insertions(+), 1207 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/85783bfe/core/sql/regress/seabase/EXPECTED011
----------------------------------------------------------------------


[04/16] incubator-trafodion git commit: Merge branch 'master' of github.com:apache/incubator-trafodion into wrkbrnch

Posted by db...@apache.org.
Merge branch 'master' of github.com:apache/incubator-trafodion into wrkbrnch


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

Branch: refs/heads/master
Commit: 2b111fdb1d867261a5305461f908d904b68f0be0
Parents: afa1daa 9572321
Author: Anuradha Hegde <an...@esgyn.com>
Authored: Fri Jun 17 17:14:52 2016 +0000
Committer: Anuradha Hegde <an...@esgyn.com>
Committed: Fri Jun 17 17:14:52 2016 +0000

----------------------------------------------------------------------
 .gitattributes                                  |    6 -
 .gitignore                                      |    1 +
 .rat-excludes                                   |    4 +-
 Makefile                                        |    1 +
 RAT_README                                      |   16 +-
 README                                          |    4 +-
 core/Makefile                                   |   14 +-
 core/conn/Makefile                              |    5 +-
 core/conn/jdbcT4/Makefile                       |    1 +
 core/conn/jdbcT4/pom.xml                        |    7 +-
 .../jdbcT4/src/main/java/T4Messages.properties  |   10 +-
 .../java/org/trafodion/jdbc/t4/Address.java     |    2 +-
 .../main/java/org/trafodion/jdbc/t4/Bytes.java  |    5 +
 .../jdbc/t4/HPT4ConnectionPoolDataSource.java   |  346 -----
 .../t4/HPT4ConnectionPoolDataSourceFactory.java |   68 -
 .../org/trafodion/jdbc/t4/HPT4DataSource.java   |  366 -----
 .../jdbc/t4/HPT4DataSourceFactory.java          |   62 -
 .../java/org/trafodion/jdbc/t4/HPT4Desc.java    |  542 -------
 .../org/trafodion/jdbc/t4/HPT4Exception.java    |   38 -
 .../java/org/trafodion/jdbc/t4/HPT4Handle.java  |   84 --
 .../org/trafodion/jdbc/t4/HPT4Messages.java     |  324 ----
 .../jdbc/t4/HPT4ParameterMetaData.java          |  243 ---
 .../trafodion/jdbc/t4/HPT4PooledConnection.java |  238 ---
 .../jdbc/t4/HPT4PooledConnectionManager.java    |  385 -----
 .../jdbc/t4/HPT4ResultSetMetaData.java          |  309 ----
 .../jdbc/t4/InitializeDialogueReply.java        |    6 +-
 .../java/org/trafodion/jdbc/t4/InputOutput.java |   50 +-
 .../trafodion/jdbc/t4/InterfaceConnection.java  |   52 +-
 .../trafodion/jdbc/t4/InterfaceResultSet.java   |   52 +-
 .../trafodion/jdbc/t4/InterfaceStatement.java   |  173 ++-
 .../java/org/trafodion/jdbc/t4/NCSAddress.java  |   22 +-
 .../jdbc/t4/PreparedStatementManager.java       |    2 +-
 .../java/org/trafodion/jdbc/t4/T4Address.java   |   24 +-
 .../org/trafodion/jdbc/t4/T4Connection.java     |   36 +-
 .../org/trafodion/jdbc/t4/T4DSProperties.java   |    6 +-
 .../trafodion/jdbc/t4/T4DatabaseMetaData.java   |  132 +-
 .../java/org/trafodion/jdbc/t4/T4Driver.java    |   14 +-
 .../org/trafodion/jdbc/t4/T4Properties.java     |   20 +-
 .../java/org/trafodion/jdbc/t4/T4ResultSet.java |   12 +-
 .../java/org/trafodion/jdbc/t4/T4Statement.java |   20 +-
 .../org/trafodion/jdbc/t4/T4_Dcs_Cancel.java    |    2 +-
 .../org/trafodion/jdbc/t4/T4_Dcs_Connect.java   |   10 +-
 .../jdbc/t4/TrafT4CallableStatement.java        |   58 +-
 .../org/trafodion/jdbc/t4/TrafT4Connection.java |  108 +-
 .../jdbc/t4/TrafT4ConnectionPoolDataSource.java |  346 +++++
 .../TrafT4ConnectionPoolDataSourceFactory.java  |   68 +
 .../org/trafodion/jdbc/t4/TrafT4DataSource.java |  366 +++++
 .../jdbc/t4/TrafT4DataSourceFactory.java        |   62 +
 .../java/org/trafodion/jdbc/t4/TrafT4Desc.java  |  542 +++++++
 .../org/trafodion/jdbc/t4/TrafT4Exception.java  |   38 +
 .../org/trafodion/jdbc/t4/TrafT4Handle.java     |   84 ++
 .../org/trafodion/jdbc/t4/TrafT4Messages.java   |  324 ++++
 .../jdbc/t4/TrafT4ParameterMetaData.java        |  243 +++
 .../jdbc/t4/TrafT4PooledConnection.java         |  238 +++
 .../jdbc/t4/TrafT4PooledConnectionManager.java  |  385 +++++
 .../jdbc/t4/TrafT4PreparedStatement.java        |  120 +-
 .../org/trafodion/jdbc/t4/TrafT4ResultSet.java  |  296 ++--
 .../jdbc/t4/TrafT4ResultSetMetaData.java        |  309 ++++
 .../org/trafodion/jdbc/t4/TrafT4Statement.java  |   70 +-
 .../java/org/trafodion/jdbc/t4/Utility.java     |   34 +-
 .../jdbc/t4/odbc_Dcs_GetObjRefHdl_exc_.java     |   16 +-
 .../jdbc/t4/odbc_Dcs_StopSrvr_exc_.java         |    8 +-
 .../jdbc/t4/odbc_SQLSvc_Close_exc_.java         |    8 +-
 .../t4/odbc_SQLSvc_EndTransaction_exc_.java     |    8 +-
 .../jdbc/t4/odbc_SQLSvc_Execute_exc_.java       |   10 +-
 .../jdbc/t4/odbc_SQLSvc_Fetch_exc_.java         |   10 +-
 .../t4/odbc_SQLSvc_GetSQLCatalogs_exc_.java     |    6 +-
 .../t4/odbc_SQLSvc_InitializeDialogue_exc_.java |    6 +-
 .../jdbc/t4/odbc_SQLSvc_Prepare_exc_.java       |   10 +-
 .../odbc_SQLSvc_SetConnectionOption_exc_.java   |   12 +-
 .../t4/odbc_SQLSvc_TerminateDialogue_exc_.java  |    8 +-
 .../java/org/trafodion/jdbc/t4/RunAllTests.java |    2 +
 core/conn/jdbc_type2/Makefile                   |    2 +-
 core/conn/jdbc_type2/build.xml                  |   11 +-
 core/conn/jdbc_type2/native/SQLMXDriver.cpp     |   38 +-
 core/conn/jdbc_type2/native/SrvrCommon.cpp      |    4 +-
 core/conn/odb/build.bat                         |   56 +
 core/conn/odb/odb/odb.vcxproj                   |    2 +
 core/conn/odbc/src/odbc/Makefile                |    8 +-
 .../odbc/src/odbc/nsksrvrcore/sqlinterface.cpp  |   65 +-
 .../odbc/src/odbc/nsksrvrcore/srvrothers.cpp    |   63 +-
 core/conn/trafci/install/Installer.java         |    7 +-
 .../odbc/odbcclient/unixcli/makefile.lnx        |    8 +-
 .../odbc/odbcclient/unixcli/package/TRAFDSN     |    2 +-
 .../odbc/odbcclient/unixcli/package/mklnxpkg.sh |    2 +
 .../unixcli/package/runconnect_test.sh          |   26 +
 core/dbsecurity/scripts/sqcertgen               |    5 -
 core/dbsecurity/scripts/update_auth             |    9 +-
 core/rest/Makefile                              |   16 +-
 core/rest/pom.xml                               |   40 +-
 core/rest/src/assembly/all.xml                  |   11 +-
 .../org/trafodion/rest/util/JdbcT4Util.java     |    6 +-
 core/sqf/.gitignore                             |    4 +
 core/sqf/Makefile                               |   22 +-
 core/sqf/samples/.gitignore                     |    4 +
 core/sqf/sqenvcom.sh                            |    1 -
 core/sqf/sql/scripts/dcscheck                   |   20 +-
 core/sqf/sql/scripts/install_traf_components    |   53 +-
 core/sqf/sql/scripts/sqcheck                    |   57 +-
 core/sqf/sqvers                                 |    2 +-
 core/sqf/src/seabed/test/t284.h                 |   52 +-
 core/sqf/src/seabed/test/t284cli.cpp            |    5 +
 core/sqf/src/seabed/test/t284cli.java           |   75 +-
 core/sqf/src/seabed/test/t284clicom.h           |   58 +
 core/sqf/src/seabed/test/t284lib.cpp            |   79 +
 core/sqf/src/seabed/test/t284srv.cpp            |  250 ++++
 .../client/TrafParallelClientScanner.java.tmpl  |    7 +-
 .../hbase/client/transactional/RMInterface.java |   43 +-
 .../RetryTransactionException.java              |   54 +
 .../RollbackUnsuccessfulException.java          |   62 +
 .../transactional/SsccTransactionalTable.java   |   34 +-
 .../hbase/client/transactional/TmDDL.java       |   24 +-
 .../transactional/TransactionManager.java       |  626 ++++----
 .../TransactionalScanner.java.tmpl              |   99 +-
 .../transactional/TransactionalTable.java       |   46 +-
 .../transactional/SplitBalanceHelper.java       |   51 +-
 .../transactional/TrxRegionEndpoint.java.tmpl   |   40 +-
 .../transactional/TrxRegionObserver.java.tmpl   |    4 +-
 .../hbase/regionserver/transactional/IdTm.java  |   82 +-
 .../transactional/IdTmException.java            |   14 +
 core/sqf/src/seatrans/tm/hbasetmlib2/idtm.cpp   |   85 +-
 .../src/seatrans/tm/hbasetmlib2/idtmclicom.h    |   70 +-
 core/sqf/src/seatrans/tm/hbasetmlib2/idtmjni.h  |   14 +
 .../trafodion/dtm/HBaseAuditControlPoint.java   |    4 +-
 .../java/org/trafodion/dtm/HBaseTxClient.java   |    7 +-
 .../java/org/trafodion/dtm/TmAuditTlog.java     |  101 +-
 core/sqf/src/tm/idtmsrv.cpp                     |  350 ++++-
 core/sqf/src/tm/idtmsrv.h                       |   52 +-
 core/sqf/src/tm/tmlib.cpp                       |    5 +-
 core/sqf/src/tm/tmtx.cpp                        |    6 +-
 core/sql/arkcmp/CmpStatement.cpp                |   42 +-
 core/sql/bin/SqlciErrors.txt                    |    8 +-
 core/sql/cli/Cli.cpp                            |   49 +-
 core/sql/cli/CliExpExchange.cpp                 |   29 +-
 core/sql/cli/CliExtern.cpp                      |    1 -
 core/sql/cli/Context.cpp                        |  116 +-
 core/sql/cli/Context.h                          |    2 +
 core/sql/cli/Descriptor.cpp                     |    8 +-
 core/sql/cli/ExSqlComp.cpp                      |   22 +-
 core/sql/cli/ExSqlComp.h                        |    2 +
 core/sql/cli/SessionDefaults.cpp                |   18 +-
 core/sql/cli/SessionDefaults.h                  |   23 +-
 core/sql/cli/Statement.cpp                      |    2 +-
 core/sql/cli/sqlcli.h                           |    6 +
 core/sql/comexe/ComTdb.cpp                      |   51 -
 core/sql/comexe/ComTdb.h                        |   24 +-
 core/sql/comexe/ComTdbExeUtil.cpp               |   29 +-
 core/sql/comexe/ComTdbExeUtil.h                 |   46 +-
 core/sql/comexe/ComTdbFastTransport.cpp         |    6 +-
 core/sql/comexe/ComTdbFastTransport.h           |    7 +-
 core/sql/comexe/ComTdbHdfsScan.cpp              |   62 +-
 core/sql/comexe/ComTdbHdfsScan.h                |   75 +-
 core/sql/common/BaseTypes.cpp                   |   60 +-
 core/sql/common/CharType.cpp                    |    4 +
 core/sql/common/CharType.h                      |    1 +
 core/sql/common/ComSmallDefs.h                  |   13 +
 core/sql/common/NAType.cpp                      |   10 +-
 core/sql/common/NumericType.cpp                 |  153 +-
 core/sql/common/NumericType.h                   |  195 ++-
 core/sql/common/OperTypeEnum.h                  |    1 +
 core/sql/common/SQLTypeDefs.h                   |    5 +
 core/sql/common/dfs2rec.h                       |    8 +-
 core/sql/executor/ExExeUtil.h                   |   15 +-
 core/sql/executor/ExExeUtilCli.cpp              |    5 +-
 core/sql/executor/ExExeUtilGet.cpp              |  226 ++-
 core/sql/executor/ExExeUtilLoad.cpp             |    2 +-
 core/sql/executor/ExExeUtilMisc.cpp             |  129 +-
 core/sql/executor/ExFastTransport.cpp           |  117 +-
 core/sql/executor/ExFastTransport.h             |    5 +
 core/sql/executor/ExHbaseIUD.cpp                |    6 +-
 core/sql/executor/ExHdfsScan.cpp                |  120 +-
 core/sql/executor/ExHdfsScan.h                  |   13 +-
 core/sql/executor/ex_control.cpp                |   12 +
 core/sql/executor/hiveHook.cpp                  |   27 +-
 core/sql/exp/ExpErrorEnums.h                    |    1 +
 core/sql/exp/ExpLOB.cpp                         |   35 +-
 core/sql/exp/ExpLOB.h                           |   14 +-
 core/sql/exp/ExpLOBaccess.cpp                   |  294 +++-
 core/sql/exp/ExpLOBaccess.h                     |   81 +-
 core/sql/exp/ExpLOBenums.h                      |    6 +-
 core/sql/exp/ExpLOBinterface.cpp                |   54 +-
 core/sql/exp/ExpLOBinterface.h                  |   10 +
 core/sql/exp/ExpPCodeClauseGen.cpp              |    2 -
 core/sql/exp/exp_arith.cpp                      |   99 +-
 core/sql/exp/exp_attrs.cpp                      |    4 +-
 core/sql/exp/exp_clause_derived.h               |   18 +-
 core/sql/exp/exp_comp.cpp                       |   80 +-
 core/sql/exp/exp_conv.cpp                       |  529 +++++--
 core/sql/exp/exp_fixup.cpp                      |   44 +-
 core/sql/exp/exp_function.cpp                   |  165 +-
 core/sql/exp/exp_math_func.cpp                  |  107 +-
 core/sql/generator/GenFastTransport.cpp         |   67 +-
 core/sql/generator/GenPreCode.cpp               |  119 +-
 core/sql/generator/GenRelExeUtil.cpp            |   20 +-
 core/sql/generator/GenRelScan.cpp               |   89 +-
 core/sql/generator/Generator.cpp                |    3 +-
 core/sql/langman/LmJavaType.cpp                 |   21 +-
 core/sql/langman/LmJavaType.h                   |    1 +
 core/sql/langman/LmResultSetJava.cpp            |   56 +-
 core/sql/langman/LmRoutineCSql.cpp              |   27 +
 core/sql/lib_mgmt/pom.xml                       |    2 +-
 core/sql/nskgmake/openssl_client/Makefile       |   80 -
 core/sql/optimizer/BindRelExpr.cpp              |  279 ++--
 core/sql/optimizer/BindWA.h                     |    1 +
 core/sql/optimizer/EncodedValue.cpp             |   10 +-
 core/sql/optimizer/HDFSHook.cpp                 |    6 +
 core/sql/optimizer/HDFSHook.h                   |   11 +
 core/sql/optimizer/ItemExpr.cpp                 |   10 +-
 core/sql/optimizer/ItemFunc.h                   |   41 +-
 core/sql/optimizer/NAColumn.cpp                 |   50 +-
 core/sql/optimizer/NAColumn.h                   |    2 +-
 core/sql/optimizer/NATable.cpp                  |  140 +-
 core/sql/optimizer/NormRelExpr.cpp              |    4 +-
 core/sql/optimizer/OptRange.cpp                 |    2 -
 core/sql/optimizer/RelExeUtil.cpp               |   39 +-
 core/sql/optimizer/RelExeUtil.h                 |    9 +-
 core/sql/optimizer/RelExpr.cpp                  |    2 +-
 core/sql/optimizer/RelFastTransport.cpp         |    6 +-
 core/sql/optimizer/RelFastTransport.h           |   32 +-
 core/sql/optimizer/RelUpdate.h                  |    5 +
 core/sql/optimizer/ScanOptimizer.cpp            |    6 +
 core/sql/optimizer/ValueDesc.cpp                |   66 +-
 core/sql/optimizer/hiveHook.h                   |   25 +-
 core/sql/parser/ElemDDLCol.cpp                  |    2 +-
 core/sql/parser/ElemDDLLikeOptions.cpp          |   25 +
 core/sql/parser/ElemDDLLikeOptions.h            |   34 +
 core/sql/parser/ElemDDLNode.cpp                 |   32 +
 core/sql/parser/ElemDDLNode.h                   |    2 +
 core/sql/parser/ElemDDLSaltOptions.h            |    2 +
 core/sql/parser/ParDDLLikeOpts.cpp              |   45 +
 core/sql/parser/ParDDLLikeOptsCreateTable.h     |    8 +
 core/sql/parser/ParKeyWords.cpp                 |    3 -
 core/sql/parser/SqlParserGlobalsCmn.h           |   52 +-
 core/sql/parser/sqlparser.y                     |  134 +-
 core/sql/regress/compGeneral/EXPECTED015.SB     |  469 +++---
 core/sql/regress/core/EXPECTED162               |   22 +-
 core/sql/regress/executor/EXPECTED013.SB        |   42 +-
 core/sql/regress/executor/EXPECTED020           |    5 +
 core/sql/regress/executor/EXPECTED022.SB        |  246 +--
 core/sql/regress/executor/EXPECTED130           |  293 +++-
 core/sql/regress/executor/EXPECTED140           |  317 +++-
 core/sql/regress/executor/FILTER140             |    4 +
 core/sql/regress/executor/TEST013               |    4 -
 core/sql/regress/executor/TEST022               |   54 +-
 core/sql/regress/executor/TEST130               |   50 +-
 core/sql/regress/executor/TEST130_argfile2      |    3 +
 core/sql/regress/executor/TEST140               |   94 +-
 core/sql/regress/hive/EXPECTED001               |   22 +-
 core/sql/regress/hive/EXPECTED003               |  320 ++--
 core/sql/regress/hive/EXPECTED004               |  240 +--
 core/sql/regress/hive/EXPECTED005               |  212 ++-
 core/sql/regress/hive/EXPECTED006               |   19 +-
 core/sql/regress/hive/EXPECTED015               |   71 +-
 core/sql/regress/hive/EXPECTED018               |  633 +++++---
 core/sql/regress/hive/TEST003                   |   23 +-
 core/sql/regress/hive/TEST005                   |   48 +-
 core/sql/regress/hive/TEST005_a.hive.sql        |    8 +-
 core/sql/regress/hive/TEST006                   |    1 -
 core/sql/regress/hive/TEST015                   |    3 +-
 core/sql/regress/hive/TEST018                   |   58 +-
 .../hive/TEST018_create_hive_tables.hive        |   16 +-
 core/sql/regress/hive/tbl_bad.data              |    2 +-
 core/sql/regress/hive/tbl_type.data             |    2 +-
 core/sql/regress/privs1/EXPECTED133             |  Bin 26383 -> 26390 bytes
 core/sql/regress/privs1/TEST133                 |    2 +-
 core/sql/regress/seabase/EXPECTED003            |  425 ++++++
 core/sql/regress/seabase/EXPECTED040            |  275 ++++
 core/sql/regress/seabase/TEST003                |  138 ++
 core/sql/regress/seabase/TEST040                |  115 ++
 core/sql/regress/tools/runallsb                 |    2 +-
 core/sql/regress/tools/runregr_executor.ksh     |    2 +-
 core/sql/regress/tools/runregr_hive.ksh         |   39 +-
 core/sql/regress/udr/EXPECTED100.SB             |   53 +-
 core/sql/regress/udr/TEST100                    |   13 +
 core/sql/regress/udr/t100.java                  |    4 +
 core/sql/sqlci/Formatter.cpp                    |   14 +-
 core/sql/sqlci/Param.cpp                        |    4 +-
 core/sql/sqlci/SqlciEnv.cpp                     |   28 +-
 core/sql/sqlci/SqlciEnv.h                       |    2 +-
 core/sql/sqlcomp/CmpDDLCatErrorCodes.h          |    2 +-
 core/sql/sqlcomp/CmpSeabaseDDLauth.cpp          |  108 +-
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp        |  141 +-
 core/sql/sqlcomp/CmpSeabaseDDLroutine.cpp       |    2 +
 core/sql/sqlcomp/CmpSeabaseDDLschema.cpp        |    2 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp         |   25 +-
 core/sql/sqlcomp/DefaultConstants.h             |   37 +-
 core/sql/sqlcomp/NADefaults.h                   |    4 +-
 core/sql/sqlcomp/QCache.cpp                     |    4 +-
 core/sql/sqlcomp/nadefaults.cpp                 |  139 +-
 core/sql/sqludr/sqludr.cpp                      |    6 +
 .../java/org/trafodion/sql/ByteArrayList.java   |   54 -
 .../java/org/trafodion/sql/HBaseClient.java     |   93 +-
 .../java/org/trafodion/sql/HBulkLoadClient.java |   43 +-
 .../java/org/trafodion/sql/HTableClient.java    |   23 +-
 .../main/java/org/trafodion/sql/HiveClient.java |   59 +-
 .../java/org/trafodion/sql/ResultIterator.java  |  133 --
 .../org/trafodion/sql/ResultKeyValueList.java   |  100 --
 .../java/org/trafodion/sql/RowToInsert.java     |   44 -
 .../java/org/trafodion/sql/RowsToInsert.java    |   57 -
 .../org/trafodion/sql/SequenceFileWriter.java   |  129 +-
 .../java/org/trafodion/sql/StringArrayList.java |   47 -
 .../java/org/trafodion/sql/udr/ColumnInfo.java  |    6 +
 core/sql/ustat/hs_cli.cpp                       |   42 +-
 core/sql/ustat/hs_const.h                       |    1 +
 core/sql/ustat/hs_faststats.cpp                 |    6 +
 core/sql/ustat/hs_globals.cpp                   |  266 ++--
 core/sql/ustat/hs_la.cpp                        |   36 +-
 core/sql/ustat/hs_la.h                          |   23 +-
 core/sql/ustat/hs_parser.cpp                    |   13 +
 dcs/Makefile                                    |   17 +-
 dcs/pom.xml                                     |   46 +-
 dcs/src/assembly/all.xml                        |    8 +-
 .../java/org/trafodion/dcs/util/JdbcT4Util.java |   24 +-
 .../src/asciidoc/_chapters/jdbct4.adoc          |    9 +-
 .../src/asciidoc/_chapters/odbc_windows.adoc    |    6 +-
 .../src/asciidoc/_chapters/commands.adoc        |    4 +-
 .../src/asciidoc/_chapters/parser_msgs.adoc     |   13 +
 .../src/asciidoc/_chapters/sqlstate.adoc        |    1 +
 .../src/asciidoc/_chapters/activate.adoc        |    2 +-
 .../src/asciidoc/_chapters/enable_security.adoc |   12 +-
 .../src/asciidoc/_chapters/introduction.adoc    |   26 +-
 .../src/asciidoc/_chapters/prepare.adoc         |   12 +-
 .../src/asciidoc/_chapters/requirements.adoc    |    6 +-
 .../src/asciidoc/_chapters/script_install.adoc  |   38 +-
 .../src/asciidoc/_chapters/script_remove.adoc   |    8 +-
 .../src/asciidoc/_chapters/script_upgrade.adoc  |   26 +-
 .../src/asciidoc/_chapters/sql_statements.adoc  |   46 +-
 docs/src/site/markdown/documentation.md         |    8 +-
 docs/src/site/markdown/download.md              |  159 +-
 docs/src/site/markdown/index.md                 |   16 +-
 docs/src/site/markdown/release-notes-2-0-0.md   |  152 ++
 docs/src/site/markdown/release-notes-2-0-1.md   |   40 +
 docs/src/site/markdown/release-notes.md         |    4 +-
 docs/src/site/resources/css/site.css            |    2 +-
 docs/src/site/site.xml                          |    3 +-
 install/Makefile                                |   18 +-
 install/installer/dcs_installer                 |   19 +-
 install/installer/rest_installer                |   21 +-
 .../installer/traf_apache_hadoop_config_setup   |  842 -----------
 install/installer/traf_cloudera_mods            |    3 +-
 install/installer/traf_config                   |   62 +-
 install/installer/traf_config_check             |   44 +-
 install/installer/traf_config_setup             |   69 +-
 install/installer/traf_hortonworks_mods         |    4 +-
 install/installer/traf_package_setup            |    4 +-
 .../installer/trafodion_apache_hadoop_install   |  763 ----------
 install/installer/trafodion_config_default      |   14 +-
 install/installer/trafodion_install             |  153 +-
 install/traf_tools_setup.sh                     |    1 +
 licenses/Makefile                               |   15 +-
 licenses/lic-clients-bin                        |  136 +-
 licenses/lic-dcs-bin                            |  652 --------
 licenses/lic-dcs-src                            |   69 -
 licenses/lic-rest-bin                           | 1416 ------------------
 licenses/lic-server-bin                         | 1278 ++++++++++++++++
 licenses/lic-server-src                         |   72 +
 licenses/not-dcs-bin                            |   20 -
 licenses/not-rest-bin                           |   20 -
 licenses/note-server-bin                        |   20 +
 pom.xml                                         |    1 +
 win-odbc64/odbcclient/drvr35/cconnect.cpp       |    9 +-
 361 files changed, 14735 insertions(+), 13040 deletions(-)
----------------------------------------------------------------------



[13/16] incubator-trafodion git commit: Refactor and fix repository upgrade code

Posted by db...@apache.org.
Refactor and fix repository upgrade code


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

Branch: refs/heads/master
Commit: 1cfc0ed8bcaa9c3953d702429a406a8c4635b61c
Parents: a49afa1
Author: Dave Birdsall <db...@apache.org>
Authored: Wed Jul 13 18:42:53 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Wed Jul 13 18:42:53 2016 +0000

----------------------------------------------------------------------
 core/sql/sqlcomp/CmpSeabaseDDL.h          |  10 +-
 core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp   | 160 ++++++++++++++----
 core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp | 225 +++++++++++++++++++++----
 core/sql/sqlcomp/CmpSeabaseDDLupgrade.h   | 193 ++++++++++++++++++++-
 4 files changed, 517 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1cfc0ed8/core/sql/sqlcomp/CmpSeabaseDDL.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDL.h b/core/sql/sqlcomp/CmpSeabaseDDL.h
index 21f5cbe..a00a7ec 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDL.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDL.h
@@ -1286,10 +1286,18 @@ protected:
 
   short createRepos(ExeCliInterface * cliInterface);
   short dropRepos(ExeCliInterface * cliInterface, 
-                  NABoolean oldRepos = FALSE, NABoolean dropSchema = TRUE);
+                  NABoolean oldRepos = FALSE, NABoolean dropSchema = TRUE,
+                  NABoolean inRecovery = FALSE);
   short alterRenameRepos(ExeCliInterface * cliInterface, NABoolean newToOld);
   short copyOldReposToNew(ExeCliInterface * cliInterface);
+
+public:
+
   short upgradeRepos(ExeCliInterface * cliInterface, CmpDDLwithStatusInfo *mdui);
+  short upgradeReposComplete(ExeCliInterface * cliInterface, CmpDDLwithStatusInfo *mdui);
+  short upgradeReposUndo(ExeCliInterface * cliInterface, CmpDDLwithStatusInfo *mdui);
+
+protected:
 
   void processRepository(NABoolean createR, NABoolean dropR, NABoolean upgradeR);
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1cfc0ed8/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp b/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
index bc39c8d..f4704ea 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLrepos.cpp
@@ -137,7 +137,8 @@ short CmpSeabaseDDL::createRepos(ExeCliInterface * cliInterface)
 
 short CmpSeabaseDDL::dropRepos(ExeCliInterface * cliInterface,
                                NABoolean oldRepos,
-                               NABoolean dropSchema)
+                               NABoolean dropSchema,
+                               NABoolean inRecovery)
 {
   Lng32 cliRC = 0;
   NABoolean xnWasStartedHere = FALSE;
@@ -147,6 +148,13 @@ short CmpSeabaseDDL::dropRepos(ExeCliInterface * cliInterface,
     {
       const MDUpgradeInfo &rti = allReposUpgradeInfo[i];
 
+      // If we are dropping the new repository as part of a recovery action,
+      // and there is no "old" table (because the table didn't change in this
+      // upgrade), then don't drop the new table. (If we did, we would be 
+      // dropping the existing data.)
+      if (!oldRepos && inRecovery && !rti.oldName)
+        continue;
+
       if ((oldRepos && !rti.oldName) || (NOT oldRepos && ! rti.newName))
         continue;
 
@@ -361,7 +369,7 @@ short CmpSeabaseDDL::upgradeRepos(ExeCliInterface * cliInterface,
         {
         case 0:
           {
-            mdui->setMsg("Upgrade Repository: started");
+            mdui->setMsg("Upgrade Repository: Started");
             mdui->subStep()++;
             mdui->setEndStep(FALSE);
         
@@ -383,7 +391,10 @@ short CmpSeabaseDDL::upgradeRepos(ExeCliInterface * cliInterface,
           {
             // drop old repository
             if (dropRepos(cliInterface, TRUE/*old repos*/, FALSE/*no schema drop*/))
-              return -1;
+              return -3;  // error, but no recovery needed (and in fact
+                          // doing such things as dropping the *new* repository
+                          // would just destroy the existing repository data
+                          // that we wish to save)
         
             mdui->setMsg("  End:   Drop Old Repository");
             mdui->subStep()++;
@@ -407,10 +418,7 @@ short CmpSeabaseDDL::upgradeRepos(ExeCliInterface * cliInterface,
           {
             // rename current repository tables to *_OLD_REPOS
             if (alterRenameRepos(cliInterface, TRUE))
-              {
-                mdui->setSubstep(12); // label_error1
-                break;
-              }
+              return -2;  // error, need to undo the rename only
 
             mdui->setMsg("  End:   Rename Current Repository");
             mdui->subStep()++;
@@ -434,10 +442,7 @@ short CmpSeabaseDDL::upgradeRepos(ExeCliInterface * cliInterface,
           {
             // create new repository
             if (createRepos(cliInterface))
-              {
-                mdui->setSubstep(13); // label_error2
-                break;
-              }
+              return -1;  // error, need to drop new repository then undo rename
         
             mdui->setMsg("  End:   Create New Repository");
             mdui->subStep()++;
@@ -461,10 +466,7 @@ short CmpSeabaseDDL::upgradeRepos(ExeCliInterface * cliInterface,
           {
             // copy old contents into new repository
             if (copyOldReposToNew(cliInterface))
-              {
-                mdui->setSubstep(13); // label_error2
-                break;
-              }
+              return -1;  // error, need to drop new repository then undo rename
         
             mdui->setMsg("  End:   Copy Old Repository Contents ");
             mdui->subStep()++;
@@ -473,10 +475,38 @@ short CmpSeabaseDDL::upgradeRepos(ExeCliInterface * cliInterface,
             return 0;
           }
           break;
-      
+
         case 9:
           {
-            mdui->setMsg("  Start: Drop Old Repository ");
+            mdui->setMsg("Upgrade Repository: Done except for cleaning up");
+            mdui->setSubstep(0);
+            mdui->setEndStep(TRUE);
+        
+            return 0;
+          }
+          break;
+
+        default:
+          return -1;
+        }
+    } // while
+
+  return 0;
+}
+      
+
+short CmpSeabaseDDL::upgradeReposComplete(ExeCliInterface * cliInterface,
+                                          CmpDDLwithStatusInfo *mdui)
+{
+  Lng32 cliRC = 0;
+
+  while (1) // exit via return stmt in switch
+    {
+      switch (mdui->subStep())
+        {
+        case 0:
+          {
+            mdui->setMsg("Upgrade Repository: Drop Old Repository");
             mdui->subStep()++;
             mdui->setEndStep(FALSE);
         
@@ -484,47 +514,105 @@ short CmpSeabaseDDL::upgradeRepos(ExeCliInterface * cliInterface,
           }
           break;
 
-        case 10:
+        case 1:
           {
-            // drop old repository
+            // drop old repository; ignore errors
             dropRepos(cliInterface, TRUE/*old repos*/, FALSE/*no schema drop*/);
         
-            mdui->setMsg("  End:   Drop Old Repository");
+            mdui->setMsg("Upgrade Repository: Drop Old Repository done");
+            mdui->setEndStep(TRUE);
+            mdui->setSubstep(0);
+         
+            return 0;
+          }
+          break;
+
+        default:
+          return -1;
+        }
+    } // while
+
+  return 0;
+}
+
+short CmpSeabaseDDL::upgradeReposUndo(ExeCliInterface * cliInterface,
+                                      CmpDDLwithStatusInfo *mdui)
+{
+  Lng32 cliRC = 0;
+
+  while (1) // exit via return stmt in switch
+    {
+      switch (mdui->subStep())
+        {
+        // error return codes from upgradeRepos can be mapped to
+        // the right recovery substep by this formula: substep = -(retcode + 1)
+        case 0: // corresponds to -1 return code from upgradeRepos (or
+                // to full recovery after some error after upgradeRepos)
+        case 1: // corresponds to -2 return code from upgradeRepos
+        case 2: // corresponds to -3 return code from upgradeRepos
+          {
+            mdui->setMsg("Upgrade Repository: Restoring Old Repository");
+            mdui->setSubstep(2*mdui->subStep()+3); // go to appropriate case
+            mdui->setEndStep(FALSE);
+        
+            return 0;
+          }
+          break;
+
+        case 3:
+          {
+            mdui->setMsg(" Start: Drop New Repository");
             mdui->subStep()++;
             mdui->setEndStep(FALSE);
-         
+        
             return 0;
           }
           break;
 
-        case 11:
+        case 4:
           {
-            mdui->setMsg("Upgrade Repository: done");
+            // drop new repository; ignore errors
+            dropRepos(cliInterface, FALSE/*new repos*/, FALSE/*no schema drop*/,
+                      TRUE /* don't drop new tables that haven't been upgraded */);
+            cliInterface->clearGlobalDiags();
+            mdui->setMsg(" End: Drop New Repository");
             mdui->subStep()++;
-            mdui->setEndStep(TRUE);
-            mdui->setSubstep(0);
-  
+            mdui->setEndStep(FALSE);
+        
+            return 0;
+          }
+          break;
+
+        case 5:
+          {
+            mdui->setMsg(" Start: Rename Old Repository back to New");
+            mdui->subStep()++;
+            mdui->setEndStep(FALSE);
+        
             return 0;
           }
           break;
  
-        case 12: // label_error1
+        case 6:
           {
-            // rename old repos to current
+            // rename old repos to current; ignore errors
             alterRenameRepos(cliInterface, FALSE);
-            return -1;
+            cliInterface->clearGlobalDiags();
+            mdui->setMsg(" End: Rename Old Repository back to New");
+            mdui->subStep()++;
+            mdui->setEndStep(FALSE);
+        
+            return 0;
           }
           break;
 
-        case 13: // label_error2
+        case 7:
           {
-            // drop new repository
-            dropRepos(cliInterface, FALSE/*new repos*/, FALSE/*no schema drop*/);
-        
-            // rename old to new
-            alterRenameRepos(cliInterface, FALSE);
+            mdui->setMsg("Upgrade Repository: Restore done");
+            mdui->setSubstep(0);
+            mdui->setEndStep(TRUE);
         
-            return -1;
+            return 0;
           }
           break;
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1cfc0ed8/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
index 1c058df..48ad516 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
@@ -310,15 +310,22 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
   char msgBuf[1000];
   char buf[10000];
 
+  // interfaces for upgrading subsystems; OK to create on stack for
+  // now as they are stateless
+  CmpSeabaseUpgradeRepository upgradeRepository;
+  CmpSeabaseUpgradePrivMgr upgradePrivMgr;
+
   ExeCliInterface cliInterface(STMTHEAP, NULL, NULL,
     CmpCommon::context()->sqlSession()->getParentQid());
   ExpHbaseInterface * ehi = NULL;
 
   while (1)
     {
-      // TODO: remove this debugging code
-      cout << "mdui->step() is " << mdui->step() << ", mdui->subStep() is " << mdui->subStep() << endl;
-      // TODO: remove the above debugging code
+      // The line below is useful when debugging upgrade; it shows the step progression
+      // through the upgrade state machine.
+      // cout << "mdui->step() is " << mdui->step() 
+      //      << ", mdui->subStep() is " << mdui->subStep() << endl;
+
       switch (mdui->step())
 	{
 	case UPGRADE_START: 
@@ -440,7 +447,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		
 	      case 2:
 		{
-		  str_sprintf(msgBuf, "  Metadata need to be upgraded or reinitialized.");
+		  str_sprintf(msgBuf, "  Metadata needs to be upgraded or reinitialized.");
 		  mdui->setMsg(msgBuf);
 		  mdui->setEndStep(FALSE);
 		  
@@ -534,7 +541,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
                   else
                     {
                       if (retcode == -1395)
-                        str_sprintf(msgBuf, "   Metadata need to be upgraded or reinitialized (Current Version %Ld.%Ld.%Ld, Expected Version %Ld.%Ld.%Ld).",
+                        str_sprintf(msgBuf, "   Metadata needs to be upgraded or reinitialized (Current Version %Ld.%Ld.%Ld, Expected Version %Ld.%Ld.%Ld).",
                                     mdCurrMajorVersion, mdCurrMinorVersion, mdCurrUpdateVersion,
                                     (Int64)METADATA_MAJOR_VERSION, (Int64)METADATA_MINOR_VERSION, (Int64)METADATA_UPDATE_VERSION);   
                       else
@@ -577,7 +584,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		
 	      case 2:
 		{
-		  str_sprintf(msgBuf, "  Metadata need to be updated with current software version. Run 'initialize trafodion, update software version' to update it.");
+		  str_sprintf(msgBuf, "  Metadata needs to be updated with current software version. Run 'initialize trafodion, update software version' to update it.");
 		  mdui->setMsg(msgBuf);
 		  mdui->setEndStep(FALSE);
 		  
@@ -666,17 +673,17 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 
                               if (isMDUpgradeNeeded())
                                 {
-                                  upgItems += " Catalogs, ";
+                                  upgItems += " Catalogs,";
                                 }
                               if (isViewsUpgradeNeeded())
                                 {
                                   upgItems += " Views,";
                                 }
-                              if (isPrivsUpgradeNeeded())
+                              if (upgradePrivMgr.needsUpgrade(this))
                                 {
                                   upgItems += " Privileges,";
                                 }
-                              if (isReposUpgradeNeeded())
+                              if (upgradeRepository.needsUpgrade(this))
                                 {
                                   upgItems += " Repository,";
                                 }
@@ -686,7 +693,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
                                   upgItems += ".";
                                 }
                             }
-			  str_sprintf(msgBuf, "  Metadata need to be upgraded from Version %Ld.%Ld.%Ld to %Ld.%Ld.%Ld.%s",
+			  str_sprintf(msgBuf, "  Metadata needs to be upgraded from Version %Ld.%Ld.%Ld to %Ld.%Ld.%Ld.%s",
 				      mdCurrMajorVersion, mdCurrMinorVersion/10, 
                                       (mdCurrMinorVersion - (mdCurrMinorVersion/10)*10),
 				      METADATA_MAJOR_VERSION, METADATA_MINOR_VERSION,
@@ -1426,7 +1433,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		{
                   if (NOT isViewsUpgradeNeeded())
                     {
-                      mdui->setStep(UPGRADE_PRIV_MGR);
+                      mdui->setStep(UPGRADE_REPOS);
                       mdui->setSubstep(0);
                       break;
                     }
@@ -1492,7 +1499,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		    }
 		  
 		  mdui->setMsg("Update Metadata Views: done");
-		  mdui->setStep(UPGRADE_PRIV_MGR);
+		  mdui->setStep(UPGRADE_REPOS);
 		  mdui->setSubstep(0);
 		  mdui->setEndStep(TRUE);
 
@@ -1506,13 +1513,20 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 
         case UPGRADE_PRIV_MGR:
           {
+            // Note: We used to do this case before UPGRADE_REPOS, but
+            // that was changed in Trafodion 2.1 to do it afterwards instead.
+            // The reason is that the Privilege Manager does not adhere
+            // to the CmpSeabaseUpgradeSubsystem class contract; its drop
+            // and recovery logic is packaged in its upgrade method. So,
+            // we have to do the Privilege Manager upgrade last since there
+            // is no way to undo it if we have an error afterward.
 	    switch (mdui->subStep())
 	      {
 	      case 0:
 		{
-                  if (NOT isPrivsUpgradeNeeded())
+                  if (NOT upgradePrivMgr.needsUpgrade(this))
                     {
-                      mdui->setStep(UPGRADE_REPOS);
+                      mdui->setStep(UPDATE_VERSION);
                       mdui->setSubstep(0);
                       break;
                     }
@@ -1527,12 +1541,11 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		
 	      case 1:
 		{
-                  NAString privMgrDoneMsg;
 		  if (xnInProgress(&cliInterface))
 		    {
 		      *CmpCommon::diags() << DgSqlCode(-20123);
 
-		      mdui->setStep(UPGRADE_FAILED);
+		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_REPOS);
 		      mdui->setSubstep(0);
 
 		      break;
@@ -1543,16 +1556,16 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		    {
 		      cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
 
-		      mdui->setStep(UPGRADE_FAILED);
+		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_REPOS);
 		      mdui->setSubstep(0);
 
 		      break;
 		    }
 		  
-		  cliRC = upgradePrivMgr(&cliInterface, ddlXns, privMgrDoneMsg);
+		  cliRC = upgradePrivMgr.doUpgrade(&cliInterface,mdui,this,ddlXns);
 		  if (cliRC != 0)
 		    {
-		      mdui->setStep(UPGRADE_FAILED);
+		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_REPOS);
 		      mdui->setSubstep(0);
 
 		      break;
@@ -1563,14 +1576,14 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		    {
 		      cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
 		    
-		      mdui->setStep(UPGRADE_FAILED);
+		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_REPOS);
 		      mdui->setSubstep(0);
 
 		      break;
 		    }
 		  
-		  mdui->setMsg(privMgrDoneMsg.data());
-		  mdui->setStep(UPGRADE_REPOS);
+                  // mdui->setMsg() was called in upgradePrivMgr.doUpgrade()
+		  mdui->setStep(UPDATE_VERSION);
 		  mdui->setSubstep(0);
 		  mdui->setEndStep(TRUE);
 
@@ -1586,7 +1599,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
           {
             if (NOT isReposUpgradeNeeded())
               {
-                mdui->setStep(UPDATE_VERSION);
+                mdui->setStep(UPGRADE_PRIV_MGR);
                 mdui->setSubstep(0);
                 break;
               }
@@ -1601,18 +1614,18 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
                 break;
               }
             
-            cliRC = upgradeRepos(&cliInterface, mdui);
+            cliRC = upgradeRepository.doUpgrade(&cliInterface, mdui, this, ddlXns);
             if (cliRC != 0)
               {
-                mdui->setStep(UPGRADE_FAILED);
-                mdui->setSubstep(0);
+                mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_REPOS);
+                mdui->setSubstep(-(cliRC+1));
                 
                 break;
               }
             
             if (mdui->endStep())
               {
-                mdui->setStep(UPDATE_VERSION);
+                mdui->setStep(UPGRADE_PRIV_MGR);
                 mdui->setSubstep(0);
               }
             
@@ -1640,7 +1653,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		    {
 		      *CmpCommon::diags() << DgSqlCode(-20123);
 
-		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_MD);
+		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_REPOS);
 		      mdui->setSubstep(0);
 
 		      break;
@@ -1651,7 +1664,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		    {
 		      cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
 
-		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_MD);
+		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_REPOS);
 		      mdui->setSubstep(0);
 
 		      break;
@@ -1660,7 +1673,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		  cliRC = updateSeabaseVersions(&cliInterface, TRAFODION_SYSCAT_LIT);
 		  if (cliRC < 0)
 		    {
-		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_MD);
+		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_REPOS);
 		      mdui->setSubstep(0);
 
 		      break;
@@ -1674,7 +1687,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		    {
 		      cliInterface.retrieveSQLDiagnostics(CmpCommon::diags());
 		    
-		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_MD);
+		      mdui->setStep(UPGRADE_FAILED_RESTORE_OLD_REPOS);
 		      mdui->setSubstep(0);
 
 		      break;
@@ -1686,7 +1699,7 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
                       (NOT isViewsUpgradeNeeded()))
                     mdui->setStep(METADATA_UPGRADED);
                   else
-                    mdui->setStep(OLD_MD_TABLES_HBASE_DELETE);
+                    mdui->setStep(OLD_REPOS_DROP);
 		  mdui->setSubstep(0);
 		  mdui->setEndStep(TRUE);
                   
@@ -1697,6 +1710,32 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 	  }
 	  break;
 
+	case OLD_REPOS_DROP:
+	  {
+            if (upgradeRepository.needsUpgrade(this))
+              {
+                if (upgradeRepository.doDrops(&cliInterface,mdui,this))
+                  {
+                    // no status message in this case so no return
+                    cliInterface.clearGlobalDiags();
+                    mdui->setStep(OLD_MD_TABLES_HBASE_DELETE);
+                    mdui->setSubstep(0);
+                    mdui->setEndStep(TRUE);
+                  }
+                else
+                  {
+                    if (mdui->endStep())
+                      {
+                        mdui->setStep(OLD_MD_TABLES_HBASE_DELETE);
+                        mdui->setSubstep(0);
+                        mdui->setEndStep(TRUE);
+                      }                   
+                    return 0;
+                  }
+              }
+	  }
+	  break;
+
 	case OLD_MD_TABLES_HBASE_DELETE:
 	  {
 	    switch (mdui->subStep())
@@ -1814,6 +1853,51 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 	  }
 	  break;
 
+        case UPGRADE_FAILED_RESTORE_OLD_REPOS:
+          {
+            // Note: We can't combine this case with UPGRADE_FAILED etc.
+            // below, because the subsystem code uses mdui->subStep()
+            // to keep track of its progress.
+
+            if (upgradeRepository.needsUpgrade(this))
+              {
+                if (xnInProgress(&cliInterface))
+                  {
+                    cliRC = rollbackXn(&cliInterface);
+                    if (cliRC < 0)
+                      {
+                        // ignore errors
+                      }
+                  }
+
+                if (upgradeRepository.doUndo(&cliInterface,mdui,this))
+                  {
+                    // ignore errors; no status message so just continue on
+                    cliInterface.clearGlobalDiags();
+                    mdui->setStep(UPGRADE_FAILED_DROP_OLD_MD);
+                    mdui->setSubstep(0);
+                    mdui->setEndStep(TRUE);
+                  }
+                else
+                  {
+                    if (mdui->endStep())
+                      {
+                        mdui->setStep(UPGRADE_FAILED_DROP_OLD_MD);
+                        mdui->setSubstep(0);
+                        mdui->setEndStep(TRUE);
+                      }
+                    return 0;
+                  }
+              }
+            else
+              {
+                mdui->setStep(UPGRADE_FAILED_DROP_OLD_MD);
+                mdui->setSubstep(0);
+                mdui->setEndStep(TRUE);
+              }
+          }
+          break;
+
 	case UPGRADE_FAILED:
 	case UPGRADE_FAILED_RESTORE_OLD_MD:
 	case UPGRADE_FAILED_DROP_OLD_MD:
@@ -2414,6 +2498,83 @@ short CmpSeabaseMDupgrade::customizeNewMDv23tov30(CmpDDLwithStatusInfo *mdui,
 }
 
 // ----------------------------------------------------------------------------
+// Methods for class CmpSeabaseUpgradeRepository
+// ----------------------------------------------------------------------------
+NABoolean CmpSeabaseUpgradeRepository::needsUpgrade(CmpSeabaseMDupgrade * ddlState)
+{ 
+  return ddlState->isReposUpgradeNeeded();
+}
+
+short CmpSeabaseUpgradeRepository::doUpgrade(ExeCliInterface * cliInterface,
+  CmpDDLwithStatusInfo * mdui,
+  CmpSeabaseMDupgrade * ddlState,
+  NABoolean /* ddlXns */)
+{
+  return ddlState->upgradeRepos(cliInterface,mdui);
+}
+
+short CmpSeabaseUpgradeRepository::doDrops(ExeCliInterface * cliInterface,
+  CmpDDLwithStatusInfo * mdui, CmpSeabaseMDupgrade * ddlState)
+{
+  return ddlState->upgradeReposComplete(cliInterface,mdui);
+}
+
+short CmpSeabaseUpgradeRepository::doUndo(ExeCliInterface * cliInterface,
+  CmpDDLwithStatusInfo * mdui, CmpSeabaseMDupgrade * ddlState)
+{
+  return ddlState->upgradeReposUndo(cliInterface,mdui);
+}
+
+// ----------------------------------------------------------------------------
+// Methods for class CmpSeabaseUpgradePrivMgr
+// ----------------------------------------------------------------------------
+NABoolean CmpSeabaseUpgradePrivMgr::needsUpgrade(CmpSeabaseMDupgrade * ddlState)
+{ 
+  return ddlState->isPrivsUpgradeNeeded();
+}
+
+short CmpSeabaseUpgradePrivMgr::doUpgrade(ExeCliInterface * cliInterface,
+  CmpDDLwithStatusInfo * mdui,
+  CmpSeabaseMDupgrade * ddlState,
+  NABoolean ddlXns)
+{
+  // If this is refactored in the future to return multiple messages
+  // then mdui will need to be passed in, and setEndStep called when
+  // we want to stop redriving this method.
+  NAString doneString;
+  short retcode = ddlState->upgradePrivMgr(cliInterface, ddlXns, doneString);
+  if (!retcode)
+    {
+      mdui->setMsg(doneString.data());
+      mdui->setEndStep(TRUE);
+    }
+  return retcode;
+}
+
+short CmpSeabaseUpgradePrivMgr::doDrops(ExeCliInterface * cliInterface,
+  CmpDDLwithStatusInfo * mdui, CmpSeabaseMDupgrade * ddlState)
+{
+  // At the moment, the privilege manager does not adhere to the contract.
+  // It does its drops inside the CmpSeabaseMDupgrade::upgradePrivMgr
+  // method. That is why the upgrade state machine above must do the
+  // privilege manager last. Because if there were an error afterward
+  // that required us to revert to previous state, we couldn't since
+  // the drops have already been done.
+  return 0;  // stubbed, until Privilege Manager upgrade is refactored
+}
+
+short CmpSeabaseUpgradePrivMgr::doUndo(ExeCliInterface * cliInterface,
+  CmpDDLwithStatusInfo * mdui, CmpSeabaseMDupgrade * ddlState)
+{
+  // At the moment, the privilege manager does not adhere to the contract.
+  // It does its recovery inside the CmpSeabaseMDupgrade::upgradePrivMgr
+  // method. That is why the upgrade state machine above must do the
+  // privilege manager last. Because if there were an error afterward
+  // that required us to revert to previous state, we couldn't since
+  // the drops have already been done.
+  return 0;  // stubbed, until Privilege Manager upgrade is refactored
+}
+// ----------------------------------------------------------------------------
 // method: upgradePrivMgr
 //
 // This method upgrades the privilege manager repository

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/1cfc0ed8/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
index 3fcc94b..4182a3d 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
@@ -60,6 +60,81 @@ CmpSeabaseDDLupgrade.cpp
   -- modify CUSTOMIZE_NEW_MD case if something specified need to be done.
     Ex: update new sql_data_type field in COLUMNS table
 
+Similar changes may be needed for subsystems that are upgraded as part
+of "initialize trafodion, upgrade", for example the Repository and the
+Privilege Manager. The Repository upgrade code is in CmpSeabaseDDLrepos.h/.cpp,
+while the Privilege Manager code is in the Priv* modules.
+
+The architecture of upgrade is as follows:
+
+Guiding principle:
+
+In the event of a failure, we do our best to put things back to their
+initial state. That allows the user to try again (for example, for a
+transient HBase difficulty), or to reinstall the old software if desired.
+
+Control flow:
+
+First we upgrade the metadata tables ("_MD_" schema). This has to be done
+using bootstrapping techniques. We rename the existing metadata tables
+to an old name, using HBase primitives. We then create the new metadata
+tables, and copy the data from the old tables to the new, transforming it
+as needed. The copy is done using a vanilla UPSERT/SELECT. We can do this
+because at process startup time, the NATable cache is bootstrapped with
+both the old and new metadata table definitions. We don't drop the old
+metadata tables yet, because we want to be able to revert to our initial
+state should an error occur.
+
+Subsystems are upgraded after the metadata table upgrade succeeds. The 
+subsystems are not self-referencing from a metadata point of view. So, 
+for example, it is possible to rename a subsystem table using a SQL 
+ALTER TABLE RENAME statement, which is not true for a metadata table.
+
+Subsystems go through basically the same steps: Rename the existing table
+to old, create the new, copy the data in. Again, the old tables are not
+dropped yet, so we can revert in the event of an error (in the next 
+subsystem for example).
+
+Once all the subsystems have been upgraded, we update the version in
+the VERSIONS table.
+
+Finally, we drop all the old tables. We can ignore errors at this point
+because we have good new tables.
+
+If there is an error, we undo the upgrade for each subsystem, then undo
+the upgrade for the metadata tables. Again, we can use vanilla SQL for
+the subsystems, but must use low level HBase primitives for the metadata
+tables.
+
+The CmpSeabaseUpgradeSubsystem class defines the contract that a subsystem
+must implement in order to be called from "initialize trafodion, upgrade".
+Briefly, each subsystem must implement the following:
+
+-- a method that says whether an upgrade is needed for that subsystem
+-- a method that does the upgrade, but leaves the old tables around
+   so that they can be recovered in case we have to undo the upgrade
+-- a method that drops the old tables, called when we have decided that
+   the upgrade has succeeded
+-- a method that undoes the upgrade, called when an error is detected
+   in "initialize trafodion, upgrade".
+
+These are packaged in separate methods because, as mentioned above,
+processing is interleaved. We do all the subsystem upgrades. If they are
+all successful, we do the drops. But if there was an error, we do the undo's.
+
+Data flow:
+
+The "initialize trafodion, upgrade" statement is a DDL statement that returns
+rows. The rows are status messages, which if displayed immediately (as they
+would be, say, in sqlci or trafci), give a real time status of the operation.
+
+As such, the upgrade methods are redriven after each row is returned. The
+upgrade processing occurs in a tdm_arkcmp process. All state is kept in the
+message objects communicated between it and its invoker. For this reason,
+the classes used for the upgrade methods are stateless. Instead, state 
+consists of state-machine step information which is stored in a
+CmpDDLwithStatusInfo object.
+
 ***************************************************************************************/
 
 // structure containing information on old and new MD tables
@@ -501,13 +576,14 @@ class CmpSeabaseMDupgrade : public CmpSeabaseDDL
     OLD_TABLES_MD_DELETE,
     OLD_MD_TABLES_HBASE_DELETE,
     UPDATE_MD_VIEWS,
-    UPGRADE_PRIV_MGR,
     UPGRADE_REPOS,
+    UPGRADE_PRIV_MGR,
     UPDATE_VERSION,
-    OLD_MD_DROP_POST,
+    OLD_REPOS_DROP,
     METADATA_UPGRADED,
     UPGRADE_DONE,
     UPGRADE_FAILED,
+    UPGRADE_FAILED_RESTORE_OLD_REPOS,
     UPGRADE_FAILED_RESTORE_OLD_MD,
     UPGRADE_FAILED_DROP_OLD_MD,
     GET_MD_VERSION,
@@ -553,5 +629,118 @@ class CmpSeabaseMDupgrade : public CmpSeabaseDDL
 
 };
 
+
+// abstract class defining the contract that a subsystem must implement
+// in order to be called from "initialize trafodion, upgrade"
+class CmpSeabaseUpgradeSubsystem
+{
+  public:
+
+    CmpSeabaseUpgradeSubsystem(void) { } ;
+    ~CmpSeabaseUpgradeSubsystem(void) { } ;
+  
+    // Returns TRUE if an upgrade is needed, FALSE if not
+    virtual NABoolean needsUpgrade(CmpSeabaseMDupgrade * ddlState) = 0;
+
+    // The next three methods have the same return interface:
+    //
+    // returns 0 if successful or not done yet, a negative value
+    // if not. ("Not done yet" means call again. This allows
+    // the method to return status text messages to the user as
+    // it progresses in its processing.) To signal successful
+    // completion, the method should return 0, and call
+    // mdui->setEndStep(TRUE). Any state needed across calls
+    // should be kept in the CmpDDLwithStatusInfo object,
+    // e.g., via its setStep and setSubstep methods.
+    //
+    // The negative value can be used to signal what sort of
+    // recovery is needed.
+
+    // Does the upgrade, but leaves old tables there in case we
+    // need to undo.
+    virtual short doUpgrade(ExeCliInterface * cliInterface,
+                            CmpDDLwithStatusInfo * mdui,
+                            CmpSeabaseMDupgrade * ddlState,
+                            NABoolean ddlXns) = 0;
+
+    // Drops the old tables left behind by doUpgrade; errors
+    // are typically ignored as at this point upgrade is
+    // done except for dropping old tables. 
+    virtual short doDrops(ExeCliInterface * cliInterface,
+                         CmpDDLwithStatusInfo * mdui,
+                         CmpSeabaseMDupgrade * ddlState) = 0;
+
+    // Undoes the upgrade by putting the old tables back to
+    // their original names.
+    virtual short doUndo(ExeCliInterface * cliInterface,
+                         CmpDDLwithStatusInfo * mdui,
+                         CmpSeabaseMDupgrade * ddlState) = 0;
+
+  private:
+
+    // for now, avoid having any state; the upgrade mainline
+    // keeps most of its state in the CmpDDLwithStatusInfo message
+};
+
+// Repository specialization
+
+class CmpSeabaseUpgradeRepository : public CmpSeabaseUpgradeSubsystem
+{
+  public:
+
+    CmpSeabaseUpgradeRepository(void) { } ;
+    ~CmpSeabaseUpgradeRepository(void) { } ;
+  
+    NABoolean needsUpgrade(CmpSeabaseMDupgrade * ddlState);
+
+    short doUpgrade(ExeCliInterface * cliInterface,
+                    CmpDDLwithStatusInfo * mdui,
+                    CmpSeabaseMDupgrade * ddlState,
+                    NABoolean ddlXns);
+
+    short doDrops(ExeCliInterface * cliInterface,
+                  CmpDDLwithStatusInfo * mdui,
+                  CmpSeabaseMDupgrade * ddlState);
+
+    short doUndo(ExeCliInterface * cliInterface,
+                 CmpDDLwithStatusInfo * mdui,
+                 CmpSeabaseMDupgrade * ddlState);
+  
+  private:
+
+    // avoid having state for now
+
+};
+
+// Privilege Manager specialization
+
+class CmpSeabaseUpgradePrivMgr : public CmpSeabaseUpgradeSubsystem
+{
+  public:
+
+    CmpSeabaseUpgradePrivMgr(void) { } ;
+    ~CmpSeabaseUpgradePrivMgr(void) { } ;
+  
+    NABoolean needsUpgrade(CmpSeabaseMDupgrade * ddlState);
+
+    short doUpgrade(ExeCliInterface * cliInterface,
+                    CmpDDLwithStatusInfo * mdui,
+                    CmpSeabaseMDupgrade * ddlState,
+                    NABoolean ddlXns);
+ 
+    short doDrops(ExeCliInterface * cliInterface,
+                  CmpDDLwithStatusInfo * mdui,
+                  CmpSeabaseMDupgrade * ddlState);
+
+    short doUndo(ExeCliInterface * cliInterface,
+                 CmpDDLwithStatusInfo * mdui,
+                 CmpSeabaseMDupgrade * ddlState);
+
+  private:
+
+    // avoid having state for now
+
+};
+
 #endif
 


[12/16] incubator-trafodion git commit: Fix upgrade so repository upgrade will succeed

Posted by db...@apache.org.
Fix upgrade so repository upgrade will succeed


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

Branch: refs/heads/master
Commit: a49afa1be39fed8b90efe15d66024548123075d9
Parents: ff89586
Author: Dave Birdsall <db...@apache.org>
Authored: Wed Jul 6 18:30:46 2016 +0000
Committer: Dave Birdsall <db...@apache.org>
Committed: Wed Jul 6 18:30:46 2016 +0000

----------------------------------------------------------------------
 core/sql/optimizer/RelExeUtil.h           |  7 +++++
 core/sql/parser/ParKeyWords.cpp           |  1 +
 core/sql/parser/sqlparser.y               | 41 +++++++++++++++++++-------
 core/sql/sqlcomp/CmpSeabaseDDL.h          |  2 +-
 core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp  | 27 ++++++++++-------
 core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp | 16 +++++-----
 core/sql/sqlcomp/CmpSeabaseDDLupgrade.h   | 23 +++++++++++++--
 7 files changed, 85 insertions(+), 32 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a49afa1b/core/sql/optimizer/RelExeUtil.h
----------------------------------------------------------------------
diff --git a/core/sql/optimizer/RelExeUtil.h b/core/sql/optimizer/RelExeUtil.h
index b97cf72..2591926 100644
--- a/core/sql/optimizer/RelExeUtil.h
+++ b/core/sql/optimizer/RelExeUtil.h
@@ -242,6 +242,7 @@ public:
     dropAuthorization_(FALSE),
     addSeqTable_(FALSE),
     addSchemaObjects_(FALSE),
+    minimal_(FALSE),
     returnStatus_(FALSE),
     flags_(0)
   {
@@ -255,6 +256,7 @@ public:
 	 NABoolean createMDviews, NABoolean dropMDviews,
          NABoolean initAuthorization, NABoolean dropAuthorization,
 	 NABoolean addSeqTable, NABoolean updateVersion, NABoolean addSchemaObjects,
+         NABoolean minimal,
 	 char * ddlStmtText,
 	 CharInfo::CharSet ddlStmtTextCharSet,
 	  CollHeap *oHeap = CmpCommon::statementHeap())
@@ -280,6 +282,7 @@ public:
     dropAuthorization_(dropAuthorization),
     addSeqTable_(addSeqTable),
     addSchemaObjects_(addSchemaObjects),
+    minimal_(minimal),
     returnStatus_(FALSE),
     flags_(0)
   {
@@ -318,6 +321,7 @@ public:
     dropAuthorization_(FALSE),
     addSeqTable_(FALSE),
     addSchemaObjects_(FALSE),
+    minimal_(FALSE),
     returnStatus_(FALSE),
     flags_(0)
   {
@@ -390,6 +394,7 @@ public:
   NABoolean dropAuthorization() { return dropAuthorization_; }
   NABoolean addSeqTable() { return addSeqTable_; }
   NABoolean addSchemaObjects() { return addSchemaObjects_; }
+  NABoolean minimal() { return minimal_; }
 
   short ddlXnsInfo(NABoolean &ddlXns, NABoolean &xnCanBeStarted);
 
@@ -489,6 +494,8 @@ public:
   NABoolean dropAuthorization_;
   NABoolean addSeqTable_;
   NABoolean addSchemaObjects_;
+  NABoolean minimal_;  // meaningful only when initHbase_ is true; if this is true,
+                       // means create the metadata tables only (and not repository etc.)
 
   // if set, this ddl cannot run under a user transaction. It must run in autocommit
   // mode.

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a49afa1b/core/sql/parser/ParKeyWords.cpp
----------------------------------------------------------------------
diff --git a/core/sql/parser/ParKeyWords.cpp b/core/sql/parser/ParKeyWords.cpp
index fee890f..c75cae8 100644
--- a/core/sql/parser/ParKeyWords.cpp
+++ b/core/sql/parser/ParKeyWords.cpp
@@ -637,6 +637,7 @@ ParKeyWord ParKeyWords::keyWords_[] = {
   ParKeyWord("MESSAGE_TEXT",       TOK_MESSAGE_TEXT, NONRESTOKEN_),
   ParKeyWord("METADATA",       TOK_METADATA, SECOND_ | NONRESTOKEN_),
   ParKeyWord("MIN",                TOK_MIN,         ANS_|RESWORD_|NONRESTOKEN_),
+  ParKeyWord("MINIMAL",            TOK_MINIMAL,     NONRESTOKEN_),
   ParKeyWord("MINUTE",             TOK_MINUTE,      ANS_|RESWORD_|MPWORD_),
   ParKeyWord("MINUTES",            TOK_MINUTES,     NONRESTOKEN_),
   ParKeyWord("MINVALUE",           TOK_MINVALUE,   NONRESTOKEN_),

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a49afa1b/core/sql/parser/sqlparser.y
----------------------------------------------------------------------
diff --git a/core/sql/parser/sqlparser.y b/core/sql/parser/sqlparser.y
index 318988b..6cc4040 100755
--- a/core/sql/parser/sqlparser.y
+++ b/core/sql/parser/sqlparser.y
@@ -831,6 +831,7 @@ static void enableMakeQuotedStringISO88591Mechanism()
 %token <tokval> TOK_MERGE
 %token <tokval> TOK_METADATA
 %token <tokval> TOK_MIN
+%token <tokval> TOK_MINIMAL
 %token <tokval> TOK_MINUTE
 %token <tokval> TOK_MINUTES
 %token <tokval> TOK_MINVALUE
@@ -16022,13 +16023,30 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
 
 		 DDLExpr * de = new(PARSERHEAP()) DDLExpr(TRUE, FALSE, TRUE, FALSE,
                                                           FALSE, FALSE,
-							  FALSE, FALSE, FALSE,
+							  FALSE, FALSE, FALSE, FALSE,
 							  (char*)stmt->data(),
 							  stmtCharSet,
 							  PARSERHEAP());
 
 		 $$ = de;
-	       } 
+	       }
+
+           | TOK_INITIALIZE TOK_TRAFODION ',' TOK_MINIMAL
+               {
+ 		 CharInfo::CharSet stmtCharSet = CharInfo::UnknownCharSet;
+		 NAString * stmt = getSqlStmtStr ( stmtCharSet  // out - CharInfo::CharSet &
+						   , PARSERHEAP() 
+	                                       );
+
+		 DDLExpr * de = new(PARSERHEAP()) DDLExpr(TRUE, FALSE, TRUE, FALSE,
+                                                          FALSE, FALSE,
+							  FALSE, FALSE, FALSE, TRUE /* minimal */,
+							  (char*)stmt->data(),
+							  stmtCharSet,
+							  PARSERHEAP());
+
+		 $$ = de;                
+               }
 
            | TOK_INITIALIZE TOK_TRAFODION ',' TOK_NO TOK_METADATA TOK_VIEWS
                {
@@ -16039,7 +16057,7 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
 
 		 DDLExpr * de = new(PARSERHEAP()) DDLExpr(TRUE, FALSE, FALSE, FALSE,
                                                           FALSE, FALSE,
-							  FALSE, FALSE, FALSE,
+							  FALSE, FALSE, FALSE, FALSE,
 							  (char*)stmt->data(),
 							  stmtCharSet,
 							  PARSERHEAP());
@@ -16056,7 +16074,7 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
 
 		 DDLExpr * de = new(PARSERHEAP()) DDLExpr(FALSE, TRUE, FALSE, TRUE,
                                                           FALSE, FALSE,
-							  FALSE, FALSE, FALSE,
+							  FALSE, FALSE, FALSE, FALSE,
 							  (char*)stmt->data(),
 							  stmtCharSet,
 							  PARSERHEAP());
@@ -16073,7 +16091,7 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
 
 		 DDLExpr * de = new(PARSERHEAP()) DDLExpr(FALSE, FALSE, TRUE, FALSE,
                                                           FALSE, FALSE,
-							  FALSE, FALSE, FALSE,
+							  FALSE, FALSE, FALSE, FALSE,
 							  (char*)stmt->data(),
 							  stmtCharSet,
 							  PARSERHEAP());
@@ -16090,7 +16108,7 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
 
 		 DDLExpr * de = new(PARSERHEAP()) DDLExpr(FALSE, FALSE, FALSE, TRUE,
                                                           FALSE, FALSE,
-							  FALSE, FALSE, FALSE,
+							  FALSE, FALSE, FALSE, FALSE,
 							  (char*)stmt->data(),
 							  stmtCharSet,
 							  PARSERHEAP());
@@ -16114,7 +16132,7 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
 
 		 DDLExpr * de = new(PARSERHEAP()) DDLExpr(FALSE, FALSE, FALSE, FALSE,
                                                           FALSE, FALSE,
-							  TRUE, FALSE, FALSE,
+							  TRUE, FALSE, FALSE, FALSE,
 							  (char*)stmt->data(),
 							  stmtCharSet,
 							  PARSERHEAP());
@@ -16131,7 +16149,7 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
 
 		 DDLExpr * de = new(PARSERHEAP()) DDLExpr(FALSE, FALSE, FALSE, FALSE,
                                                           FALSE, FALSE,
-							  FALSE, FALSE,	TRUE,
+							  FALSE, FALSE,	TRUE, FALSE,
 							  (char*)stmt->data(),
 							  stmtCharSet,
 							  PARSERHEAP());
@@ -16247,7 +16265,7 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
 	                                       );
 		 DDLExpr * ia = new(PARSERHEAP()) DDLExpr(FALSE, FALSE, FALSE, FALSE,
                                                           TRUE, FALSE,
-							  FALSE, FALSE, FALSE,
+							  FALSE, FALSE, FALSE, FALSE,
 							  (char*)stmt->data(),
 							  stmtCharSet,
 							  PARSERHEAP());
@@ -16280,7 +16298,7 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
 
 		 DDLExpr * ia = new(PARSERHEAP()) DDLExpr(FALSE, FALSE, FALSE, FALSE,
                                                           FALSE, TRUE,
-							  FALSE, FALSE, FALSE,
+							  FALSE, FALSE, FALSE, FALSE,
 							  (char*)stmt->data(),
 							  stmtCharSet,
 							  PARSERHEAP());
@@ -16298,7 +16316,7 @@ exe_util_init_hbase : TOK_INITIALIZE TOK_TRAFODION
 
 		 DDLExpr * de = new(PARSERHEAP()) DDLExpr(FALSE, FALSE, FALSE, FALSE,
                                                           FALSE, FALSE,
-							  FALSE, TRUE, FALSE,
+							  FALSE, TRUE, FALSE, FALSE,
 							  (char*)stmt->data(),
 							  stmtCharSet,
 							  PARSERHEAP());
@@ -33054,6 +33072,7 @@ nonreserved_word :      TOK_ABORT
                       | TOK_MESSAGE_OCTET_LEN
                       | TOK_MESSAGE_TEXT
                       | TOK_METADATA
+                      | TOK_MINIMAL
 		      | TOK_MINUTES
 		      | TOK_MINVALUE
                       | TOK_MODE

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a49afa1b/core/sql/sqlcomp/CmpSeabaseDDL.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDL.h b/core/sql/sqlcomp/CmpSeabaseDDL.h
index 970a6cf..21f5cbe 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDL.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDL.h
@@ -1243,7 +1243,7 @@ protected:
 			     StmtDDLDropHbaseTable                  * createTableNode,
 			     NAString &currCatName, NAString &currSchName);
   
-  void initSeabaseMD(NABoolean ddlXns);
+  void initSeabaseMD(NABoolean ddlXns, NABoolean minimal);
   void dropSeabaseMD(NABoolean ddlXns);
   void createSeabaseMDviews();
   void dropSeabaseMDviews();

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a49afa1b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
index d65a5cc..e91c810 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLcommon.cpp
@@ -6730,7 +6730,7 @@ short CmpSeabaseDDL::updateSeabaseAuths(
   return 0;
 }
 
-void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns)
+void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns, NABoolean minimal)
 {
   int breadCrumb = -1;  // useful for debugging
   Lng32 retcode = 0;
@@ -6975,16 +6975,23 @@ void CmpSeabaseDDL::initSeabaseMD(NABoolean ddlXns)
       goto label_error;
     }
 
- if (createRepos(&cliInterface))
+ // If this is a MINIMAL initialization, don't create the repository
+ // or privilege manager tables. (This happens underneath an upgrade,
+ // for example, because the repository and privilege manager tables
+ // already exist and we will later upgrade them.)
+ if (!minimal)  
    {
-     breadCrumb = 10;
-     goto label_error;
-   }
+     if (createRepos(&cliInterface))
+       {
+         breadCrumb = 10;
+         goto label_error;
+       }
 
- if (createPrivMgrRepos(&cliInterface, ddlXns))
-   {
-     breadCrumb = 11;
-     goto label_error;
+     if (createPrivMgrRepos(&cliInterface, ddlXns))
+       {
+         breadCrumb = 11;
+         goto label_error;
+       }
    }
 
  if (createSeabaseLibmgr (&cliInterface))
@@ -8557,7 +8564,7 @@ short CmpSeabaseDDL::executeSeabaseDDL(DDLExpr * ddlExpr, ExprNode * ddlNode,
 
   if (ddlExpr->initHbase()) 
     {
-      initSeabaseMD(ddlExpr->ddlXns());
+      initSeabaseMD(ddlExpr->ddlXns(), ddlExpr->minimal());
     }
   else if (ddlExpr->dropHbase())
     {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a49afa1b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
index e6e4caa..1c058df 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.cpp
@@ -170,13 +170,7 @@ short CmpSeabaseMDupgrade::dropMDtables(ExpHbaseInterface *ehi,
       
     } // for
   
-  Lng32 reposErrcode = dropReposTables(ehi, oldTbls);
-  if (errcode)
-    return errcode;
-  else if (reposErrcode)
-    return reposErrcode;
-  else
-    return 0;
+  return errcode;
 }
 
 short CmpSeabaseMDupgrade::restoreOldMDtables(ExpHbaseInterface *ehi)
@@ -322,6 +316,9 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 
   while (1)
     {
+      // TODO: remove this debugging code
+      cout << "mdui->step() is " << mdui->step() << ", mdui->subStep() is " << mdui->subStep() << endl;
+      // TODO: remove the above debugging code
       switch (mdui->step())
 	{
 	case UPGRADE_START: 
@@ -979,7 +976,10 @@ short CmpSeabaseMDupgrade::executeSeabaseMDupgrade(CmpDDLwithStatusInfo *mdui,
 		  CmpCommon::context()->setIsUninitializedSeabase(TRUE);
 		  CmpCommon::context()->uninitializedSeabaseErrNum() = -1393; // MD doesn't exist
 
-		  str_sprintf(buf, "initialize trafodion;");
+                  // Use "initialize trafodion, minimal" so we only create the metadata
+                  // tables. The other tables (repository and privilege manager) already
+                  // exist; we will upgrade them later in this method.
+		  str_sprintf(buf, "initialize trafodion, minimal;");
 		  
 		  cliRC = cliInterface.executeImmediate(buf);
 		  if (cliRC < 0)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a49afa1b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
index 4e7111c..3fcc94b 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDLupgrade.h
@@ -89,7 +89,12 @@ struct MDUpgradeInfo
 
   // if new and old col info is different, then data need to be copied using
   // explicit column names in insert and select part of the query.
-  // insert into tgt (insertedCols) select selectedCols from src;
+  // upsert into tgt (insertedCols) select selectedCols from src;
+  // Note that the OBJECTS table must always do this, since we need to modify
+  // the table name for rows concerning the metadata tables themselves. That is,
+  // we are copying in rows concerning the *old* metadata tables; rows concerning
+  // the *new* metadata tables are already there from "initialize trafodion" and
+  // we don't want to overwrite them as part of the UPSERT.
   const char * insertedCols;
   const char * selectedCols;
 
@@ -191,7 +196,21 @@ static const MDUpgradeInfo allMDupgradeInfo[] = {
    seabaseObjectsDDL, sizeof(seabaseObjectsDDL),
    NULL, 0,
    NULL, 0,
-   FALSE, NULL, NULL, NULL, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
+   FALSE,
+   // Note: For OBJECTS, we always have to provide insertedCols and
+   // selectedCols since we have to modify the table name for rows
+   // concerning the old metadata (see the "case" expression below).
+   "catalog_name,schema_name,"
+   "object_name,"
+   "object_type,object_uid,"
+   "create_time,redef_time,valid_def,droppable,object_owner,schema_owner,"
+   "flags",
+   "catalog_name,schema_name,"
+   "case when schema_name = '_MD_' then object_name || '_OLD_MD' else object_name end,"
+   "object_type,object_uid,"
+   "create_time,redef_time,valid_def,droppable,object_owner,schema_owner,"
+   "flags",
+   NULL, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE},
 
   {SEABASE_OBJECTS_UNIQ_IDX, SEABASE_OBJECTS_UNIQ_IDX_OLD_MD,
    seabaseObjectsUniqIdxDDL, sizeof(seabaseObjectsUniqIdxDDL),


[03/16] incubator-trafodion git commit: Merge branch 'master' of github.com:apache/incubator-trafodion into wrkbrnch

Posted by db...@apache.org.
Merge branch 'master' of github.com:apache/incubator-trafodion into wrkbrnch


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

Branch: refs/heads/master
Commit: afa1daa5942329ce58870f4126021ad23865a8eb
Parents: 86d7880 8110b8d
Author: Anuradha Hegde <an...@esgyn.com>
Authored: Mon May 16 19:58:02 2016 +0000
Committer: Anuradha Hegde <an...@esgyn.com>
Committed: Mon May 16 19:58:02 2016 +0000

----------------------------------------------------------------------
 core/sql/executor/ExHbaseIUD.cpp |   3 +-
 core/sql/ustat/hs_globals.cpp    | 120 +++++++++++++++++++++-------------
 core/sql/ustat/hs_globals.h      |   4 ++
 3 files changed, 79 insertions(+), 48 deletions(-)
----------------------------------------------------------------------