You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafodion.apache.org by sa...@apache.org on 2017/05/02 17:24:16 UTC

[6/7] incubator-trafodion git commit: Fixed review comments

Fixed review comments


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

Branch: refs/heads/master
Commit: 53e103c0b1c542ee057a7857d431f03915a17f40
Parents: fe262aa
Author: Sandhya Sundaresan <sa...@apache.org>
Authored: Fri Apr 28 18:07:35 2017 +0000
Committer: Sandhya Sundaresan <sa...@apache.org>
Committed: Fri Apr 28 18:07:35 2017 +0000

----------------------------------------------------------------------
 core/sql/common/ComSmallDefs.h |  1 +
 core/sql/exp/ExpLOB.cpp        | 38 ++++++++++++++++++-------------------
 core/sql/exp/ExpLOB.h          |  9 ++++-----
 core/sql/exp/ExpLOBaccess.cpp  |  8 ++++----
 core/sql/exp/ExpLOBaccess.h    | 13 ++-----------
 core/sql/exp/ExpLOBenums.h     | 12 ++++++++++++
 6 files changed, 42 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/common/ComSmallDefs.h
----------------------------------------------------------------------
diff --git a/core/sql/common/ComSmallDefs.h b/core/sql/common/ComSmallDefs.h
index f930f55..c3803e5 100644
--- a/core/sql/common/ComSmallDefs.h
+++ b/core/sql/common/ComSmallDefs.h
@@ -53,6 +53,7 @@ using namespace std;
 #include "NAString.h"
 #include "Int64.h"
 #include "dfs2rec.h"
