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

svn commit: r1088637 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c merge.c questions.c translate.c translate.h update_editor.c workqueue.c

Author: rhuijben
Date: Mon Apr  4 14:31:21 2011
New Revision: 1088637

URL: http://svn.apache.org/viewvc?rev=1088637&view=rev
Log:
Avoid several database transactions while installing files during update and
checkout. Do this by using the svn_wc__db_read_node_install_info() and using
this information instead of several separate database queries to gather
individual flags.

* subversion/libsvn_wc/adm_ops.c
  (svn_wc__internal_remove_from_revision_control): Update caller.

* subversion/libsvn_wc/merge.c
  (detranslate_wc_file, merge_text_file): Update caller.

* subversion/libsvn_wc/questions.c
  (compare_and_verify): Update caller.

* subversion/libsvn_wc/translate.c
  (svn_wc__internal_translated_stream,
   svn_wc__internal_translated_file): Update caller.
  (svn_wc__get_translate_info): Add props argument to allow the caller
    to avoid retrieving properties.

* subversion/libsvn_wc/translate.h
  (svn_wc__get_translate_info): Add props argument to allow the caller
    to avoid retrieving properties.

* subversion/libsvn_wc/update_editor.c
  (merge_file): Update caller.

* subversion/libsvn_wc/workqueue.c
  (install_committed_file): Update caller.
  (run_file_install): Use svn_wc__db_read_node_install_info to avoid the
    (extra) db transactions inside svn_wc__get_pristine_contents,
      svn_wc__db_temp_wcroot_tempdir, svn_wc__get_translate_info and
      sync_file_flags.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/merge.c
    subversion/trunk/subversion/libsvn_wc/questions.c
    subversion/trunk/subversion/libsvn_wc/translate.c
    subversion/trunk/subversion/libsvn_wc/translate.h
    subversion/trunk/subversion/libsvn_wc/update_editor.c
    subversion/trunk/subversion/libsvn_wc/workqueue.c

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1088637&r1=1088636&r2=1088637&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Mon Apr  4 14:31:21 2011
@@ -2067,7 +2067,7 @@ svn_wc__internal_remove_from_revision_co
       /* Only check if the file was modified when it wasn't overwritten with a
          special file */
       SVN_ERR(svn_wc__get_translate_info(NULL, NULL, NULL,
-                                         &wc_special, db, local_abspath,
+                                         &wc_special, db, local_abspath, NULL,
                                          scratch_pool, scratch_pool));
       SVN_ERR(svn_io_check_special_path(local_abspath, &on_disk,
                                         &local_special, scratch_pool));

