diff --git a/cdc/server/server.go b/cdc/server/server.go index c1a311373c4..b9dbdbe6ec5 100644 --- a/cdc/server/server.go +++ b/cdc/server/server.go @@ -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(), diff --git a/dm/pkg/etcdutil/etcdutil.go b/dm/pkg/etcdutil/etcdutil.go index a8cbec291e6..d0ba3df8faa 100644 --- a/dm/pkg/etcdutil/etcdutil.go +++ b/dm/pkg/etcdutil/etcdutil.go @@ -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, }) }