Author: rhuijben
Date: Tue Jun 28 13:35:15 2011
New Revision: 1140600

URL: http://svn.apache.org/viewvc?rev=1140600&view=rev
Log:
Make the upgrade code pass the new wc_id down to the helper functions to allow
the property update code to use an index instead of a table scan.

* subversion/libsvn_wc/upgrade.c
  (migrate_node_props,
   migrate_props,
   upgrade_to_wcng): Add wc_id argument. Update caller.
  (upgrade_working_copy): Pass initial wc_id to upgrade_to_wcng.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_NODE_UPGRADE): Assume a wc_id as first argument.

* subversion/libsvn_wc/wc_db.c
  (svn_wc__db_upgrade_apply_props): Add wc_id argument instead of fetching the
    wc_id via STMT_SELECT_NODE_UPGRADE.

* subversion/libsvn_wc/wc_db.h
  (svn_wc__db_upgrade_apply_props): Add wc_id argument.

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

Modified: subversion/trunk/subversion/libsvn_wc/upgrade.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/upgrade.c?rev=1140600&r1=1140599&r2=1140600&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/trunk/subversion/libsvn_wc/upgrade.c Tue Jun 28 13:35:15 2011
@@ -838,6 +838,7 @@ migrate_node_props(const char *dir_abspa
                    const char *name,
                    svn_sqlite__db_t *sdb,
                    int original_format,
+                   apr_int64_t wc_id,
                    apr_pool_t *scratch_pool)
 {
   const char *base_abspath;  /* old name. nowadays: "pristine"  */
@@ -904,7 +905,7 @@ migrate_node_props(const char *dir_abspa
                             sdb, new_wcroot_abspath,
                             svn_relpath_join(dir_relpath, name, scratch_pool),
                             base_props, revert_props, working_props,
-                            original_format,
+                            original_format, wc_id,
                             scratch_pool));
 }
 
@@ -915,6 +916,7 @@ migrate_props(const char *dir_abspath,
               const char *new_wcroot_abspath,
               svn_sqlite__db_t *sdb,
               int original_format,
+              apr_int64_t wc_id,
               apr_pool_t *scratch_pool)
 {
   /* General logic here: iterate over all the immediate children of the root
@@ -948,7 +950,7 @@ migrate_props(const char *dir_abspath,
 
   /* Migrate the props for "this dir".  */
   SVN_ERR(migrate_node_props(dir_abspath, new_wcroot_abspath, "", sdb,
-                             original_format, iterpool));
+                             original_format, wc_id, iterpool));
 
   /* Iterate over all the files in this SDB.  */
   SVN_ERR(get_versioned_files(&children, dir_relpath, sdb, scratch_pool,
@@ -960,7 +962,7 @@ migrate_props(const char *dir_abspath,
       svn_pool_clear(iterpool);
 
       SVN_ERR(migrate_node_props(dir_abspath, new_wcroot_abspath,
-                                 name, sdb, original_format, iterpool));
+                                 name, sdb, original_format, wc_id, iterpool));
     }
 
   svn_pool_destroy(iterpool);
@@ -1376,6 +1378,7 @@ upgrade_to_wcng(void **dir_baton,
                 svn_wc__db_t *db,
                 const char *dir_abspath,
                 int old_format,
+                apr_int64_t wc_id,
                 svn_wc_upgrade_get_repos_info_t repos_info_func,
                 void *repos_info_baton,
                 apr_hash_t *repos_cache,
@@ -1490,7 +1493,7 @@ upgrade_to_wcng(void **dir_baton,
      database. The upgrade process needs the children in BASE_NODE and
      WORKING_NODE, and to examine the resultant WORKING state.  */
   SVN_ERR(migrate_props(dir_abspath, data->root_abspath, data->sdb, old_format,
-                        scratch_pool));
+                        wc_id, scratch_pool));
 
   return SVN_NO_ERROR;
 }
@@ -1703,7 +1706,8 @@ upgrade_working_copy(void *parent_baton,
     }
 
 
-  SVN_ERR(upgrade_to_wcng(&dir_baton, parent_baton, db, dir_abspath, 
old_format,
+  SVN_ERR(upgrade_to_wcng(&dir_baton, parent_baton, db, dir_abspath,
+                          old_format, data->wc_id,
                           repos_info_func, repos_info_baton,
                           repos_cache, data, scratch_pool, iterpool));
 

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1140600&r1=1140599&r2=1140600&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Tue Jun 28 13:35:15 
2011
@@ -992,7 +992,7 @@ WHERE kind = 'file' AND parent_relpath =
 -- STMT_SELECT_NODE_UPGRADE
 SELECT op_depth, presence, wc_id, kind
 FROM nodes
-WHERE local_relpath = ?1
+WHERE wc_id = ?1 AND local_relpath = ?2
 ORDER BY op_depth DESC
 
 -- STMT_UPDATE_NODE_PROPS

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1140600&r1=1140599&r2=1140600&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Jun 28 13:35:15 2011
@@ -9605,11 +9605,11 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
                                apr_hash_t *revert_props,
                                apr_hash_t *working_props,
                                int original_format,
+                               apr_int64_t wc_id,
                                apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
   svn_boolean_t have_row;
-  apr_int64_t wc_id;
   apr_int64_t top_op_depth = -1;
   apr_int64_t below_op_depth = -1;
   svn_wc__db_status_t top_presence;
@@ -9645,13 +9645,12 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
   */
 
   SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_SELECT_NODE_UPGRADE));
-  SVN_ERR(svn_sqlite__bindf(stmt, "s", local_relpath));
+  SVN_ERR(svn_sqlite__bindf(stmt, "is", wc_id, local_relpath));
   SVN_ERR(svn_sqlite__step(&have_row, stmt));
   if (have_row)
     {
       top_op_depth = svn_sqlite__column_int64(stmt, 0);
       top_presence = svn_sqlite__column_token(stmt, 1, presence_map);
-      wc_id = svn_sqlite__column_int64(stmt, 2);
       kind = svn_sqlite__column_token(stmt, 3, kind_map);
       SVN_ERR(svn_sqlite__step(&have_row, stmt));
       if (have_row)

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=1140600&r1=1140599&r2=1140600&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue Jun 28 13:35:15 2011
@@ -2597,6 +2597,7 @@ svn_wc__db_upgrade_apply_props(svn_sqlit
                                apr_hash_t *revert_props,
                                apr_hash_t *working_props,
                                int original_format,
+                               apr_int64_t wc_id,
                                apr_pool_t *scratch_pool);
 
 


Reply via email to