PCT-637: Query Analytics does not handle MySQL Restart

Done

However, I'm afraid that FileIntervalIter goroutine might access mysqlConn.Connect/Close/Set at the same time as the goroutine with check if mysql was restarted. @daniel-nichter What you think? Should I protect mysql.Connection with mutex?
Kind of, yes.  Create a more full-featured `mock.MySQLConnection` like https://github.com/percona/percona-agent/blob/release/test/mock/ticker.go is for the Ticker interface.  In other words, mock objects are just like real objects except they're created with everything they need to return fake values (i.e. values provided by the test case), simulate fake conditions (e.g. block on `Connect()` until the test is ready), etc.

So instead of using callbacks to provide the values, provide the values when the mock object is created.  For example, if we had a mock object to return the name of a person, then we can create that mock obj with "John" (or a list of names if the calling code being tested will get multiple names).  Or, we could create the mock obj with a function that returns "John".  This latter style if what you've done, and it's valid, but imho it's more confusing having so many functions/callbacks, closures, etc.  If all we need to do is return some fake values, then make a list of fake values and return them; the extra callback and closure aren't necessary.