[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Help with Issue #773 patch...

From: Justin Erenkrantz <jerenkrantz_at_apache.org>
Date: 2003-01-11 21:40:25 CET

For those that haven't been paying attention, I've been trying to
address Issue #773. It mainly has to do with large memory usage in
certain circumstances. Previously, we thought it had to do with
mod_dav/mod_dav_svn. I don't think that's the case anymore. We're
also seeing a similar problem when doing a 1,000 file update after a
commit using ra_local. (The memory culprits are almost identical.)

Anyway, the following patch takes a two-pronged approach:

- Reduce the memory usage within libsvn_fs as much as possible in the
functions that I saw. This reduces the memory footprint from ~548 MB
to ~155MB in the 1,000 file update case that Michael posted earlier.
This uses the trail_t->scratchpool pool which is cleared when the
transaction is completed or aborted. (trail_t->pool is never
cleared.)

- Add a temporary pool parameter to svn_repos_set_path. This takes
the prior memory usage from ~155MB to ~13MB for a 1,000 file update
case (my hunch is it is now close to constant memory usage in the
update case). The txn is still allocated in rbaton->pool, but the
rest of the temporary allocations are in the child subpool (cleared
after each file).

I haven't run 'make check' or am even certain that all of these
optimizations are safe, so I'm asking for assistance in finishing
this and getting it merged into the trunk. Hopefully, the
critical memory bottlenecks have been identified in this patch.
(If someone does want to help, hopefully, we can create a branch.)

I think we could just do the svn_repos_set_path component and get
some improvement, but the libsvn_fs code is, well, piggy when it
comes to memory allocations. So, I think we need to do iterative
subpool with svn_repos_set_path and try to shrink down the memory
usage in libsvn_fs. Getting it better than ~13MB doesn't sound like
it'll be worth the effort right now.

Anyway, I've spent way too much time on this lately, and I need to
set it aside for a little bit. It'd be great if someone could pick
it up and take it home. =) -- justin

