From e8fe1107dcf6e3ce2abea229cb8359207e1112ff Mon Sep 17 00:00:00 2001 From: Ling Jin <7138436+3AceShowHand@users.noreply.github.com> Date: Wed, 27 Jul 2022 14:05:11 +0800 Subject: [PATCH] cdc rolling upgrade remove status check to prevent false detection. (#1996) --- pkg/cluster/api/cdcapi.go | 4 ++-- pkg/cluster/spec/cdc.go | 12 +----------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/pkg/cluster/api/cdcapi.go b/pkg/cluster/api/cdcapi.go index a57b4470ca..c5c2f8ede6 100644 --- a/pkg/cluster/api/cdcapi.go +++ b/pkg/cluster/api/cdcapi.go @@ -195,7 +195,7 @@ func (c *CDCOpenAPIClient) GetAllCaptures() (result []*Capture, err error) { } return nil }, utils.RetryOption{ - Timeout: 20 * time.Second, + Timeout: 10 * time.Second, }) return result, err } @@ -260,7 +260,7 @@ func (c *CDCOpenAPIClient) GetStatus() (result ServerStatus, err error) { } return nil }, utils.RetryOption{ - Timeout: 20 * time.Second, + Timeout: 10 * time.Second, }) return result, err diff --git a/pkg/cluster/spec/cdc.go b/pkg/cluster/spec/cdc.go index 4ed7bacbb5..71750d232a 100644 --- a/pkg/cluster/spec/cdc.go +++ b/pkg/cluster/spec/cdc.go @@ -237,16 +237,11 @@ func (i *CDCInstance) PreRestart(ctx context.Context, topo Topology, apiTimeoutS return nil } - if i.Status(ctx, 5*time.Second, tlsCfg) == "Down" { - logger.Debugf("cdc pre-restart skipped, instance is down, trigger hard restart, addr: %s", address) - return nil - } - start := time.Now() client := api.NewCDCOpenAPIClient(ctx, []string{address}, 5*time.Second, tlsCfg) captures, err := client.GetAllCaptures() if err != nil { - logger.Warnf("cdc pre-restart failed, cannot get all captures, trigger hard restart, addr: %s, elapsed: %+v", address, time.Since(start)) + logger.Warnf("cdc pre-restart skipped, cannot get all captures, trigger hard restart, addr: %s, elapsed: %+v", address, time.Since(start)) return nil } @@ -306,13 +301,8 @@ func (i *CDCInstance) PostRestart(ctx context.Context, topo Topology, tlsCfg *tl start := time.Now() address := i.GetAddr() - if i.Status(ctx, 5*time.Second, tlsCfg) == "Down" { - logger.Debugf("cdc post-restart skipped, instance is down, addr: %s, elapsed: %+v", address, time.Since(start)) - return nil - } client := api.NewCDCOpenAPIClient(ctx, []string{address}, 5*time.Second, tlsCfg) - err := client.IsCaptureAlive() if err != nil { logger.Debugf("cdc post-restart finished, get capture status failed, addr: %s, err: %+v, elapsed: %+v", address, err, time.Since(start))