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 2013/08/20 06:00:54 UTC

svn commit: r1515702 - in /subversion/branches/1.8.x: ./ STATUS subversion/libsvn_ra_serf/replay.c

Author: svn-role
Date: Tue Aug 20 04:00:53 2013
New Revision: 1515702

URL: http://svn.apache.org/r1515702
Log:
Merge the 1.8.x-svnsync-serf-memory branch:

 * ^/subversion/branches/1.8.x-svnsync-serf-memory
   ra_serf: Fix high memory usage running svnsync.
   Branch: ^/subversion/branches/1.8.x-svnsync-serf-memory
   Justification:
     Causes svnsync to fail due to excessive memory usage.
   Notes:
     Fixed directly on 1.8.x since the switch to transition based parser solved
     this there.  See r1515249 and r1515269 on branch for the specific changes.
   Votes:
     +1: breser, philip, stefan2

Modified:
    subversion/branches/1.8.x/   (props changed)
    subversion/branches/1.8.x/STATUS
    subversion/branches/1.8.x/subversion/libsvn_ra_serf/replay.c

Propchange: subversion/branches/1.8.x/
------------------------------------------------------------------------------
  Merged /subversion/branches/1.8.x-synvsync-serf-memory:r1515247
  Merged /subversion/branches/1.8.x-svnsync-serf-memory:r1515248-1515701

Modified: subversion/branches/1.8.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/STATUS?rev=1515702&r1=1515701&r2=1515702&view=diff
==============================================================================
--- subversion/branches/1.8.x/STATUS (original)
+++ subversion/branches/1.8.x/STATUS Tue Aug 20 04:00:53 2013
@@ -220,17 +220,6 @@ Veto-blocked changes:
 Approved changes:
 =================
 
- * ^/subversion/branches/1.8.x-svnsync-serf-memory
-   ra_serf: Fix high memory usage running svnsync.
-   Branch: ^/subversion/branches/1.8.x-svnsync-serf-memory
-   Justification:
-     Causes svnsync to fail due to excessive memory usage.
-   Notes:
-     Fixed directly on 1.8.x since the switch to transition based parser solved
-     this there.  See r1515249 and r1515269 on branch for the specific changes.
-   Votes:
-     +1: breser, philip, stefan2
-
  * r1512432, r1512471, r1512472, r1513463, r1513472
    mod_dav_svn: No longer map requests to the filesystem.
    Justification:

