subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@apache.org
Subject svn commit: r1533816 - in /subversion/branches/log-addressing/subversion/libsvn_fs_fs: cached_data.c index.c pack.c recovery.c revprops.c verify.c
Date Sat, 19 Oct 2013 20:09:38 GMT
Author: stefan2
Date: Sat Oct 19 20:09:38 2013
New Revision: 1533816

URL: http://svn.apache.org/r1533816
Log:
On the log-addressing branch:
Use / clean iterpools consistent with our standard pool usage pattern.

* subversion/libsvn_fs_fs/cached_data.c
  (block_read): clean iterpool at loop start

* subversion/libsvn_fs_fs/index.c
  (svn_fs_fs__l2p_index_create,
   prefetch_l2p_pages,
   l2p_index_lookup,
   svn_fs_fs__p2l_index_create,
   p2l_index_lookup): ditto

* subversion/libsvn_fs_fs/recovery.c
  (recover_get_largest_revision): same here, ...

* subversion/libsvn_fs_fs/revprops.c
  (svn_fs_fs__upgrade_pack_revprops,
   parse_packed_revprops,
   read_pack_revprop,
   switch_to_new_revprop,
   serialize_revprops_header,
   svn_fs_fs__delete_revprops_shard): ... here, ...

* subversion/libsvn_fs_fs/verify.c
  (compare_l2p_to_p2l_index,
   compare_p2l_to_l2p_index,
   compare_p2l_to_rev,
   verify_index_consistency): ... here, ...

* subversion/libsvn_fs_fs/pack.c
  (pack_range,
   append_revision,
   pack_log_addressed): ... and here
  (store_items,
   copy_reps_from_temp): clean iterpool after initial skip check

