[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

When to upgrade repository format number?

From: <kfogel_at_collab.net>
Date: 2005-03-12 00:03:54 CET

kfogel@tigris.org writes:
> Author: kfogel
> Date: Fri Mar 11 16:48:15 2005
> New Revision: 13384
>
> Log:
> Instead of waiting until a locking operation to upgrade a legacy
> repository's format number, just do it the first time the repository
> is opened. This involves reverting most of r13366.
>
> [...]

Max Bowsher pointed out that we could take the following strategy
instead:

Remain at repository format 3 by default. After upgrading to 1.2, the
code would not demand format 4, until you use locking features.
Before you use them, you must run

   $ svnadmin upgrade REPOS

This would be the moment when your repository becomes incompatible
with pre-1.2 Subversion. In other words, we'd remain compatible by
default, and insist that the admin do something exceptional to enable
locking, so that admins can't miss the fact that this is an one-way
step.

(Internally, the locking functions would all check that the repository
format was 4 or higher, and error if not.)

After arguing with Max for a while, I now think this is a sane
proposal, and maybe even our best option.

Some unanswered questions:

   * Would 'svnadmin create' create format 4 or format 3 repositories
     in 1.2?

   * If format 3, would 'svnadmin create' take a new option to
     indicate that you want locking from the beginning?

   * If format 3, would we move the silent auto-creation of the
     locking tables/hooks/etc to become part of 'svnadmin upgrade',
     instead of part of the default 1.2 code as they are now?

One possible response is: "This is nice, but too complex. Let's just
unconditionally upgrade repositories to 4, and create new ones at 4.
Admins should be reading the release notes carefully anyway!"

If that's the way we want to go, then we don't have to do anything,
because that's how the current code behaves.

Finally, note that our compatibility guidelines permit both ways.

-Karl

> Modified: branches/locking/subversion/include/svn_fs.h
> Url: http://svn.collab.net/viewcvs/svn/branches/locking/subversion/include/svn_fs.h?view=diff&rev=13384&p1=branches/locking/subversion/include/svn_fs.h&r1=13383&p2=branches/locking/subversion/include/svn_fs.h&r2=13384
> ==============================================================================
> --- branches/locking/subversion/include/svn_fs.h (original)
> +++ branches/locking/subversion/include/svn_fs.h Fri Mar 11 16:48:15 2005
> @@ -1486,10 +1486,8 @@
> /** Lock @a path in @a fs, and set @a *lock to a lock
> * representing the new lock, allocated in @a pool.
> *
> - * @warning You may prefer to use @a svn_repos_fs_lock instead. It
> - * wraps this function but also runs hooks and conditionally bumps the
> - * repository format number. See that function's doc string for
> - * details of why this might be important.
> + * @warning You may prefer to use @a svn_repos_fs_lock instead,
> + * which see.
> *
> * @a fs must have a username associated with it (see @c
> * svn_fs_access_t), else return @c SVN_ERR_FS_NO_USER. Set the
>
> Modified: branches/locking/subversion/include/svn_repos.h
> Url: http://svn.collab.net/viewcvs/svn/branches/locking/subversion/include/svn_repos.h?view=diff&rev=13384&p1=branches/locking/subversion/include/svn_repos.h&r1=13383&p2=branches/locking/subversion/include/svn_repos.h&r2=13384
> ==============================================================================
> --- branches/locking/subversion/include/svn_repos.h (original)
> +++ branches/locking/subversion/include/svn_repos.h Fri Mar 11 16:48:15 2005
> @@ -956,13 +956,6 @@
> * hook, return the original error wrapped with
> * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the caller sees this
> * error, it knows that the lock succeeded anyway.
> - *
> - * Calling this may also silently bump the repository's format number,
> - * if this is first time a lock is being set in a repository that was
> - * created by pre-1.2 Subversion. (For maximum compatibility,
> - * Subversion tries to avoid bumping the format number of legacy
> - * repositories until it becomes necessary; in this case, it becomes
> - * necessary the first time the locking features are used.)
> */
> svn_error_t *svn_repos_fs_lock (svn_lock_t **lock,
> svn_repos_t *repos,
> @@ -986,9 +979,6 @@
> * post-lock hook, return the original error wrapped with
> * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the caller sees this
> * error, it knows that the lock succeeded anyway.
> - *
> - * Calling this may also silently bump the repository's format number,
> - * in the same manner as @a svn_repos_fs_lock, which see.
> */
> svn_error_t *svn_repos_fs_attach_lock (svn_lock_t *lock,
> svn_repos_t *repos,
> @@ -1009,10 +999,6 @@
> * hook, return the original error wrapped with
> * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. If the caller sees this
> * error, it knows that the unlock succeeded anyway.
> - *
> - * If the lock is successfully removed, but @a repos somehow still has
> - * a pre-1.2 format number, then bump its format number now. See
> - * @a svn_repos_fs_lock for more.
> */
> svn_error_t *svn_repos_fs_unlock (svn_repos_t *repos,
> const char *path,
> @@ -1029,10 +1015,6 @@
> * authz_read_baton to "screen" all returned locks. That is: do not
> * return any locks on any paths that are unreadable in HEAD, just
> * silently omit them.
> - *
> - * If any locks are retrieved into @a *locks, but @a repos somehow
> - * still has a pre-1.2 format number, then bump its format number
> - * now. See @a svn_repos_fs_lock for more.
> */
> svn_error_t *svn_repos_fs_get_locks (apr_hash_t **locks,
> svn_repos_t *repos,
>
> Modified: branches/locking/subversion/libsvn_repos/fs-wrap.c
> Url: http://svn.collab.net/viewcvs/svn/branches/locking/subversion/libsvn_repos/fs-wrap.c?view=diff&rev=13384&p1=branches/locking/subversion/libsvn_repos/fs-wrap.c&r1=13383&p2=branches/locking/subversion/libsvn_repos/fs-wrap.c&r2=13384
> ==============================================================================
> --- branches/locking/subversion/libsvn_repos/fs-wrap.c (original)
> +++ branches/locking/subversion/libsvn_repos/fs-wrap.c Fri Mar 11 16:48:15 2005
> @@ -408,30 +408,6 @@
> return SVN_NO_ERROR;
> }
>
> -
> -/* If repository REPOS's format number is 3, bump it to 4.
> - * Use POOL for temporary allocation only.
> - *
> - * The specification of actual numbers here is deliberate. As of this
> - * writing, the repos code knows how to do a soft upgrade from 3 to 4
> - * on the fly, but we can't make promises about future soft upgrades.
> - * If we were to upgrade to SVN_REPOS__VERSION here, that would be a
> - * ticking time bomb that could go off any time after
> - * SVN_REPOS__VERSION becomes 5 or higher.
> - */
> -static svn_error_t *
> -maybe_bump_format_number (svn_repos_t *repos, apr_pool_t *pool)
> -{
> - if (repos->format == 3)
> - {
> - SVN_ERR (svn_io_write_version_file
> - (svn_path_join (repos->path, SVN_REPOS__FORMAT, pool), 4, pool));
> - repos->format = 4;
> - }
> -
> - return SVN_NO_ERROR;
> -}
> -
> svn_error_t *
> svn_repos_fs_lock (svn_lock_t **lock,
> svn_repos_t *repos,
> @@ -459,10 +435,6 @@
> svn_fs_lock() from happening. */
> SVN_ERR (svn_repos__hooks_pre_lock (repos, path, username, pool));
>
> - /* Bootstrap moment: This might be the first time a lock has ever
> - been set in this repository. */
> - SVN_ERR (maybe_bump_format_number (repos, pool));
> -
> /* Lock. */
> SVN_ERR (svn_fs_lock (lock, repos->fs, path, comment, force,
> timeout, current_rev, pool));
> @@ -491,10 +463,6 @@
> svn_fs_lock() from happening. */
> SVN_ERR (svn_repos__hooks_pre_lock (repos, lock->path, lock->owner, pool));
>
> - /* Bootstrap moment: This might be the first time a lock has ever
> - been set in this repository. */
> - SVN_ERR (maybe_bump_format_number (repos, pool));
> -
> /* Lock. */
> SVN_ERR (svn_fs_attach_lock (lock, repos->fs, force, current_rev, pool));
>
> @@ -538,15 +506,6 @@
> /* Unlock. */
> SVN_ERR (svn_fs_unlock (repos->fs, path, token, force, pool));
>
> - /* Technically, the repository should already be at a high enough
> - format level to support locking -- after all, if we just
> - successfully unlocked, that means a lock was set earlier.
> - However, the lock might have been set in a format 3 repository
> - using, e.g., svn_fs_lock(), in which case libsvn_repos would
> - never have had a chance to bump the format number to 4. So we
> - take this second chance to upgrade the format number. */
> - SVN_ERR (maybe_bump_format_number (repos, pool));
> -
> /* Run post-unlock hook. */
> if ((err = svn_repos__hooks_post_unlock (repos, path, username, pool)))
> return svn_error_create
> @@ -604,16 +563,6 @@
> }
>
> svn_pool_destroy (subpool);
> -
> - /* Technically, the repository should already be at a high enough
> - format level to support locking -- after all, if we got some
> - locks here, that means locks were set earlier. However, the
> - locks might have been set in a format 3 repository using, e.g.,
> - svn_fs_lock(), in which case libsvn_repos would never have had a
> - chance to bump the format number to 4. So we take this second
> - chance to upgrade the format number. */
> - if (apr_hash_count (all_locks) > 0)
> - SVN_ERR (maybe_bump_format_number (repos, pool));
>
> *locks = all_locks;
>
>
> Modified: branches/locking/subversion/libsvn_repos/repos.c
> Url: http://svn.collab.net/viewcvs/svn/branches/locking/subversion/libsvn_repos/repos.c?view=diff&rev=13384&p1=branches/locking/subversion/libsvn_repos/repos.c&r1=13383&p2=branches/locking/subversion/libsvn_repos/repos.c&r2=13384
> ==============================================================================
> --- branches/locking/subversion/libsvn_repos/repos.c (original)
> +++ branches/locking/subversion/libsvn_repos/repos.c Fri Mar 11 16:48:15 2005
> @@ -1544,14 +1544,16 @@
> format_path = svn_path_join (repos->path, SVN_REPOS__FORMAT, pool);
> SVN_ERR (svn_io_read_version_file (&version, format_path, pool));
>
> - /* Normally the repository format number must match exactly.
> - But we tolerate one "soft upgrade" case: libsvn_repos will
> - automatically upgrade version 3 repositories to version 4 the
> - moment one of the version 4 features is invoked. So if we're
> - looking for 4 but find 3, just accept the 3 -- later code will
> - know what to do. */
> - if ((version != SVN_REPOS__VERSION)
> - && !(version == 3 && SVN_REPOS__VERSION == 4))
> + if (version == 3 && SVN_REPOS__VERSION == 4)
> + {
> + /* Silently upgrade repository format 3 to 4, since libsvn_repos
> + will automatically do the right things for that. */
> + version = 4;
> + SVN_ERR (svn_io_write_version_file
> + (svn_path_join (repos->path, SVN_REPOS__FORMAT, pool),
> + version, pool));
> + }
> + else if (version != SVN_REPOS__VERSION)
> {
> return svn_error_createf
> (SVN_ERR_REPOS_UNSUPPORTED_VERSION, NULL,
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Mar 12 00:24:49 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.