فهرست منبع

cluster: remove NumStreams config

Streams are now lazily allocated so there is no need to change
how many to use.
Chris Bannister 10 سال پیش
والد
کامیت
25a8e282f8
4فایلهای تغییر یافته به همراه4 افزوده شده و 10 حذف شده
  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)
 	Port              int               // port (default: 9042)
 	Keyspace          string            // initial keyspace (optional)
 	Keyspace          string            // initial keyspace (optional)
 	NumConns          int               // number of connections per host (default: 2)
 	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)
 	Consistency       Consistency       // default consistency level (default: Quorum)
 	Compressor        Compressor        // compression algorithm (default: nil)
 	Compressor        Compressor        // compression algorithm (default: nil)
 	Authenticator     Authenticator     // authenticator (default: nil)
 	Authenticator     Authenticator     // authenticator (default: nil)

+ 4 - 6
conn.go

@@ -93,7 +93,6 @@ type ConnConfig struct {
 	ProtoVersion  int
 	ProtoVersion  int
 	CQLVersion    string
 	CQLVersion    string
 	Timeout       time.Duration
 	Timeout       time.Duration
-	NumStreams    int
 	Compressor    Compressor
 	Compressor    Compressor
 	Authenticator Authenticator
 	Authenticator Authenticator
 	Keepalive     time.Duration
 	Keepalive     time.Duration
@@ -114,11 +113,10 @@ var TimeoutLimit int64 = 10
 // queries, but users are usually advised to use a more reliable, higher
 // queries, but users are usually advised to use a more reliable, higher
 // level API.
 // level API.
 type Conn struct {
 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
 	headerBuf []byte
 
 

+ 0 - 1
connectionpool.go

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

+ 0 - 2
stress_test.go

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