diff --git a/go/vt/vttablet/tabletserver/health/primary_monitor.go b/go/vt/vttablet/tabletserver/health/primary_monitor.go index 159ff32e88b..b16f9123a4d 100644 --- a/go/vt/vttablet/tabletserver/health/primary_monitor.go +++ b/go/vt/vttablet/tabletserver/health/primary_monitor.go @@ -86,11 +86,13 @@ func (pm *TMClientPrimaryMonitor) ping(tmc *grpctmclient.Client, primary *topoda ctx, cancel := context.WithTimeout(pm.ctx, PrimaryPingTimeout) defer cancel() + var reachable uint32 if err := tmc.Ping(ctx, primary); err != nil { log.Errorf("Failed to ping primary %s: %+v", topoproto.TabletAliasString(primary.Alias), err) - return + } else { + reachable = 1 } - atomic.StoreUint32(&pm.reachable, 1) + atomic.StoreUint32(&pm.reachable, reachable) } // poll pings the primary periodically and on-demand when the address changes. diff --git a/go/vt/vttablet/tabletserver/health/primary_monitor_test.go b/go/vt/vttablet/tabletserver/health/primary_monitor_test.go index 2ddcd95d04a..da7d52ca466 100644 --- a/go/vt/vttablet/tabletserver/health/primary_monitor_test.go +++ b/go/vt/vttablet/tabletserver/health/primary_monitor_test.go @@ -23,8 +23,8 @@ import ( "github.com/stretchr/testify/require" "google.golang.org/grpc" - topodatapb "vitess.io/vitess/go/vt/proto/topodata" + topodatapb "vitess.io/vitess/go/vt/proto/topodata" "vitess.io/vitess/go/vt/vttablet/grpctmserver" "vitess.io/vitess/go/vt/vttablet/tmrpctest" )