test_result_server: automatically reconnect to MySQL when connection dies
test_result_server: automatically reconnect to MySQL when connection dies

I found that over the weekend the test result server stopped working
and would throw an error like:
  OperationalError: (2006, 'MySQL server has gone away')

It seems that MySQL kills idle connections, which makes sense. This
patch catches this error and automatically reissues the query as
necessary.

I tested manually by running a test_result_server locally, and then
issuing 'kill <session id>;' commands as the database superuser
to kill off all the connections from my machine. I repeated this
until I saw the warning printed out:
  WARNING:root:Forcing reconnect to MySQL: (2006, 'MySQL server has gone away')

Change-Id: I403837fd6c65cb268d7d64314c3292155af5ab80
Reviewed-on: http://gerrit.sjc.cloudera.com:8080/3813
Reviewed-by: Adar Dembo <866ca730bfc7f544e3ebce604ceeba4879f23df0@cloudera.com>
Tested-by: Todd Lipcon <2c763d726a8c2f6afda9be7e0e56a2caa6bb5e6b@cloudera.com>

helifu/kudu,InspurUSA/kudu,andrwng/kudu,andrwng/kudu,EvilMcJerkface/kudu,helifu/kudu,cloudera/kudu,InspurUSA/kudu,cloudera/kudu,cloudera/kudu,EvilMcJerkface/kudu,cloudera/kudu,andrwng/kudu,andrwng/kudu,andrwng/kudu,helifu/kudu,helifu/kudu,helifu/kudu,andrwng/kudu,EvilMcJerkface/kudu,InspurUSA/kudu,InspurUSA/kudu,EvilMcJerkface/kudu,helifu/kudu,helifu/kudu,InspurUSA/kudu,EvilMcJerkface/kudu,cloudera/kudu,andrwng/kudu,InspurUSA/kudu,cloudera/kudu,InspurUSA/kudu,EvilMcJerkface/kudu,cloudera/kudu,InspurUSA/kudu,helifu/kudu,cloudera/kudu,andrwng/kudu,EvilMcJerkface/kudu,helifu/kudu,EvilMcJerkface/kudu,EvilMcJerkface/kudu,cloudera/kudu,InspurUSA/kudu,andrwng/kudu