@@ -118,11 +118,12 @@ func (s *Session) Open(enableRPCCompression bool, connectionTimeoutInMs int) err
118118}
119119
120120type ClusterConfig struct {
121- NodeUrls []string //ip:port
122- UserName string
123- Password string
124- FetchSize int32
125- TimeZone string
121+ NodeUrls []string //ip:port
122+ UserName string
123+ Password string
124+ FetchSize int32
125+ TimeZone string
126+ ConnectRetryMax int
126127}
127128
128129type ClusterSession struct {
@@ -975,12 +976,12 @@ func NewSession(config *Config) Session {
975976 return Session {config : config }
976977}
977978
978- func NewClusterSession (ClusterConfig * ClusterConfig ) Session {
979+ func NewClusterSession (clusterConfig * ClusterConfig ) Session {
979980 session := Session {}
980981 node := endPoint {}
981- for i := 0 ; i < len (ClusterConfig .NodeUrls ); i ++ {
982- node .Host = strings .Split (ClusterConfig .NodeUrls [i ], ":" )[0 ]
983- node .Port = strings .Split (ClusterConfig .NodeUrls [i ], ":" )[1 ]
982+ for i := 0 ; i < len (clusterConfig .NodeUrls ); i ++ {
983+ node .Host = strings .Split (clusterConfig .NodeUrls [i ], ":" )[0 ]
984+ node .Port = strings .Split (clusterConfig .NodeUrls [i ], ":" )[1 ]
984985 endPointList .PushBack (node )
985986 }
986987 var err error
@@ -996,7 +997,7 @@ func NewClusterSession(ClusterConfig *ClusterConfig) Session {
996997 log .Println (err )
997998 } else {
998999 session .config = getConfig (e .Value .(endPoint ).Host , e .Value .(endPoint ).Port ,
999- ClusterConfig .UserName , ClusterConfig .Password , ClusterConfig .FetchSize , ClusterConfig .TimeZone )
1000+ clusterConfig .UserName , clusterConfig .Password , clusterConfig .FetchSize , clusterConfig .TimeZone , clusterConfig . ConnectRetryMax )
10001001 break
10011002 }
10021003 }
@@ -1052,14 +1053,15 @@ func (s *Session) initClusterConn(node endPoint) error {
10521053
10531054}
10541055
1055- func getConfig (host string , port string , userName string , passWord string , fetchSize int32 , timeZone string ) * Config {
1056+ func getConfig (host string , port string , userName string , passWord string , fetchSize int32 , timeZone string , connectRetryMax int ) * Config {
10561057 return & Config {
1057- Host : host ,
1058- Port : port ,
1059- UserName : userName ,
1060- Password : passWord ,
1061- FetchSize : fetchSize ,
1062- TimeZone : timeZone ,
1058+ Host : host ,
1059+ Port : port ,
1060+ UserName : userName ,
1061+ Password : passWord ,
1062+ FetchSize : fetchSize ,
1063+ TimeZone : timeZone ,
1064+ ConnectRetryMax : connectRetryMax ,
10631065 }
10641066}
10651067
0 commit comments