Browse Source

cluster: remove NumStreams config

Streams are now lazily allocated so there is no need to change
how many to use.
Chris Bannister 10 năm trước cách đây
mục cha
commit
25a8e282f8
4 tập tin đã thay đổi với 4 bổ sung10 xóa
  1. 0 1
      cluster.go
  2. 4 6
      conn.go
  3. 0 1
      connectionpool.go
  4. 0 2
      stress_test.go

+ 0 - 1
cluster.go

@@ -89,7 +89,6 @@ type ClusterConfig struct {
 	Port              int               // port (default: 9042)
 	Keyspace          string            // initial keyspace (optional)
 	NumConns          int               // number of connections per host (default: 2)
-	NumStreams        int               // number of streams per connection (default: max per protocol, either 128 or 32768)
 	Consistency       Consistency       // default consistency level (default: Quorum)
 	Compressor        Compressor        // compression algorithm (default: nil)
 	Authenticator     Authenticator     // authenticator (default: nil)

+ 4 - 6
conn.go

@@ -93,7 +93,6 @@ type ConnConfig struct {
 	ProtoVersion  int
 	CQLVersion    string
 	Timeout       time.Duration
-	NumStreams    int
 	Compressor    Compressor
 	Authenticator Authenticator
 	Keepalive     time.Duration
@@ -114,11 +113,10 @@ var TimeoutLimit int64 = 10
 // queries, but users are usually advised to use a more reliable, higher
 // level API.
 type Conn struct {
-	conn       net.Conn
-	r          *bufio.Reader
-	timeout    time.Duration
-	cfg        *ConnConfig
-	numStreams int
+	conn    net.Conn
+	r       *bufio.Reader
+	timeout time.Duration
+	cfg     *ConnConfig
 
 	headerBuf []byte
 

+ 0 - 1
connectionpool.go

@@ -97,7 +97,6 @@ func newPolicyConnPool(session *Session, hostPolicy HostSelectionPolicy,
 			ProtoVersion:  cfg.ProtoVersion,
 			CQLVersion:    cfg.CQLVersion,
 			Timeout:       cfg.Timeout,
-			NumStreams:    cfg.NumStreams,
 			Compressor:    cfg.Compressor,
 			Authenticator: cfg.Authenticator,
 			Keepalive:     cfg.SocketKeepalive,

+ 0 - 2
stress_test.go

@@ -13,7 +13,6 @@ func BenchmarkConnStress(b *testing.B) {
 
 	cluster := createCluster()
 	cluster.NumConns = 1
-	cluster.NumStreams = workers
 	session := createSessionFromCluster(cluster, b)
 	defer session.Close()
 
@@ -43,7 +42,6 @@ func BenchmarkConnRoutingKey(b *testing.B) {
 
 	cluster := createCluster()
 	cluster.NumConns = 1
-	cluster.NumStreams = workers
 	cluster.PoolConfig.HostSelectionPolicy = TokenAwareHostPolicy(RoundRobinHostPolicy())
 	session := createSessionFromCluster(cluster, b)
 	defer session.Close()