Index: subversion/include/svn_repos.h
===================================================================
--- subversion/include/svn_repos.h (revision 4346)
+++ subversion/include/svn_repos.h (working copy)
@@ -176,7 +176,8 @@
    (useful when creating a txn, for example). */
 svn_error_t *svn_repos_set_path (void *report_baton,
                                  const char *path,
- svn_revnum_t revision);
+ svn_revnum_t revision,
+ apr_pool_t *pool);

 /* Given a REPORT_BATON constructed by svn_repos_begin_report(), this
Index: subversion/include/svn_ra.h
===================================================================
--- subversion/include/svn_ra.h (revision 4346)
+++ subversion/include/svn_ra.h (working copy)
@@ -132,7 +132,8 @@
    */
   svn_error_t *(*set_path) (void *report_baton,
                             const char *path,
- svn_revnum_t revision);
+ svn_revnum_t revision,
+ apr_pool_t *pool);

   /** Describing a working copy @a path as missing. */
   svn_error_t *(*delete_path) (void *report_baton,
Index: subversion/libsvn_fs/tree.c
===================================================================
--- subversion/libsvn_fs/tree.c (revision 4346)
+++ subversion/libsvn_fs/tree.c (working copy)
@@ -451,12 +451,12 @@
            trail_t *trail)
 {
   svn_fs_t *fs = root->fs;
- apr_pool_t *pool = trail->pool;
+ apr_pool_t *pool = trail->scratchpool;
   const svn_fs_id_t *id;
   dag_node_t *here; /* The directory we're currently looking at. */
   parent_path_t *parent_path; /* The path from HERE up to the root.
*/
   const char *rest; /* The portion of PATH we haven't traversed yet.
*/
- const char *canon_path = svn_fs__canonicalize_abspath (path,
trail->pool);
+ const char *canon_path = svn_fs__canonicalize_abspath (path, pool);

   /* Make a parent_path item for the root node, using its own current
      copy id. */
@@ -680,7 +680,7 @@
                    trail_t *trail)
 {
   dag_node_t *clone;
- const char *txn_id = svn_fs_txn_root_name (root, trail->pool);
+ const char *txn_id = svn_fs_txn_root_name (root,
trail->scratchpool);
   svn_fs_t *fs = svn_fs_root_fs (root);

   /* Is the node mutable already? */
@@ -791,7 +791,7 @@
             trail_t *trail)
 {
   svn_fs__change_t change;
- change.path = svn_fs__canonicalize_abspath (path, trail->pool);
+ change.path = svn_fs__canonicalize_abspath (path,
trail->scratchpool);
   change.noderev_id = noderev_id;
   change.kind = change_kind;
   change.text_mod = text_mod;
@@ -2446,7 +2446,6 @@
 
 /* Directories. */

-
 struct dir_entries_args
 {
   apr_hash_t **table_p;
@@ -2454,6 +2453,34 @@
   const char *path;
 };

+static apr_hash_t *
+copy_dir_entries_hash(apr_hash_t *entries, apr_pool_t *entries_pool,
+ apr_pool_t *pool)
+{
+ apr_hash_t *new_entries = apr_hash_make(pool);
+ apr_hash_index_t *hi;
+
+ for (hi = apr_hash_first(entries_pool, entries); hi;
+ hi = apr_hash_next(hi)) {
+ const svn_fs_dirent_t *entry;
+ svn_fs_dirent_t *new_entry;
+ const void *key;
+ void *value;
+ apr_ssize_t klen;
+
+ apr_hash_this(hi, &key, &klen, &value);
+ entry = (const svn_fs_dirent_t*)value;
+
+ new_entry = apr_palloc(pool, sizeof(svn_fs_dirent_t));
+ new_entry->name = apr_pstrmemdup(pool, entry->name, klen);
+ new_entry->id = svn_fs__id_copy(entry->id, pool);
+
+ apr_hash_set(new_entries, new_entry->name, klen, new_entry);
+ }
+
+ return new_entries;
+}
+

 static svn_error_t *
 txn_body_dir_entries (void *baton,
@@ -2469,7 +2496,13 @@
   SVN_ERR (svn_fs__dag_dir_entries (&entries, parent_path->node,
trail));

   /* Potentially initialize the return value to an empty hash. */
- *args->table_p = entries ? entries : apr_hash_make (trail->pool);
+ if (entries) {
+ *args->table_p = copy_dir_entries_hash(entries,
trail->scratchpool,
+ trail->pool);
+ }
+ else {
+ *args->table_p = apr_hash_make (trail->pool);
+ }
   return SVN_NO_ERROR;
 }

@@ -2690,7 +2723,7 @@
   if (svn_fs_is_revision_root (from_root))
     {
       svn_fs_path_change_kind_t kind;
- const char *txn_id = svn_fs_txn_root_name (to_root,
trail->pool);
+ const char *txn_id = svn_fs_txn_root_name (to_root,
trail->scratchpool);
       dag_node_t *new_node;

       /* If TO_PATH already existed prior to the copy, note that this
Index: subversion/libsvn_fs/reps-strings.c
===================================================================
--- subversion/libsvn_fs/reps-strings.c (revision 4346)
+++ subversion/libsvn_fs/reps-strings.c (working copy)
@@ -47,7 +47,7 @@

 /* The MD5 digest for the empty string. */
-static const char empty_digest[] = {
+static const unsigned char empty_digest[] = {
   212, 29, 140, 217, 143, 0, 178, 4, 233, 128, 9, 152, 236, 248, 66,
126
 };

@@ -729,7 +729,7 @@
   char *data;

   SVN_ERR (svn_fs__rep_contents_size (&(str->len), fs, rep_key,
trail));
- data = apr_palloc (trail->pool, str->len);
+ data = apr_palloc (trail->scratchpool, str->len);
   str->data = data;
   len = str->len;
   SVN_ERR (rep_read_range (fs, rep_key, 0, data, &len, trail));
@@ -757,8 +757,8 @@
          "svn_fs__rep_contents: checksum mismatch on rep \"%s\":\n"
          " expected: %s\n"
          " actual: %s\n", rep_key,
- svn_cstring_from_md5_digest (rep->checksum, trail->pool),
- svn_cstring_from_md5_digest (checksum, trail->pool));
+ svn_cstring_from_md5_digest (rep->checksum,
trail->scratchpool),
+ svn_cstring_from_md5_digest (checksum, trail->scratchpool));
   }

   return SVN_NO_ERROR;
