From 73996aba912a586c809352990584aecd91be3f92 Mon Sep 17 00:00:00 2001 From: godchen Date: Fri, 25 Jun 2021 15:50:23 +0800 Subject: [PATCH] Change client init timeout (#6107) Signed-off-by: godchen --- internal/distributed/datacoord/client/client.go | 4 ++-- internal/distributed/datanode/client/client.go | 4 ++-- internal/distributed/indexcoord/client/client.go | 4 ++-- internal/distributed/indexnode/client/client.go | 4 ++-- internal/distributed/proxy/client/client.go | 4 ++-- internal/distributed/querycoord/client/client.go | 4 ++-- internal/distributed/querynode/client/client.go | 4 ++-- internal/distributed/rootcoord/client/client.go | 4 ++-- 8 files changed, 16 insertions(+), 16 deletions(-) diff --git a/internal/distributed/datacoord/client/client.go b/internal/distributed/datacoord/client/client.go index 181ac0622f..8167cd974a 100644 --- a/internal/distributed/datacoord/client/client.go +++ b/internal/distributed/datacoord/client/client.go @@ -75,7 +75,7 @@ func NewClient(ctx context.Context, metaRoot string, etcdEndpoints []string) (*C } func (c *Client) Init() error { - return c.connect(retry.Attempts(300)) + return c.connect(retry.Attempts(20)) } func (c *Client) connect(retryOptions ...retry.Option) error { @@ -89,7 +89,7 @@ func (c *Client) connect(retryOptions ...retry.Option) error { opts := trace.GetInterceptorOpts() log.Debug("DataCoordClient try reconnect ", zap.String("address", c.addr)) conn, err := grpc.DialContext(c.ctx, c.addr, - grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(3*time.Second), + grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(2*time.Second), grpc.WithUnaryInterceptor( grpc_middleware.ChainUnaryClient( grpc_retry.UnaryClientInterceptor(), diff --git a/internal/distributed/datanode/client/client.go b/internal/distributed/datanode/client/client.go index abd7b6ac83..561b4ec33e 100644 --- a/internal/distributed/datanode/client/client.go +++ b/internal/distributed/datanode/client/client.go @@ -59,7 +59,7 @@ func NewClient(ctx context.Context, addr string, retryOptions ...retry.Option) ( } func (c *Client) Init() error { - return c.connect(retry.Attempts(300)) + return c.connect(retry.Attempts(20)) } func (c *Client) connect(retryOptions ...retry.Option) error { @@ -67,7 +67,7 @@ func (c *Client) connect(retryOptions ...retry.Option) error { opts := trace.GetInterceptorOpts() log.Debug("DataNode connect ", zap.String("address", c.addr)) conn, err := grpc.DialContext(c.ctx, c.addr, - grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(5*time.Second), + grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(2*time.Second), grpc.WithUnaryInterceptor( grpc_middleware.ChainUnaryClient( grpc_retry.UnaryClientInterceptor(), diff --git a/internal/distributed/indexcoord/client/client.go b/internal/distributed/indexcoord/client/client.go index c0a8ac5699..6c8a03f8ed 100644 --- a/internal/distributed/indexcoord/client/client.go +++ b/internal/distributed/indexcoord/client/client.go @@ -77,7 +77,7 @@ func NewClient(ctx context.Context, metaRoot string, etcdEndpoints []string) (*C } func (c *Client) Init() error { - return c.connect(retry.Attempts(300)) + return c.connect(retry.Attempts(20)) } func (c *Client) connect(retryOptions ...retry.Option) error { @@ -91,7 +91,7 @@ func (c *Client) connect(retryOptions ...retry.Option) error { opts := trace.GetInterceptorOpts() log.Debug("IndexCoordClient try connect ", zap.String("address", c.addr)) conn, err := grpc.DialContext(c.ctx, c.addr, - grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(3*time.Second), + grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(2*time.Second), grpc.WithUnaryInterceptor( grpc_middleware.ChainUnaryClient( grpc_retry.UnaryClientInterceptor(), diff --git a/internal/distributed/indexnode/client/client.go b/internal/distributed/indexnode/client/client.go index 11ee0a29d1..67fa96ee28 100644 --- a/internal/distributed/indexnode/client/client.go +++ b/internal/distributed/indexnode/client/client.go @@ -55,7 +55,7 @@ func NewClient(ctx context.Context, addr string) (*Client, error) { } func (c *Client) Init() error { - return c.connect(retry.Attempts(300)) + return c.connect(retry.Attempts(20)) } func (c *Client) connect(retryOptions ...retry.Option) error { @@ -63,7 +63,7 @@ func (c *Client) connect(retryOptions ...retry.Option) error { opts := trace.GetInterceptorOpts() log.Debug("IndexNodeClient try connect ", zap.String("address", c.addr)) conn, err := grpc.DialContext(c.ctx, c.addr, - grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(5*time.Second), + grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(2*time.Second), grpc.WithUnaryInterceptor( grpc_middleware.ChainUnaryClient( grpc_retry.UnaryClientInterceptor(), diff --git a/internal/distributed/proxy/client/client.go b/internal/distributed/proxy/client/client.go index c04d056ec1..db2a0cc17e 100644 --- a/internal/distributed/proxy/client/client.go +++ b/internal/distributed/proxy/client/client.go @@ -54,7 +54,7 @@ func NewClient(ctx context.Context, addr string) (*Client, error) { } func (c *Client) Init() error { - return c.connect(retry.Attempts(300)) + return c.connect(retry.Attempts(20)) } func (c *Client) connect(retryOptions ...retry.Option) error { @@ -62,7 +62,7 @@ func (c *Client) connect(retryOptions ...retry.Option) error { opts := trace.GetInterceptorOpts() log.Debug("ProxyClient try connect ", zap.String("address", c.addr)) conn, err := grpc.DialContext(c.ctx, c.addr, - grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(5*time.Second), + grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(2*time.Second), grpc.WithUnaryInterceptor( grpc_middleware.ChainUnaryClient( grpc_retry.UnaryClientInterceptor(), diff --git a/internal/distributed/querycoord/client/client.go b/internal/distributed/querycoord/client/client.go index 1d0e9e1960..18640d0163 100644 --- a/internal/distributed/querycoord/client/client.go +++ b/internal/distributed/querycoord/client/client.go @@ -76,7 +76,7 @@ func NewClient(ctx context.Context, metaRoot string, etcdEndpoints []string) (*C } func (c *Client) Init() error { - return c.connect(retry.Attempts(300)) + return c.connect(retry.Attempts(20)) } func (c *Client) connect(retryOptions ...retry.Option) error { @@ -90,7 +90,7 @@ func (c *Client) connect(retryOptions ...retry.Option) error { opts := trace.GetInterceptorOpts() log.Debug("QueryCoordClient try reconnect ", zap.String("address", c.addr)) conn, err := grpc.DialContext(c.ctx, c.addr, - grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(5*time.Second), + grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(2*time.Second), grpc.WithUnaryInterceptor( grpc_middleware.ChainUnaryClient( grpc_retry.UnaryClientInterceptor(), diff --git a/internal/distributed/querynode/client/client.go b/internal/distributed/querynode/client/client.go index 0f512209af..c2803bd3eb 100644 --- a/internal/distributed/querynode/client/client.go +++ b/internal/distributed/querynode/client/client.go @@ -55,7 +55,7 @@ func NewClient(ctx context.Context, addr string) (*Client, error) { } func (c *Client) Init() error { - return c.connect(retry.Attempts(300)) + return c.connect(retry.Attempts(20)) } func (c *Client) connect(retryOptions ...retry.Option) error { @@ -63,7 +63,7 @@ func (c *Client) connect(retryOptions ...retry.Option) error { opts := trace.GetInterceptorOpts() log.Debug("QueryNodeClient try connect ", zap.String("address", c.addr)) conn, err := grpc.DialContext(c.ctx, c.addr, - grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(5*time.Second), + grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(2*time.Second), grpc.WithUnaryInterceptor( grpc_middleware.ChainUnaryClient( grpc_retry.UnaryClientInterceptor(), diff --git a/internal/distributed/rootcoord/client/client.go b/internal/distributed/rootcoord/client/client.go index 69afec788c..1187a4eb89 100644 --- a/internal/distributed/rootcoord/client/client.go +++ b/internal/distributed/rootcoord/client/client.go @@ -83,7 +83,7 @@ func NewClient(ctx context.Context, metaRoot string, etcdEndpoints []string) (*G } func (c *GrpcClient) Init() error { - return c.connect(retry.Attempts(300)) + return c.connect(retry.Attempts(20)) } func (c *GrpcClient) connect(retryOptions ...retry.Option) error { @@ -97,7 +97,7 @@ func (c *GrpcClient) connect(retryOptions ...retry.Option) error { opts := trace.GetInterceptorOpts() log.Debug("RootCoordClient try reconnect ", zap.String("address", c.addr)) conn, err := grpc.DialContext(c.ctx, c.addr, - grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(5*time.Second), + grpc.WithInsecure(), grpc.WithBlock(), grpc.WithTimeout(2*time.Second), grpc.WithUnaryInterceptor( grpc_middleware.ChainUnaryClient( grpc_retry.UnaryClientInterceptor(),