[VersionControl] Fix concurrency in query