Index: subversion/libsvn_fs/bdb/reps-table.c
===================================================================
--- subversion/libsvn_fs/bdb/reps-table.c (revision 4346)
+++ subversion/libsvn_fs/bdb/reps-table.c (working copy)
@@ -82,7 +82,7 @@
      svn_fs__str_to_dbt (&query, (char *) key),
      svn_fs__result_dbt (&result), 0);

- svn_fs__track_dbt (&result, trail->pool);
+ svn_fs__track_dbt (&result, trail->scratchpool);

   /* If there's no such node, return an appropriately specific
error. */
   if (db_err == DB_NOTFOUND)
@@ -94,10 +94,10 @@
   SVN_ERR (BDB_WRAP (fs, "reading representation", db_err));

   /* Parse the REPRESENTATION skel. */
- skel = svn_fs__parse_skel (result.data, result.size, trail->pool);
+ skel = svn_fs__parse_skel (result.data, result.size,
trail->scratchpool);

   /* Convert to a native type. */
- SVN_ERR (svn_fs__parse_representation_skel (rep_p, skel,
trail->pool));
+ SVN_ERR (svn_fs__parse_representation_skel (rep_p, skel,
trail->scratchpool));

   return SVN_NO_ERROR;
 }
@@ -113,14 +113,16 @@
   skel_t *skel;

   /* Convert from native type to skel. */
- SVN_ERR (svn_fs__unparse_representation_skel (&skel, rep,
trail->pool));
+ SVN_ERR (svn_fs__unparse_representation_skel (&skel, rep,
+ trail->scratchpool));

   /* Now write the record. */
   SVN_ERR (BDB_WRAP (fs, "storing representation",
                     fs->representations->put
                     (fs->representations, trail->db_txn,
                      svn_fs__str_to_dbt (&query, (char *) key),
- svn_fs__skel_to_dbt (&result, skel,
trail->pool), 0)));
+ svn_fs__skel_to_dbt (&result, skel,
+ trail->scratchpool), 0)));

   return SVN_NO_ERROR;
 }
@@ -149,10 +151,10 @@
                                               svn_fs__result_dbt
(&result),
                                               0)));

- svn_fs__track_dbt (&result, trail->pool);
+ svn_fs__track_dbt (&result, trail->scratchpool);

   /* Store the new rep. */
- *key = apr_pstrmemdup (trail->pool, result.data, result.size);
+ *key = apr_pstrmemdup (trail->scratchpool, result.data,
result.size);
   SVN_ERR (svn_fs__bdb_write_rep (fs, *key, rep, trail));

   /* Bump to future key. */
Index: subversion/libsvn_fs/bdb/copies-table.c
===================================================================
--- subversion/libsvn_fs/bdb/copies-table.c (revision 4346)
+++ subversion/libsvn_fs/bdb/copies-table.c (working copy)
@@ -74,12 +74,12 @@
   DBT key, value;

   /* Convert native type to skel. */
- SVN_ERR (svn_fs__unparse_copy_skel (&copy_skel, copy,
trail->pool));
+ SVN_ERR (svn_fs__unparse_copy_skel (&copy_skel, copy,
trail->scratchpool));

   /* Only in the context of this function do we know that the DB call
      will not attempt to modify COPY_ID, so the cast belongs here.
*/
   svn_fs__str_to_dbt (&key, (char *) copy_id);
- svn_fs__skel_to_dbt (&value, copy_skel, trail->pool);
+ svn_fs__skel_to_dbt (&value, copy_skel, trail->scratchpool);
   SVN_ERR (BDB_WRAP (fs, "storing copy record",
                     fs->copies->put (fs->copies, trail->db_txn,
                                      &key, &value, 0)));
@@ -106,10 +106,10 @@
                     fs->copies->get (fs->copies, trail->db_txn,
                                      &query, svn_fs__result_dbt
(&result),
                                      0)));
- svn_fs__track_dbt (&result, trail->pool);
+ svn_fs__track_dbt (&result, trail->scratchpool);

   /* Set our return value. */
