Don't open a rev or revprop file whose number is larger than the
youngest revision (as per the "current" file).
FSFS is based around the concept that commits only take effect when
the number in "current" is bumped. Thus if there happens to be a rev
or revprops file installed for a revision higher than the one recorded
in "current" (because a commit failed between installing the rev file
and bumping "current", or because an administrator rolled back the
repository by resetting "current" without deleting rev files, etc), it
ought to be completely ignored. However, checks to this effect only
happen at high levels, and inconsistently. For example, before this
commit, "svn pl --revprop" could be run successfully against such a
revision.
This patch makes FSFS check the requested revision number against
"current" each time it goes to open a rev or revprop file. The last
read youngest-rev is cached, so in general this change will require
only one extra read of "current" per svn_fs_t.
* subversion/libsvn_fs_fs/fs.h
(struct fs_fs_data_t): New field youngest_rev_cache.
* subversion/libsvn_fs_fs/fs_fs.c
Add a forward declaration of get_youngest.
(svn_fs_fs__open): Call get_youngest to initialize
youngest_rev_cache.
(svn_fs_fs__youngest_rev): Store return value in the svn_fs_t.
(ensure_revision_exists): New.
(open_and_seek_revision, svn_fs_fs__rev_get_root,
svn_fs_fs__set_revision_proplist, svn_fs_fs__revision_proplist,
svn_fs_fs__paths_changed): Call ensure_revision_exists.
(commit_body): Update youngest_rev_cache with committed revision
after writing "current".
(svn_fs_fs__create): Initialize youngest_rev_cache to 0.
git-svn-id: http://svn.collab.net/repos/svn/trunk@29106 612f8ebc-c883-4be0-9ee0-a4e9ef946e3a