Repository: trafodion
Updated Branches:
  refs/heads/master b1e176f0c -> 9d88d0810


[TRAFODION-2908] create table with wrong char length hang and crash


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

Branch: refs/heads/master
Commit: 5f5808ab9d66bc2fba02292b3a0e5c371d3f5678
Parents: d80f009
Author: Liu Ming <ovis_p...@sina.com>
Authored: Mon Feb 5 08:11:50 2018 +0000
Committer: Liu Ming <ovis_p...@sina.com>
Committed: Mon Feb 5 08:11:50 2018 +0000

----------------------------------------------------------------------
 core/sql/bin/SqlciErrors.txt            |  2 +-
 core/sql/sqlcomp/CmpDDLCatErrorCodes.h  |  2 +-
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp | 12 ++++++++++++
 3 files changed, 14 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/5f5808ab/core/sql/bin/SqlciErrors.txt
----------------------------------------------------------------------
diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt
index 0a82369..4ef465a 100644
--- a/core/sql/bin/SqlciErrors.txt
+++ b/core/sql/bin/SqlciErrors.txt
@@ -140,7 +140,7 @@
 1138 ZZZZZ 99999 ADVANCED CRTCL DIALOUT --- unused ---
 1139 ZZZZZ 99999 BEGINNER MAJOR DBADMIN System-generated column $0~ColumnName 
of base table $1~TableName cannot appear in the search condition of a check 
constraint definition.
 1140 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Row-length $0~int0 exceeds the maximum 
allowed row-length of $1~int1 for table $2~TableName.
-1141 ZZZZZ 99999 BEGINNER MAJOR DBADMIN --- unused ---
+1141 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Key-length $0~int0 exceeds the maximum 
allowed rowkey length $1~int1.
 1142 0A000 99999 BEGINNER MAJOR DBADMIN --- unused ---
 1143 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Validation for constraint 
$0~ConstraintName failed; incompatible data exists in referencing base table 
$1~TableName and referenced base table $2~String0.  To display the data that 
violates the constraint, please use the following DML statement: $3~String1
 1144 ZZZZZ 99999 BEGINNER MAJOR DBADMIN A quoted string was expected in first 
key clause for column $0~ColumnName on table $1~TableName, but the value 
detected is ($2~String0).

http://git-wip-us.apache.org/repos/asf/trafodion/blob/5f5808ab/core/sql/sqlcomp/CmpDDLCatErrorCodes.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpDDLCatErrorCodes.h 
b/core/sql/sqlcomp/CmpDDLCatErrorCodes.h
index e00eb91..713690f 100644
--- a/core/sql/sqlcomp/CmpDDLCatErrorCodes.h
+++ b/core/sql/sqlcomp/CmpDDLCatErrorCodes.h
@@ -171,7 +171,7 @@ enum CatErrorCode { CAT_FIRST_ERROR = 1000
                   // unused                                       = 1138
                   , CAT_SYSKEY_COL_NOT_ALLOWED_IN_CK_CNSTRNT      = 1139
                   , CAT_REC_LEN_TOO_LARGE                         = 1140
-                  // unused                                       = 1141
+                  , CAT_ROWKEY_LEN_TOO_LARGE                      = 1141
                   // unused                                       = 1142
                   , CAT_DATA_NOT_MEET_RI_CONSTRAINT_CRITERIA      = 1143
                   , CAT_MISSING_QUOTE_IN_CHAR_FIRSTKEY            = 1144

http://git-wip-us.apache.org/repos/asf/trafodion/blob/5f5808ab/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp 
b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index de6f778..248deef 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -57,6 +57,8 @@
 
 #include "TrafDDLdesc.h"
 
+#define MAX_HBASE_ROWKEY_LEN 32768
+
 // defined in CmpDescribe.cpp
 extern short CmpDescribeSeabaseTable ( 
      const CorrName  &dtName,
@@ -2517,6 +2519,16 @@ short CmpSeabaseDDL::createSeabaseTable2(
        }
       keyLength += colType->getEncodedKeyLength();
     }
+  //check the key length
+  if(keyLength > MAX_HBASE_ROWKEY_LEN )
+  {
+      *CmpCommon::diags() << DgSqlCode(-CAT_ROWKEY_LEN_TOO_LARGE)
+                              << DgInt0(keyLength)
+                              << DgInt1(MAX_HBASE_ROWKEY_LEN);
+      deallocEHI(ehi); 
+      processReturn();
+      return -1;
+  }
 
   if (hbaseMapFormat)
     {

Reply via email to