- *id_p = apr_pstrmemdup (trail->pool, result.data, result.size);
+ *id_p = apr_pstrmemdup (trail->scratchpool, result.data,
result.size);

   /* Bump to future key. */
   len = result.size;
Index: subversion/libsvn_fs/bdb/changes-table.c
===================================================================
--- subversion/libsvn_fs/bdb/changes-table.c (revision 4346)
+++ subversion/libsvn_fs/bdb/changes-table.c (working copy)
@@ -73,11 +73,11 @@
   skel_t *skel;

   /* Convert native type to skel. */
- SVN_ERR (svn_fs__unparse_change_skel (&skel, change, trail->pool));
+ SVN_ERR (svn_fs__unparse_change_skel (&skel, change,
trail->scratchpool));

   /* Store a new record into the database. */
   svn_fs__str_to_dbt (&query, (char *) key);
- svn_fs__skel_to_dbt (&value, skel, trail->pool);
+ svn_fs__skel_to_dbt (&value, skel, trail->scratchpool);
   SVN_ERR (BDB_WRAP (fs, "creating change",
                     fs->changes->put (fs->changes, trail->db_txn,
                                       &query, &value, 0)));
Index: subversion/libsvn_fs/bdb/nodes-table.c
===================================================================
--- subversion/libsvn_fs/bdb/nodes-table.c (revision 4346)
+++ subversion/libsvn_fs/bdb/nodes-table.c (working copy)
@@ -98,7 +98,7 @@
   svn_fs__track_dbt (&result, trail->pool);

   /* Squirrel away our next node id value. */
- next_node_id = apr_pstrmemdup (trail->pool, result.data,
result.size);
+ next_node_id = apr_pstrmemdup (trail->scratchpool, result.data,
result.size);

   /* Bump to future key. */
   len = result.size;
@@ -134,14 +134,14 @@
   new_id = svn_fs__create_id (svn_fs__id_node_id (id),
                               copy_id ? copy_id : svn_fs__id_copy_id
(id),
                               txn_id,
- trail->pool);
+ trail->scratchpool);

   /* Now, make sure this NEW_ID doesn't already exist in FS. */
   err = svn_fs__bdb_get_node_revision (NULL, fs, new_id, trail);
   if ((! err) || (err->apr_err != SVN_ERR_FS_ID_NOT_FOUND))
     {
- svn_string_t *id_str = svn_fs_unparse_id (id, trail->pool);
- svn_string_t *new_id_str = svn_fs_unparse_id (new_id,
trail->pool);
+ svn_string_t *id_str = svn_fs_unparse_id (id,
trail->scratchpool);
+ svn_string_t *new_id_str = svn_fs_unparse_id (new_id,
trail->scratchpool);
       return svn_error_createf
         (SVN_ERR_FS_ALREADY_EXISTS, err,
          "successor id `%s' (for `%s') already exists in filesystem
%s",
@@ -190,10 +190,10 @@
   DBT key, value;

   db_err = fs->nodes->get (fs->nodes, trail->db_txn,
- svn_fs__id_to_dbt (&key, id, trail->pool),
+ svn_fs__id_to_dbt (&key, id,
trail->scratchpool),
                            svn_fs__result_dbt (&value),
                            0);
- svn_fs__track_dbt (&value, trail->pool);
+ svn_fs__track_dbt (&value, trail->scratchpool);

   /* If there's no such node, return an appropriately specific
error. */
   if (db_err == DB_NOTFOUND)
@@ -208,10 +208,11 @@
     return SVN_NO_ERROR;

   /* Parse and the NODE-REVISION skel. */
- skel = svn_fs__parse_skel (value.data, value.size, trail->pool);
+ skel = svn_fs__parse_skel (value.data, value.size,
trail->scratchpool);

   /* Convert to a native FS type. */
- SVN_ERR (svn_fs__parse_node_revision_skel (&noderev, skel,
trail->pool));
+ SVN_ERR (svn_fs__parse_node_revision_skel (&noderev, skel,
+ trail->scratchpool));
   *noderev_p = noderev;
   return SVN_NO_ERROR;
 }
@@ -224,7 +225,7 @@
                                trail_t *trail)
 {
   DB_TXN *db_txn = trail->db_txn;
- apr_pool_t *pool = trail->pool;
+ apr_pool_t *pool = trail->scratchpool;
   DBT key, value;
   skel_t *skel;

Index: subversion/libsvn_fs/trail.c
===================================================================
--- subversion/libsvn_fs/trail.c (revision 4346)
+++ subversion/libsvn_fs/trail.c (working copy)
@@ -158,7 +158,8 @@
              void *baton,
              int when)
 {
- struct undo *undo = apr_pcalloc (trail->pool, sizeof (*undo));
+ /* The undo structure is guaranteed to live as long as the
scratchpool. */
+ struct undo *undo = apr_pcalloc (trail->scratchpool, sizeof
(*undo));

   undo->when = when;
   undo->func = func;
Index: subversion/libsvn_fs/dag.c
===================================================================
--- subversion/libsvn_fs/dag.c (revision 4346)
+++ subversion/libsvn_fs/dag.c (working copy)
@@ -421,7 +421,7 @@
                  svn_fs__node_revision_t *noderev,
                  trail_t *trail)
 {
- apr_hash_t *entries = apr_hash_make (trail->pool);
+ apr_hash_t *entries = NULL;
   apr_hash_index_t *hi;
   svn_string_t entries_raw;
   skel_t *entries_skel;
@@ -439,12 +439,12 @@
       SVN_ERR (svn_fs__rep_contents (&entries_raw, fs,
                                      noderev->data_key, trail));
       entries_skel = svn_fs__parse_skel (entries_raw.data,
entries_raw.len,
- trail->pool);
+ trail->scratchpool);

       /* Were there entries? Make a hash from them. */
       if (entries_skel)
         SVN_ERR (svn_fs__parse_entries_skel (&entries, entries_skel,
- trail->pool));
+ trail->scratchpool));
     }

   /* No hash? No problem. */
