Repository: trafodion
Updated Branches:
  refs/heads/master 53391708a -> ebc847eaf


[TRAFODION-3005] Fix issues with keys on long columns


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

Branch: refs/heads/master
Commit: 9c935c529c112afe889a05c5f9aa3498a16a2fac
Parents: a52f462
Author: Dave Birdsall <[email protected]>
Authored: Thu Mar 22 18:58:38 2018 +0000
Committer: Dave Birdsall <[email protected]>
Committed: Thu Mar 22 18:58:38 2018 +0000

----------------------------------------------------------------------
 core/sql/sqlcomp/CmpSeabaseDDL.h        | 19 +++++++++++++++----
 core/sql/sqlcomp/CmpSeabaseDDLindex.cpp | 16 ++++++++--------
 2 files changed, 23 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafodion/blob/9c935c52/core/sql/sqlcomp/CmpSeabaseDDL.h
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDL.h b/core/sql/sqlcomp/CmpSeabaseDDL.h
index f1f9429..c6ff74b 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDL.h
+++ b/core/sql/sqlcomp/CmpSeabaseDDL.h
@@ -129,10 +129,21 @@ 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
+// The define below gives the maximum rowID length that we will permit
+// for Trafodion tables and indexes. The actual HBase limit is more 
+// complicated: For Puts, HBase compares the key length to 
+// HConstants.MAX_ROW_LENGTH (= Short.MAX_VALUE = 32767). It raises an
+// exception if the key length is greater than that. But there are also
+// some internal data structures that HBase uses (the WAL perhaps?) that
+// are keyed. Experiments show that a Trafodion key of length n causes
+// a hang if n + strlen(Trafodion object name) + 16 > 32767. The HBase
+// log in these cases shows an IllegalArgumentException Row > 32767 in
+// this case. So it seems best to limit Trafodion key lengths to something
+// sufficiently smaller than 32767 so we don't hit these hangs. A value
+// of 32000 seems safe, since the longest Trafodion table name will be
+// TRAFODION.something.something, with each of the somethings topping out
+// at 256 bytes.
+#define MAX_HBASE_ROWKEY_LEN 32000
 
 #define SEABASEDDL_INTERNAL_ERROR(text)                                   \
    *CmpCommon::diags() << DgSqlCode(-CAT_INTERNAL_EXCEPTION_ERROR)       \

http://git-wip-us.apache.org/repos/asf/trafodion/blob/9c935c52/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp 
b/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
index 030d76c..2e35ac0 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
@@ -239,14 +239,6 @@ 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))
@@ -396,6 +388,14 @@ CmpSeabaseDDL::createIndexColAndKeyInfoArrays(
       i++;
     }
 
+  if (keyLength > MAX_HBASE_ROWKEY_LEN )
+    {
+      *CmpCommon::diags() << DgSqlCode(-CAT_ROWKEY_LEN_TOO_LARGE)
+                              << DgInt0(keyLength)
+                              << DgInt1(MAX_HBASE_ROWKEY_LEN);
+      return -1;
+    }
+
   return 0;
 }
 

Reply via email to