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 2015/11/19 18:12:54 UTC

[2/6] incubator-trafodion git commit: [TRAFODION-1633] Fix for HBaseCient.getHbaseTableInfo throwing fpe

[TRAFODION-1633] Fix for HBaseCient.getHbaseTableInfo throwing fpe

Fix for the failure in seabase/TEST027 with [TRAFODION-1423]
Disabled creating aligned format index with multi-column family.


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

Branch: refs/heads/master
Commit: e3c5753efb771f3421a5f32dc04883a48236e202
Parents: 30da41e
Author: selvaganesang <se...@esgyn.com>
Authored: Tue Nov 17 22:20:00 2015 +0000
Committer: selvaganesang <se...@esgyn.com>
Committed: Tue Nov 17 22:20:00 2015 +0000

----------------------------------------------------------------------
 core/sql/executor/HBaseClient_JNI.cpp           | 22 ++++++++++++--------
 core/sql/sqlcomp/CmpSeabaseDDLindex.cpp         | 12 ++++++++++-
 .../java/org/trafodion/sql/HBaseClient.java     |  3 +++
 3 files changed, 27 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3c5753e/core/sql/executor/HBaseClient_JNI.cpp
----------------------------------------------------------------------
diff --git a/core/sql/executor/HBaseClient_JNI.cpp b/core/sql/executor/HBaseClient_JNI.cpp
index fbe5056..bab5c70 100644
--- a/core/sql/executor/HBaseClient_JNI.cpp
+++ b/core/sql/executor/HBaseClient_JNI.cpp
@@ -2845,10 +2845,15 @@ HBC_RetCode HBaseClient_JNI::getHbaseTableInfo(const char* tblName,
   if (jenv_ == NULL)
      if (initJVM() != JOI_OK)
          return HBC_ERROR_INIT_PARAM;
+  if (jenv_->PushLocalFrame(jniHandleCapacity_) != 0) {
+     getExceptionDetails();
+     return HBC_ERROR_GET_LATEST_SNP_EXCEPTION;
+  }
   jstring js_tblName = jenv_->NewStringUTF(tblName);
   if (js_tblName == NULL)
   {
     GetCliGlobals()->setJniErrorStr(getErrorText(HBC_ERROR_GET_HBTI_PARAM));
+    jenv_->PopLocalFrame(NULL);
     return HBC_ERROR_GET_HBTI_PARAM;
   }
 
@@ -2856,26 +2861,25 @@ HBC_RetCode HBaseClient_JNI::getHbaseTableInfo(const char* tblName,
   tsRecentJMFromJNI = JavaMethods_[JM_GET_HBTI].jm_full_name;
   jboolean jresult = jenv_->CallBooleanMethod(javaObj_, JavaMethods_[JM_GET_HBTI].methodID,
                                               js_tblName, jHtabInfo);
-  jboolean isCopy;
-  jint* arrayElems = jenv_->GetIntArrayElements(jHtabInfo, &isCopy);
-  indexLevels = arrayElems[0];
-  blockSize = arrayElems[1];
-  if (isCopy == JNI_TRUE)
-    jenv_->ReleaseIntArrayElements(jHtabInfo, arrayElems, JNI_ABORT);
-
-  jenv_->DeleteLocalRef(js_tblName);
-
   if (jenv_->ExceptionCheck())
   {
     getExceptionDetails();
     logError(CAT_SQL_HBASE, __FILE__, __LINE__);
     logError(CAT_SQL_HBASE, "HBaseClient_JNI::getHbaseTableInfo()", getLastError());
+    jenv_->PopLocalFrame(NULL);
     return HBC_ERROR_GET_HBTI_EXCEPTION;
   }
+  jboolean isCopy;
+  jint* arrayElems = jenv_->GetIntArrayElements(jHtabInfo, &isCopy);
+  indexLevels = arrayElems[0];
+  blockSize = arrayElems[1];
+  if (isCopy == JNI_TRUE)
+     jenv_->ReleaseIntArrayElements(jHtabInfo, arrayElems, JNI_ABORT);
 
   if (jresult == false)
   {
     logError(CAT_SQL_HBASE, "HBaseClient_JNI::getHbaseTableInfo()", getLastError());
+    jenv_->PopLocalFrame(NULL);
     return HBC_ERROR_GET_HBTI_EXCEPTION;
   }
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3c5753e/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
----------------------------------------------------------------------
diff --git a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp b/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
index f2ce913..ab1cb0e 100644
--- a/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
+++ b/core/sql/sqlcomp/CmpSeabaseDDLindex.cpp
@@ -412,7 +412,7 @@ void CmpSeabaseDDL::createSeabaseIndex(
   NAString objectNamePart = indexName.getObjectNamePartAsAnsiString(TRUE);
   NAString extIndexName = indexName.getExternalName(TRUE);
   NAString extNameForHbase = catalogNamePart + "." + schemaNamePart + "." + objectNamePart;
-
+  NABoolean alignedFormatNotAllowed = FALSE; 
   ExpHbaseInterface * ehi = allocEHI();
   if (ehi == NULL)
     return;
@@ -557,6 +557,7 @@ void CmpSeabaseDDL::createSeabaseIndex(
     {
       CollIndex idx = naTable->allColFams().index(indexColFam);
       genTrafColFam(idx, trafColFam);
+      alignedFormatNotAllowed = TRUE;
     }
   else
     trafColFam = indexColFam;
@@ -620,6 +621,12 @@ void CmpSeabaseDDL::createSeabaseIndex(
     {
       if (fileAttribs.getRowFormat() == ElemDDLFileAttrRowFormat::eALIGNED)
         {
+          if (alignedFormatNotAllowed)
+          {
+             *CmpCommon::diags() << DgSqlCode(-4223)
+                                 << DgString0("Column Family specification on columns of an aligned format index is");
+             processReturn();
+          }
           alignedFormat = TRUE;
         }
     }
@@ -632,6 +639,9 @@ void CmpSeabaseDDL::createSeabaseIndex(
   if (naTable->isSQLMXAlignedTable())
     alignedFormat = TRUE;
 
+  if (alignedFormatNotAllowed)
+     alignedFormat = FALSE;
+
   if ((naTable->hasSecondaryIndexes()) &&
       (NOT createIndexNode->isVolatile()))
     {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e3c5753e/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
----------------------------------------------------------------------
diff --git a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
index 36c4e05..debd527 100644
--- a/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
+++ b/core/sql/src/main/java/org/trafodion/sql/HBaseClient.java
@@ -1239,6 +1239,9 @@ public class HBaseClient {
         for (int i =0; i < regArr.length; i++) 
           logger.debug("Region Path is " + regArr[i].getPath());
       }
+
+      if (regArr.length == 0)
+         return true;
       // get random region from the region array
       int regInd = 0;
       regInd = tblName.hashCode() % regArr.length;