Modified: subversion/branches/1.8.x/subversion/libsvn_ra_serf/replay.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.8.x/subversion/libsvn_ra_serf/replay.c?rev=1515702&r1=1515701&r2=1515702&view=diff
==============================================================================
--- subversion/branches/1.8.x/subversion/libsvn_ra_serf/replay.c (original)
+++ subversion/branches/1.8.x/subversion/libsvn_ra_serf/replay.c Tue Aug 20 04:00:53 2013
@@ -90,8 +90,6 @@ typedef struct prop_info_t {
 typedef struct replay_context_t {
   apr_pool_t *src_rev_pool;
   apr_pool_t *dst_rev_pool;
-  /*file_pool is cleared after completion of each file. */
-  apr_pool_t *file_pool;
 
   /* Are we done fetching this file? */
   svn_boolean_t done;
@@ -147,10 +145,11 @@ push_state(svn_ra_serf__xml_parser_t *pa
       state == OPEN_FILE || state == ADD_FILE)
     {
       replay_info_t *info;
+      apr_pool_t *pool = svn_pool_create(replay_ctx->dst_rev_pool);
 
-      info = apr_palloc(replay_ctx->dst_rev_pool, sizeof(*info));
+      info = apr_palloc(pool, sizeof(*info));
 
-      info->pool = replay_ctx->dst_rev_pool;
+      info->pool = pool;
       info->parent = parser->state->private;
       info->baton = NULL;
       info->stream = NULL;
@@ -160,12 +159,13 @@ push_state(svn_ra_serf__xml_parser_t *pa
   else if (state == CHANGE_PROP)
     {
       prop_info_t *info;
+      apr_pool_t *pool = svn_pool_create(replay_ctx->dst_rev_pool);
 
-      info = apr_pcalloc(replay_ctx->dst_rev_pool, sizeof(*info));
+      info = apr_pcalloc(pool, sizeof(*info));
 
-      info->pool = replay_ctx->dst_rev_pool;
+      info->pool = pool;
       info->parent = parser->state->private;
-      info->prop_value = svn_stringbuf_create_empty(info->pool);
+      info->prop_value = svn_stringbuf_create_empty(pool);
 
       parser->state->private = info;
     }
@@ -194,7 +194,6 @@ start_replay(svn_ra_serf__xml_parser_t *
 
       /* Create a pool for the commit editor. */
       ctx->dst_rev_pool = svn_pool_create(ctx->src_rev_pool);
-      ctx->file_pool = svn_pool_create(ctx->dst_rev_pool);
 
       SVN_ERR(svn_ra_serf__select_revprops(&ctx->props,
                                            ctx->revprop_target,
@@ -334,6 +333,8 @@ start_replay(svn_ra_serf__xml_parser_t *
       SVN_ERR(ctx->editor->close_directory(info->baton, scratch_pool));
 
       svn_ra_serf__xml_pop_state(parser);
+
+      svn_pool_destroy(info->pool);
     }
   else if ((state == OPEN_DIR || state == ADD_DIR) &&
            strcmp(name.name, "open-file") == 0)
@@ -341,7 +342,6 @@ start_replay(svn_ra_serf__xml_parser_t *
       const char *file_name, *rev;
       replay_info_t *info;
 
-      svn_pool_clear(ctx->file_pool);
       file_name = svn_xml_get_attr_value("name", attrs);
       if (!file_name)
         {
@@ -359,7 +359,7 @@ start_replay(svn_ra_serf__xml_parser_t *
 
       SVN_ERR(ctx->editor->open_file(file_name, info->parent->baton,
                                      SVN_STR_TO_REV(rev),
-                                     ctx->file_pool, &info->baton));
+                                     info->pool, &info->baton));
     }
   else if ((state == OPEN_DIR || state == ADD_DIR) &&
            strcmp(name.name, "add-file") == 0)
@@ -368,7 +368,6 @@ start_replay(svn_ra_serf__xml_parser_t *
       svn_revnum_t rev;
       replay_info_t *info;
 
-      svn_pool_clear(ctx->file_pool);
       file_name = svn_xml_get_attr_value("name", attrs);
       if (!file_name)
         {
@@ -387,7 +386,7 @@ start_replay(svn_ra_serf__xml_parser_t *
 
       SVN_ERR(ctx->editor->add_file(file_name, info->parent->baton,
                                     copyfrom, rev,
-                                    ctx->file_pool, &info->baton));
+                                    info->pool, &info->baton));
     }
   else if ((state == OPEN_FILE || state == ADD_FILE) &&
            strcmp(name.name, "apply-textdelta") == 0)
@@ -407,7 +406,7 @@ start_replay(svn_ra_serf__xml_parser_t *
         }
 
       SVN_ERR(ctx->editor->apply_textdelta(info->baton, checksum,
-                                           ctx->file_pool,
+                                           info->pool,
                                            &textdelta,
                                            &textdelta_baton));
 
@@ -426,6 +425,8 @@ start_replay(svn_ra_serf__xml_parser_t *
       SVN_ERR(ctx->editor->close_file(info->baton, checksum, scratch_pool));
 
       svn_ra_serf__xml_pop_state(parser);
+
+      svn_pool_destroy(info->pool);
     }
   else if (((state == OPEN_FILE || state == ADD_FILE) &&
             strcmp(name.name, "change-file-prop") == 0) ||
@@ -451,14 +452,13 @@ start_replay(svn_ra_serf__xml_parser_t *
       else
         info->del_prop = FALSE;
 
+      info->name = apr_pstrdup(info->pool, prop_name);
       if (state == OPEN_FILE || state == ADD_FILE)
         {
-          info->name = apr_pstrdup(ctx->file_pool, prop_name);
           info->change = ctx->editor->change_file_prop;
         }
       else
         {
-          info->name = apr_pstrdup(ctx->dst_rev_pool, prop_name);
           info->change = ctx->editor->change_dir_prop;
         }
 
@@ -538,15 +538,14 @@ end_replay(svn_ra_serf__xml_parser_t *pa
           info->prop_value = NULL;  /* morph killed the stringbuf.  */
 #endif
 
-          if (strcmp(name.name, "change-file-prop") == 0)
-            prop_val = svn_base64_decode_string(morph, ctx->file_pool);
-          else
-            prop_val = svn_base64_decode_string(morph, ctx->dst_rev_pool);
+          prop_val = svn_base64_decode_string(morph, info->pool);
         }
 
       SVN_ERR(info->change(info->parent->baton, info->name, prop_val,
                            info->parent->pool));
       svn_ra_serf__xml_pop_state(parser);
+
+      svn_pool_destroy(info->pool);
     }
 
   return SVN_NO_ERROR;