Author: svn-role
Date: Fri Apr 13 04:01:20 2012
New Revision: 1325605

URL: http://svn.apache.org/viewvc?rev=1325605&view=rev
Log:
Merge r1306334 from trunk:

 * r1306334
   Optimize failure of opening wc.db files.
   Justification:
     Takes far too much CPU when performing status on not-working copies.
     Reported as raw performance data on AnkhSVN. Probably noticable on the
     buildbot total time too.
   Votes:
     +1: rhuijben, hwright, philip

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/libsvn_wc/wc_db_util.c

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /subversion/trunk:r1306334

Modified: subversion/branches/1.7.x/STATUS
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1325605&r1=1325604&r2=1325605&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Fri Apr 13 04:01:20 2012
@@ -144,15 +144,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * r1306334
-   Optimize failure of opening wc.db files.
-   Justification:
-     Takes far too much CPU when performing status on not-working copies.
-     Reported as raw performance data on AnkhSVN. Probably noticable on the
-     buildbot total time too.
-   Votes:
-     +1: rhuijben, hwright, philip
-
  * r1311702
    Prevent out-of-bounds array access during 'svn diff' arguments processing.
    Justification:

Modified: subversion/branches/1.7.x/subversion/libsvn_wc/wc_db_util.c
URL: 
http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_wc/wc_db_util.c?rev=1325605&r1=1325604&r2=1325605&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_wc/wc_db_util.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_wc/wc_db_util.c Fri Apr 13 
04:01:20 2012
@@ -121,6 +121,21 @@ svn_wc__db_util_open_db(svn_sqlite__db_t
   const char *sdb_abspath = svn_wc__adm_child(dir_abspath, sdb_fname,
                                               scratch_pool);
 
+  if (smode != svn_sqlite__mode_rwcreate)
+    {
+      svn_node_kind_t kind;
+
+      /* A file stat is much cheaper then a failed database open handled
+         by SQLite. */
+      SVN_ERR(svn_io_check_path(sdb_abspath, &kind, scratch_pool));
+
+      if (kind != svn_node_file)
+        return svn_error_createf(APR_ENOENT, NULL,
+                                 _("Working copy database '%s' not found"),
+                                 svn_dirent_local_style(sdb_abspath,
+                                                        scratch_pool));
+    }
+
   SVN_ERR(svn_sqlite__open(sdb, sdb_abspath, smode,
                            my_statements ? my_statements : statements,
                            0, NULL, result_pool, scratch_pool));


Reply via email to