Skip to content

Commit

Permalink
cdc rolling upgrade remove status check to prevent false detection. (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
3AceShowHand authored Jul 27, 2022
1 parent 0681606 commit e8fe110
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
4 changes: 2 additions & 2 deletions pkg/cluster/api/cdcapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
12 changes: 1 addition & 11 deletions pkg/cluster/spec/cdc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit e8fe110

Please sign in to comment.