@@ -453,22 +453,24 @@
     return SVN_NO_ERROR;

   /* Else, convert the hash from a name->id mapping to a
name->dirent one. */
- *entries_p = apr_hash_make (trail->pool);
- for (hi = apr_hash_first (trail->pool, entries); hi; hi =
apr_hash_next (hi))
+ for (hi = apr_hash_first (trail->scratchpool, entries); hi;
+ hi = apr_hash_next (hi))
     {
       const void *key;
       apr_ssize_t klen;
       void *val;
- svn_fs_dirent_t *dirent = apr_palloc (trail->pool, sizeof
(*dirent));
-
+ svn_fs_dirent_t *dirent = apr_palloc (trail->scratchpool,
+ sizeof (*dirent));
+
       /* KEY will be the entry name in ancestor, VAL the id. */
       apr_hash_this (hi, &key, &klen, &val);
       dirent->name = (char *) key;
       dirent->id = val;
- apr_hash_set (*entries_p, key, klen, (void *) dirent);
+ apr_hash_set (entries, key, klen, (void *) dirent);
     }

   /* Return our findings. */
+ *entries_p = entries;
   return SVN_NO_ERROR;
 }

@@ -487,8 +489,16 @@
   svn_fs_dirent_t *dirent;

   SVN_ERR (svn_fs__dag_dir_entries (&entries, parent, trail));
- if (entries)
+ if (entries) {
     dirent = apr_hash_get (entries, name, APR_HASH_KEY_STRING);
+ if (dirent) {
+ svn_fs_dirent_t *local_dirent;
+ local_dirent = apr_palloc(trail->pool,
sizeof(svn_fs_dirent_t));
+ local_dirent->name = apr_pstrdup(trail->pool, dirent->name);
+ local_dirent->id = svn_fs__id_copy(dirent->id, trail->pool);
+ dirent = local_dirent;
+ }
+ }
   else
     dirent = NULL;

@@ -697,7 +707,7 @@
   SVN_ERR (svn_fs__rep_contents (&raw_proplist, svn_fs__dag_get_fs
(node),
                                  noderev->prop_key, trail));
   proplist_skel = svn_fs__parse_skel (raw_proplist.data,
raw_proplist.len,
- trail->pool);
+ trail->scratchpool);
   if (proplist_skel)
     SVN_ERR (svn_fs__parse_proplist_skel (&proplist, proplist_skel,
                                           trail->pool));
