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 2017/08/07 22:13:35 UTC
[2/3] incubator-trafodion git commit: Make threshold of compression
configurable in windows
Make threshold of compression configurable in windows
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/commit/c181c842
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/tree/c181c842
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafodion/diff/c181c842
Branch: refs/heads/master
Commit: c181c842beb1c8c9617c1c5db507d672eff0ea46
Parents: a731155
Author: CoderSong2015 <40...@qq.com>
Authored: Fri Aug 4 03:48:18 2017 +0000
Committer: CoderSong2015 <40...@qq.com>
Committed: Fri Aug 4 03:48:18 2017 +0000
----------------------------------------------------------------------
win-odbc64/Common/TCPIPSystemDrvr.cpp | 5 ++--
win-odbc64/Common/TCPIPSystemDrvr.h | 1 +
win-odbc64/odbcclient/drvr35/cconnect.cpp | 4 +++
win-odbc64/odbcclient/drvr35/cconnect.h | 1 +
win-odbc64/odbcclient/drvr35/cdatasource.cpp | 32 +++++++++++++++++++++++
win-odbc64/odbcclient/drvr35/cdatasource.h | 1 +
win-odbc64/odbcclient/drvr35/drvrglobal.cpp | 4 ++-
win-odbc64/odbcclient/drvr35/drvrglobal.h | 1 +
8 files changed, 46 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c181c842/win-odbc64/Common/TCPIPSystemDrvr.cpp
----------------------------------------------------------------------
diff --git a/win-odbc64/Common/TCPIPSystemDrvr.cpp b/win-odbc64/Common/TCPIPSystemDrvr.cpp
index 3565a8a..e56caf6 100644
--- a/win-odbc64/Common/TCPIPSystemDrvr.cpp
+++ b/win-odbc64/Common/TCPIPSystemDrvr.cpp
@@ -52,6 +52,7 @@ CTCPIPSystemDrvr::CTCPIPSystemDrvr()
exit(0);
m_hSocket = NULL;
m_IOCompression = 0;
+ m_IOCompressionThreshold = 1000;
m_hEvents[0] = NULL;
m_hEvents[1] = NULL;
m_swap = SWAP_YES;
@@ -376,7 +377,7 @@ bool DoIO (CTCPIPSystemDrvr* pTCPIPSystem, char* wbuffer, long write_count, char
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;
@@ -395,7 +396,7 @@ bool DoIO (CTCPIPSystemDrvr* pTCPIPSystem, char* wbuffer, long write_count, char
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 long&)write_count);
else
wheader.compress_type = COMP_NO_COMPRESSION;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c181c842/win-odbc64/Common/TCPIPSystemDrvr.h
----------------------------------------------------------------------
diff --git a/win-odbc64/Common/TCPIPSystemDrvr.h b/win-odbc64/Common/TCPIPSystemDrvr.h
index 56b25ab..3baf3d6 100644
--- a/win-odbc64/Common/TCPIPSystemDrvr.h
+++ b/win-odbc64/Common/TCPIPSystemDrvr.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:
char m_swap;
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c181c842/win-odbc64/odbcclient/drvr35/cconnect.cpp
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/cconnect.cpp b/win-odbc64/odbcclient/drvr35/cconnect.cpp
index 6cc6175..ade058b 100644
--- a/win-odbc64/odbcclient/drvr35/cconnect.cpp
+++ b/win-odbc64/odbcclient/drvr35/cconnect.cpp
@@ -587,6 +587,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;
//if (m_DSValue.m_DSServiceName[0] != 0)
/// strcpy(m_QSServiceName, m_DSValue.m_DSServiceName);
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c181c842/win-odbc64/odbcclient/drvr35/cconnect.h
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/cconnect.h b/win-odbc64/odbcclient/drvr35/cconnect.h
index 3f6d111..4bfe1df 100644
--- a/win-odbc64/odbcclient/drvr35/cconnect.h
+++ b/win-odbc64/odbcclient/drvr35/cconnect.h
@@ -238,6 +238,7 @@ private:
BOOL m_ConnectionDead;
BOOL m_SelectRowsets;
SQLUINTEGER m_IOCompression;
+ int m_IOCompressionThreshold;
BOOL m_ChangePassword; // for password expiry
BOOL m_FlushFetchData; // For query driver which cannot handle huge data being returned.
SQLINTEGER m_StartNode; // Node(cpu) to start the mxosrvr on - defaults to -1 (any)
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c181c842/win-odbc64/odbcclient/drvr35/cdatasource.cpp
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/cdatasource.cpp b/win-odbc64/odbcclient/drvr35/cdatasource.cpp
index 4ac6a50..054621a 100644
--- a/win-odbc64/odbcclient/drvr35/cdatasource.cpp
+++ b/win-odbc64/odbcclient/drvr35/cdatasource.cpp
@@ -34,6 +34,7 @@
#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 FETCH_BUFFER_SIZE_DEFAULT 0
@@ -515,6 +516,28 @@ short CDataSource::readDSValues(char *DSName, char* transError)
else
m_DSIOCompression = 0;
+ //get threshold of compression ,default is 1000
+ keyValueLength = sizeof(keyValueBuf);
+ error = RegQueryValueEx(keyHandle,
+ "CompressionThreshold",
+ NULL, // Reserved
+ &keyValueType,
+ keyValueBuf,
+ &keyValueLength);
+
+ if (error == ERROR_SUCCESS)
+ {
+ 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(keyValueBuf);
error = RegQueryValueEx(keyHandle,
"RowsetErrorRecovery",
@@ -733,6 +756,15 @@ void CDataSource::updateDSValues(short DSNType, CONNECT_FIELD_ITEMS *connectFiel
m_DSIOCompression = atol(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/c181c842/win-odbc64/odbcclient/drvr35/cdatasource.h
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/cdatasource.h b/win-odbc64/odbcclient/drvr35/cdatasource.h
index ca349e1..fa776c6 100644
--- a/win-odbc64/odbcclient/drvr35/cdatasource.h
+++ b/win-odbc64/odbcclient/drvr35/cdatasource.h
@@ -63,6 +63,7 @@ private:
char m_DSReplacementChar[5];
BOOL m_DSSelectRowsets;
SQLUINTEGER m_DSIOCompression;
+ int m_DSIOCompressionThreshold;
BOOL m_DSRowsetErrorRecovery;
char m_DSServerDSName[MAX_SQL_IDENTIFIER_LEN + 1];
char m_DSServiceName[SQL_MAX_SERVICENAME_LEN + 1];
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c181c842/win-odbc64/odbcclient/drvr35/drvrglobal.cpp
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/drvrglobal.cpp b/win-odbc64/odbcclient/drvr35/drvrglobal.cpp
index 8d1124c..6128ced 100644
--- a/win-odbc64/odbcclient/drvr35/drvrglobal.cpp
+++ b/win-odbc64/odbcclient/drvr35/drvrglobal.cpp
@@ -164,7 +164,8 @@ char *ConnectKeywords[] =
"CERTIFICATEDIR",
"CERTIFICATEFILE",
"CERTIFICATEFILE_ACTIVE",
- "COMPRESSION",
+ "COMPRESSION",
+ "COMPRESSIONTHRESHOLD",
NULL
};
@@ -198,6 +199,7 @@ char *ConnectLocalizedIdentifier[] =
"Certificate File",
"Certificate File Active",
"Compression",
+ "CompressionThreshold",
NULL
};
http://git-wip-us.apache.org/repos/asf/incubator-trafodion/blob/c181c842/win-odbc64/odbcclient/drvr35/drvrglobal.h
----------------------------------------------------------------------
diff --git a/win-odbc64/odbcclient/drvr35/drvrglobal.h b/win-odbc64/odbcclient/drvr35/drvrglobal.h
index 0865698..2bb174b 100644
--- a/win-odbc64/odbcclient/drvr35/drvrglobal.h
+++ b/win-odbc64/odbcclient/drvr35/drvrglobal.h
@@ -390,6 +390,7 @@ typedef enum CONNECT_KEYWORDS
KEY_CERTIFICATEFILE,
KEY_CERTIFICATEFILE_ACTIVE,
KEY_COMPRESSION,
+ KEY_COMPRESSIONTHRESHOLD,
KEY_MAX
};