Change some variable. Make the description more detailed.
Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/8cd59bf0 Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/8cd59bf0 Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/8cd59bf0 Branch: refs/heads/master Commit: 8cd59bf0146fde470e1484b5a03adefd6647865d Parents: 1b19b96 Author: Haolin.song <[email protected]> Authored: Wed Mar 28 11:15:50 2018 +0000 Committer: Haolin.song <[email protected]> Committed: Wed Mar 28 11:15:50 2018 +0000 ---------------------------------------------------------------------- core/conn/odbc/src/odbc/Common/Global.h | 12 ++++----- .../odbc/nsksrvr/Interface/Listener_srvr.cpp | 22 +++------------- .../src/odbc/nsksrvr/Interface/Listener_srvr.h | 4 +-- core/conn/odbc/src/odbc/nsksrvr/SrvrMain.cpp | 27 +++++++++++--------- .../main/java/org/trafodion/dcs/Constants.java | 2 +- .../org/trafodion/dcs/server/ServerManager.java | 24 ++++++++--------- dcs/src/main/resources/dcs-default.xml | 14 +++++----- 7 files changed, 47 insertions(+), 58 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/8cd59bf0/core/conn/odbc/src/odbc/Common/Global.h ---------------------------------------------------------------------- diff --git a/core/conn/odbc/src/odbc/Common/Global.h b/core/conn/odbc/src/odbc/Common/Global.h index 8dc22cf..0789b1c 100644 --- a/core/conn/odbc/src/odbc/Common/Global.h +++ b/core/conn/odbc/src/odbc/Common/Global.h @@ -139,7 +139,7 @@ class ODBCMXTraceMsg; #define DEFAULT_REFRESH_RATE_SECS 60 #define DEFAULT_SRVR_IDLE_TIMEOUT 0 #define DEFAULT_CONN_IDLE_TIMEOUT 0 -#define DEFAULT_KEEPALIVE 1 //OPEN KEEPALIVE +#define DEFAULT_KEEPALIVE 0 //OPEN KEEPALIVE #define DEFAULT_KEEPALIVE_TIMESEC 3600 #define DEFAULT_KEEPALIVE_COUNT 3 #define DEFAULT_KEEPALIVE_INTVL 20 @@ -941,7 +941,7 @@ typedef struct _SRVR_GLOBAL_Def bzero(m_ProcName,sizeof(m_ProcName)); m_bNewConnection = false; m_bNewService = false; - bzero(clientKeepaliveStatus, sizeof(clientKeepaliveStatus)); + clientKeepaliveStatus = false; clientKeepaliveIdletime = 0; clientKeepaliveIntervaltime = 0; clientKeepaliveRetrycount = 0; @@ -1062,10 +1062,10 @@ typedef struct _SRVR_GLOBAL_Def tip_handle_t tip_gateway; - char clientKeepaliveStatus[64]; - int clientKeepaliveIdletime; - int clientKeepaliveIntervaltime; - int clientKeepaliveRetrycount; + BOOL clientKeepaliveStatus; + int clientKeepaliveIdletime; + int clientKeepaliveIntervaltime; + int clientKeepaliveRetrycount; char *pxid_url; IDL_long_long local_xid; UINT xid_length; http://git-wip-us.apache.org/repos/asf/trafodion/blob/8cd59bf0/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.cpp ---------------------------------------------------------------------- diff --git a/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.cpp b/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.cpp index bdd40ce..a31b51b 100644 --- a/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.cpp +++ b/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.cpp @@ -82,38 +82,22 @@ void CNSKListenerSrvr::TCP_PROCESSNAME_PORT(FILE* fp) } void CNSKListenerSrvr::TCP_SetKeepalive(int socketnum, - char *keepaliveStatus, + bool keepaliveStatus, int idleTime, int intervalTime, int retryCount) { //all need to be configured - if(NULL == keepaliveStatus){ - return; - } - if(0 == strcmp(keepaliveStatus,"default")){ + if(!keepaliveStatus){ keepaliveOpt.isKeepalive = DEFAULT_KEEPALIVE; keepaliveOpt.keepaliveIdle = DEFAULT_KEEPALIVE_TIMESEC; keepaliveOpt.keepaliveInterval = DEFAULT_KEEPALIVE_INTVL; keepaliveOpt.keepCount = DEFAULT_KEEPALIVE_COUNT; - }else - if(0 == strcmp(keepaliveStatus,"unenable")){ - keepaliveOpt.isKeepalive = 0; - keepaliveOpt.keepaliveIdle = DEFAULT_KEEPALIVE_TIMESEC; - keepaliveOpt.keepaliveInterval = DEFAULT_KEEPALIVE_INTVL; - keepaliveOpt.keepCount = DEFAULT_KEEPALIVE_COUNT; - }else - if(0 == strcmp(keepaliveStatus, "enable")){ + }else{ keepaliveOpt.isKeepalive = 1; keepaliveOpt.keepaliveIdle = idleTime; keepaliveOpt.keepaliveInterval = intervalTime; keepaliveOpt.keepCount = retryCount; - - }else{ - keepaliveOpt.isKeepalive = 0; - keepaliveOpt.keepaliveIdle = DEFAULT_KEEPALIVE_TIMESEC; - keepaliveOpt.keepaliveInterval = DEFAULT_KEEPALIVE_INTVL; - keepaliveOpt.keepCount = DEFAULT_KEEPALIVE_COUNT; } int error; http://git-wip-us.apache.org/repos/asf/trafodion/blob/8cd59bf0/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.h ---------------------------------------------------------------------- diff --git a/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.h b/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.h index 9a5d010..dcf4f4b 100644 --- a/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.h +++ b/core/conn/odbc/src/odbc/nsksrvr/Interface/Listener_srvr.h @@ -47,8 +47,8 @@ public: long getPort() { return m_port; }; void closeTCPIPSession(int fnum); - KEEPALIVE_OPT keepaliveOpt; - void TCP_SetKeepalive(int socketnum, char *keepaliveStatus, int idleTime, int intervalTime, int retryCount); + KEEPALIVE_OPT keepaliveOpt; + void TCP_SetKeepalive(int socketnum, bool keepaliveStatus, int idleTime, int intervalTime, int retryCount); protected: long m_port; CURR_TCPIP_OPER m_tcpip_operation; http://git-wip-us.apache.org/repos/asf/trafodion/blob/8cd59bf0/core/conn/odbc/src/odbc/nsksrvr/SrvrMain.cpp ---------------------------------------------------------------------- diff --git a/core/conn/odbc/src/odbc/nsksrvr/SrvrMain.cpp b/core/conn/odbc/src/odbc/nsksrvr/SrvrMain.cpp index 52e4ce1..132a0a4 100644 --- a/core/conn/odbc/src/odbc/nsksrvr/SrvrMain.cpp +++ b/core/conn/odbc/src/odbc/nsksrvr/SrvrMain.cpp @@ -95,7 +95,7 @@ long initSessMemSize; int portMapToSecs = -1; int portBindToSecs = -1; bool bPlanEnabled = false; -char keepaliveStatus[256]; +bool keepaliveStatus = false; int keepaliveIdletime; int keepaliveIntervaltime; int keepaliveRetrycount; @@ -794,14 +794,12 @@ catch(SB_Fatal_Excep sbfe) //LCOV_EXCL_STOP } } - if( strlen(keepaliveStatus) > 0){ - strncpy( srvrGlobal->clientKeepaliveStatus, keepaliveStatus, strlen(keepaliveStatus)); - srvrGlobal->clientKeepaliveIntervaltime = keepaliveIntervaltime; - srvrGlobal->clientKeepaliveIdletime = keepaliveIdletime; - srvrGlobal->clientKeepaliveRetrycount = keepaliveRetrycount; - }else{ - strncpy( srvrGlobal->clientKeepaliveStatus, "unenable", strlen("unenable")); - } + + srvrGlobal->clientKeepaliveStatus = keepaliveStatus; + srvrGlobal->clientKeepaliveIntervaltime = keepaliveIntervaltime; + srvrGlobal->clientKeepaliveIdletime = keepaliveIdletime; + srvrGlobal->clientKeepaliveRetrycount = keepaliveRetrycount; + // TCPADD and RZ are required parameters. // The address is passed in with TCPADD parameter . // The hostname is passed in with RZ parameter. @@ -1441,10 +1439,15 @@ BOOL getInitParamSrvr(int argc, char *argv[], SRVR_INIT_PARAM_Def &initParam, ch if (strcmp(arg, "-TCPKEEPALIVESTATUS") == 0){ if (++count < argc && argv[count][0] != '-') { - if (strlen(argv[count]) < sizeof(keepaliveStatus) - 1) + char keepaliveEnable[20]; + if (strlen(argv[count]) < sizeof(keepaliveEnable) - 1) { - memset(keepaliveStatus, 0, sizeof(keepaliveStatus) - 1); - strncpy(keepaliveStatus, argv[count], sizeof(keepaliveStatus) - 1); + memset(keepaliveEnable, 0, sizeof(keepaliveEnable) - 1); + strncpy(keepaliveEnable, argv[count], sizeof(keepaliveEnable) - 1); + if(stricmp(keepaliveEnable, "true") == 0) + keepaliveStatus = true; + else + keepaliveStatus = false; } else { http://git-wip-us.apache.org/repos/asf/trafodion/blob/8cd59bf0/dcs/src/main/java/org/trafodion/dcs/Constants.java ---------------------------------------------------------------------- diff --git a/dcs/src/main/java/org/trafodion/dcs/Constants.java b/dcs/src/main/java/org/trafodion/dcs/Constants.java index de51773..b3e5f38 100644 --- a/dcs/src/main/java/org/trafodion/dcs/Constants.java +++ b/dcs/src/main/java/org/trafodion/dcs/Constants.java @@ -116,7 +116,7 @@ public final class Constants { public static final String DEFAULT_DCS_SERVER_PROGRAM_TCP_KEEPALIVE_STATUS= "dcs.server.user.program.tcp.keepalive.status"; /** Default value for DCS server program mxosrvr keepalive STATUS*/ - public static final String DCS_SERVER_PROGRAM_KEEPALIVE_STATUS = "enable"; + public static final String DCS_SERVER_PROGRAM_KEEPALIVE_STATUS = "true"; /** Configuration key for DCS server program mxosrvr keepalive IDLETIME*/ public static final String DEFAULT_DCS_SERVER_PROGRAM_TCP_KEEPALIVE_IDLETIME = "dcs.server.user.program.tcp.keepalive.idletime"; http://git-wip-us.apache.org/repos/asf/trafodion/blob/8cd59bf0/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java ---------------------------------------------------------------------- diff --git a/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java b/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java index 23e5721..e9dc98c 100644 --- a/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java +++ b/dcs/src/main/java/org/trafodion/dcs/server/ServerManager.java @@ -83,10 +83,10 @@ public final class ServerManager implements Callable { private int maxRestartAttempts; private int retryIntervalMillis; private String nid = null; - private static String mxosrvrKeepaliveStatus; - private static int mxosrvrKeepaliveIdletime; - private static int mxosrvrKeepaliveIntervaltime; - private static int mxosrvrKeepaliveRetrycount; + private static String userProgKeepaliveStatus; + private static int userProgKeepaliveIdletime; + private static int userProgKeepaliveIntervaltime; + private static int userProgKeepaliveRetrycount; class RegisteredWatcher implements Watcher { CountDownLatch startSignal; @@ -210,13 +210,13 @@ public final class ServerManager implements Callable { .replace("-PORTBINDTOSECS", "-PORTBINDTOSECS " + userProgPortBindToSecs) .replace("-TCPKEEPALIVESTATUS", - "-TCPKEEPALIVESTATUS " + mxosrvrKeepaliveStatus + " ") + "-TCPKEEPALIVESTATUS " + userProgKeepaliveStatus + " ") .replace("-TCPKEEPALIVEIDLETIME", - "-TCPKEEPALIVEIDLETIME " + mxosrvrKeepaliveIdletime + " ") + "-TCPKEEPALIVEIDLETIME " + userProgKeepaliveIdletime + " ") .replace("-TCPKEEPALIVEINTERVAL", - "-TCPKEEPALIVEINTERVAL " + mxosrvrKeepaliveIntervaltime + " ") + "-TCPKEEPALIVEINTERVAL " + userProgKeepaliveIntervaltime + " ") .replace("-TCPKEEPALIVERETRYCOUNT", - "-TCPKEEPALIVERETRYCOUNT " + mxosrvrKeepaliveRetrycount + " ") + "-TCPKEEPALIVERETRYCOUNT " + userProgKeepaliveRetrycount + " ") .replace("<", "<").replace("&", "&") .replace(">", ">"); scriptContext.setCommand(command); @@ -360,16 +360,16 @@ public final class ServerManager implements Callable { this.retryIntervalMillis = conf .getInt(Constants.DCS_SERVER_USER_PROGRAM_RESTART_HANDLER_RETRY_INTERVAL_MILLIS, Constants.DEFAULT_DCS_SERVER_USER_PROGRAM_RESTART_HANDLER_RETRY_INTERVAL_MILLIS); - this.mxosrvrKeepaliveStatus = conf.get( + this.userProgKeepaliveStatus = conf.get( Constants.DEFAULT_DCS_SERVER_PROGRAM_TCP_KEEPALIVE_STATUS, Constants.DCS_SERVER_PROGRAM_KEEPALIVE_STATUS); - this.mxosrvrKeepaliveIdletime = conf.getInt( + this.userProgKeepaliveIdletime = conf.getInt( Constants.DEFAULT_DCS_SERVER_PROGRAM_TCP_KEEPALIVE_IDLETIME, Constants.DCS_SERVER_PROGRAM_KEEPALIVE_IDLETIME); - this.mxosrvrKeepaliveIntervaltime = conf.getInt( + this.userProgKeepaliveIntervaltime = conf.getInt( Constants.DEFAULT_DCS_SERVER_PROGRAM_TCP_KEEPALIVE_INTERVALTIME, Constants.DCS_SERVER_PROGRAM_KEEPALIVE_INTERVALTIME); - this.mxosrvrKeepaliveRetrycount = conf.getInt( + this.userProgKeepaliveRetrycount = conf.getInt( Constants.DEFAULT_DCS_SERVER_PROGRAM_TCP_KEEPALIVE_RETRYCOUNT, Constants.DCS_SERVER_PROGRAM_KEEPALIVE_RETRYCOUNT); serverHandlers = new ServerHandler[this.childServers]; http://git-wip-us.apache.org/repos/asf/trafodion/blob/8cd59bf0/dcs/src/main/resources/dcs-default.xml ---------------------------------------------------------------------- diff --git a/dcs/src/main/resources/dcs-default.xml b/dcs/src/main/resources/dcs-default.xml index 9967b5b..b568d99 100644 --- a/dcs/src/main/resources/dcs-default.xml +++ b/dcs/src/main/resources/dcs-default.xml @@ -388,30 +388,32 @@ </property> <property> <name>dcs.server.user.program.tcp.keepalive.status</name> - <value>enable</value> + <value>true</value> <description> - Used in mxosrvr keepalive , parameter is ENABLE IDLETIME INTERTIME RETRYCNT. + If tcp keepalive is enabled. The default is true. Set false to disable. </description> </property> <property> <name>dcs.server.user.program.tcp.keepalive.idletime</name> <value>300</value> <description> - Used in mxosrvr keepalive , parameter is ENABLE IDLETIME INTERTIME RETRYCNT. + Time in seconds for the interval between the last data packet sent and the first keepalive probe. + The default is 300. </description> </property> <property> <name>dcs.server.user.program.tcp.keepalive.intervaltime</name> - <value>5</value> + <value>3</value> <description> - Used in mxosrvr keepalive , parameter is ENABLE IDLETIME INTERTIME RETRYCNT. + Time in seconds for interval between two keepalive probes . + The default is 3. </description> </property> <property> <name>dcs.server.user.program.tcp.keepalive.retrycount</name> <value>3</value> <description> - Used in mxosrvr keepalive , parameter is ENABLE IDLETIME INTERTIME RETRYCNT. + The maximum number of keepalive probes TCP should send before dropping the connection. </description> </property>