@@ -1461,14 +1471,14 @@

       /* Make a copy of the original node revision. */
       SVN_ERR (get_node_revision (&from_noderev, from_node, trail));
- to_noderev = copy_node_revision (from_noderev, trail->pool);
+ to_noderev = copy_node_revision (from_noderev,
trail->scratchpool);

       /* Reserve a copy ID for this new copy. */
       SVN_ERR (svn_fs__bdb_reserve_copy_id (&copy_id, fs, trail));

       /* Create a successor with its predecessor pointing at the copy
          source. */
- to_noderev->predecessor_id = svn_fs__id_copy (src_id,
trail->pool);
+ to_noderev->predecessor_id = svn_fs__id_copy (src_id,
trail->scratchpool);
       if (to_noderev->predecessor_count != -1)
         to_noderev->predecessor_count++;
       SVN_ERR (svn_fs__create_successor (&id, fs, src_id, to_noderev,
@@ -1482,7 +1492,7 @@
          reserved above. */
       SVN_ERR (svn_fs__bdb_create_copy
                (copy_id, fs,
- svn_fs__canonicalize_abspath (from_path,
trail->pool),
+ svn_fs__canonicalize_abspath (from_path,
trail->scratchpool),
                 from_txn_id, id, trail));

       /* Finally, add the COPY_ID to the transaction's list of copies
Index: subversion/libsvn_fs/util/fs_skels.c
===================================================================
--- subversion/libsvn_fs/util/fs_skels.c (revision 4346)
+++ subversion/libsvn_fs/util/fs_skels.c (working copy)
@@ -520,6 +520,7 @@
           chunk = apr_palloc (pool, sizeof (*chunk));

           /* Populate the window */
+ /* XXX: These apr_pstrmemdup's are probably superfluous. */
           chunk->version
             = (apr_byte_t) atoi (apr_pstrmemdup
                                  (pool,
Index: subversion/libsvn_wc/adm_crawler.c
===================================================================
--- subversion/libsvn_wc/adm_crawler.c (revision 4346)
+++ subversion/libsvn_wc/adm_crawler.c (working copy)
@@ -128,7 +131,7 @@
 {
   apr_hash_t *entries, *dirents;
   apr_hash_index_t *hi;
- apr_pool_t *subpool = svn_pool_create (pool);
+ apr_pool_t *subpool = svn_pool_create (pool), *child_subpool;
   const svn_wc_entry_t *dot_entry;
   const char *this_url, *this_path, *this_full_path;
   svn_wc_adm_access_t *dir_access;
@@ -177,6 +180,8 @@
     }

   /* Looping over current directory's SVN entries: */
+ child_subpool = svn_pool_create(subpool);
+
   for (hi = apr_hash_first (subpool, entries); hi; hi =
apr_hash_next (hi))
     {
       const void *key;
@@ -201,14 +206,18 @@
            It needs a more thorough rewrite, but for now we paper it
            over with a terrifyingly ugly kluge. */

- svn_stringbuf_t *this_path_s = svn_stringbuf_create
(this_path, pool);
- svn_stringbuf_t *dir_path_s = svn_stringbuf_create
(dir_path, pool);
- svn_stringbuf_t *full_path_s = svn_stringbuf_create
(full_path, pool);
+ svn_stringbuf_t *this_path_s = svn_stringbuf_create
(this_path,
+
child_subpool);
+ svn_stringbuf_t *dir_path_s = svn_stringbuf_create (dir_path,
+
child_subpool);
+ svn_stringbuf_t *full_path_s = svn_stringbuf_create
(full_path,
+
child_subpool);
         svn_stringbuf_t *this_full_path_s
- = svn_stringbuf_create (this_full_path, pool);
- svn_stringbuf_t *this_url_s = svn_stringbuf_create
(this_url, pool);
+ = svn_stringbuf_create (this_full_path, child_subpool);
+ svn_stringbuf_t *this_url_s = svn_stringbuf_create (this_url,
+
child_subpool);
         svn_stringbuf_t *dot_entry_url_s
- = svn_stringbuf_create (dot_entry->url, pool);
+ = svn_stringbuf_create (dot_entry->url, child_subpool);

         if (this_path_s->len > dir_path_s->len)
           svn_stringbuf_chop (this_path_s, this_path_s->len -
dir_path_s->len);
@@ -221,7 +230,7 @@
         svn_path_add_component (this_path_s, key);
         svn_path_add_component (this_full_path_s, key);
         svn_path_add_component (this_url_s,
- svn_path_uri_encode (key, pool));
+ svn_path_uri_encode (key,
child_subpool));

         this_path = this_path_s->data;
         this_full_path = this_full_path_s->data;
@@ -264,7 +273,8 @@
               && (current_entry->schedule !=
svn_wc_schedule_replace))
             {
               /* Recreate file from text-base. */
- SVN_ERR (restore_file (this_full_path, dir_access,
pool));
+ SVN_ERR (restore_file (this_full_path, dir_access,
+ child_subpool));

               /* Report the restoration to the caller. */
               if (notify_func != NULL)
@@ -291,7 +301,8 @@
           else if (current_entry->revision != dir_rev)
             SVN_ERR (reporter->set_path (report_baton,
                                          this_path,
- current_entry->revision));
+ current_entry->revision,
+ child_subpool));
         }

       else if (current_entry->kind == svn_node_dir && recurse)
@@ -322,9 +333,9 @@
           /* We need to read the full entry of the directory from its
              own "this dir", if available. */
           SVN_ERR (svn_wc_adm_retrieve (&subdir_access, adm_access,
- this_full_path, subpool));
+ this_full_path,
child_subpool));
           SVN_ERR (svn_wc_entry (&subdir_entry, this_full_path,
subdir_access,
- TRUE, subpool));
+ TRUE, child_subpool));

           /* Possibly report a disjoint URL... */
           if (strcmp (subdir_entry->url, this_url) != 0)
