Repository: trafodion
Updated Branches:
  refs/heads/master 290570e72 -> b19868adc


[TRAFODION-2977] Fix issues with maximum key length detection


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

Branch: refs/heads/master
Commit: e7fd657474842b017e26f50aeda3895b7cfd337c
Parents: 75c7b39
Author: Dave Birdsall <[email protected]>
Authored: Tue Mar 13 20:00:18 2018 +0000
Committer: Dave Birdsall <[email protected]>
Committed: Tue Mar 13 20:00:18 2018 +0000

----------------------------------------------------------------------
 core/sql/bin/SqlciErrors.txt            | 2 +-
 core/sql/generator/GenRelUpdate.cpp     | 2 ++
 core/sql/sqlcomp/CmpSeabaseDDL.h        | 5 +++++
 core/sql/sqlcomp/CmpSeabaseDDLindex.cpp | 8 ++++++++
 core/sql/sqlcomp/CmpSeabaseDDLtable.cpp | 1 -
 5 files changed, 16 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/e7fd6574/core/sql/bin/SqlciErrors.txt
----------------------------------------------------------------------
diff --git a/core/sql/bin/SqlciErrors.txt b/core/sql/bin/SqlciErrors.txt
index c79010b..321fd62 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 Key length $0-int0 exceeds the maximum 
allowed key length of $1~int1
+1141 ZZZZZ 99999 BEGINNER MAJOR DBADMIN Key length $0~int0 exceeds the maximum 
allowed key length of $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/e7fd6574/core/sql/generator/GenRelUpdate.cpp
----------------------------------------------------------------------
diff --git a/core/sql/generator/GenRelUpdate.cpp 
b/core/sql/generator/GenRelUpdate.cpp
index e0a8d38..b7cc6bb 100644
--- a/core/sql/generator/GenRelUpdate.cpp
+++ b/core/sql/generator/GenRelUpdate.cpp
@@ -2945,6 +2945,8 @@ short HbaseInsert::codeGen(Generator *generator)
        // without code change
        if (loadFlushSizeinRows >= USHRT_MAX/2)
          loadFlushSizeinRows = ((USHRT_MAX/2)-1);
+       else if (loadFlushSizeinRows < 1)  // make sure we don't fall to zero 
on really long rows
+         loadFlushSizeinRows = 1;
        hbasescan_tdb->setTrafLoadFlushSize(loadFlushSizeinRows);
 
         // For sample file, set the sample location in HDFS and the sampling 
rate.

http://git-wip-us.apache.org/repos/asf/trafodion/blob/e7fd6574/core/sql/sqlcomp/CmpSeabaseDDL.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDL.h b/core/sql/sqlcomp/CmpSeabaseDDL.h
index 1f6295d..1aff308 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDL.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDL.h
@@ -129,6 +129,11 @@ class CmpDDLwithStatusInfo;
 
 #include "CmpSeabaseDDLmd.h"
 
+// The value HBase uses for checking key length is HConstants.MAX_ROW_LENGTH.
+// The rowID length limit in HBase is enforced in HBase modules Put.java and
+// Mutation.java. (The above was true as of HBase 1.0.0.)
+#define MAX_HBASE_ROWKEY_LEN 32767
+
 #define SEABASEDDL_INTERNAL_ERROR(text)                                   \
    *CmpCommon::diags() << DgSqlCode(-CAT_INTERNAL_EXCEPTION_ERROR)       \
                        << DgString0(__FILE__)                            \

http://git-wip-us.apache.org/repos/asf/trafodion/blob/e7fd6574/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp 
b/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
index 2e4c5a0..030d76c 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
@@ -239,6 +239,14 @@ CmpSeabaseDDL::createIndexColAndKeyInfoArrays(
      keyInfoArray[i].hbaseColQual = new(CTXTHEAP) char[strlen(qualNumStr)+1];
      strcpy((char*)keyInfoArray[i].hbaseColQual, qualNumStr);
     }
+
+  if (keyLength > MAX_HBASE_ROWKEY_LEN )
+    {
+      *CmpCommon::diags() << DgSqlCode(-CAT_ROWKEY_LEN_TOO_LARGE)
+                              << DgInt0(keyLength)
+                              << DgInt1(MAX_HBASE_ROWKEY_LEN);
+      return -1;
+    }
   
   if ((syskeyOnly) &&
       (hasSyskey))

http://git-wip-us.apache.org/repos/asf/trafodion/blob/e7fd6574/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp 
b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
index 248deef..b16f777 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLtable.cpp
@@ -57,7 +57,6 @@
 
 #include "TrafDDLdesc.h"
 
-#define MAX_HBASE_ROWKEY_LEN 32768
 
 // defined in CmpDescribe.cpp
 extern short CmpDescribeSeabaseTable ( 

Reply via email to