+
 #ifndef NULL
 #define NULL 0
 #endif

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/exp/ExpLOB.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOB.cpp b/core/sql/exp/ExpLOB.cpp
index 28cd1c1..7184fb4 100644
--- a/core/sql/exp/ExpLOB.cpp
+++ b/core/sql/exp/ExpLOB.cpp
@@ -155,9 +155,9 @@ Lng32 ExpLOBoper::createLOB(void * exLobGlob, void *currContext, void * lobHeap,
 			    char * lobLoc,Int32 hdfsPort,char *hdfsServer,
 			    Int64 uid, Lng32 num, Int64 lobMaxSize )
 {
-  char buf[100];
+  char buf[LOB_NAME_LEN];
   
-  char * lobName = ExpGetLOBname(uid, num, buf, 100);
+  char * lobName = ExpGetLOBname(uid, num, buf, LOB_NAME_LEN);
   if (lobName == NULL)
     return -1;
 
@@ -279,9 +279,9 @@ Lng32 ExpLOBoper::dropLOB(void * exLobGlob, void * lobHeap, void *currContext,
 			  char * lobLoc,Int32 hdfsPort, char *hdfsServer,
 			  Int64 uid, Lng32 num)
 {
-  char buf[101];
+  char buf[LOB_NAME_LEN];
   
-  char * lobName = ExpGetLOBname(uid, num, buf, 100);
+  char * lobName = ExpGetLOBname(uid, num, buf, LOB_NAME_LEN);
   if (lobName == NULL)
     return -1;
 
@@ -307,9 +307,9 @@ Lng32 ExpLOBoper::purgedataLOB(void * exLobGlob, char * lobLoc,
                                
 			       Int64 uid, Lng32 num)
 {
-  char buf[100];
+  char buf[LOB_NAME_LEN];
   
-  char * lobName = ExpGetLOBname(uid, num, buf, 100);
+  char * lobName = ExpGetLOBname(uid, num, buf, LOB_NAME_LEN);
   if (lobName == NULL)
     return -1;
 
@@ -706,8 +706,8 @@ ex_expr::exp_return_type ExpLOBiud::insertDesc(char *op_data[],
 		      (ExeErrorCode)(8434));
       return ex_expr::EXPR_ERROR;
     }
-  char tgtLobNameBuf[100];
-  char * tgtLobName = ExpGetLOBname(objectUID_, lobNum(), tgtLobNameBuf, 100);
+  char tgtLobNameBuf[LOB_NAME_LEN];
+  char * tgtLobName = ExpGetLOBname(objectUID_, lobNum(), tgtLobNameBuf, LOB_NAME_LEN);
 
   if (tgtLobName == NULL)
     return ex_expr::EXPR_ERROR;
@@ -929,8 +929,8 @@ ex_expr::exp_return_type ExpLOBiud::insertData(Lng32 handleLen,
 		       handle);
   
    // get the lob name where data need to be inserted
-  char tgtLobNameBuf[100];
-  char * tgtLobName = ExpGetLOBname(uid, lobNum, tgtLobNameBuf, 100);
+  char tgtLobNameBuf[LOB_NAME_LEN];
+  char * tgtLobName = ExpGetLOBname(uid, lobNum, tgtLobNameBuf, LOB_NAME_LEN);
 
   if (tgtLobName == NULL)
     return ex_expr::EXPR_ERROR;
@@ -1112,8 +1112,8 @@ ex_expr::exp_return_type ExpLOBdelete::eval(char *op_data[],
   Lng32 handleLen = getOperand(1)->getLength(op_data[-MAX_OPERANDS+1]);
 
   // get the lob name where data need to be deleted
-  char lobNameBuf[100];
-  char * lobName = ExpGetLOBname(uid, lobNum, lobNameBuf, 100);
+  char lobNameBuf[LOB_NAME_LEN];
+  char * lobName = ExpGetLOBname(uid, lobNum, lobNameBuf, LOB_NAME_LEN);
   if (lobName == NULL)
     return ex_expr::EXPR_ERROR;
 
@@ -1294,18 +1294,18 @@ ex_expr::exp_return_type ExpLOBupdate::eval(char *op_data[],
 
   
   // get the lob name where data need to be updated
-  char tgtLobNameBuf[100];
-  char * tgtLobName = ExpGetLOBname(sUid, sLobNum, tgtLobNameBuf, 100);
+  char tgtLobNameBuf[LOB_NAME_LEN];
+  char * tgtLobName = ExpGetLOBname(sUid, sLobNum, tgtLobNameBuf, LOB_NAME_LEN);
 
   if (tgtLobName == NULL)
     return ex_expr::EXPR_ERROR;
 
-  char fromLobNameBuf[100];
+  char fromLobNameBuf[LOB_NAME_LEN];
   char * fromLobName = NULL;
   Int64 fromDescKey = 0;
   Int64 fromDescTS = 0;
   short fromSchNameLen = 0;
-  char  fromSchName[500];
+  char  fromSchName[ComAnsiNamePart::MAX_IDENTIFIER_EXT_LEN+1];
   if (0) // TBD. fromLob())
     {
       Lng32 fromLobType;
@@ -1318,7 +1318,7 @@ ex_expr::exp_return_type ExpLOBupdate::eval(char *op_data[],
 			   op_data[1]);
 
       // get the lob name where data will be read from
-      fromLobName = ExpGetLOBname(fromLobUid, fromLobNum, fromLobNameBuf, 100);
+      fromLobName = ExpGetLOBname(fromLobUid, fromLobNum, fromLobNameBuf, LOB_NAME_LEN);
       if (fromLobName == NULL)
 	return ex_expr::EXPR_ERROR;
     }
@@ -1563,8 +1563,8 @@ ex_expr::exp_return_type ExpLOBconvert::eval(char *op_data[],
 			   &schNameLen, schName,
 			   lobHandle);
   // get the lob name where data need to be inserted
-  char lobNameBuf[100];
-  char * lobName = ExpGetLOBname(uid, lobNum, lobNameBuf, 100);
+  char lobNameBuf[LOB_NAME_LEN];
+  char * lobName = ExpGetLOBname(uid, lobNum, lobNameBuf, LOB_NAME_LEN);
       
   if (descKey == -1) //This is an empty_blob/clob
     {

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/exp/ExpLOB.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOB.h b/core/sql/exp/ExpLOB.h
index 66f213c..0d2561d 100644
--- a/core/sql/exp/ExpLOB.h
+++ b/core/sql/exp/ExpLOB.h
@@ -45,7 +45,6 @@
 #include "exp_clause.h"
 #include "ExpLOBenums.h"
 
-#define LOB_HANDLE_LEN 1024
 
 class ExLobInMemoryDescChunksEntry;
 ////////////////////////////////
@@ -384,16 +383,16 @@ protected:
   char outLobHandle_[LOB_HANDLE_LEN];
   Int32 outHandleLen_;
 
-  char blackBox_[1024];
+  char blackBox_[MAX_BLACK_BOX_LEN];
   Int64 blackBoxLen_;
 
-  char lobStorageLocation_[1024];
+  char lobStorageLocation_[MAX_LOB_FILE_NAME_LEN];
 
-  char lobHdfsServer_[512];
+  char lobHdfsServer_[256];
   Lng32 lobHdfsPort_;
 
   short descSchNameLen_;
-  char  descSchName_[510];
+  char  descSchName_[ComAnsiNamePart::MAX_IDENTIFIER_EXT_LEN+1];
   Int64 lobSize_;
   Int64 lobMaxSize_;
   Int64 lobMaxChunkMemSize_;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/exp/ExpLOBaccess.cpp
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBaccess.cpp b/core/sql/exp/ExpLOBaccess.cpp
index 7ea3da5..27d8c5f 100644
--- a/core/sql/exp/ExpLOBaccess.cpp
+++ b/core/sql/exp/ExpLOBaccess.cpp
@@ -2569,16 +2569,16 @@ Ex_Lob_Error ExLobsOper (
         Int32 lobType;
         Int64 uid, inDescSyskey, descPartnKey;
         short schNameLen;
-        char schName[1024];
-        char sourceHandle[512]  = {};
+        char schName[ComAnsiNamePart::MAX_IDENTIFIER_EXT_LEN+1];
+        char sourceHandle[LOB_HANDLE_LEN]  = {};
         str_cpy_all(sourceHandle, source, sourceLen);
         ExpLOBoper::extractFromLOBhandle(&flags, &lobType, &lobNum, &uid,  
                                    &inDescSyskey, &descPartnKey,
                                    &schNameLen, schName,
                                    sourceHandle); 
-        char srcLobNameBuf[100];
+        char srcLobNameBuf[LOB_NAME_LEN];
         char * srcLobName = 
-          ExpLOBoper::ExpGetLOBname(uid, lobNum, srcLobNameBuf, 100);
+          ExpLOBoper::ExpGetLOBname(uid, lobNum, srcLobNameBuf, LOB_NAME_LEN);
         lobMap_it it2;
         it2 = lobMap->find(string(srcLobName));
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/exp/ExpLOBaccess.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBaccess.h b/core/sql/exp/ExpLOBaccess.h
index 7d97e19..acb63fc 100644
--- a/core/sql/exp/ExpLOBaccess.h
+++ b/core/sql/exp/ExpLOBaccess.h
@@ -67,15 +67,6 @@
 using namespace std;
 
 
-#define MAX_LOB_FILE_NAME_LEN 256
-#define MAX_HANDLE_IN_LEN 1024
-#define MAX_HANDLE_OUT_LEN 1024
-#define MAX_BLACK_BOX_LEN 2048
-#define LOB_DESC_HEADER_KEY 1
-#define NUM_WORKER_THREADS 2 
-// 2 threads at most, one to read and the other to pick up next read from preOpen
-
-#define LOB_CURSOR_PREFETCH_BYTES_MAX (1 << 27) // 128MB
 
 class ExLobGlobals;
 // This class defines the request used to construct the message to send over 
@@ -133,9 +124,9 @@ class ExLobRequest
     Int64 reqNum_;
     Int64 descNumIn_;
     Int64 descNumOut_;
-    char handleIn_[MAX_HANDLE_IN_LEN];
+    char handleIn_[LOB_HANDLE_LEN];
     Int64 handleInLen_;
-    char handleOut_[MAX_HANDLE_OUT_LEN];
+    char handleOut_[LOB_HANDLE_LEN];
     Int64 handleOutLen_;
     Int64 dataOffset_;
     LobsRequest type_;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/53e103c0/core/sql/exp/ExpLOBenums.h
----------------------------------------------------------------------
diff --git a/core/sql/exp/ExpLOBenums.h b/core/sql/exp/ExpLOBenums.h
index d63a0e2..37af1d0 100644
--- a/core/sql/exp/ExpLOBenums.h
+++ b/core/sql/exp/ExpLOBenums.h
@@ -24,7 +24,19 @@
 #define EXP_LOB_ENUMS_H
 
 #include "ComSmallDefs.h"
+#include "ComAnsiNamePart.h"
+#define LOB_HANDLE_LEN 1024
+#define LOB_NAME_LEN 50 // LOBP_<objectUid>_<LOBnum>  
+                         //      <---20----> <--4--->Need 30 bytes -  allocating extra.
+#define MAX_LOB_FILE_NAME_LEN 256
+#define MAX_BLACK_BOX_LEN 2048
+#define LOB_DESC_HEADER_KEY 1
+#define NUM_WORKER_THREADS 2
 
+ 
+// 2 threads at most, one to read and the other to pick up next read from preOpen
+
+#define LOB_CURSOR_PREFETCH_BYTES_MAX (1 << 27) // 128MB
 // IMPORTANT //
 // If an enum is added here, make sure that a corresponding entry is
 // made in lobErrorEnumStr that follows this enum list.