@@ -336,7 +347,8 @@
           else if (subdir_entry->revision != dir_rev)
             SVN_ERR (reporter->set_path (report_baton,
                                          this_path,
- subdir_entry->revision));
+ subdir_entry->revision,
+ child_subpool));

           /* Recurse. */
           SVN_ERR (report_revisions (adm_access, this_path,
@@ -345,9 +357,10 @@
                                      notify_func, notify_baton,
                                      restore_files, recurse,
                                      traversal_info,
- subpool));
+ child_subpool));
         } /* end directory case */

+ svn_pool_clear (child_subpool);
     } /* end main entries loop */

   /* We're done examining this dir's entries, so free everything. */
@@ -398,7 +411,7 @@
   /* The first call to the reporter merely informs it that the
      top-level directory being updated is at BASE_REV. Its PATH
      argument is ignored. */
- SVN_ERR (reporter->set_path (report_baton, "", base_rev));
+ SVN_ERR (reporter->set_path (report_baton, "", base_rev, pool));

   if (entry->schedule != svn_wc_schedule_delete)
     {
@@ -489,7 +502,7 @@
              of the report (not some file in a subdirectory of a
target
              directory), and that target is a file, we need to pass
an
              empty string to set_path. */
- err = reporter->set_path (report_baton, "", base_rev);
+ err = reporter->set_path (report_baton, "", base_rev,
pool);
           if (err)
             goto abort_report;
         }
Index: subversion/libsvn_ra_local/ra_plugin.c
===================================================================
--- subversion/libsvn_ra_local/ra_plugin.c (revision 4346)
+++ subversion/libsvn_ra_local/ra_plugin.c (working copy)
@@ -120,10 +120,11 @@
 static svn_error_t *
 reporter_set_path (void *reporter_baton,
                    const char *path,
- svn_revnum_t revision)
+ svn_revnum_t revision,
+ apr_pool_t *pool)
 {
   reporter_baton_t *rbaton = reporter_baton;
- return svn_repos_set_path (rbaton->report_baton, path, revision);
+ return svn_repos_set_path (rbaton->report_baton, path, revision,
pool);
 }