Modified:
    subversion/branches/log-addressing/subversion/libsvn_fs_fs/cached_data.c
    subversion/branches/log-addressing/subversion/libsvn_fs_fs/index.c
    subversion/branches/log-addressing/subversion/libsvn_fs_fs/pack.c
    subversion/branches/log-addressing/subversion/libsvn_fs_fs/recovery.c
    subversion/branches/log-addressing/subversion/libsvn_fs_fs/revprops.c
    subversion/branches/log-addressing/subversion/libsvn_fs_fs/verify.c

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/cached_data.c?rev=1533816&r1=1533815&r2=1533816&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/cached_data.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/cached_data.c Sat Oct 19 20:09:38
2013
@@ -2632,6 +2632,8 @@ block_read(void **result,
           svn_boolean_t is_result;
           apr_pool_t *pool;
 
+          svn_pool_clear(iterpool);
+
           svn_fs_fs__p2l_entry_t* entry
             = &APR_ARRAY_IDX(entries, i, svn_fs_fs__p2l_entry_t);
 
@@ -2692,8 +2694,6 @@ block_read(void **result,
               offset = entry->offset + entry->size;
               if (offset > block_start + ffd->block_size)
                 ++run_count;
-
-              svn_pool_clear(iterpool);
             }
         }
 

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/index.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/index.c?rev=1533816&r1=1533815&r2=1533816&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/index.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/index.c Sat Oct 19 20:09:38
2013
@@ -597,16 +597,16 @@ svn_fs_fs__l2p_index_create(svn_fs_t *fs
             {
               /* 1 page with up to 8k entries */
               apr_size_t last_buffer_size = svn_spillbuf__get_size(buffer);
-              entry_count = MIN(entries->nelts - i, ffd->l2p_page_size);
 
+              svn_pool_clear(iterpool);
+
+              entry_count = MIN(entries->nelts - i, ffd->l2p_page_size);
               SVN_ERR(encode_l2p_page(entries, i, i + entry_count,
                                       buffer, iterpool));
 
               APR_ARRAY_PUSH(entry_counts, apr_uint64_t) = entry_count;
               APR_ARRAY_PUSH(page_sizes, apr_uint64_t)
                 = svn_spillbuf__get_size(buffer) - last_buffer_size;
-
-              svn_pool_clear(iterpool);
             }
 
           apr_array_clear(entries);
@@ -1121,6 +1121,8 @@ prefetch_l2p_pages(svn_boolean_t *end,
     {
       l2p_page_table_entry_t *entry
         = &APR_ARRAY_IDX(pages, i, l2p_page_table_entry_t);
+      svn_pool_clear(iterpool);
+
       if (i == exlcuded_page_no)
         continue;
 
@@ -1147,8 +1149,6 @@ prefetch_l2p_pages(svn_boolean_t *end,
           SVN_ERR(svn_cache__set(ffd->l2p_page_cache, &key, page,
                                  iterpool));
         }
-
-      svn_pool_clear(iterpool);
     }
 
   svn_pool_destroy(iterpool);
@@ -1290,12 +1290,13 @@ l2p_index_lookup(apr_off_t *offset,
           int excluded_page_no = prefetch_revision == revision
                                ? info_baton.page_no
                                : -1;
+          svn_pool_clear(iterpool);
+
           SVN_ERR(prefetch_l2p_pages(&end, fs, rev_file,
                                      info_baton.first_revision,
                                      prefetch_revision, pages,
                                      excluded_page_no, min_offset,
                                      max_offset, iterpool));
-          svn_pool_clear(iterpool);
         }
 
       end = FALSE;
@@ -1303,11 +1304,12 @@ l2p_index_lookup(apr_off_t *offset,
            prefetch_revision >= info_baton.first_revision && !end;
            --prefetch_revision)
         {
+          svn_pool_clear(iterpool);
+
           SVN_ERR(prefetch_l2p_pages(&end, fs, rev_file,
                                      info_baton.first_revision,
                                      prefetch_revision, pages, -1,
                                      min_offset, max_offset, iterpool));
-          svn_pool_clear(iterpool);
         }
 
       svn_pool_destroy(iterpool);
@@ -1584,6 +1586,8 @@ svn_fs_fs__p2l_index_create(svn_fs_t *fs
       apr_uint64_t compound;
       apr_int64_t rev_diff, compound_diff;
 
+      svn_pool_clear(iter_pool);
+
       /* (attempt to) read the next entry from the source */
       SVN_ERR(svn_io_file_read_full2(proto_index, &entry, sizeof(entry),
                                      &read, &eof, iter_pool));
@@ -1653,10 +1657,8 @@ svn_fs_fs__p2l_index_create(svn_fs_t *fs
       SVN_ERR(svn_spillbuf__write(buffer, (const char *)encoded,
                                   encode_uint(encoded, entry.fnv1_checksum),
                                   iter_pool));
-     
-      last_entry_end = entry_end;
 
-      svn_pool_clear(iter_pool);
+      last_entry_end = entry_end;
     }
 
   /* store length of last table */
@@ -2210,11 +2212,12 @@ p2l_index_lookup(apr_array_header_t **en
       prefetch_info.offset = original_page_start;
       while (prefetch_info.offset >= prefetch_info.page_size && !end)
         {
+          svn_pool_clear(iterpool);
+
           prefetch_info.offset -= prefetch_info.page_size;
           SVN_ERR(prefetch_p2l_page(&end, &leaking_bucket, fs, rev_file,
                                     &prefetch_info, min_offset,
                                     iterpool));
-          svn_pool_clear(iterpool);
         }
 
       /* fetch page from disk and put it into the cache */
@@ -2236,11 +2239,12 @@ p2l_index_lookup(apr_array_header_t **en
              && prefetch_info.page_no + 1 < prefetch_info.page_count
              && !end)
         {
+          svn_pool_clear(iterpool);
+
           prefetch_info.offset += prefetch_info.page_size;
           SVN_ERR(prefetch_p2l_page(&end, &leaking_bucket, fs, rev_file,
                                     &prefetch_info, min_offset,
                                     iterpool));
-          svn_pool_clear(iterpool);
         }
 
       svn_pool_destroy(iterpool);

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/pack.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/pack.c?rev=1533816&r1=1533815&r2=1533816&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/pack.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/pack.c Sat Oct 19 20:09:38
2013
@@ -874,6 +874,8 @@ store_items(pack_context_t *context,
       if (entry->type == SVN_FS_FS__ITEM_TYPE_UNUSED)
         continue;
 
+      svn_pool_clear(iterpool);
+
       /* If the next item does not fit into the current block, auto-pad it.
          Take special care of textual noderevs since their parsers may
          prefetch up to 80 bytes and we don't want them to cross block
@@ -898,7 +900,6 @@ store_items(pack_context_t *context,
                   (context->proto_p2l_index, entry, iterpool));
 
       APR_ARRAY_PUSH(context->reps, svn_fs_fs__p2l_entry_t *) = entry;
-      svn_pool_clear(iterpool);
     }
 
   svn_pool_destroy(iterpool);
@@ -1034,6 +1035,8 @@ copy_reps_from_temp(pack_context_t *cont
       if (APR_ARRAY_IDX(path_order, i, path_order_t *) == NULL)
         continue;
 
+      svn_pool_clear(iterpool);
+
       /* Collect reps to combine and all noderevs referencing them */
       SVN_ERR(select_reps(context, i, node_parts, rep_parts));
 
@@ -1044,8 +1047,6 @@ copy_reps_from_temp(pack_context_t *cont
       /* processed all items */
       apr_array_clear(node_parts);
       apr_array_clear(rep_parts);
-
-      svn_pool_clear(iterpool);
     }
 
   svn_pool_destroy(iterpool);
@@ -1145,12 +1146,14 @@ pack_range(pack_context_t *context,
       apr_off_t offset = 0;
       apr_finfo_t finfo;
       svn_fs_fs__revision_file_t *rev_file;
+      const char *path;
+
+      svn_pool_clear(revpool);
 
       /* Get the size of the file. */
-      const char *path = svn_dirent_join(context->shard_dir,
-                                         apr_psprintf(revpool, "%ld",
-                                                      revision),
-                                         revpool);
+      path = svn_dirent_join(context->shard_dir,
+                             apr_psprintf(revpool, "%ld", revision),
+                             revpool);
       SVN_ERR(svn_io_stat(&finfo, path, APR_FINFO_SIZE, revpool));
       SVN_ERR(svn_fs_fs__open_pack_or_rev_file(&rev_file, context->fs,
                                                revision, revpool));
@@ -1174,6 +1177,8 @@ pack_range(pack_context_t *context,
               svn_fs_fs__p2l_entry_t *entry
                 = &APR_ARRAY_IDX(entries, i, svn_fs_fs__p2l_entry_t);
 
+              svn_pool_clear(iterpool);
+
               /* skip first entry if that was duplicated due crossing a
                  cluster boundary */
               if (offset > entry->offset)
@@ -1220,11 +1225,7 @@ pack_range(pack_context_t *context,
 
           if (context->cancel_func)
             SVN_ERR(context->cancel_func(context->cancel_baton));
-
-          svn_pool_clear(iterpool);
         }
-
-      svn_pool_clear(revpool);
     }
 
   svn_pool_destroy(iterpool);
@@ -1296,6 +1297,8 @@ append_revision(pack_context_t *context,
       /* read one cluster */
       int i;
       apr_array_header_t *entries;
+
+      svn_pool_clear(iterpool);
       SVN_ERR(svn_fs_fs__p2l_index_lookup(&entries, context->fs, rev_file,
                                           context->start_rev, offset,
                                           iterpool));
@@ -1323,8 +1326,6 @@ append_revision(pack_context_t *context,
                         (context->proto_p2l_index, entry, iterpool));
             }
         }
-
-      svn_pool_clear(iterpool);
     }
 
   svn_pool_destroy(iterpool);
@@ -1386,6 +1387,8 @@ pack_log_addressed(svn_fs_t *fs,
       }
     else
       {
+        svn_pool_clear(iterpool);
+
         /* some unpacked revisions before this one? */
         if (context.start_rev < context.end_rev)
           {
@@ -1407,8 +1410,6 @@ pack_log_addressed(svn_fs_t *fs,
           }
         else
           item_count += (apr_size_t)APR_ARRAY_IDX(max_ids, i, apr_uint64_t);
-
-        svn_pool_clear(iterpool);
       }
 
   /* non-empty revision range at the end? */

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/recovery.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/recovery.c?rev=1533816&r1=1533815&r2=1533816&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/recovery.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/recovery.c Sat Oct 19 20:09:38
2013
@@ -55,10 +55,9 @@ recover_get_largest_revision(svn_fs_t *f
     {
       svn_error_t *err;
       svn_fs_fs__revision_file_t *file;
-
-      err = svn_fs_fs__open_pack_or_rev_file(&file, fs, right, iterpool);
       svn_pool_clear(iterpool);
 
+      err = svn_fs_fs__open_pack_or_rev_file(&file, fs, right, iterpool);
       if (err && err->apr_err == SVN_ERR_FS_NO_SUCH_REVISION)
         {
           svn_error_clear(err);
@@ -79,10 +78,9 @@ recover_get_largest_revision(svn_fs_t *f
       svn_revnum_t probe = left + ((right - left) / 2);
       svn_error_t *err;
       svn_fs_fs__revision_file_t *file;
-
-      err = svn_fs_fs__open_pack_or_rev_file(&file, fs, probe, iterpool);
       svn_pool_clear(iterpool);
 
+      err = svn_fs_fs__open_pack_or_rev_file(&file, fs, probe, iterpool);
       if (err && err->apr_err == SVN_ERR_FS_NO_SUCH_REVISION)
         {
           svn_error_clear(err);

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/revprops.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/revprops.c?rev=1533816&r1=1533815&r2=1533816&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/revprops.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/revprops.c Sat Oct 19 20:09:38
2013
@@ -72,6 +72,8 @@ svn_fs_fs__upgrade_pack_revprops(svn_fs_
   /* first, pack all revprops shards to match the packed revision shards */
   for (shard = 0; shard < first_unpacked_shard; ++shard)
     {
+      svn_pool_clear(iterpool);
+
       revprops_pack_file_dir = svn_dirent_join(revsprops_dir,
                    apr_psprintf(iterpool,
                                 "%" APR_INT64_T_FMT PATH_EXT_PACKED_SHARD,
@@ -91,8 +93,6 @@ svn_fs_fs__upgrade_pack_revprops(svn_fs_
       if (notify_func)
         SVN_ERR(notify_func(notify_baton, shard,
                             svn_fs_upgrade_pack_revprops, iterpool));
-
-      svn_pool_clear(iterpool);
     }
 
   svn_pool_destroy(iterpool);
@@ -121,6 +121,8 @@ svn_fs_fs__upgrade_cleanup_pack_revprops
   /* delete the non-packed revprops shards afterwards */
   for (shard = 0; shard < first_unpacked_shard; ++shard)
     {
+      svn_pool_clear(iterpool);
+
       revprops_shard_path = svn_dirent_join(revsprops_dir,
                        apr_psprintf(iterpool, "%" APR_INT64_T_FMT, shard),
                        iterpool);
@@ -132,8 +134,6 @@ svn_fs_fs__upgrade_cleanup_pack_revprops
       if (notify_func)
         SVN_ERR(notify_func(notify_baton, shard,
                             svn_fs_upgrade_cleanup_revprops, iterpool));
-
-      svn_pool_clear(iterpool);
     }
 
   svn_pool_destroy(iterpool);
@@ -819,6 +819,7 @@ parse_packed_revprops(svn_fs_t *fs,
       svn_string_t serialized;
       apr_hash_t *properties;
       svn_revnum_t revision = (svn_revnum_t)(first_rev + i);
+      svn_pool_clear(iterpool);
 
       /* read & check the serialized size */
       SVN_ERR(svn_fs_fs__read_number_from_stream(&size, NULL, stream,
@@ -854,8 +855,6 @@ parse_packed_revprops(svn_fs_t *fs,
       revprops->total_size += serialized.len;
 
       offset += serialized.len;
-
-      svn_pool_clear(iterpool);
     }
 
   return SVN_NO_ERROR;
@@ -898,6 +897,7 @@ read_pack_revprop(packed_revprops_t **re
        ++i)
     {
       const char *file_path;
+      svn_pool_clear(iterpool);
 
       /* there might have been concurrent writes.
        * Re-read the manifest and the pack file.
@@ -919,8 +919,6 @@ read_pack_revprop(packed_revprops_t **re
        */
       if (missing && has_revprop_cache(fs, pool))
         SVN_ERR(read_revprop_generation(&result->generation, fs, pool));
-
-      svn_pool_clear(iterpool);
     }
 
   /* the file content should be available now */
@@ -1081,8 +1079,9 @@ switch_to_new_revprop(svn_fs_t *fs,
       for (i = 0; i < files_to_delete->nelts; ++i)
         {
           const char *path = APR_ARRAY_IDX(files_to_delete, i, const char*);
-          SVN_ERR(svn_io_remove_file2(path, TRUE, iterpool));
+
           svn_pool_clear(iterpool);
+          SVN_ERR(svn_io_remove_file2(path, TRUE, iterpool));
         }
 
       svn_pool_destroy(iterpool);
@@ -1121,7 +1120,7 @@ serialize_revprops_header(svn_stream_t *
   /* the double newline char indicates the end of the header */
   SVN_ERR(svn_stream_printf(stream, iterpool, "\n"));
 
-  svn_pool_clear(iterpool);
+##  svn_pool_destroy(iterpool);
   return SVN_NO_ERROR;
 }
 
@@ -1739,14 +1738,16 @@ svn_fs_fs__delete_revprops_shard(const c
       /* delete all files except the one for revision 0 */
       for (i = 1; i < max_files_per_dir; ++i)
         {
-          const char *path = svn_dirent_join(shard_path,
-                                       apr_psprintf(iterpool, "%d", i),
-                                       iterpool);
+          const char *path;
+          svn_pool_clear(iterpool);
+
+          path = svn_dirent_join(shard_path,
+                                 apr_psprintf(iterpool, "%d", i),
+                                 iterpool);
           if (cancel_func)
             SVN_ERR((*cancel_func)(cancel_baton));
 
           SVN_ERR(svn_io_remove_file2(path, TRUE, iterpool));
-          svn_pool_clear(iterpool);
         }
 
       svn_pool_destroy(iterpool);

Modified: subversion/branches/log-addressing/subversion/libsvn_fs_fs/verify.c
URL: http://svn.apache.org/viewvc/subversion/branches/log-addressing/subversion/libsvn_fs_fs/verify.c?rev=1533816&r1=1533815&r2=1533816&view=diff
==============================================================================
--- subversion/branches/log-addressing/subversion/libsvn_fs_fs/verify.c (original)
+++ subversion/branches/log-addressing/subversion/libsvn_fs_fs/verify.c Sat Oct 19 20:09:38
2013
@@ -194,6 +194,7 @@ compare_l2p_to_p2l_index(svn_fs_t *fs,
         {
           apr_off_t offset;
           svn_fs_fs__p2l_entry_t *p2l_entry;
+          svn_pool_clear(iterpool);
 
           /* get L2P entry.  Ignore unused entries. */
           SVN_ERR(svn_fs_fs__item_offset(&offset, fs, &rev_file, revision,
@@ -224,8 +225,6 @@ compare_l2p_to_p2l_index(svn_fs_t *fs,
                                      p2l_entry->item.revision,
                                      (long)p2l_entry->item.number,
                                      revision, (long)k);
-
-          svn_pool_clear(iterpool);
         }
 
       if (cancel_func)
@@ -273,6 +272,8 @@ compare_p2l_to_l2p_index(svn_fs_t *fs,
       svn_fs_fs__p2l_entry_t *last_entry;
       int i;
 
+      svn_pool_clear(iterpool);
+
       /* get all entries for the current block */
       SVN_ERR(svn_fs_fs__p2l_index_lookup(&entries, fs, &rev_file, start,
                                           offset, iterpool));
@@ -287,7 +288,7 @@ compare_p2l_to_l2p_index(svn_fs_t *fs,
       last_entry
         = &APR_ARRAY_IDX(entries, entries->nelts-1, svn_fs_fs__p2l_entry_t);
       offset = last_entry->offset + last_entry->size;
-      
+
       for (i = 0; i < entries->nelts; ++i)
         {
           svn_fs_fs__p2l_entry_t *entry
@@ -314,8 +315,6 @@ compare_p2l_to_l2p_index(svn_fs_t *fs,
             }
         }
 
-      svn_pool_clear(iterpool);
-
       if (cancel_func)
         SVN_ERR(cancel_func(cancel_baton));
     }
@@ -519,6 +518,8 @@ compare_p2l_to_rev(svn_fs_t *fs,
       apr_array_header_t *entries;
       int i;
 
+      svn_pool_clear(iterpool);
+
       /* get all entries for the current block */
       SVN_ERR(svn_fs_fs__p2l_index_lookup(&entries, fs, rev_file, start,
                                           offset, iterpool));
@@ -569,8 +570,6 @@ compare_p2l_to_rev(svn_fs_t *fs,
           offset += entry->size;
         }
 
-      svn_pool_clear(iterpool);
-
       if (cancel_func)
         SVN_ERR(cancel_func(cancel_baton));
     }
@@ -627,6 +626,8 @@ verify_index_consistency(svn_fs_t *fs,
       pack_start = packed_base_rev(fs, revision);
       pack_end = pack_start + count;
 
+      svn_pool_clear(iterpool);
+
       if (notify_func && (pack_start % ffd->max_files_per_dir == 0))
         notify_func(pack_start, notify_baton, iterpool);
 
@@ -652,8 +653,6 @@ verify_index_consistency(svn_fs_t *fs,
         {
           SVN_ERR(err);
         }
-
-      svn_pool_clear(iterpool);
     }
 
   svn_pool_destroy(iterpool);



Mime
View raw message