Skip to content

Commit

Permalink
optimize meta executor and shard writer
Browse files Browse the repository at this point in the history
  • Loading branch information
chengshiwen committed Sep 6, 2024
1 parent d010621 commit 539623e
Show file tree
Hide file tree
Showing 8 changed files with 165 additions and 90 deletions.
3 changes: 2 additions & 1 deletion cmd/influxd/run/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,8 @@ func NewServer(c *Config, buildInfo *BuildInfo) (*Server, error) {
s.PointsWriter.Subscriber = s.Subscriber

// Initialize meta executor.
s.MetaExecutor = coordinator.NewMetaExecutor(time.Duration(c.Coordinator.QueryTimeout), time.Duration(c.Coordinator.DialTimeout))
s.MetaExecutor = coordinator.NewMetaExecutor(time.Duration(c.Coordinator.ShardReaderTimeout), time.Duration(c.Coordinator.DialTimeout),
time.Duration(c.Coordinator.PoolMaxIdleTime), c.Coordinator.PoolMaxIdleStreams)
s.MetaExecutor.MetaClient = s.MetaClient
s.MetaExecutor.TLSConfig = tlsClientConfig

Expand Down
3 changes: 3 additions & 0 deletions coordinator/client_pool.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package coordinator

import (
"errors"
"net"
"sync"
)

var ErrClientClosed = errors.New("client already closed")

type clientPool struct {
mu sync.RWMutex
pool map[uint64]Pool
Expand Down
4 changes: 4 additions & 0 deletions coordinator/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ const (
// remains idle in the connection pool.
DefaultPoolMaxIdleTime = time.Minute

// DefaultShardReaderTimeout is the default timeout set on shard readers.
DefaultShardReaderTimeout = time.Duration(0)

// DefaultWriteTimeout is the default timeout for a complete write to succeed.
DefaultWriteTimeout = 10 * time.Second

Expand Down Expand Up @@ -78,6 +81,7 @@ func NewConfig() Config {
DialTimeout: toml.Duration(DefaultDialTimeout),
PoolMaxIdleStreams: DefaultPoolMaxIdleStreams,
PoolMaxIdleTime: toml.Duration(DefaultPoolMaxIdleTime),
ShardReaderTimeout: toml.Duration(DefaultShardReaderTimeout),
WriteTimeout: toml.Duration(DefaultWriteTimeout),
QueryTimeout: toml.Duration(query.DefaultQueryTimeout),
MaxConcurrentQueries: DefaultMaxConcurrentQueries,
Expand Down
Loading

0 comments on commit 539623e

Please sign in to comment.