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

svn commit: r1564619 - in /subversion/branches/1.7.x: ./ STATUS subversion/libsvn_repos/reporter.c

Author: svn-role
Date: Wed Feb  5 04:04:45 2014
New Revision: 1564619

URL: http://svn.apache.org/r1564619
Log:
Merge the 1.7.x-r1564215 branch:

 * r1564215
   Reduce dynamic memory usage during c/o and export.
   Branch: ^/subversion/branches/1.7.x-r1564215
   Justification:
     Without this patch, operations using the standard reporter (at least
     svn: c/o and export; probably same for httpv1) use more or less
     unbounded amounts of memory.  Dynamic peaks of up to 20GB have been
     observed.  With this patch, those peaks come down to 100MB which
     matches our claim to streaminess.
   Votes:
     +1: stefan2, philip, breser

Modified:
    subversion/branches/1.7.x/   (props changed)
    subversion/branches/1.7.x/STATUS
    subversion/branches/1.7.x/subversion/libsvn_repos/reporter.c

Propchange: subversion/branches/1.7.x/
------------------------------------------------------------------------------
  Merged /subversion/branches/1.7.x-r1564215:r1564280-1564618
  Merged /subversion/trunk:r1564215

Modified: subversion/branches/1.7.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/STATUS?rev=1564619&r1=1564618&r2=1564619&view=diff
==============================================================================
--- subversion/branches/1.7.x/STATUS (original)
+++ subversion/branches/1.7.x/STATUS Wed Feb  5 04:04:45 2014
@@ -117,15 +117,3 @@ Approved changes:
    Votes:
      +1: breser, philip, stefan2
 
- * r1564215
-   Reduce dynamic memory usage during c/o and export.
-   Branch: ^/subversion/branches/1.7.x-r1564215
-   Justification:
-     Without this patch, operations using the standard reporter (at least
-     svn: c/o and export; probably same for httpv1) use more or less
-     unbounded amounts of memory.  Dynamic peaks of up to 20GB have been
-     observed.  With this patch, those peaks come down to 100MB which
-     matches our claim to streaminess.
-   Votes:
-     +1: stefan2, philip, breser
-

Modified: subversion/branches/1.7.x/subversion/libsvn_repos/reporter.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.7.x/subversion/libsvn_repos/reporter.c?rev=1564619&r1=1564618&r2=1564619&view=diff
==============================================================================
--- subversion/branches/1.7.x/subversion/libsvn_repos/reporter.c (original)
+++ subversion/branches/1.7.x/subversion/libsvn_repos/reporter.c Wed Feb  5 04:04:45 2014
@@ -1026,7 +1026,8 @@ delta_dirs(report_baton_t *b, svn_revnum
   svn_fs_root_t *s_root;
   apr_hash_t *s_entries = NULL, *t_entries;
   apr_hash_index_t *hi;
-  apr_pool_t *subpool;
+  apr_pool_t *subpool = svn_pool_create(pool);
+  apr_pool_t *iterpool;
   const char *name, *s_fullpath, *t_fullpath, *e_fullpath;
   path_info_t *info;
 
@@ -1035,7 +1036,8 @@ delta_dirs(report_baton_t *b, svn_revnum
 
      When we support directory locks, we must pass the lock token here. */
   SVN_ERR(delta_proplists(b, s_rev, start_empty ? NULL : s_path, t_path,
-                          NULL, change_dir_prop, dir_baton, pool));
+                          NULL, change_dir_prop, dir_baton, subpool));
+  svn_pool_clear(subpool);
 
   if (requested_depth > svn_depth_empty
       || requested_depth == svn_depth_unknown)
