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

RE: svn commit: r1470904 - /subversion/trunk/subversion/libsvn_wc/wc-metadata.sql

From: Bert Huijben <bert_at_qqmail.nl>
Date: Thu, 25 Apr 2013 00:14:28 +0200

> -----Original Message-----
> From: Bert Huijben [mailto:bert_at_qqmail.nl]
> Sent: donderdag 25 april 2013 00:10
> To: 'Paul Burba'; 'Subversion Development'
> Subject: RE: svn commit: r1470904 -
> /subversion/trunk/subversion/libsvn_wc/wc-metadata.sql
>
>
>
> > -----Original Message-----
> > From: Paul Burba [mailto:ptburba_at_gmail.com]
> > Sent: woensdag 24 april 2013 23:50
> > To: Subversion Development
> > Cc: Bert Huijben
> > Subject: Re: svn commit: r1470904 -
> > /subversion/trunk/subversion/libsvn_wc/wc-metadata.sql
> >
> > On Tue, Apr 23, 2013 at 7:42 AM, <rhuijben_at_apache.org> wrote:
> > > Author: rhuijben
> > > Date: Tue Apr 23 11:42:04 2013
> > > New Revision: 1470904
> > >
> > > URL: http://svn.apache.org/r1470904
> > > Log:
> > > * subversion/libsvn_wc/wc-metadata.sql
> > > (STMT_UPGRADE_31_SELECT_WCROOT_NODES): Replace some ugly
> SQL
> > with some
> > > slightly less ugly sql that more accurately describes what we do here.
> > >
> > > Modified:
> > > subversion/trunk/subversion/libsvn_wc/wc-metadata.sql
> > >
> > > Modified: subversion/trunk/subversion/libsvn_wc/wc-metadata.sql
> > > URL:
> >
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-
> > metadata.sql?rev=1470904&r1=1470903&r2=1470904&view=diff
> > >
> >
> ==========================================================
> > ====================
> > > --- subversion/trunk/subversion/libsvn_wc/wc-metadata.sql (original)
> > > +++ subversion/trunk/subversion/libsvn_wc/wc-metadata.sql Tue Apr 23
> > 11:42:04 2013
> > > @@ -840,17 +840,15 @@ PRAGMA user_version = 31;
> > > SELECT l.wc_id, l.local_relpath FROM nodes as l
> > > LEFT OUTER JOIN nodes as r
> > > ON l.wc_id = r.wc_id
> > > - AND l.repos_id = r.repos_id
> > > AND r.local_relpath = l.parent_relpath
> > > -WHERE (l.local_relpath = '' AND l.repos_path != '')
> > > - OR (l.op_depth = 0
> > > - AND l.local_relpath != ''
> > > - AND l.repos_path != ltrim(r.repos_path
> > > - || '/'
> > > - || ltrim(substr(l.local_relpath,
> > > - length(l.parent_relpath) + 1),
> > > - '/'),
> > > - '/'))
> > > + AND r.op_depth = 0 AND l.op_depth = 0
> > > + AND l.repos_path != ''
> > > +WHERE (l.local_relpath = '')
> >
> > Hi Bert,
> >
> > I believe this needs to be:
> >
> > +WHERE (l.local_relpath = '' AND l.repos_path != '')
> >
> > Otherwise we select the root of the working copy even when that root
> > points to the root of the repository (and obviously has no parent to
> > inherit from). This is not what
> > STMT_UPGRADE_31_SELECT_WCROOT_NODES
> > promises:
> >
> > -- STMT_UPGRADE_31_SELECT_WCROOT_NODES
> > /* Select all base nodes which are the root of a WC, including
> > switched subtrees, but excluding those which map to the root
> > of the repos.
> >
> > Here's a quick example:
> >
> > Check out a WC with a 1.7 client:
> >
> > 1.7.9-dev>svn co
> > file:///C:/SVN/src-branch-1.7.x/Debug/subversion/tests/cmdline/svn-test-
> > work/repositories/merge_tests-101
> > wc-root
> > A wc-root\iota
> > A wc-root\branch
> > A wc-root\branch\J
> > <snip>
> > A wc-root\A\D\H\chi
> > A wc-root\A\D\H\omega
> > A wc-root\A\D\H\psi
> > Checked out revision 7.
> >
> > 1.7.9-dev>
> >
> > 1.9.0-dev>cd wc-root
> > ...
> >
> > Now assume we are going to run upgrade. The current query:
> >
> > SELECT l.wc_id, l.local_relpath FROM nodes as l
> > LEFT OUTER JOIN nodes as r
> > ON l.wc_id = r.wc_id
> > AND r.local_relpath = l.parent_relpath
> > AND r.op_depth = 0 AND l.op_depth = 0
> > AND l.repos_path != ''
> > WHERE (l.local_relpath = '')
> > OR (l.local_relpath != '' AND l.repos_id != r.repos_id)
> > OR (l.local_relpath != ''
> > AND l.repos_path
> > != (CASE WHEN (r.local_relpath) = '' THEN (CASE WHEN
> > (r.repos_path) = '' THEN (l.local_relpath) WHEN (l.local_relpath) = ''
> > THEN (r.repos_path) ELSE (r.repos_path) || '/' || (l.local_relpath)
> > END) WHEN (r.repos_path) = '' THEN (CASE WHEN (r.local_relpath) = ''
> > THEN (l.local_relpath) WHEN SUBSTR((l.local_relpath), 1,
> > LENGTH(r.local_relpath)) = (r.local_relpath) THEN CASE WHEN
> > LENGTH(r.local_relpath) = LENGTH(l.local_relpath) THEN '' WHEN
> > SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN
> > SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+2) END END) WHEN
> > SUBSTR((l.local_relpath), 1, LENGTH(r.local_relpath)) =
> > (r.local_relpath) THEN CASE WHEN LENGTH(r.local_relpath) =
> > LENGTH(l.local_relpath) THEN (r.repos_path) WHEN
> > SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1, 1) = '/' THEN
> > (r.repos_path) || SUBSTR((l.local_relpath), LENGTH(r.local_relpath)+1)
> > END END))
> >
> > Returns the root:
> >
> > #|wc_id|local_relpath
> > -+-----+-------------
> > 1|1 |
> >
> > 1 row(s) affected in 0.00142 second(s).
> >
> > Which ultimately causes libsvn_wc/upgrade:bump_to_31() to create an
> > INHERITED_PROPS cache for the WC root, albeit and empty one.
> >
> > The tweak I suggest above avoids the root from being selected:
> >
> > SELECT l.wc_id, l.local_relpath FROM nodes as l
> > LEFT OUTER JOIN nodes as r
> > ON l.wc_id = r.wc_id
> > AND r.local_relpath = l.parent_relpath
> > AND r.op_depth = 0 AND l.op_depth = 0
> > AND l.repos_path != ''
>
> ^^^
> This line should have that same effect?
> (Moved from the where to the join to have it apply to all the or clauses
> without having to duplicate it 3 times)
>
> Are you sure that you have that line in your testcase.

Tested this query and indeed it shows this problem.

The op-depth checks on the line above it should also be moved to the where part for all three cases.

        Bert
Received on 2013-04-25 00:15:32 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.