You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2011/05/16 16:28:45 UTC

svn commit: r1103749 - /subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c

Author: stefan2
Date: Mon May 16 14:28:45 2011
New Revision: 1103749

URL: http://svn.apache.org/viewvc?rev=1103749&view=rev
Log:
SVN status will try to read the .format file for every folder in
the working copy.  That is very expensive, so do a stat call
to check whether the .format file exists - which it won't for
wc-ng w/cs.

* subversion/libsvn_wc/wc_db_wcroot.c
  (get_old_version): early exit upon failed stat

Modified:
    subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c

Modified: subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c?rev=1103749&r1=1103748&r2=1103749&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c Mon May 16 14:28:45 2011
@@ -50,10 +50,21 @@ get_old_version(int *version,
 {
   svn_error_t *err;
   const char *format_file_path;
+  svn_node_kind_t kind;
 
   /* Try reading the format number from the entries file.  */
   format_file_path = svn_wc__adm_child(abspath, SVN_WC__ADM_ENTRIES,
                                        scratch_pool);
+  
+  /* Since trying to open a non-existent file is quite expensive, try a
+     quick stat call first. In wc-ng w/cs, this will be an early exit. */
+  SVN_ERR(svn_io_check_path(format_file_path, &kind, scratch_pool));
+  if (kind == svn_node_none)
+    {
+      *version = 0;
+      return SVN_NO_ERROR;
+    }
+  
   err = svn_io_read_version_file(version, format_file_path, scratch_pool);
   if (err == NULL)
     return SVN_NO_ERROR;



RE: svn commit: r1103749 - /subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c

Posted by Bert Huijben <be...@qqmail.nl>.

> -----Original Message-----
> From: Branko Čibej [mailto:brane@xbc.nu] On Behalf Of Branko Cibej
> Sent: woensdag 18 mei 2011 21:25
> To: dev@subversion.apache.org
> Subject: Re: svn commit: r1103749 -
> /subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c
> 
> On 17.05.2011 12:37, Stefan Fuhrmann wrote:
> > On 17.05.2011 10:11, Greg Stein wrote:
> >> On May 16, 2011 10:29 AM,<st...@apache.org>  wrote:
> >>> Author: stefan2
> >>> Date: Mon May 16 14:28:45 2011
> >>> New Revision: 1103749
> >>>
> >>> URL: http://svn.apache.org/viewvc?rev=1103749&view=rev
> >>> Log:
> >>> SVN status will try to read the .format file for every folder in
> >>> the working copy.  That is very expensive, so do a stat call
> >>> to check whether the .format file exists - which it won't for
> >>> wc-ng w/cs.
> >> Is this true for both Windows and unix-ish?
> > AFAICT, this is true for both Windows and Unix.
> > Even if a failed file_open is equivalent to a stat,
> > we would still create a locale-dependent svn_error_t
> > object and that is expensive (at least not for free).
> 
> Wait -- creating an svn_error_t is more expensive than the extra stat?

It is not an extra stat. It is an 'instead' stat.

1.7+ will just read the db as the format file isn't there in all those folders that don't exist.

	Bert


Re: svn commit: r1103749 - /subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c

Posted by Branko Čibej <br...@e-reka.si>.
On 17.05.2011 12:37, Stefan Fuhrmann wrote:
> On 17.05.2011 10:11, Greg Stein wrote:
>> On May 16, 2011 10:29 AM,<st...@apache.org>  wrote:
>>> Author: stefan2
>>> Date: Mon May 16 14:28:45 2011
>>> New Revision: 1103749
>>>
>>> URL: http://svn.apache.org/viewvc?rev=1103749&view=rev
>>> Log:
>>> SVN status will try to read the .format file for every folder in
>>> the working copy.  That is very expensive, so do a stat call
>>> to check whether the .format file exists - which it won't for
>>> wc-ng w/cs.
>> Is this true for both Windows and unix-ish?
> AFAICT, this is true for both Windows and Unix.
> Even if a failed file_open is equivalent to a stat,
> we would still create a locale-dependent svn_error_t
> object and that is expensive (at least not for free).

Wait -- creating an svn_error_t is more expensive than the extra stat?

-- Brane

Re: svn commit: r1103749 - /subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c

Posted by Stefan Fuhrmann <eq...@web.de>.
On 17.05.2011 10:11, Greg Stein wrote:
> On May 16, 2011 10:29 AM,<st...@apache.org>  wrote:
>> Author: stefan2
>> Date: Mon May 16 14:28:45 2011
>> New Revision: 1103749
>>
>> URL: http://svn.apache.org/viewvc?rev=1103749&view=rev
>> Log:
>> SVN status will try to read the .format file for every folder in
>> the working copy.  That is very expensive, so do a stat call
>> to check whether the .format file exists - which it won't for
>> wc-ng w/cs.
> Is this true for both Windows and unix-ish?
AFAICT, this is true for both Windows and Unix.
Even if a failed file_open is equivalent to a stat,
we would still create a locale-dependent svn_error_t
object and that is expensive (at least not for free).

-- Stefan^2.

Re: svn commit: r1103749 - /subversion/trunk/subversion/libsvn_wc/wc_db_wcroot.c

Posted by Greg Stein <gs...@gmail.com>.
On May 16, 2011 10:29 AM, <st...@apache.org> wrote:
>
> Author: stefan2
> Date: Mon May 16 14:28:45 2011
> New Revision: 1103749
>
> URL: http://svn.apache.org/viewvc?rev=1103749&view=rev
> Log:
> SVN status will try to read the .format file for every folder in
> the working copy.  That is very expensive, so do a stat call
> to check whether the .format file exists - which it won't for
> wc-ng w/cs.

Is this true for both Windows and unix-ish?

Cheers,
-g