Modified: subversion/trunk/subversion/libsvn_wc/merge.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/merge.c?rev=1088637&r1=1088636&r2=1088637&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/merge.c (original)
+++ subversion/trunk/subversion/libsvn_wc/merge.c Mon Apr  4 14:31:21 2011
@@ -167,7 +167,7 @@ detranslate_wc_file(const char **detrans
         SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                            &keywords,
                                            &special,
-                                           db, target_abspath,
+                                           db, target_abspath, NULL,
                                            scratch_pool, scratch_pool));
       else
         {
@@ -186,7 +186,7 @@ detranslate_wc_file(const char **detrans
         SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                            &keywords,
                                            &special,
-                                           db, target_abspath,
+                                           db, target_abspath, NULL,
                                            scratch_pool, scratch_pool));
       else
         {
@@ -1054,7 +1054,7 @@ merge_text_file(svn_skel_t **work_items,
          but the same treatment is probably also appropriate for
          whatever special file types we may invent in the future. */
       SVN_ERR(svn_wc__get_translate_info(NULL, NULL, NULL,
-                                         &special, db, target_abspath,
+                                         &special, db, target_abspath, NULL,
                                          pool, pool));
       SVN_ERR(svn_io_files_contents_same_p(&same, result_target,
                                            (special ?

Modified: subversion/trunk/subversion/libsvn_wc/questions.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/questions.c?rev=1088637&r1=1088636&r2=1088637&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/questions.c (original)
+++ subversion/trunk/subversion/libsvn_wc/questions.c Mon Apr  4 14:31:21 2011
@@ -118,7 +118,7 @@ compare_and_verify(svn_boolean_t *modifi
   SVN_ERR(svn_wc__get_translate_info(&eol_style, &eol_str,
                                      &keywords,
                                      &special,
-                                     db, versioned_file_abspath,
+                                     db, versioned_file_abspath, NULL,
                                      scratch_pool, scratch_pool));
 
   need_translation = svn_subst_translation_required(eol_style, eol_str,

Modified: subversion/trunk/subversion/libsvn_wc/translate.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/translate.c?rev=1088637&r1=1088636&r2=1088637&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/translate.c (original)
+++ subversion/trunk/subversion/libsvn_wc/translate.c Mon Apr  4 14:31:21 2011
@@ -85,7 +85,7 @@ svn_wc__internal_translated_stream(svn_s
   SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                      &keywords,
                                      &special,
-                                     db, versioned_abspath,
+                                     db, versioned_abspath, NULL,
                                      scratch_pool, scratch_pool));
 
   if (special)
@@ -171,7 +171,7 @@ svn_wc__internal_translated_file(const c
   SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                      &keywords,
                                      &special,
-                                     db, versioned_abspath,
+                                     db, versioned_abspath, NULL, 
                                      scratch_pool, scratch_pool));
 
   if (! svn_subst_translation_required(style, eol, keywords, special, TRUE)
@@ -260,15 +260,16 @@ svn_wc__get_translate_info(svn_subst_eol
                            svn_boolean_t *special,
                            svn_wc__db_t *db,
                            const char *local_abspath,
+                           apr_hash_t *props,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
 {
-  apr_hash_t *props;
   svn_string_t *propval;
   SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
 
-  SVN_ERR(svn_wc__get_actual_props(&props, db, local_abspath,
-                                   scratch_pool, scratch_pool));
+  if (props == NULL)
+    SVN_ERR(svn_wc__get_actual_props(&props, db, local_abspath,
+                                     scratch_pool, scratch_pool));
 
   if (eol)
     {

Modified: subversion/trunk/subversion/libsvn_wc/translate.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/translate.h?rev=1088637&r1=1088636&r2=1088637&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/translate.h (original)
+++ subversion/trunk/subversion/libsvn_wc/translate.h Mon Apr  4 14:31:21 2011
@@ -61,8 +61,10 @@ extern "C" {
    available, do not create a hash entry for it.  If no keywords are
    found in the list, or if there is no list, set *KEYWORDS to NULL.
 
-   If SPECIAL is not NULL determine if the svn:special flag is set on LOCAL_ABSPATH
-   in DB.  If so, set SPECIAL to TRUE, if not, set it to FALSE
+   If SPECIAL is not NULL determine if the svn:special flag is set on 
+   LOCAL_ABSPATH in DB.  If so, set SPECIAL to TRUE, if not, set it to FALSE.
+
+   If PROPS is not NULL, use PROPS instead of the properties on LOCAL_ABSPATH.
 
    Use SCRATCH_POOL for temporary allocation, RESULT_POOL for allocating
    *STYLE and *EOL.
@@ -74,10 +76,10 @@ svn_wc__get_translate_info(svn_subst_eol
                            svn_boolean_t *special,
                            svn_wc__db_t *db,
                            const char *local_abspath,
+                           apr_hash_t *props,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool);
 
-
 /* Reverse parser.  Given a real EOL string ("\n", "\r", or "\r\n"),
    return an encoded *VALUE ("LF", "CR", "CRLF") that one might see in
    the property value. */

Modified: subversion/trunk/subversion/libsvn_wc/update_editor.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/update_editor.c?rev=1088637&r1=1088636&r2=1088637&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/update_editor.c (original)
+++ subversion/trunk/subversion/libsvn_wc/update_editor.c Mon Apr  4 14:31:21 2011
@@ -3827,7 +3827,7 @@ merge_file(svn_skel_t **work_items,
       SVN_ERR(svn_wc__get_translate_info(NULL, NULL,
                                          &keywords,
                                          NULL,
-                                         eb->db, fb->local_abspath,
+                                         eb->db, fb->local_abspath, NULL,
                                          scratch_pool, scratch_pool));
       if (magic_props_changed || keywords)
         {

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=1088637&r1=1088636&r2=1088637&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Mon Apr  4 14:31:21 2011
@@ -849,7 +849,7 @@ install_committed_file(svn_boolean_t *ov
     SVN_ERR(svn_wc__get_translate_info(NULL, NULL,
                                        NULL,
                                        &special,
-                                       db, file_abspath,
+                                       db, file_abspath, NULL,
                                        scratch_pool, scratch_pool));
     /* ### Should this be a strcmp()? */
     if (! special && tmp != tmp_wfile)
@@ -1385,6 +1385,10 @@ run_file_install(svn_wc__db_t *db,
   svn_stream_t *dst_stream;
   const char *dst_abspath;
   apr_int64_t val;
+  const char *wcroot_abspath;
+  const char *source_abspath;
+  const svn_checksum_t *checksum;
+  apr_hash_t *props;
 
   local_abspath = apr_pstrmemdup(scratch_pool, arg1->data, arg1->len);
   SVN_ERR(svn_skel__parse_int(&val, arg1->next, scratch_pool));
@@ -1392,27 +1396,32 @@ run_file_install(svn_wc__db_t *db,
   SVN_ERR(svn_skel__parse_int(&val, arg1->next->next, scratch_pool));
   record_fileinfo = (val != 0);
 
-  if (arg4 == NULL)
-    {
-      /* Get the pristine contents (from WORKING or BASE, as appropriate).  */
-      SVN_ERR(svn_wc__get_pristine_contents(&src_stream, db, local_abspath,
+  SVN_ERR(svn_wc__db_read_node_install_info(&wcroot_abspath, NULL, NULL,
+                                            &checksum, NULL, &props,
+                                            db, local_abspath,
                                             scratch_pool, scratch_pool));
-      SVN_ERR_ASSERT(src_stream != NULL);
-    }
-  else
-    {
-      const char *source_abspath;
 
+  if (arg4 != NULL)
+    {
       /* Use the provided path for the source.  */
       source_abspath = apr_pstrmemdup(scratch_pool, arg4->data, arg4->len);
-      SVN_ERR(svn_stream_open_readonly(&src_stream, source_abspath,
-                                       scratch_pool, scratch_pool));
     }
+  else
+    {
+      SVN_ERR_ASSERT(checksum != NULL);
+      SVN_ERR(svn_wc__db_pristine_get_future_path(&source_abspath,
+                                                  wcroot_abspath,
+                                                  checksum,
+                                                  scratch_pool, scratch_pool));
+    }
+
+  SVN_ERR(svn_stream_open_readonly(&src_stream, source_abspath,
+                                   scratch_pool, scratch_pool));
 
   /* Fetch all the translation bits.  */
   SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                      &keywords,
-                                     &special, db, local_abspath,
+                                     &special, db, local_abspath, props,
                                      scratch_pool, scratch_pool));
   if (special)
     {
@@ -1445,7 +1454,7 @@ run_file_install(svn_wc__db_t *db,
 
   /* Where is the Right Place to put a temp file in this working copy?  */
   SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&temp_dir_abspath,
-                                         db, local_abspath,
+                                         db, wcroot_abspath,
                                          scratch_pool, scratch_pool));
 
   /* Translate to a temporary file. We don't want the user seeing a partial
@@ -1469,7 +1478,12 @@ run_file_install(svn_wc__db_t *db,
   SVN_ERR(svn_io_file_rename(dst_abspath, local_abspath, scratch_pool));
 
   /* Tweak the on-disk file according to its properties.  */
-  SVN_ERR(sync_file_flags(db, local_abspath, scratch_pool));
+  if (props
+      && (apr_hash_get(props, SVN_PROP_NEEDS_LOCK, APR_HASH_KEY_STRING)
+          || apr_hash_get(props, SVN_PROP_EXECUTABLE, APR_HASH_KEY_STRING)))
+    {
+      SVN_ERR(sync_file_flags(db, local_abspath, scratch_pool));
+    }
 
   if (use_commit_times)
     {
@@ -1675,7 +1689,7 @@ run_file_copy_translated(svn_wc__db_t *d
   SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                      &keywords,
                                      &special,
-                                     db, local_abspath,
+                                     db, local_abspath, NULL,
                                      scratch_pool, scratch_pool));
 
   SVN_ERR(svn_subst_copy_and_translate4(src_abspath, dst_abspath,