trafodion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dbirds...@apache.org
Subject [1/3] incubator-trafodion git commit: Make threshold of compression configurable in linux
Date Mon, 07 Aug 2017 22:13:34 GMT
Repository: incubator-trafodion
Updated Branches:
  refs/heads/master 56183e291 -> d53816273


Make threshold of compression configurable in linux


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

Branch: refs/heads/master
Commit: a731155a95df05b41ad780a8254a60faada79027
Parents: d86a0ba
Author: CoderSong2015 <403438485@qq.com>
Authored: Fri Aug 4 03:36:14 2017 +0000
Committer: CoderSong2015 <403438485@qq.com>
Committed: Fri Aug 4 03:36:14 2017 +0000

----------------------------------------------------------------------
 .../odbc/odbcclient/unixcli/cli/cconnect.cpp    |  4 +++
 .../odbc/odbcclient/unixcli/cli/cconnect.h      |  2 +-
 .../odbc/odbcclient/unixcli/cli/cdatasource.cpp | 38 ++++++++++++++++++--
 .../odbc/odbcclient/unixcli/cli/cdatasource.h   |  2 +-
 .../odbc/odbcclient/unixcli/cli/drvrglobal.cpp  |  2 ++
 .../odbc/odbcclient/unixcli/cli/drvrglobal.h    |  1 +
 .../odbcclient/unixcli/common/TCPIPUnixDrvr.cpp |  5 +--
 .../odbcclient/unixcli/common/TCPIPUnixDrvr.h   |  1 +
 8 files changed, 48 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a731155a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
index 7fa0bb2..3245dee 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.cpp
@@ -772,6 +772,10 @@ SQLRETURN CConnect::Connect(SQLCHAR *ServerName,
 	if (m_srvrTCPIPSystem != NULL)
 		m_srvrTCPIPSystem->m_IOCompression = m_IOCompression;
 
+	if (m_asTCPIPSystem != NULL)
+		m_asTCPIPSystem->m_IOCompressionThreshold = m_DSValue.m_DSIOCompressionThreshold;
+	if (m_srvrTCPIPSystem != NULL)
+		m_srvrTCPIPSystem->m_IOCompressionThreshold= m_DSValue.m_DSIOCompressionThreshold;
 	// Set the Assocation Service Object Reference
 	strcpy(m_ASSvc_ObjRef, m_DSValue.m_DSServer);
 	strcpy(buffer,m_DSValue.m_DSServer);

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a731155a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.h
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.h b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.h
index 75d9c19..87c0a7e 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.h
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cconnect.h
@@ -469,7 +469,7 @@ private:
 	SQLUINTEGER		m_SecurityMode;
 	bool			m_RetryEncryption;
 	SQLUINTEGER	    m_IOCompression;
-
+       int             m_IOCompressionThreshold;
 	void reset(bool clearE=true);
 	friend class	CStmt;
 	friend class	CDesc;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a731155a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdatasource.cpp
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdatasource.cpp b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdatasource.cpp
index 5413aec..b222fb4 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdatasource.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdatasource.cpp
@@ -34,9 +34,9 @@
 #define CONNECTION_TIMEOUT_DEFAULT	60
 #define LOGIN_TIMEOUT_DEFAULT		60
 #define	QUERY_TIMEOUT_DEFAULT		0
+#define IOCOMPRESSION_DEFAULT       1000
 #define FETCH_BUFFER_SIZE_DEFAULT	512 * 1024
 #define TCP_DEFAULT_PROCESS			"$ZTC0"
-
 // we are using the hpodbc driver manager
 extern int hpodbc_dmanager = 1;
 
@@ -93,7 +93,7 @@ CDataSource::CDataSource()
     m_DSCertificateFileActive[0] = '\0';
     strcpy(m_DSCertificateDir,"SYSTEM_DEFAULT");
     m_DSIOCompression = 0;
-
+    m_DSIOCompressionThreshold = 0;
     //
     // Read the ODBC section to get Certificate Directory Location
     //
@@ -613,7 +613,7 @@ short CDataSource::readDSValues(char *DSName,CConnect* pConnection)
 						keyValueLength,
 						path);
 	if (len > 0)
-	{	
+	{
 		if (strcmp((const char *)keyValueBuf, SYSTEM_DEFAULT) == 0)
 			m_DSQueryTimeout = QUERY_TIMEOUT_DEFAULT;
 		else
@@ -788,6 +788,29 @@ short CDataSource::readDSValues(char *DSName,CConnect* pConnection)
 		}
 	}
 