@@ -1044,19 +1046,19 @@ delta_dirs(report_baton_t *b, svn_revnum
       if (s_path && !start_empty)
         {
           SVN_ERR(get_source_root(b, &s_root, s_rev));
-          SVN_ERR(svn_fs_dir_entries(&s_entries, s_root, s_path, pool));
+          SVN_ERR(svn_fs_dir_entries(&s_entries, s_root, s_path, subpool));
         }
-      SVN_ERR(svn_fs_dir_entries(&t_entries, b->t_root, t_path, pool));
+      SVN_ERR(svn_fs_dir_entries(&t_entries, b->t_root, t_path, subpool));
 
       /* Iterate over the report information for this directory. */
-      subpool = svn_pool_create(pool);
+      iterpool = svn_pool_create(pool);
 
       while (1)
         {
           const svn_fs_dirent_t *s_entry, *t_entry;
 
-          svn_pool_clear(subpool);
-          SVN_ERR(fetch_path_info(b, &name, &info, e_path, subpool));
+          svn_pool_clear(iterpool);
+          SVN_ERR(fetch_path_info(b, &name, &info, e_path, iterpool));
           if (!name)
             break;
 
@@ -1076,10 +1078,10 @@ delta_dirs(report_baton_t *b, svn_revnum
               continue;
             }
 
-          e_fullpath = svn_relpath_join(e_path, name, subpool);
-          t_fullpath = svn_fspath__join(t_path, name, subpool);
+          e_fullpath = svn_relpath_join(e_path, name, iterpool);
+          t_fullpath = svn_fspath__join(t_path, name, iterpool);
           t_entry = apr_hash_get(t_entries, name, APR_HASH_KEY_STRING);
-          s_fullpath = s_path ? svn_fspath__join(s_path, name, subpool) : NULL;
+          s_fullpath = s_path ? svn_fspath__join(s_path, name, iterpool) : NULL;
           s_entry = s_entries ?
             apr_hash_get(s_entries, name, APR_HASH_KEY_STRING) : NULL;
 
@@ -1099,7 +1101,7 @@ delta_dirs(report_baton_t *b, svn_revnum
                                  t_entry, dir_baton, e_fullpath, info,
                                  info ? info->depth
                                       : DEPTH_BELOW_HERE(wc_depth),
-                                 DEPTH_BELOW_HERE(requested_depth), subpool));
+                                 DEPTH_BELOW_HERE(requested_depth), iterpool));
 
           /* Don't revisit this name in the target or source entries. */
           apr_hash_set(t_entries, name, APR_HASH_KEY_STRING, NULL);
@@ -1119,13 +1121,13 @@ delta_dirs(report_baton_t *b, svn_revnum
          target, for graceful handling of case-only renames. */
       if (s_entries)
         {
-          for (hi = apr_hash_first(pool, s_entries);
+          for (hi = apr_hash_first(subpool, s_entries);
                hi;
                hi = apr_hash_next(hi))
             {
               const svn_fs_dirent_t *s_entry;
 
-              svn_pool_clear(subpool);
+              svn_pool_clear(iterpool);
               s_entry = svn__apr_hash_index_val(hi);
 
               if (apr_hash_get(t_entries, s_entry->name,
@@ -1143,27 +1145,29 @@ delta_dirs(report_baton_t *b, svn_revnum
                     continue;
 
                   /* There is no corresponding target entry, so delete. */
-                  e_fullpath = svn_relpath_join(e_path, s_entry->name, subpool);
+                  e_fullpath = svn_relpath_join(e_path, s_entry->name, iterpool);
                   SVN_ERR(svn_repos_deleted_rev(svn_fs_root_fs(b->t_root),
                                                 svn_fspath__join(t_path,
                                                                  s_entry->name,
-                                                                 subpool),
+                                                                 iterpool),
                                                 s_rev, b->t_rev,
-                                                &deleted_rev, subpool));
+                                                &deleted_rev, iterpool));
 
                   SVN_ERR(b->editor->delete_entry(e_fullpath,
                                                   deleted_rev,
-                                                  dir_baton, subpool));
+                                                  dir_baton, iterpool));
                 }
             }
         }
 
       /* Loop over the dirents in the target. */
-      for (hi = apr_hash_first(pool, t_entries); hi; hi = apr_hash_next(hi))
+      for (hi = apr_hash_first(subpool, t_entries);
+           hi;
+           hi = apr_hash_next(hi))
         {
           const svn_fs_dirent_t *s_entry, *t_entry;
 
-          svn_pool_clear(subpool);
+          svn_pool_clear(iterpool);
           t_entry = svn__apr_hash_index_val(hi);
 
           if (is_depth_upgrade(wc_depth, requested_depth, t_entry->kind))
@@ -1191,24 +1195,27 @@ delta_dirs(report_baton_t *b, svn_revnum
                   apr_hash_get(s_entries, t_entry->name, APR_HASH_KEY_STRING)
                   : NULL;
               s_fullpath = s_entry ?
-                  svn_fspath__join(s_path, t_entry->name, subpool) : NULL;
+                  svn_fspath__join(s_path, t_entry->name, iterpool) : NULL;
             }
 
           /* Compose the report, editor, and target paths for this entry. */
-          e_fullpath = svn_relpath_join(e_path, t_entry->name, subpool);
-          t_fullpath = svn_fspath__join(t_path, t_entry->name, subpool);
+          e_fullpath = svn_relpath_join(e_path, t_entry->name, iterpool);
+          t_fullpath = svn_fspath__join(t_path, t_entry->name, iterpool);
 
           SVN_ERR(update_entry(b, s_rev, s_fullpath, s_entry, t_fullpath,
                                t_entry, dir_baton, e_fullpath, NULL,
                                DEPTH_BELOW_HERE(wc_depth),
                                DEPTH_BELOW_HERE(requested_depth),
-                               subpool));
+                               iterpool));
         }
 
 
       /* Destroy iteration subpool. */
-      svn_pool_destroy(subpool);
+      svn_pool_destroy(iterpool);
     }
+
+  svn_pool_destroy(subpool);
+
   return SVN_NO_ERROR;
 }