Skip to content

Commit

Permalink
Etcd (ticdc, dm):add AutoSyncInterval for Etcd client (#8813)
Browse files Browse the repository at this point in the history
close #8812
  • Loading branch information
asddongmen authored May 6, 2023
1 parent 648fe8a commit 58b465a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
9 changes: 5 additions & 4 deletions cdc/server/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,11 @@ func (s *server) prepare(ctx context.Context) error {
// then cause the new owner cannot be elected immediately after the old owner offline.
// see https://github.com/etcd-io/etcd/blob/525d53bd41/client/v3/concurrency/election.go#L98
etcdCli, err := clientv3.New(clientv3.Config{
Endpoints: s.pdEndpoints,
TLS: tlsConfig,
LogConfig: &logConfig,
DialTimeout: 5 * time.Second,
Endpoints: s.pdEndpoints,
TLS: tlsConfig,
LogConfig: &logConfig,
DialTimeout: 5 * time.Second,
AutoSyncInterval: 30 * time.Second,
DialOptions: []grpc.DialOption{
grpcTLSOption,
grpc.WithBlock(),
Expand Down
7 changes: 4 additions & 3 deletions dm/pkg/etcdutil/etcdutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,10 @@ var etcdDefaultTxnStrategy = retry.FiniteRetryStrategy{}
// CreateClient creates an etcd client with some default config items.
func CreateClient(endpoints []string, tlsCfg *tls.Config) (*clientv3.Client, error) {
return clientv3.New(clientv3.Config{
Endpoints: endpoints,
DialTimeout: DefaultDialTimeout,
TLS: tlsCfg,
Endpoints: endpoints,
DialTimeout: DefaultDialTimeout,
AutoSyncInterval: 30 * time.Second,
TLS: tlsCfg,
})
}

Expand Down

0 comments on commit 58b465a

Please sign in to comment.