+//get threshold of compression ,default is 1000
+	keyValueLength = sizeof(keyValueBuf);
+	len = GetMyPrivateProfileString(
+						searchKey,
+						"CompressionThreshold",
+						NULL,
+						keyValueBuf,
+						keyValueLength,
+						path);
+
+	if (len > 0)
+	{
+		if (strcmp((const char *)keyValueBuf, SYSTEM_DEFAULT) == 0)
+			m_DSIOCompressionThreshold = IOCOMPRESSION_DEFAULT;
+		else
+		{
+			m_DSIOCompressionThreshold = atol((const char *)keyValueBuf);
+		}
+
+       }
+    else
+			m_DSIOCompressionThreshold = IOCOMPRESSION_DEFAULT;
+
 	keyValueLength = sizeof(m_DSServiceName);
 	len = GetMyPrivateProfileString(
 						searchKey,
@@ -993,6 +1016,15 @@ void CDataSource::updateDSValues(short DSNType, CONNECT_FIELD_ITEMS
*connectFiel
 			        m_DSIOCompression = atol((const char *)AttrValue);
 				}
 				break;
+			case KEY_COMPRESSIONTHRESHOLD:
+			    if (stricmp(AttrValue, SYSTEM_DEFAULT) == 0){
+			        m_DSIOCompressionThreshold = IOCOMPRESSION_DEFAULT;
+	                    }
+				else
+				{
+					m_DSIOCompressionThreshold = atol((const char *)AttrValue);
+				}
+			    break;
 			default:
 				break;
 			}

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a731155a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdatasource.h
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdatasource.h b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdatasource.h
index 67c4cef..5c072b2 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdatasource.h
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/cdatasource.h
@@ -88,7 +88,7 @@ private:
 	char		m_DSCertificateFile[MAX_SQL_IDENTIFIER_LEN + 1];
 	char		m_DSCertificateFileActive[MAX_SQL_IDENTIFIER_LEN + 1];
 	SQLUINTEGER	m_DSIOCompression;
-
+       int         m_DSIOCompressionThreshold;
 	friend class CConnect;
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a731155a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.cpp
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.cpp b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.cpp
index 0d4fcab..975d66b 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.cpp
@@ -192,6 +192,7 @@ char *ConnectKeywords[] =
 	"CERTIFICATEFILE",
 	"CERTIFICATEFILE_ACTIVE",
 	"COMPRESSION",
+	"COMPRESSIONTHRESHOLD",
 	NULL
 };
 
@@ -228,6 +229,7 @@ char *ConnectLocalizedIdentifier[] =
 	"Certificate File",
 	"Certificate File Active",
 	"Compression",
+	"CompressionThreshold",
 	NULL,
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a731155a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.h
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.h b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.h
index a3c9dd0..c082a46 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.h
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/cli/drvrglobal.h
@@ -401,6 +401,7 @@ typedef enum CONNECT_KEYWORDS
 	KEY_CERTIFICATEFILE,
 	KEY_CERTIFICATEFILE_ACTIVE,
 	KEY_COMPRESSION,
+	KEY_COMPRESSIONTHRESHOLD,
 	KEY_MAX
 };
 

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a731155a/core/conn/unixodbc/odbc/odbcclient/unixcli/common/TCPIPUnixDrvr.cpp
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/common/TCPIPUnixDrvr.cpp b/core/conn/unixodbc/odbc/odbcclient/unixcli/common/TCPIPUnixDrvr.cpp
index 6984b54..013f61b 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/common/TCPIPUnixDrvr.cpp
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/common/TCPIPUnixDrvr.cpp
@@ -59,6 +59,7 @@ CTCPIPUnixDrvr::CTCPIPUnixDrvr()
 	m_hSocket = INVALID_SOCKET;
 
 	m_IOCompression = 0;
+	m_IOCompressionThreshold = 1000;
 	m_hEvents[0] = NULL;
 	m_hEvents[1] = NULL;
 
@@ -440,7 +441,7 @@ bool DoIO (CTCPIPUnixDrvr* pTCPIPSystem, IDL_char* wbuffer, IDL_long write_count
 
 	RESET_ERRORS((long)pTCPIPSystem);
 
-	if (pTCPIPSystem->m_IOCompression != 0)
+	if ((pTCPIPSystem->m_IOCompression != 0)&&(pTCPIPSystem->odbcAPI != AS_API_GETOBJREF))
 	{
 		wheader.compress_ind = COMP_YES;
 		wheader.compress_type = pTCPIPSystem->m_IOCompression;
@@ -459,7 +460,7 @@ bool DoIO (CTCPIPUnixDrvr* pTCPIPSystem, IDL_char* wbuffer, IDL_long write_count
 
 	wheader.total_length = write_count;
 	wheader.hdr_type = WRITE_REQUEST_FIRST;
-	if (wheader.compress_ind == COMP_YES  && write_count > MIN_LENGTH_FOR_COMPRESSION)
+	if (wheader.compress_ind == COMP_YES  && write_count > pTCPIPSystem->m_IOCompressionThreshold)
 		DoCompression(pTCPIPSystem, wheader, (unsigned char*)wbuffer, (unsigned int&)write_count);
 	else
 		wheader.compress_type = COMP_NO_COMPRESSION;

http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/a731155a/core/conn/unixodbc/odbc/odbcclient/unixcli/common/TCPIPUnixDrvr.h
----------------------------------------------------------------------
diff --git a/core/conn/unixodbc/odbc/odbcclient/unixcli/common/TCPIPUnixDrvr.h b/core/conn/unixodbc/odbc/odbcclient/unixcli/common/TCPIPUnixDrvr.h
index f53dc8a..50e3f0f 100644
--- a/core/conn/unixodbc/odbc/odbcclient/unixcli/common/TCPIPUnixDrvr.h
+++ b/core/conn/unixodbc/odbc/odbcclient/unixcli/common/TCPIPUnixDrvr.h
@@ -72,6 +72,7 @@ public:
 	HEADER		m_rheader;
 	char		m_object_ref[MAX_OBJECT_REF + 1];
 	int		    m_IOCompression;
+       int         m_IOCompressionThreshold;
 	CCompression m_compression;
 
 private:


Mime
View raw message