SERVER-8765 fix memory leaks in config upgrade codepath
SERVER-8530 Prevent redundant logging of errors during queries