Repository: incubator-trafodion
Updated Branches:
  refs/heads/master acb7f2b6f -> 9409c8ea0


[TRAFODION-1682]MT-DCS protocol issue fix

This commit will fix following issues.
1. [TRAFODION-1682][MTDCS] ODBC: SQLFetch returned invalid cursor
state. It's caused by the length of descriptor2List is not correct and
the sqlQueryType is not correct either. For sqlQueryType,
    SqlUtils.getSqlStmtType(String str) will be used instead of
    SqlUtils.getSqlStmtType(int stmtType) since it can't return the
    correct value.
2. [TRAFODION-1653][MTDCS] coast tests core dumped at 'operator new'
when Multithread DCS is on. It's caused by the EndTransaction message
missing a int which indicate 0 excaption when there is no exception.
3. [TRAFODION-1658][MTDCS] with MultiThread DCS on, coast core dumped
at memcpy when there is parameter in prepare statement. It's caused by
the length of the descriptor2List is not correct.


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

Branch: refs/heads/master
Commit: e06b2640e6f83556217405f81f8f211db1fedac0
Parents: fc9651f
Author: Weiqing Xu <[email protected]>
Authored: Thu Jan 14 02:57:32 2016 +0000
Committer: Weiqing Xu <[email protected]>
Committed: Thu Jan 14 02:57:32 2016 +0000

----------------------------------------------------------------------
 .../serverDriverInputOutput/Descriptor2List.java      |  2 +-
 .../serverHandler/ServerApiSqlEndTransact.java        | 14 +++++++++++++-
 .../serverHandler/ServerApiSqlExecDirect.java         |  2 +-
 3 files changed, 15 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e06b2640/dcs/src/main/java/org/trafodion/dcs/servermt/serverDriverInputOutput/Descriptor2List.java
----------------------------------------------------------------------
diff --git 
a/dcs/src/main/java/org/trafodion/dcs/servermt/serverDriverInputOutput/Descriptor2List.java
 
b/dcs/src/main/java/org/trafodion/dcs/servermt/serverDriverInputOutput/Descriptor2List.java
index df8c749..53de87a 100644
--- 
a/dcs/src/main/java/org/trafodion/dcs/servermt/serverDriverInputOutput/Descriptor2List.java
+++ 
b/dcs/src/main/java/org/trafodion/dcs/servermt/serverDriverInputOutput/Descriptor2List.java
@@ -80,7 +80,7 @@ public class Descriptor2List {
         if (descCount == descNumber){
             Descriptor2 desc = null;
             if (oldFormat == false)
-                descLength = 3 * ServerConstants.INT_FIELD_SIZE;
+                descLength = 2 * ServerConstants.INT_FIELD_SIZE;
             else
                 descLength = ServerConstants.INT_FIELD_SIZE;
             varLength = 0;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e06b2640/dcs/src/main/java/org/trafodion/dcs/servermt/serverHandler/ServerApiSqlEndTransact.java
----------------------------------------------------------------------
diff --git 
a/dcs/src/main/java/org/trafodion/dcs/servermt/serverHandler/ServerApiSqlEndTransact.java
 
b/dcs/src/main/java/org/trafodion/dcs/servermt/serverHandler/ServerApiSqlEndTransact.java
index dc1a323..22cc97e 100644
--- 
a/dcs/src/main/java/org/trafodion/dcs/servermt/serverHandler/ServerApiSqlEndTransact.java
+++ 
b/dcs/src/main/java/org/trafodion/dcs/servermt/serverHandler/ServerApiSqlEndTransact.java
@@ -127,6 +127,13 @@ public class ServerApiSqlEndTransact {
             dataLength = serverException.lengthOfData();
             availableBuffer = bbBody.capacity() - bbBody.position();
             
+            // If there is no Exception, serverException.lengthOfData() will 
return 8;
+            // The driver still need read a int will indicate the number of 
the exception,
+            // which should be 0;
+            // So here, we add extra 4 bytes for it.
+            if (dataLength == 2 * ServerConstants.INT_FIELD_SIZE) {
+                dataLength = dataLength + ServerConstants.INT_FIELD_SIZE;
+            }
             if(LOG.isDebugEnabled())
                 LOG.debug(serverWorkerName + ". dataLength :" + dataLength + " 
availableBuffer :" + availableBuffer);
         
@@ -138,6 +145,11 @@ public class ServerApiSqlEndTransact {
 //===================== build output 
==============================================
             serverException.insertIntoByteBuffer(bbBody);
             
+            // if there is no exception, we add a extra 4 bytes which indicate 
the number of
+            // the exception which should be 0;
+            if (serverException.lengthOfData() == 2 * 
ServerConstants.INT_FIELD_SIZE) {
+                bbBody.putInt(0);
+            }
             bbBody.flip();
 //=========================Update header================================ 
             hdr.setTotalLength(bbBody.limit());
@@ -161,4 +173,4 @@ public class ServerApiSqlEndTransact {
         reset();
         return clientData;
     }
-}
\ No newline at end of file
+}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/e06b2640/dcs/src/main/java/org/trafodion/dcs/servermt/serverHandler/ServerApiSqlExecDirect.java
----------------------------------------------------------------------
diff --git 
a/dcs/src/main/java/org/trafodion/dcs/servermt/serverHandler/ServerApiSqlExecDirect.java
 
b/dcs/src/main/java/org/trafodion/dcs/servermt/serverHandler/ServerApiSqlExecDirect.java
index d2c8448..c0eff71 100644
--- 
a/dcs/src/main/java/org/trafodion/dcs/servermt/serverHandler/ServerApiSqlExecDirect.java
+++ 
b/dcs/src/main/java/org/trafodion/dcs/servermt/serverHandler/ServerApiSqlExecDirect.java
@@ -215,7 +215,7 @@ public class ServerApiSqlExecDirect {
                 throw new SQLException(serverWorkerName + ". Wrong dialogueId 
sent by the Client [sent/expected] : [" + dialogueId + "/" + 
clientData.getDialogueId() + "]");
             }
 //=============================================================================
-            sqlQueryType = SqlUtils.getSqlStmtType(sqlStmtType);
+            sqlQueryType = SqlUtils.getSqlStmtType(sqlString);
 
             try {
                 trafConn = clientData.getTrafConnection();

Reply via email to