Index: subversion/libsvn_client/diff.c
===================================================================
--- subversion/libsvn_client/diff.c (revision 4346)
+++ subversion/libsvn_client/diff.c (working copy)
@@ -767,7 +767,7 @@
                             URL2,
                             diff_editor, diff_edit_baton));

- SVN_ERR (reporter->set_path (report_baton, "", start_revnum));
+ SVN_ERR (reporter->set_path (report_baton, "", start_revnum,
pool));

   SVN_ERR (reporter->finish_report (report_baton));

@@ -1219,7 +1219,7 @@
                                 URL2,
                                 diff_editor, diff_edit_baton));

- SVN_ERR (reporter->set_path (report_baton, "", start_revnum));
+ SVN_ERR (reporter->set_path (report_baton, "", start_revnum,
pool));
       SVN_ERR (reporter->finish_report (report_baton));

       SVN_ERR (ra_lib->close (session2));
Index: subversion/mod_dav_svn/update.c
===================================================================
--- subversion/mod_dav_svn/update.c (revision 4346)
+++ subversion/mod_dav_svn/update.c (working copy)
@@ -748,7 +748,7 @@
             path = dav_xml_get_cdata(child, resource->pool, 1);

             if (! linkpath)
- serr = svn_repos_set_path(rbaton, path, rev);
+ serr = svn_repos_set_path(rbaton, path, rev,
resource->pool);
             else
               serr = svn_repos_link_path(rbaton, path, linkpath,
rev);
             if (serr != NULL)
Index: subversion/libsvn_repos/reporter.c
===================================================================
--- subversion/libsvn_repos/reporter.c (revision 4346)
+++ subversion/libsvn_repos/reporter.c (working copy)
@@ -146,7 +146,8 @@
 svn_error_t *
 svn_repos_set_path (void *report_baton,
                     const char *path,
- svn_revnum_t revision)
+ svn_revnum_t revision,
+ apr_pool_t *pool)
 {
   svn_repos_report_baton_t *rbaton = report_baton;
   svn_revnum_t *rev_ptr = apr_palloc (rbaton->pool, sizeof
(*rev_ptr));
@@ -186,7 +187,7 @@
          reported) + path (stuff relative to the target...this is the
          empty string in the file case since the target is the file
          itself, not a directory containing the file). */
- from_path = svn_path_join_many (rbaton->pool,
+ from_path = svn_path_join_many (pool,
                                       rbaton->base_path,
                                       rbaton->target ?
rbaton->target : path,
                                       rbaton->target ? path : NULL,
@@ -196,19 +197,19 @@
          which case we'll be linking from somewhere entirely
          different. */
       link_path = get_from_path_map (rbaton->linked_paths,
from_path,
- rbaton->pool);
+ pool);

       /* Create the "from" root. */
       SVN_ERR (svn_fs_revision_root (&from_root, rbaton->repos->fs,
- revision, rbaton->pool));
+ revision, pool));

       /* Copy into our txn (use svn_fs_revision_link if we can). */
       if (strcmp (link_path, from_path))
         SVN_ERR (svn_fs_copy (from_root, link_path,
- rbaton->txn_root, from_path,
rbaton->pool));
+ rbaton->txn_root, from_path, pool));
       else
         SVN_ERR (svn_fs_revision_link (from_root, rbaton->txn_root,
- from_path, rbaton->pool));
+ from_path, pool));
     }

   return SVN_NO_ERROR;
Index: subversion/svnserve/serve.c
===================================================================
--- subversion/svnserve/serve.c (revision 4346)
+++ subversion/svnserve/serve.c (working copy)
@@ -75,7 +75,7 @@
   svn_revnum_t rev;

   SVN_ERR(svn_ra_svn_parse_tuple(params, pool, "cr", &path, &rev));
- SVN_CMD_ERR(svn_repos_set_path(b->report_baton, path, rev));
+ SVN_CMD_ERR(svn_repos_set_path(b->report_baton, path, rev, pool));
   SVN_ERR(svn_ra_svn_write_cmd_response(conn, pool, ""));
   return SVN_NO_ERROR;
 }

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jan 11 21:41:15 2003

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.