Refactor th to have one gearman worker thread

Change-Id: I78f95a67b80ce0627b4a3bbb20578f3d16028714
Fix typo in mysql database loading

Change-Id: I85c96900aef64674fdf11f6821bafa06ad393e97