The new `sync()` method is now faster and also more robust.
Explicitly storing the `youngest_rev` addresses the efficiency concerns about the old `get_youngest_rev_from_cache()` method (#3837). That method is now only used once for automatically migrating environments to the new way, without requiring an explicit `resync`. It is otherwise deprecated and should be removed in the future.
The new scheme also takes lots of precautions to do the right thing in case of concurrent resync attempts. When a given thread accesses a repository, it will manage to sync none, some or all revisions. In any case, it will leave the sync() method with the notion of an usable and coherent youngest_rev, which will be used for the rest of the processing.
This changes fixes #4586 and is believed to fix #4043 as well.