SERVER-8711 check dynamic_cast result in config upgrade