Author: rhuijben
Date: Tue Jun 28 13:52:54 2011
New Revision: 1140617

URL: http://svn.apache.org/viewvc?rev=1140617&view=rev
Log:
Following up on r1140600, pass a wc_id to another query to avoid more table
scans while upgrading.

* subversion/libsvn_wc/upgrade.c
  (get_versioned_files): Add wc_id argument and pass it to the query.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_ALL_FILES): Reorder query and add wc_id argument.
  (STMT_HAS_WORKING_NODES,
   STMT_HAS_ACTUAL_NODES_CONFLICTS): Add LIMIT 1 to query.

Modified:
    subversion/trunk/subversion/libsvn_wc/upgrade.c
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql

Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=1140617&r1=1140616&r2=1140617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Tue Jun 28 13:52:54 2011
@@ -357,6 +357,7 @@ static svn_error_t *
 get_versioned_files(const apr_array_header_t **children,
                     const char *parent_relpath,
                     svn_sqlite__db_t *sdb,
+                    apr_int64_t wc_id,
                     apr_pool_t *result_pool,
                     apr_pool_t *scratch_pool)
 {
@@ -366,7 +367,7 @@ get_versioned_files(const apr_array_head
 
   /* ### just select 'file' children. do we need 'symlink' in the future?  */
   SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_ALL_FILES));
-  SVN_ERR(svn_sqlite__bindf(stmt, "s", parent_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, parent_relpath));
 
   /* ### 10 is based on Subversion's average of 8.5 files per versioned
      ### directory in its repository. maybe use a different value? or
@@ -953,7 +954,7 @@ migrate_props(const char *dir_abspath,
                              original_format, wc_id, iterpool));
 
   /* Iterate over all the files in this SDB.  */
-  SVN_ERR(get_versioned_files(&children, dir_relpath, sdb, scratch_pool,
+  SVN_ERR(get_versioned_files(&children, dir_relpath, sdb, wc_id, scratch_pool,
                               iterpool));
   for (i = 0; i < children->nelts; i++)
     {

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1140617&r1=1140616&r2=1140617&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue Jun 28 13:52:54 
2011
@@ -987,7 +987,7 @@ UPDATE actual_node SET tree_conflict_dat
 -- STMT_SELECT_ALL_FILES
 /* Should this select on wc_id as well? */
 SELECT DISTINCT local_relpath FROM nodes
-WHERE kind = 'file' AND parent_relpath = ?1
+WHERE wc_id = ?1 AND parent_relpath = ?2 AND kind = 'file'
 
 -- STMT_UPDATE_NODE_PROPS
 UPDATE nodes SET properties = ?4
@@ -995,12 +995,14 @@ WHERE wc_id = ?1 AND local_relpath = ?2 
 
 -- STMT_HAS_WORKING_NODES
 SELECT 1 FROM nodes WHERE op_depth > 0
+LIMIT 1
 
 -- STMT_HAS_ACTUAL_NODES_CONFLICTS
 SELECT 1 FROM actual_node
 WHERE NOT ((prop_reject IS NULL) AND (conflict_old IS NULL)
            AND (conflict_new IS NULL) AND (conflict_working IS NULL)
            AND (tree_conflict_data IS NULL))
+LIMIT 1
 
 /* ------------------------------------------------------------------------- */
 /* PROOF OF CONCEPT: Complex queries for callback walks, caching results


Reply via email to