enable/disable query cache per-thread

fixes CNVS-8879

so that when you switch shards, the query cache is still on

port of g/22837

Change-Id: I285fc8b85d82c4f1423e60ba13762fde150c88f2
Reviewed-on: https://gerrit.instructure.com/27827
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Brian Palmer <brianp@instructure.com>
QA-Review: Jacob Fugal <jacob@instructure.com>
Product-Review: Jacob Fugal <jacob@instructure.com>
reset schema cache after migrating for new shards

Change-Id: I218bbd62f86ccc5f8ef3835e5abf097b639899e3
Reviewed-on: https://gerrit.instructure.com/28213
Tested-by: Jenkins <jenkins@instructure.com>
Reviewed-by: Cody Cutrer <cody@instructure.com>
QA-Review: James Williams  <jamesw@instructure.com>
Product-Review: James Williams  <jamesw@instructure.com>