trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [1/6] incubator-trafodion git commit: TRAFODION-2231 support transactional ddl exceptions to sql.
Date Mon, 28 Nov 2016 22:32:17 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 3b3166308 -> 0bbd910d0


TRAFODION-2231 support transactional ddl exceptions to sql.


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

Branch: refs/heads/master
Commit: c4e45965951dd3ff19c4b0dd97e22e081a13dfba
Parents: aedb7ec
Author: Prashant Vasudev <prashanth.vasudev@esgyn.com>
Authored: Fri Sep 23 23:10:39 2016 +0000
Committer: Prashant Vasudev <prashanth.vasudev@esgyn.com>
Committed: Fri Sep 23 23:10:39 2016 +0000

----------------------------------------------------------------------
 core/sqf/export/include/dtm/tm.h                | 10 +--
 core/sqf/export/include/dtm/tmtransaction.h     |  8 +--
 .../hbase/client/transactional/RMInterface.java | 40 ++++++------
 .../sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp | 30 +++++++--
 core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.h  | 14 +++--
 core/sqf/src/tm/tmddlrequests.cpp               | 66 ++++++++++++++++----
 core/sqf/src/tm/tmddlrequests.h                 |  8 +--
 core/sqf/src/tm/tmlib.cpp                       | 18 +++---
 core/sqf/src/tm/tmlibmsg.h                      |  3 +
 core/sqf/src/tm/tmrmhbase.cpp                   | 23 +++++--
 core/sqf/src/tm/tmtransaction.cpp               | 39 ++++++++++--
 11 files changed, 186 insertions(+), 73 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c4e45965/core/sqf/export/include/dtm/tm.h
