Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bf: MD-989 try next sentinels after I/O timeout errors #12

Merged
merged 2 commits into from
Nov 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ name: Go

on:
push:
branches: [master, v9, v9.7]
branches:
- v9.7
- bugfix/*
- improvement/*
pull_request:
branches: [master, v9, v9.7]
branches: [v9.7]

permissions:
contents: read
Expand Down
12 changes: 6 additions & 6 deletions sentinel.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ func (c *sentinelFailover) MasterAddr(ctx context.Context) (string, error) {
if sentinel != nil {
addr, err := c.getMasterAddr(ctx, sentinel)
if err != nil {
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
if ctx.Err() != nil {
return "", err
}
// Continue on other errors
Expand All @@ -538,7 +538,7 @@ func (c *sentinelFailover) MasterAddr(ctx context.Context) (string, error) {
addr, err := c.getMasterAddr(ctx, c.sentinel)
if err != nil {
_ = c.closeSentinel()
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
if ctx.Err() != nil {
return "", err
}
// Continue on other errors
Expand All @@ -555,7 +555,7 @@ func (c *sentinelFailover) MasterAddr(ctx context.Context) (string, error) {
masterAddr, err := sentinel.GetMasterAddrByName(ctx, c.opt.MasterName).Result()
if err != nil {
_ = sentinel.Close()
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
if ctx.Err() != nil {
return "", err
}
internal.Logger.Printf(ctx, "sentinel: GetMasterAddrByName master=%q failed: %s",
Expand All @@ -582,7 +582,7 @@ func (c *sentinelFailover) replicaAddrs(ctx context.Context, useDisconnected boo
if sentinel != nil {
addrs, err := c.getReplicaAddrs(ctx, sentinel)
if err != nil {
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
if ctx.Err() != nil {
return nil, err
}
// Continue on other errors
Expand All @@ -600,7 +600,7 @@ func (c *sentinelFailover) replicaAddrs(ctx context.Context, useDisconnected boo
addrs, err := c.getReplicaAddrs(ctx, c.sentinel)
if err != nil {
_ = c.closeSentinel()
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
if ctx.Err() != nil {
return nil, err
}
// Continue on other errors
Expand All @@ -622,7 +622,7 @@ func (c *sentinelFailover) replicaAddrs(ctx context.Context, useDisconnected boo
replicas, err := sentinel.Replicas(ctx, c.opt.MasterName).Result()
if err != nil {
_ = sentinel.Close()
if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
if ctx.Err() != nil {
return nil, err
}
internal.Logger.Printf(ctx, "sentinel: Replicas master=%q failed: %s",
Expand Down
Loading