Skip to content

Commit 6f6dec8

Browse files
"WARNING: NamedStopwatch.Stop("instance")
IsRunning is false" https://jira.percona.com/browse/DISTMYSQL-232 The problem is caused by NamedStopwatch implementation which writes this warning. There is no way to suppress this warning. NamedStopwatch also does not have a method like IsRunning() to learn its state. The problem was that stopwatch was stopped after the error returned by Ping(). The cleanup part of the function expects the stopwatch to be started. Please note that the original code suffers the same problem. If OpenDiscovery() failed, the stopwatch was stopped and the control directly went to Cleanup causing a warning print. The same is for the branch after checkMaxScale() call. As there were no complaints about the original behavior I decided to solve the problem in the simplest way. In case of Ping() failure, we do not stop the stopwatch and go directly to Cleanup.
1 parent e7b23d9 commit 6f6dec8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

go/inst/instance_dao.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -380,16 +380,15 @@ func ReadTopologyInstanceBufferable(instanceKey *InstanceKey, bufferWrites bool,
380380

381381
latency.Start("instance")
382382
db, err := db.OpenDiscovery(instanceKey.Hostname, instanceKey.Port)
383-
if err == nil {
384-
err = db.Ping()
385-
latency.Stop("instance")
386-
if err != nil {
387-
goto Cleanup
388-
}
389-
} else {
383+
if err != nil {
390384
latency.Stop("instance")
391385
goto Cleanup
392386
}
387+
err = db.Ping()
388+
if err != nil {
389+
goto Cleanup
390+
}
391+
latency.Stop("instance")
393392

394393
instance.Key = *instanceKey
395394

0 commit comments

Comments
 (0)