[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: Fri, 09 Jul 2010 14:32:26 +0100

On Thu, 2010-07-08 at 13:24 -0400, Greg Stein wrote:
> On Thu, Jul 8, 2010 at 12:33, Julian Foad <julian.foad_at_wandisco.com> wrote:
> >...
> > The auto-upgrade code, currently used for 1.7-dev to 1.7-dev, is invoked
> > when opening a versioned directory:
> >...
> > 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 suspect that it might be too messy to have the auto-upgrade code
> manage this process. It finds an SDB, auto-upgrades, but then has to
> find one again?
>
> Much of the flow would be bastardized to handle this case.
>
> I'd suggest that we simply force it to be a manual upgrade.

OK.

I'm working on SQL statements using "ATTACH" to attach the WC-root DB as
a secondary DB into the same sqlite context, and to copy all row of one
table at a time into it, adjusting the relpaths as we go, like so:

[[[
/* Merge tables from a subdirectory DB into the WC-root DB. */
-- STMT_MERGE_INTO_WCROOT_DB
ATTACH ?1 AS ROOT;
INSERT OR REPLACE INTO ROOT.WORKING_NODE (
    wc_id, local_relpath, parent_relpath, presence, kind, checksum,
    translated_size, changed_rev, changed_date, changed_author, depth,
    symlink_target, last_mod_time, properties, copyfrom_repos_id,
    copyfrom_repos_path, copyfrom_revnum )
SELECT wc_id, ?2 || '/' || local_relpath, ?2 AS parent_relpath,
    presence, kind, checksum,
    translated_size, changed_rev, changed_date, changed_author, depth,
    symlink_target, last_mod_time, properties, copyfrom_repos_id,
    copyfrom_repos_path, copyfrom_revnum FROM WORKING_NODE;
/* TODO - maybe: WHERE kind != 'subdir'; */
]]]

where
  ?1 is the path to the WC-root DB
  ?2 is the wc_relpath of the subdirectory that we're processing

- Julian
Received on 2010-07-09 15:33:15 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.