----------------------------------------------------------------------
diff --git a/core/sqf/export/include/dtm/tm.h b/core/sqf/export/include/dtm/tm.h
index e7bbd60..d558567 100644
--- a/core/sqf/export/include/dtm/tm.h
+++ b/core/sqf/export/include/dtm/tm.h
@@ -274,11 +274,13 @@ typedef struct TM_HBASEREGIONINFO {
 // Trafodion start //
 #define TM_MAX_REGIONSERVER_STRING 2048
 #define TM_MAX_DDLREQUEST_STRING 2048
+#define TM_MAX_ERROR_STRING 2048
 extern "C" short REGISTERREGION(long transid, long startid, int port, char *hostname, int
hostname_length, long startcode, char *regionInfo, int regionInfo_Length);
-extern "C" short CREATETABLE(char *pa_tbldesc, int pv_tbldesc_length, char *pv_tblname, char**
pv_keys, int pv_numsplits, int pv_keylen, long transid);
-extern "C" short REGTRUNCATEONABORT(char *pv_tblname, int pv_tblname_len, long pv_transid);
-extern "C" short DROPTABLE(char *pv_tblname, int pv_tblname_len, long transid);
-extern "C" short ALTERTABLE(char *pv_tblname, int pv_tblname_len, char ** pv_tbloptions,
int pv_tbloptslen, int pv_tbloptscnt, long pv_transid);
+extern "C" short CREATETABLE(char *pa_tbldesc, int pv_tbldesc_length, char *pv_tblname, char**
pv_keys, int pv_numsplits, int pv_keylen, long transid,
+				char* pv_err_str);
+extern "C" short REGTRUNCATEONABORT(char *pv_tblname, int pv_tblname_len, long pv_transid,
char* pv_err_str);
+extern "C" short DROPTABLE(char *pv_tblname, int pv_tblname_len, long transid, char* pv_err_str);
+extern "C" short ALTERTABLE(char *pv_tblname, int pv_tblname_len, char ** pv_tbloptions,
int pv_tbloptslen, int pv_tbloptscnt, long pv_transid, char* pv_err_str);
 extern "C" short HBASETM_REQUESTREGIONINFO(TM_HBASEREGIONINFO pa_trans[], short *pp_count);
 extern "C" short DTM_GETNEXTSEQNUMBLOCK(unsigned int &pp_seqNum_start, unsigned int &pp_seqNum_count);
 extern "C" bool DTM_LOCALTRANSACTION(int32 *pp_node, int32 *pp_seqnum);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c4e45965/core/sqf/export/include/dtm/tmtransaction.h
----------------------------------------------------------------------
diff --git a/core/sqf/export/include/dtm/tmtransaction.h b/core/sqf/export/include/dtm/tmtransaction.h
index b8d2560..4467842 100755
--- a/core/sqf/export/include/dtm/tmtransaction.h
+++ b/core/sqf/export/include/dtm/tmtransaction.h
@@ -52,10 +52,10 @@ public:
     short suspend(TM_Transid *transid, bool coordinator_role=true);
     short resume();
     short register_region(long startid, int port, char *hostname, int hostname_length, long
startcode, char *regionInfo, int regionInfoLength); //TOPL
-    short create_table(char* pa_tbldesc, int pv_tbldesc_len, char* pa_tblname, char** pv_keys,
int pv_numsplits, int pv_keylen);
-    short reg_truncateonabort(char* pa_tblname, int pv_tblname_len);
-    short drop_table(char* pa_tblname, int pv_tblname_len);
-    short alter_table(char * pa_tblname, int pv_tblname_len, char ** pv_tbloptions, int pv_tbloptslen,
int pv_tbloptscnt);
+    short create_table(char* pa_tbldesc, int pv_tbldesc_len, char* pa_tblname, char** pv_keys,
int pv_numsplits, int pv_keylen, char* pv_err_str);
+    short reg_truncateonabort(char* pa_tblname, int pv_tblname_len, char* pv_err_str);
+    short drop_table(char* pa_tblname, int pv_tblname_len, char* pv_err_str);
+    short alter_table(char * pa_tblname, int pv_tblname_len, char ** pv_tbloptions, int pv_tbloptslen,
int pv_tbloptscnt, char* pv_err_str);
     TM_Transaction *release();
     short status(short *status);
     TM_Transid * getTransid();

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c4e45965/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/RMInterface.java
----------------------------------------------------------------------
diff --git a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/RMInterface.java
b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/RMInterface.java
index 05c7d0e..e73f4de 100644
--- a/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/RMInterface.java
+++ b/core/sqf/src/seatrans/hbase-trx/src/main/java/org/apache/hadoop/hbase/client/transactional/RMInterface.java
@@ -96,10 +96,10 @@ public class RMInterface {
     }
 
     private native void registerRegion(int port, byte[] hostname, long startcode, byte[]
regionInfo);
-    private native int createTableReq(byte[] lv_byte_htabledesc, byte[][] keys, int numSplits,
int keyLength, long transID, byte[] tblName);
-    private native int dropTableReq(byte[] lv_byte_tblname, long transID);
-    private native int truncateOnAbortReq(byte[] lv_byte_tblName, long transID); 
-    private native int alterTableReq(byte[] lv_byte_tblname, Object[] tableOptions, long
transID);
+    private native String createTableReq(byte[] lv_byte_htabledesc, byte[][] keys, int numSplits,
int keyLength, long transID, byte[] tblName);
+    private native String dropTableReq(byte[] lv_byte_tblname, long transID);
+    private native String truncateOnAbortReq(byte[] lv_byte_tblName, long transID); 
+    private native String alterTableReq(byte[] lv_byte_tblname, Object[] tableOptions, long
transID);
 
     public static void main(String[] args) {
       System.out.println("MAIN ENTRY");
@@ -229,11 +229,11 @@ public class RMInterface {
         byte[] lv_byte_desc = desc.toByteArray();
         byte[] lv_byte_tblname = desc.getNameAsString().getBytes();
         if (LOG.isTraceEnabled()) LOG.trace("createTable: htabledesc bytearray: " + lv_byte_desc
+ "desc in hex: " + Hex.encodeHexString(lv_byte_desc));
-        int ret = createTableReq(lv_byte_desc, keys, numSplits, keyLength, transID, lv_byte_tblname);
-        if(ret != 0)
+        String retstr = createTableReq(lv_byte_desc, keys, numSplits, keyLength, transID,
lv_byte_tblname);
+        if(retstr != null)
         {
-        	LOG.error("createTable exception. Unable to create table " + desc.getNameAsString()
+ " txid " + transID);
-        	throw new IOException("createTable exception. Unable to create table " + desc.getNameAsString());
+        	LOG.error("createTable exception. Unable to create table " + desc.getNameAsString()
+ " txid " + transID + " exception " + retstr);
+        	throw new IOException("createTable exception. Unable to create table " + desc.getNameAsString()
+ " Reason: " + retstr);
         }
         if (LOG.isTraceEnabled()) LOG.trace("Exit createTable, txid: " + transID + " Table:
" + desc.getNameAsString());
     }
@@ -241,11 +241,11 @@ public class RMInterface {
     public void truncateTableOnAbort(String tblName, long transID) throws IOException {
 		if (LOG.isTraceEnabled()) LOG.trace("Enter truncateTableOnAbort, txid: " + transID + "
Table: " + tblName);
         byte[] lv_byte_tblName = tblName.getBytes();
-        int ret = truncateOnAbortReq(lv_byte_tblName, transID);
-        if(ret != 0)
+        String retstr = truncateOnAbortReq(lv_byte_tblName, transID);
+        if(retstr != null)
         {
-        	LOG.error("truncateTableOnAbort exception. Unable to truncate table" + tblName +
" txid " + transID);
-        	throw new IOException("truncateTableOnAbort exception. Unable to truncate table"
+ tblName);
+        	LOG.error("truncateTableOnAbort exception. Unable to truncate table" + tblName +
" txid " + transID + " exception " + retstr);
+        	throw new IOException("truncateTableOnAbort exception. Unable to truncate table
" + tblName + " Reason: " + retstr);
         }
         if (LOG.isTraceEnabled()) LOG.trace("Exit truncateTableOnAbort, txid: " + transID
+ " Table: " + tblName);
     }
@@ -253,11 +253,11 @@ public class RMInterface {
     public void dropTable(String tblName, long transID) throws IOException {
     	if (LOG.isTraceEnabled()) LOG.trace("Enter dropTable, txid: " + transID + " Table: "
+ tblName);
         byte[] lv_byte_tblname = tblName.getBytes();
-        int ret = dropTableReq(lv_byte_tblname, transID);
-        if(ret != 0)
+        String retstr = dropTableReq(lv_byte_tblname, transID);
+        if(retstr != null)
         {
-        	LOG.error("dropTable exception. Unable to drop table" + tblName + " txid " + transID);
-        	throw new IOException("dropTable exception. Unable to drop table" + tblName);
+        	LOG.error("dropTable exception. Unable to drop table" + tblName + " txid " + transID
+ " exception " + retstr);
+        	throw new IOException("dropTable exception. Unable to drop table" + tblName + "
Reason: " + retstr);
         }
         if (LOG.isTraceEnabled()) LOG.trace("Exit dropTable, txid: " + transID + " Table:
" + tblName);
     }
@@ -265,11 +265,11 @@ public class RMInterface {
     public void alter(String tblName, Object[] tableOptions, long transID) throws IOException
{
     	if (LOG.isTraceEnabled()) LOG.trace("Enter alterTable, txid: " + transID + " Table:
" + tblName);
         byte[] lv_byte_tblname = tblName.getBytes();
-        int ret = alterTableReq(lv_byte_tblname, tableOptions, transID);
-        if(ret != 0)
+        String retstr = alterTableReq(lv_byte_tblname, tableOptions, transID);
+        if(retstr != null)
         {
-        	LOG.error("alter Table exception. Unable to alter table" + tblName + " txid " +
transID);
-        	throw new IOException("alter Table exception. Unable to alter table" + tblName);
+        	LOG.error("alter Table exception. Unable to alter table" + tblName + " txid " +
transID + " exception " + retstr);
+        	throw new IOException("alter Table exception. Unable to alter table" + tblName +
" Reason: " + retstr);
         }
         if (LOG.isTraceEnabled()) LOG.trace("Exit alterTable, txid: " + transID + " Table:
" + tblName);
     }   

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c4e45965/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp b/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp
index 89d117c..5c619a7 100644
--- a/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp
+++ b/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.cpp
@@ -826,7 +826,9 @@ int CHbaseTM::createTable(int64 pv_transid,
                            int pv_tbldesc_len,
                            char** pv_keys,
                            int pv_numsplits,
-                           int pv_keylen)
+                           int pv_keylen,
+                           char *errstr,
+                           int &errstrlen)
 {
    int lv_error = FEOK;
    jlong jlv_transid = pv_transid;
@@ -860,7 +862,10 @@ int CHbaseTM::createTable(int64 pv_transid,
                     jba_tbldesc,
                     j_keys);
   if (getExceptionDetails(NULL)) {
-     tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)"CHbaseTM::createTable()", (char
*)_tlp_error_msg->c_str(), pv_transid);
+	 errstrlen = ((int)_tlp_error_msg->length() < errstrlen) ? (int)_tlp_error_msg->length()
: errstrlen;
+	 strncpy(errstr, _tlp_error_msg->c_str(), errstrlen);
+	 errstr[errstrlen -1] = '\0';
+	 tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)"CHbaseTM::createTable()", (char *)_tlp_error_msg->c_str(),
pv_transid);
      return RET_EXCEPTION;
   }
 
@@ -882,7 +887,9 @@ int CHbaseTM::alterTable(int64 pv_transid,
                         int pv_tblname_len,
                         char ** buffer_tblopts,
                         int pv_numtblopts,
-                        int pv_tbloptslen)
+                        int pv_tbloptslen,
+                        char *errstr,
+                        int &errstrlen)
 {
    int lv_error = FEOK;
    jlong jlv_transid = pv_transid;
@@ -913,6 +920,9 @@ int CHbaseTM::alterTable(int64 pv_transid,
                     jba_tblname,
                     j_tblopts);
    if (getExceptionDetails(NULL)) {
+      errstrlen = ((int)_tlp_error_msg->length() < errstrlen) ? (int)_tlp_error_msg->length()
: errstrlen;
+      strncpy(errstr, _tlp_error_msg->c_str(), errstrlen);
+      errstr[errstrlen -1] = '\0';
       tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)"CHbaseTM::alterTable()", (char
*)_tlp_error_msg->c_str(), pv_transid);
       return RET_EXCEPTION;
    }
@@ -933,7 +943,9 @@ int CHbaseTM::alterTable(int64 pv_transid,
 // ---------------------------------------------------------------------------
 int CHbaseTM::regTruncateOnAbort(int64 pv_transid,
                            const char* pa_tblname,
-                           int pv_tblname_len)
+                           int pv_tblname_len,
+                           char *errstr,
+                           int &errstrlen)
 {
    int lv_error = FEOK;
    jlong jlv_transid = pv_transid;
@@ -960,6 +972,9 @@ int CHbaseTM::regTruncateOnAbort(int64 pv_transid,
                     jlv_transid,
                     jba_tblname);
    if (getExceptionDetails(NULL)) {
+      errstrlen = ((int)_tlp_error_msg->length() < errstrlen) ? (int)_tlp_error_msg->length()
: errstrlen;
+      strncpy(errstr, _tlp_error_msg->c_str(), errstrlen);
+      errstr[errstrlen -1] = '\0';
       tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)"CHbaseTM::regTruncateOnAbort()",
(char *)_tlp_error_msg->c_str(), pv_transid);
       return RET_EXCEPTION;
    }
@@ -978,7 +993,9 @@ int CHbaseTM::regTruncateOnAbort(int64 pv_transid,
 // ---------------------------------------------------------------------------
 int CHbaseTM::dropTable(int64 pv_transid,
                            const char* pa_tblname,
-                           int pv_tblname_len)
+                           int pv_tblname_len,
+                           char *errstr,
+                           int &errstrlen)
 {
    int lv_error = FEOK;
    jlong jlv_transid = pv_transid;
@@ -1005,6 +1022,9 @@ int CHbaseTM::dropTable(int64 pv_transid,
                     jlv_transid,
                     jba_tblname);
    if (getExceptionDetails(NULL)) {
+      errstrlen = ((int)_tlp_error_msg->length() < errstrlen) ? (int)_tlp_error_msg->length()
: errstrlen;
+      strncpy(errstr, _tlp_error_msg->c_str(), errstrlen);
+      errstr[errstrlen -1] = '\0';
       tm_log_write(DTM_TM_JNI_ERROR, SQ_LOG_ERR, (char *)"CHbaseTM::dropTable()", (char *)_tlp_error_msg->c_str(),
pv_transid);
       return RET_EXCEPTION;
    }

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c4e45965/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.h
----------------------------------------------------------------------
diff --git a/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.h b/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.h
index 78b9b1c..18ab6b5 100644
--- a/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.h
+++ b/core/sqf/src/seatrans/tm/hbasetmlib2/hbasetm.h
@@ -179,22 +179,28 @@ public:
    short tryCommit(int64 pv_transid);
    short completeRequest(int64 pv_transid);
    short abortTransaction(int64 pv_transid);
-   int dropTable(int64 pv_transid, const char* pa_tblname, int pv_tblname_len);
+   int dropTable(int64 pv_transid, const char* pa_tblname, int pv_tblname_len, char *errstr,
int &errstrlen);
    int regTruncateOnAbort(int64 pv_transid,
                            const char* pa_tblname,
-                           int pv_tblname_len);
+                           int pv_tblname_len,
+                           char *errstr,
+                           int &errstrlen);
    int createTable(int64 pv_transid,
                            const char* pa_tbldesc,
                            int pv_tbldesc_len,
                            char** pv_keys,
                            int pv_numsplits,
-                           int pv_keylen);
+                           int pv_keylen,
+                           char *errstr,
+                           int &errstrlen);
    int alterTable(int64 pv_transid,
                         const char* pa_tblname,
                         int pv_tblname_len,
                         char ** buffer_tblopts,
                         int pv_numtblopts,
-                        int pv_tbloptslen);
+                        int pv_tbloptslen,
+                        char *errstr,
+                        int &errstrlen);
    jobjectArray convertToByteArrayObjectArray(char **array, int numElements, int elementLen);
    jobjectArray convertToStringObjectArray(const char **textArray, int arrayLen);
    int registerRegion(int64 pv_transid, const char pa_region[], const char pa_regionInfo[],
int pv_regionInfo_Length);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c4e45965/core/sqf/src/tm/tmddlrequests.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tmddlrequests.cpp b/core/sqf/src/tm/tmddlrequests.cpp
index 28f3b6d..d854e69 100644
--- a/core/sqf/src/tm/tmddlrequests.cpp
+++ b/core/sqf/src/tm/tmddlrequests.cpp
@@ -34,11 +34,13 @@ using namespace std;
 * Signature: ([B)V
 */
 
-JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_createTableReq
-  (JNIEnv *pp_env, jobject pv_object, jbyteArray pv_tableDescriptor, jobjectArray pv_keys,
jint pv_numSplits, jint pv_keyLength, jlong pv_transid, jbyteArray pv_tblname){
+JNIEXPORT jstring JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_createTableReq
+  (JNIEnv *pp_env, jobject pv_object, jbyteArray pv_tableDescriptor, jobjectArray pv_keys,
jint pv_numSplits, jint pv_keyLength, jlong pv_transid, jbyteArray pv_tblname)
+{
 
    char la_tbldesc[TM_MAX_DDLREQUEST_STRING];
    char la_tblname[TM_MAX_DDLREQUEST_STRING];
+   char la_err_str[TM_MAX_ERROR_STRING];
    char* str_key;
    str_key = new char[TM_MAX_DDLREQUEST_STRING];
    char** la_keys;
@@ -77,12 +79,21 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInter
          pp_env->DeleteLocalRef(jba_keyarray);
       }
 
-      lv_error  = CREATETABLE(la_tbldesc, lv_tbldesc_length, la_tblname, la_keys, lv_numSplits,
lv_keyLength, lv_transid);
+      lv_error  = CREATETABLE(la_tbldesc, lv_tbldesc_length, la_tblname, la_keys, lv_numSplits,
lv_keyLength, lv_transid, la_err_str);
 
       pp_env->ReleaseByteArrayElements(pv_tableDescriptor, lp_tbldesc, 0);
       pp_env->ReleaseByteArrayElements(pv_tblname, lp_tblname, 0);
    }
-   return lv_error;
+   
+   if(lv_error)
+   {
+	   jstring lv_err_str = pp_env->NewStringUTF(la_err_str);
+	   return lv_err_str;
+   }
+   else
+   {
+	 return 0;
+   }
 }
 
 
@@ -91,10 +102,11 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInter
  * Method:    dropTableReq
  * Signature: ([BJ)V
  */
-JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_dropTableReq
+JNIEXPORT jstring JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_dropTableReq
   (JNIEnv *pp_env, jobject pv_object, jbyteArray pv_tblname, jlong pv_transid) {
 
    char la_tblname[TM_MAX_DDLREQUEST_STRING];
+   char la_err_str[TM_MAX_ERROR_STRING];
    int lv_error = FEOK;
 
    int lv_tblname_len = pp_env->GetArrayLength(pv_tblname);
@@ -108,10 +120,19 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInter
 
       long lv_transid = (long) pv_transid;
 
-      lv_error = DROPTABLE(la_tblname, lv_tblname_len, lv_transid);
+      lv_error = DROPTABLE(la_tblname, lv_tblname_len, lv_transid, la_err_str);
       pp_env->ReleaseByteArrayElements(pv_tblname, lp_tblname, 0);
    }
-   return lv_error;
+   
+   if(lv_error)
+   {
+	   jstring lv_err_str = pp_env->NewStringUTF(la_err_str);
+	   return lv_err_str;
+   }
+   else
+   {
+	 return 0;
+   }
 }
 
 /*
@@ -119,10 +140,11 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInter
  * Method:    truncateOnAbortReq
  * Signature: ([BJ)V
  */
-JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_truncateOnAbortReq
+JNIEXPORT jstring JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_truncateOnAbortReq
   (JNIEnv *pp_env, jobject pv_object, jbyteArray pv_tblname, jlong pv_transid) {
 
    char la_tblname[TM_MAX_DDLREQUEST_STRING];
+   char la_err_str[TM_MAX_ERROR_STRING];
    int lv_error = FEOK;
 
    int lv_tblname_len = pp_env->GetArrayLength(pv_tblname);
@@ -136,10 +158,19 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInter
 
       long lv_transid = (long) pv_transid;
 
-      lv_error = REGTRUNCATEONABORT(la_tblname, lv_tblname_len, lv_transid);
+      lv_error = REGTRUNCATEONABORT(la_tblname, lv_tblname_len, lv_transid, la_err_str);
       pp_env->ReleaseByteArrayElements(pv_tblname, lp_tblname, 0);
    }
-   return lv_error;
+   
+   if(lv_error)
+   {
+	   jstring lv_err_str = pp_env->NewStringUTF(la_err_str);
+	   return lv_err_str;
+   }
+   else
+   {
+	 return 0;
+   }
 }
 
 /*
@@ -147,12 +178,13 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInter
  * Method:    alterTableReq
  * Signature: ([B[Ljava/lang/Object;J)V
  */
-JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_alterTableReq
+JNIEXPORT jstring JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_alterTableReq
   (JNIEnv *pp_env, jobject pv_object, jbyteArray pv_tblName, jobjectArray pv_tableOptions,
jlong pv_transID) {
 
    int lv_error = FEOK;
    int tblopts_len =0;
    char la_tblname[TM_MAX_DDLREQUEST_STRING];
+   char la_err_str[TM_MAX_ERROR_STRING];
 
    char** tbl_options;
    tbl_options = new char *[TM_MAX_DDLREQUEST_STRING];
@@ -190,9 +222,17 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInter
       }
 
       long lv_transid = (long) pv_transID;
-      lv_error = ALTERTABLE(la_tblname, lv_tblname_len, tbl_options, tblopts_len, tbloptions_cnt,
lv_transid);
+      lv_error = ALTERTABLE(la_tblname, lv_tblname_len, tbl_options, tblopts_len, tbloptions_cnt,
lv_transid, la_err_str);
       pp_env->ReleaseByteArrayElements(pv_tblName, lp_tblname, 0);
    }
-   return lv_error;
+   if(lv_error)
+   {
+	   jstring lv_err_str = pp_env->NewStringUTF(la_err_str);
+	   return lv_err_str;
+   }
+   else
+   {
+	 return 0;
+   }
 }
  

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c4e45965/core/sqf/src/tm/tmddlrequests.h
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tmddlrequests.h b/core/sqf/src/tm/tmddlrequests.h
index dd8fc39..85a8bcd 100644
--- a/core/sqf/src/tm/tmddlrequests.h
+++ b/core/sqf/src/tm/tmddlrequests.h
@@ -13,7 +13,7 @@ extern "C" {
  * Method:    createTableReq
  * Signature: ([B[[BIIJ[B)V
  */
-JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_createTableReq
+JNIEXPORT jstring JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_createTableReq
   (JNIEnv *, jobject, jbyteArray, jobjectArray, jint, jint, jlong, jbyteArray);
 
 /*
@@ -21,7 +21,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInter
  * Method:    dropTableReq
  * Signature: ([BJ)V
  */
-JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_dropTableReq
+JNIEXPORT jstring JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_dropTableReq
   (JNIEnv *, jobject, jbyteArray, jlong);
 
 
@@ -31,7 +31,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInter
  * Method:    dropTableReq
  * Signature: ([BJ)V
  */
-JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_truncateOnAbortReq
+JNIEXPORT jstring JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_truncateOnAbortReq
   (JNIEnv *pp_env, jobject pv_object, jbyteArray pv_tblname, jlong pv_transid);
 
 
@@ -40,7 +40,7 @@ JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInter
  * Method:    alterTableReq
  * Signature: ([B[Ljava/lang/Object;J)V
  */
-JNIEXPORT jint JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_alterTableReq
+JNIEXPORT jstring JNICALL Java_org_apache_hadoop_hbase_client_transactional_RMInterface_alterTableReq
   (JNIEnv *pp_env, jobject pv_object, jbyteArray pv_tblName, jobjectArray pv_tableOptions,
jlong pv_transID);
 
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c4e45965/core/sqf/src/tm/tmlib.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tmlib.cpp b/core/sqf/src/tm/tmlib.cpp
index b9ca476..665404d 100644
--- a/core/sqf/src/tm/tmlib.cpp
+++ b/core/sqf/src/tm/tmlib.cpp
@@ -701,7 +701,8 @@ short REGISTERREGION(long transid, long startid, int pv_port, char *pa_hostname,
 // Purpose: send CREATETABLE message to the TM
 // Params: pa_tabledesc, pv_tabledesc_length, pv_tblname, transid
 // -------------------------------------------------------------------
-short CREATETABLE(char *pa_tbldesc, int pv_tbldesc_length, char *pv_tblname, char** pv_keys,
int pv_numsplits, int pv_keylen, long transid)
+short CREATETABLE(char *pa_tbldesc, int pv_tbldesc_length, char *pv_tblname, char** pv_keys,
int pv_numsplits, int pv_keylen, long transid ,
+		char* pv_err_str)
 {
     TM_Transid lv_transid((TM_Native_Type) transid);
     short lv_error = FEOK;
@@ -712,7 +713,7 @@ short CREATETABLE(char *pa_tbldesc, int pv_tbldesc_length, char *pv_tblname,
cha
     if (gp_trans_thr == NULL)
        gp_trans_thr = new TMLIB_ThreadTxn_Object();
     TM_Transaction *lp_trans = gp_trans_thr->get_current();
-    lv_error =  lp_trans->create_table(pa_tbldesc, pv_tbldesc_length, pv_tblname, pv_keys,
pv_numsplits, pv_keylen);
+    lv_error =  lp_trans->create_table(pa_tbldesc, pv_tbldesc_length, pv_tblname, pv_keys,
pv_numsplits, pv_keylen, pv_err_str);
 
     TMlibTrace(("TMLIB_TRACE : CREATETABLE EXIT: txid: (%d,%d), returning %d\n",
        lv_transid.get_node(), lv_transid.get_seq_num(), lv_error), 2);
@@ -726,7 +727,7 @@ short CREATETABLE(char *pa_tbldesc, int pv_tbldesc_length, char *pv_tblname,
cha
 // Purpose: send REGTRUNCATEONABORT message to the TM
 // Params: pa_tabledesc, pv_tabledesc_length, pv_tblname, transid
 // -------------------------------------------------------------------
-short REGTRUNCATEONABORT(char *pv_tblname, int pv_tblname_len, long pv_transid)
+short REGTRUNCATEONABORT(char *pv_tblname, int pv_tblname_len, long pv_transid, char* pv_err_str)
 {
     short lv_error = FEOK;
     TM_Transid lv_transid((TM_Native_Type) pv_transid);
@@ -736,7 +737,7 @@ short REGTRUNCATEONABORT(char *pv_tblname, int pv_tblname_len, long pv_transid)
     if (gp_trans_thr == NULL)
        gp_trans_thr = new TMLIB_ThreadTxn_Object();
     TM_Transaction *lp_trans = gp_trans_thr->get_current();
-    lv_error = lp_trans->reg_truncateonabort(pv_tblname, pv_tblname_len);
+    lv_error = lp_trans->reg_truncateonabort(pv_tblname, pv_tblname_len, pv_err_str);
 
     TMlibTrace(("TMLIB_TRACE : REGTRUNCATEONABORT EXIT: txid: (%d,%d), tablename: %s, returning
%d\n",
        lv_transid.get_node(), lv_transid.get_seq_num(), pv_tblname, lv_error), 2);
@@ -745,7 +746,8 @@ short REGTRUNCATEONABORT(char *pv_tblname, int pv_tblname_len, long pv_transid)
 }
 
 
-short ALTERTABLE(char *pv_tblname, int pv_tblname_len, char ** pv_tbloptions, int pv_tbloptslen,
int pv_tbloptscnt, long pv_transid)
+short ALTERTABLE(char *pv_tblname, int pv_tblname_len, char ** pv_tbloptions, int pv_tbloptslen,
int pv_tbloptscnt, long pv_transid,
+                 char* pv_err_str)
 {
     short lv_error = FEOK;
     TM_Transid lv_transid((TM_Native_Type) pv_transid);
@@ -755,7 +757,7 @@ short ALTERTABLE(char *pv_tblname, int pv_tblname_len, char ** pv_tbloptions,
in
     if (gp_trans_thr == NULL)
        gp_trans_thr = new TMLIB_ThreadTxn_Object();
     TM_Transaction *lp_trans = gp_trans_thr->get_current();
-    lv_error = lp_trans->alter_table(pv_tblname, pv_tblname_len, pv_tbloptions, pv_tbloptslen,
pv_tbloptscnt);
+    lv_error = lp_trans->alter_table(pv_tblname, pv_tblname_len, pv_tbloptions, pv_tbloptslen,
pv_tbloptscnt, pv_err_str);
 
     TMlibTrace(("TMLIB_TRACE : ALTERTABLE EXIT: txid: (%d,%d), tablename: %s, returning %d\n",
        lv_transid.get_node(), lv_transid.get_seq_num(), pv_tblname, lv_error), 2);
@@ -770,7 +772,7 @@ short ALTERTABLE(char *pv_tblname, int pv_tblname_len, char ** pv_tbloptions,
in
 // Purpose: send DROPTABLE message to TM
 // Params: pv_tablename, transid
 // -------------------------------------------------------------------
-short DROPTABLE(char *pv_tblname, int pv_tblname_len, long transid)
+short DROPTABLE(char *pv_tblname, int pv_tblname_len, long transid, char* pv_err_str)
 {
     short lv_error = FEOK;
     TM_Transid lv_transid((TM_Native_Type) transid);
@@ -780,7 +782,7 @@ short DROPTABLE(char *pv_tblname, int pv_tblname_len, long transid)
     if (gp_trans_thr == NULL)
        gp_trans_thr = new TMLIB_ThreadTxn_Object();
     TM_Transaction *lp_trans = gp_trans_thr->get_current();
-    lv_error = lp_trans->drop_table(pv_tblname, pv_tblname_len);
+    lv_error = lp_trans->drop_table(pv_tblname, pv_tblname_len, pv_err_str);
 
     TMlibTrace(("TMLIB_TRACE : DROPTABLE EXIT: txid: (%d,%d), tablename: %s, returning %d\n",
        lv_transid.get_node(), lv_transid.get_seq_num(), pv_tblname, lv_error), 2);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c4e45965/core/sqf/src/tm/tmlibmsg.h
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tmlibmsg.h b/core/sqf/src/tm/tmlibmsg.h
index 30d81ce..0f6614d 100644
--- a/core/sqf/src/tm/tmlibmsg.h
+++ b/core/sqf/src/tm/tmlibmsg.h
@@ -822,6 +822,8 @@ typedef struct registerregion_rsp {
 } Register_Region_Rsp_Type;
 
 typedef struct ddlrequest_rsp {
+    char	iv_err_str[TM_MAX_ERROR_STRING];
+    int     iv_err_str_len;
 } Ddl_Request_Rsp_Type;
 
 typedef struct hbaseregioninfo_rsp {
@@ -969,6 +971,7 @@ typedef struct _tmlibmsg_h_as_44 {
         Wait_TmUp_Rsp_Type      iv_wait_tmup;
         Test_Tx_Count_Rsp_Type  iv_count;
         Tm_RolloverCP_Rsp_Type  iv_control_point;
+        Ddl_Request_Rsp_Type    iv_ddl_response;
 #ifndef HP_CLOSED_SOURCE_1
         HbaseRegionInfo_Rsp_Type iv_hbaseregion_info;
         TM_GetNextSeqNum_Rsp_Type iv_GetNextSeqNum;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c4e45965/core/sqf/src/tm/tmrmhbase.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tmrmhbase.cpp b/core/sqf/src/tm/tmrmhbase.cpp
index a0974dc..b4585fa 100644
--- a/core/sqf/src/tm/tmrmhbase.cpp
+++ b/core/sqf/src/tm/tmrmhbase.cpp
@@ -412,6 +412,9 @@ int32 RM_Info_HBASE::hb_ddl_operation(CTmTxBase *pp_txn, int64 pv_flags,
CTmTxMe
 
    TMTrace (2, ("RM_Info_HBASE::hb_ddl_operation ENTRY\n"));
 
+   pp_msg->response()->u.iv_ddl_response.iv_err_str_len = 
+  	 sizeof(pp_msg->response()->u.iv_ddl_response.iv_err_str);
+   
    switch(pp_msg->request()->u.iv_ddl_request.ddlreq_type)
    {
       case TM_DDL_CREATE:
@@ -433,7 +436,9 @@ int32 RM_Info_HBASE::hb_ddl_operation(CTmTxBase *pp_txn, int64 pv_flags,
CTmTxMe
                          pv_tbldesclen,
                          NULL,
                          0,
-                         0);
+                         0,
+                         pp_msg->response()->u.iv_ddl_response.iv_err_str,
+                         pp_msg->response()->u.iv_ddl_response.iv_err_str_len);
          }
          else {
             buffer_keys = new char *[pv_numsplits];
@@ -450,7 +455,9 @@ int32 RM_Info_HBASE::hb_ddl_operation(CTmTxBase *pp_txn, int64 pv_flags,
CTmTxMe
                          pv_tbldesclen,
                          buffer_keys,
                          pv_numsplits,
-                         pv_keylen);
+                         pv_keylen,
+                         pp_msg->response()->u.iv_ddl_response.iv_err_str,
+                         pp_msg->response()->u.iv_ddl_response.iv_err_str_len);
          }
 
          if(ddlbuffer!=NULL) {
@@ -462,12 +469,16 @@ int32 RM_Info_HBASE::hb_ddl_operation(CTmTxBase *pp_txn, int64 pv_flags,
CTmTxMe
       case TM_DDL_DROP:
          lv_err = gv_HbaseTM.dropTable(lv_transid,
                          pp_msg->request()->u.iv_ddl_request.ddlreq,
-                         pp_msg->request()->u.iv_ddl_request.ddlreq_len);
+                         pp_msg->request()->u.iv_ddl_request.ddlreq_len,
+                         pp_msg->response()->u.iv_ddl_response.iv_err_str,
+                         pp_msg->response()->u.iv_ddl_response.iv_err_str_len);
          break;
       case TM_DDL_TRUNCATE:
          lv_err = gv_HbaseTM.regTruncateOnAbort(lv_transid,
                          pp_msg->request()->u.iv_ddl_request.ddlreq,
-                         pp_msg->request()->u.iv_ddl_request.ddlreq_len);
+                         pp_msg->request()->u.iv_ddl_request.ddlreq_len,
+                         pp_msg->response()->u.iv_ddl_response.iv_err_str,
+                         pp_msg->response()->u.iv_ddl_response.iv_err_str_len);
       case TM_DDL_ALTER:
         
          len = sizeof(Tm_Req_Msg_Type);
@@ -493,7 +504,9 @@ int32 RM_Info_HBASE::hb_ddl_operation(CTmTxBase *pp_txn, int64 pv_flags,
CTmTxMe
                          pp_msg->request()->u.iv_ddl_request.ddlreq_len,
                          buffer_opts,
                          pv_numtblopts,
-                         pv_tbloptslen);
+                         pv_tbloptslen,
+                         pp_msg->response()->u.iv_ddl_response.iv_err_str,
+                         pp_msg->response()->u.iv_ddl_response.iv_err_str_len);
 
          if(ddlbuffer!=NULL) {
             for(int i=0; i<pp_msg->request()->u.iv_ddl_request.alt_numopts; i++)

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c4e45965/core/sqf/src/tm/tmtransaction.cpp
----------------------------------------------------------------------
diff --git a/core/sqf/src/tm/tmtransaction.cpp b/core/sqf/src/tm/tmtransaction.cpp
index 11c5a72..dfbd838 100644
--- a/core/sqf/src/tm/tmtransaction.cpp
+++ b/core/sqf/src/tm/tmtransaction.cpp
@@ -134,10 +134,11 @@ short  TM_Transaction::register_region(long startid, int port, char
*hostName, i
 
 }
 
-short TM_Transaction::create_table(char* pa_tbldesc, int pv_tbldesc_len, char* pa_tblname,
char** pa_keys, int pv_numsplits, int pv_keylen)
+short TM_Transaction::create_table(char* pa_tbldesc, int pv_tbldesc_len, char* pa_tblname,
char** pa_keys, int pv_numsplits, int pv_keylen, char* pv_err_str)
 {
     Tm_Req_Msg_Type lv_req;
     Tm_Rsp_Msg_Type lv_rsp;
+    int maxErrStrBufLen = sizeof(lv_rsp.u.iv_ddl_response.iv_err_str);
 
     int len = sizeof(Tm_Req_Msg_Type);
     int len_aligned = 8*(((len + 7)/8));
@@ -165,7 +166,7 @@ short TM_Transaction::create_table(char* pa_tbldesc, int pv_tbldesc_len,
char* p
        memcpy((buffer+index), pa_keys[i], pv_keylen);
        index = index + pv_keylen;
     }
-
+  
     iv_last_error = gv_tmlib.send_tm_link(buffer, total_buffer, &lv_rsp, iv_transid.get_node());
     delete buffer;
     if(iv_last_error)
@@ -175,14 +176,20 @@ short TM_Transaction::create_table(char* pa_tbldesc, int pv_tbldesc_len,
char* p
     }
     
     iv_last_error = lv_rsp.iv_msg_hdr.miv_err.error;
+    if(iv_last_error)
+    {
+    	int len = lv_rsp.u.iv_ddl_response.iv_err_str_len < maxErrStrBufLen ? lv_rsp.u.iv_ddl_response.iv_err_str_len
: maxErrStrBufLen;
+    	memcpy(pv_err_str, lv_rsp.u.iv_ddl_response.iv_err_str, len); 
+    }
     
     return iv_last_error;
 }
 
-short TM_Transaction::alter_table(char * pa_tblname, int pv_tblname_len,  char ** pv_tbloptions,
 int pv_tbloptslen, int pv_tbloptscnt)
+short TM_Transaction::alter_table(char * pa_tblname, int pv_tblname_len,  char ** pv_tbloptions,
 int pv_tbloptslen, int pv_tbloptscnt, char* pv_err_str)
 {    
     Tm_Req_Msg_Type lv_req;
     Tm_Rsp_Msg_Type lv_rsp;
+    int maxErrStrBufLen = sizeof(lv_rsp.u.iv_ddl_response.iv_err_str);
  
     TMlibTrace(("TMLIB_TRACE : TM_Transaction::alter_table ENTRY tablename: %s\n", pa_tblname),
1);
 
@@ -220,13 +227,20 @@ short TM_Transaction::alter_table(char * pa_tblname, int pv_tblname_len,
 char *
     }
 
     iv_last_error = lv_rsp.iv_msg_hdr.miv_err.error;
-    return lv_last_error;
+    if(iv_last_error)
+    {
+    	int len = lv_rsp.u.iv_ddl_response.iv_err_str_len < maxErrStrBufLen ? lv_rsp.u.iv_ddl_response.iv_err_str_len
: maxErrStrBufLen;
+    	memcpy(pv_err_str, lv_rsp.u.iv_ddl_response.iv_err_str, len); 
+    }
+    
+    return iv_last_error;
 }
 
-short TM_Transaction::reg_truncateonabort(char* pa_tblname, int pv_tblname_len)
+short TM_Transaction::reg_truncateonabort(char* pa_tblname, int pv_tblname_len, char* pv_err_str)
 {
     Tm_Req_Msg_Type lv_req;
     Tm_Rsp_Msg_Type lv_rsp;
+    int maxErrStrBufLen = sizeof(lv_rsp.u.iv_ddl_response.iv_err_str);
 
     TMlibTrace(("TMLIB_TRACE : TM_Transaction::reg_truncateonabort ENTRY tablename: %s\n",
pa_tblname), 1);
 
@@ -246,13 +260,20 @@ short TM_Transaction::reg_truncateonabort(char* pa_tblname, int pv_tblname_len)
         return iv_last_error;
     }
     iv_last_error = lv_rsp.iv_msg_hdr.miv_err.error;
+    if(iv_last_error)
+    {
+    	int len = lv_rsp.u.iv_ddl_response.iv_err_str_len < maxErrStrBufLen ? lv_rsp.u.iv_ddl_response.iv_err_str_len
: maxErrStrBufLen;
+    	memcpy(pv_err_str, lv_rsp.u.iv_ddl_response.iv_err_str, len); 
+    }
+    
     return iv_last_error;
 }
 
-short TM_Transaction::drop_table(char* pa_tblname, int pv_tblname_len)
+short TM_Transaction::drop_table(char* pa_tblname, int pv_tblname_len, char* pv_err_str)
 {
     Tm_Req_Msg_Type lv_req;
     Tm_Rsp_Msg_Type lv_rsp;
+    int maxErrStrBufLen = sizeof(lv_rsp.u.iv_ddl_response.iv_err_str);
 
     TMlibTrace(("TMLIB_TRACE : TM_Transaction::drop_table ENTRY tablename: %s\n", pa_tblname),
1);
 
@@ -272,6 +293,12 @@ short TM_Transaction::drop_table(char* pa_tblname, int pv_tblname_len)
         return iv_last_error;
     }
     iv_last_error = lv_rsp.iv_msg_hdr.miv_err.error;
+    if(iv_last_error)
+    {
+    	int len = lv_rsp.u.iv_ddl_response.iv_err_str_len < maxErrStrBufLen ? lv_rsp.u.iv_ddl_response.iv_err_str_len
: maxErrStrBufLen;
+    	memcpy(pv_err_str, lv_rsp.u.iv_ddl_response.iv_err_str, len); 
+    }
+    
     return iv_last_error;
 }
 



Mime
View raw message