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

Re: How to migrate to Single DB per WC

From: Julian Foad <julian.foad_at_wandisco.com>
Date: Thu, 08 Jul 2010 17:33:28 +0100

I'm looking at the upgrade process. I haven't looked at implementing
the DB table rows migration described in <notes/wc-ng/single-db-per-wc>;
instead I'm trying to see how that fits into the overall DB
open-and-upgrade code flow.

Here's the upgrade code for 1.6 to 1.7:

svn_client_upgrade() // upgrade a whole WC to latest
    |
  svn_wc_upgrade() // upgrade a whole WC
      |
    svn_wc__db_open(no auto-upgrade),
    upgrade_working_copy() // upgrade a whole WC by recursing
        |
      upgrade_to_wcng() // upgrade an individual subdirectory to F12
          |
        svn_wc__write_upgraded_entries(),
        svn_wc__db_upgrade_apply_dav_cache(),
        migrate_text_bases(), ...

Inside svn_wc_upgrade(), everything that gets written to a DB must get
written into the single WC-root DB. That looks like it requires no
significant changes in the functions shown above, as it should all
happen invisibly within the wc-db management code, in conjunction with
the auto-upgrade part below. (The migrate_text_bases() step may need
modifying to ensure they migrate to the WC root.)

The auto-upgrade code, currently used for 1.7-dev to 1.7-dev, is invoked
when opening a versioned directory:

wc_db.c:*()
    |
  svn_wc__db_pdh_parse_local_abspath()
      |
    svn_wc__db_pdh_create_wcroot(sdb) // create *or find* a db_wcroot_t
        |
      svn_wc__upgrade_sdb() // upgrade an SDB from F>=12 to latest
          |
        bump_to_XX(),
        ...,
        bump_to_19() // migrate an SDB to the WC-root

The term "wcroot" becomes confusing, because in the existing code each
individual directory has its own db_wcroot_t structure, rather than a
single one at the root of the WC which is what we are moving to. When I
say "the WC-root SDB", I mean the one at the root of the whole WC.

(Some renaming of data and/or functions named "wcroot" might be useful
as a precursor to the transition, but I can't yet see what exactly would
be useful.)

So a possible way is:

  * bump_to_19() needs to migrate the contents of the SDB (and pristine
store) down into the WC-root SDB, and delete the SDB (and pristine
store), or do nothing if it is the WC-root SDB.

  * svn_wc__db_pdh_create_wcroot() needs to return not a new wcroot_t
object but a pointer to the existing one for the real WC-root, except of
course when it is creating the real WC-root object.

  * And in which function will we search for and find the WC root
directory? I can't see us using any of the existing functions such as
svn_wc__db_is_wcroot(), svn_wc__strictly_is_wc_root(), because they all
invoke svn_wc__db_pdh_parse_local_abspath().

I anticipate not getting much further with this before I go on holiday
at the end of tomorrow, so anybody willing to jump in is most welcome to
do so.

- Julian
Received on 2010-07-08 18:40:47 CEST

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.