Author: stefan2
Date: Wed Feb 4 15:15:13 2015
New Revision: 1657274
URL: http://svn.apache.org/r1657274
Log:
In FSX, make the revprop getter comply to the two-pool paradigm.
Propagate along the caller and callee chains.
* subversion/libsvn_fs_x/revprops.h
(svn_fs_x__get_revision_proplist): Switch to 2-pool paradigm.
* subversion/libsvn_fs_x/revprops.c
(read_non_packed_revprop,
read_pack_revprop): Switch these sub-functions to the new scheme, too.
(svn_fs_x__get_revision_proplist): Update implementation using the new
scratch pool wherever possible.
(write_packed_revprop): Update caller.
* subversion/libsvn_fs_x/fs_x.h
(svn_fs_x__revision_prop): Switch calling function to 2-pool paradigm.
* subversion/libsvn_fs_x/fs_x.c
(svn_fs_x__revision_prop): Fetch all data as temporary and copy only
the requested prop value into the result pool.
(change_rev_prop_body): Update caller.
* subversion/libsvn_fs_x/fs.c
(x_revision_prop): New FS API adapter function, providing the
additional scratch pool.
(x_revision_proplist): Update caller providing a scratch pool.
(fs_vtable): Link to the new wrapper.
* subversion/libsvn_fs_x/verify.c
(verify_revprops): Update caller.
Modified:
subversion/trunk/subversion/libsvn_fs_x/fs.c
subversion/trunk/subversion/libsvn_fs_x/fs_x.c
subversion/trunk/subversion/libsvn_fs_x/fs_x.h
subversion/trunk/subversion/libsvn_fs_x/revprops.c
subversion/trunk/subversion/libsvn_fs_x/revprops.h
subversion/trunk/subversion/libsvn_fs_x/verify.c
Modified: subversion/trunk/subversion/libsvn_fs_x/fs.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs.c?rev=1657274&r1=1657273&r2=1657274&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs.c Wed Feb 4 15:15:13 2015
@@ -216,6 +216,23 @@ x_info(const void **fsx_info,
return SVN_NO_ERROR;
}
+/* Wrapper around svn_fs_x__revision_prop() adapting between function
+ signatures. */
+static svn_error_t *
+x_revision_prop(svn_string_t **value_p,
+ svn_fs_t *fs,
+ svn_revnum_t rev,
+ const char *propname,
+ apr_pool_t *pool)
+{
+ apr_pool_t *scratch_pool = svn_pool_create(pool);
+ SVN_ERR(svn_fs_x__revision_prop(value_p, fs, rev, propname, pool,
+ scratch_pool));
+ svn_pool_destroy(scratch_pool);
+
+ return SVN_NO_ERROR;
+}
+
/* Wrapper around svn_fs_x__get_revision_proplist() adapting between function
signatures. */
static svn_error_t *
@@ -224,9 +241,14 @@ x_revision_proplist(apr_hash_t **proplis
svn_revnum_t rev,
apr_pool_t *pool)
{
+ apr_pool_t *scratch_pool = svn_pool_create(pool);
+
/* No need to bypass the caches for r/o access to revprops. */
- return svn_error_trace(svn_fs_x__get_revision_proplist(proplist_p, fs,
- rev, FALSE, pool));
+ SVN_ERR(svn_fs_x__get_revision_proplist(proplist_p, fs, rev, FALSE,
+ pool, scratch_pool));
+ svn_pool_destroy(scratch_pool);
+
+ return SVN_NO_ERROR;
}
/* Wrapper around svn_fs_x__set_uuid() adapting between function
@@ -261,7 +283,7 @@ x_begin_txn(svn_fs_txn_t **txn_p,
/* The vtable associated with a specific open filesystem. */
static fs_vtable_t fs_vtable = {
svn_fs_x__youngest_rev,
- svn_fs_x__revision_prop,
+ x_revision_prop,
x_revision_proplist,
svn_fs_x__change_rev_prop,
x_set_uuid,
Modified: subversion/trunk/subversion/libsvn_fs_x/fs_x.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs_x.c?rev=1657274&r1=1657273&r2=1657274&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_x.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_x.c Wed Feb 4 15:15:13 2015
@@ -1097,17 +1097,19 @@ svn_fs_x__ensure_dir_exists(const char *
svn_error_t *
svn_fs_x__revision_prop(svn_string_t **value_p,
- svn_fs_t *fs,
- svn_revnum_t rev,
- const char *propname,
- apr_pool_t *pool)
+ svn_fs_t *fs,
+ svn_revnum_t rev,
+ const char *propname,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
apr_hash_t *table;
SVN_ERR(svn_fs__check_fs(fs, TRUE));
- SVN_ERR(svn_fs_x__get_revision_proplist(&table, fs, rev, FALSE, pool));
+ SVN_ERR(svn_fs_x__get_revision_proplist(&table, fs, rev, FALSE,
+ scratch_pool, scratch_pool));
- *value_p = svn_hash_gets(table, propname);
+ *value_p = svn_string_dup(svn_hash_gets(table, propname), result_pool);
return SVN_NO_ERROR;
}
@@ -1136,7 +1138,7 @@ change_rev_prop_body(void *baton,
Even if somehow the cache got out of sync, we want to make sure that
we read, update and write up-to-date data. */
SVN_ERR(svn_fs_x__get_revision_proplist(&table, cb->fs, cb->rev, TRUE,
- scratch_pool));
+ scratch_pool, scratch_pool));
if (cb->old_value_p)
{
Modified: subversion/trunk/subversion/libsvn_fs_x/fs_x.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/fs_x.h?rev=1657274&r1=1657273&r2=1657274&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/fs_x.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/fs_x.h Wed Feb 4 15:15:13 2015
@@ -158,15 +158,16 @@ svn_fs_x__write_format(svn_fs_t *fs,
svn_boolean_t overwrite,
apr_pool_t *scratch_pool);
-/* Find the value of the property named PROPNAME in transaction TXN.
- Return the contents in *VALUE_P. The contents will be allocated
- from POOL. */
+/* Find the value of the property named PROPNAME in transaction REV.
+ Return the contents in *VALUE_P, allocated from RESULT_POOL.
+ Use SCRATCH_POOL for temporary allocations. */
svn_error_t *
svn_fs_x__revision_prop(svn_string_t **value_p,
svn_fs_t *fs,
svn_revnum_t rev,
const char *propname,
- apr_pool_t *pool);
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Change, add, or delete a property on a revision REV in filesystem
FS. NAME gives the name of the property, and value, if non-NULL,
Modified: subversion/trunk/subversion/libsvn_fs_x/revprops.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/revprops.c?rev=1657274&r1=1657273&r2=1657274&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/revprops.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/revprops.c Wed Feb 4 15:15:13 2015
@@ -698,17 +698,18 @@ parse_revprop(apr_hash_t **properties,
* If the data could not be read due to an otherwise recoverable error,
* leave *PROPERTIES unchanged. No error will be returned in that case.
*
- * Allocations will be done in POOL.
+ * Allocate *PROPERTIES in RESULT_POOL and temporaries in SCRATCH_POOL.
*/
static svn_error_t *
read_non_packed_revprop(apr_hash_t **properties,
svn_fs_t *fs,
svn_revnum_t rev,
apr_int64_t generation,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_stringbuf_t *content = NULL;
- apr_pool_t *iterpool = svn_pool_create(pool);
+ apr_pool_t *iterpool = svn_pool_create(scratch_pool);
svn_boolean_t missing = FALSE;
int i;
@@ -727,7 +728,7 @@ read_non_packed_revprop(apr_hash_t **pro
if (content)
SVN_ERR(parse_revprop(properties, fs, rev, generation,
svn_stringbuf__morph_into_string(content),
- pool, iterpool));
+ result_pool, iterpool));
svn_pool_clear(iterpool);
@@ -1006,7 +1007,8 @@ parse_packed_revprops(svn_fs_t *fs,
* *REVPROPS. Use GENERATION to populate the revprop cache, if enabled.
* If you want to modify revprop contents / update REVPROPS, READ_ALL
* must be set. Otherwise, only the properties of REV are being provided.
- * Allocate data in POOL.
+ *
+ * Allocate *PROPERTIES in RESULT_POOL and temporaries in SCRATCH_POOL.
*/
static svn_error_t *
read_pack_revprop(packed_revprops_t **revprops,
@@ -1014,9 +1016,10 @@ read_pack_revprop(packed_revprops_t **re
svn_revnum_t rev,
apr_int64_t generation,
svn_boolean_t read_all,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
- apr_pool_t *iterpool = svn_pool_create(pool);
+ apr_pool_t *iterpool = svn_pool_create(scratch_pool);
svn_boolean_t missing = FALSE;
svn_error_t *err;
packed_revprops_t *result;
@@ -1031,7 +1034,7 @@ read_pack_revprop(packed_revprops_t **re
_("No such packed revision %ld"), rev);
/* initialize the result data structure */
- result = apr_pcalloc(pool, sizeof(*result));
+ result = apr_pcalloc(result_pool, sizeof(*result));
result->revision = rev;
result->generation = generation;
@@ -1047,7 +1050,7 @@ read_pack_revprop(packed_revprops_t **re
/* there might have been concurrent writes.
* Re-read the manifest and the pack file.
*/
- SVN_ERR(get_revprop_packname(fs, result, pool, iterpool));
+ SVN_ERR(get_revprop_packname(fs, result, result_pool, iterpool));
file_path = svn_dirent_join(result->folder,
result->filename,
iterpool);
@@ -1055,15 +1058,15 @@ read_pack_revprop(packed_revprops_t **re
&missing,
file_path,
i + 1 < SVN_FS_X__RECOVERABLE_RETRY_COUNT,
- pool));
+ result_pool));
/* If we could not find the file, there was a write.
* So, we should refresh our revprop generation info as well such
* that others may find data we will put into the cache. They would
* consider it outdated, otherwise.
*/
- if (missing && has_revprop_cache(fs, pool))
- SVN_ERR(read_revprop_generation(&result->generation, fs, pool));
+ if (missing && has_revprop_cache(fs, iterpool))
+ SVN_ERR(read_revprop_generation(&result->generation, fs, iterpool));
}
/* the file content should be available now */
@@ -1072,7 +1075,7 @@ read_pack_revprop(packed_revprops_t **re
_("Failed to read revprop pack file for r%ld"), rev);
/* parse it. RESULT will be complete afterwards. */
- err = parse_packed_revprops(fs, result, read_all, pool, iterpool);
+ err = parse_packed_revprops(fs, result, read_all, result_pool, iterpool);
svn_pool_destroy(iterpool);
if (err)
return svn_error_createf(SVN_ERR_FS_CORRUPT, err,
@@ -1092,7 +1095,8 @@ svn_fs_x__get_revision_proplist(apr_hash
svn_fs_t *fs,
svn_revnum_t rev,
svn_boolean_t bypass_cache,
- apr_pool_t *pool)
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
{
svn_fs_x__data_t *ffd = fs->fsap_data;
apr_int64_t generation = 0;
@@ -1101,20 +1105,20 @@ svn_fs_x__get_revision_proplist(apr_hash
*proplist_p = NULL;
/* should they be available at all? */
- SVN_ERR(svn_fs_x__ensure_revision_exists(rev, fs, pool));
+ SVN_ERR(svn_fs_x__ensure_revision_exists(rev, fs, scratch_pool));
/* Try cache lookup first. */
- if (!bypass_cache && has_revprop_cache(fs, pool))
+ if (!bypass_cache && has_revprop_cache(fs, scratch_pool))
{
svn_boolean_t is_cached;
svn_fs_x__pair_cache_key_t key = { 0 };
- SVN_ERR(read_revprop_generation(&generation, fs, pool));
+ SVN_ERR(read_revprop_generation(&generation, fs, scratch_pool));
key.revision = rev;
key.second = generation;
SVN_ERR(svn_cache__get((void **) proplist_p, &is_cached,
- ffd->revprop_cache, &key, pool));
+ ffd->revprop_cache, &key, result_pool));
if (is_cached)
return SVN_NO_ERROR;
}
@@ -1125,7 +1129,8 @@ svn_fs_x__get_revision_proplist(apr_hash
if (!svn_fs_x__is_packed_revprop(fs, rev))
{
svn_error_t *err = read_non_packed_revprop(proplist_p, fs, rev,
- generation, pool);
+ generation, result_pool,
+ scratch_pool);
if (err)
{
if (!APR_STATUS_IS_ENOENT(err->apr_err))
@@ -1142,7 +1147,8 @@ svn_fs_x__get_revision_proplist(apr_hash
if (!*proplist_p)
{
packed_revprops_t *revprops;
- SVN_ERR(read_pack_revprop(&revprops, fs, rev, generation, FALSE, pool));
+ SVN_ERR(read_pack_revprop(&revprops, fs, rev, generation, FALSE,
+ result_pool, scratch_pool));
*proplist_p = revprops->properties;
}
@@ -1440,7 +1446,8 @@ write_packed_revprop(const char **final_
SVN_ERR(read_revprop_generation(&generation, fs, pool));
/* read contents of the current pack file */
- SVN_ERR(read_pack_revprop(&revprops, fs, rev, generation, TRUE, pool));
+ SVN_ERR(read_pack_revprop(&revprops, fs, rev, generation, TRUE, pool,
+ pool));
/* serialize the new revprops */
serialized = svn_stringbuf_create_empty(pool);
Modified: subversion/trunk/subversion/libsvn_fs_x/revprops.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/revprops.h?rev=1657274&r1=1657273&r2=1657274&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/revprops.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/revprops.h Wed Feb 4 15:15:13 2015
@@ -75,17 +75,19 @@ svn_fs_x__upgrade_cleanup_pack_revprops(
void *cancel_baton,
apr_pool_t *scratch_pool);
-/* Read the revprops for revision REV in FS and return them in *PROPERTIES_P.
+/* Read the revprops for revision REV in FS and return them in *PROPLIST_P.
* If BYPASS_CACHE is set, don't consult the disks but always read from disk.
*
- * Allocations will be done in POOL.
+ * Allocate the *PROPLIST_P in RESULT_POOL and use SCRATCH_POOL for temporary
+ * allocations.
*/
svn_error_t *
svn_fs_x__get_revision_proplist(apr_hash_t **proplist_p,
svn_fs_t *fs,
svn_revnum_t rev,
svn_boolean_t bypass_cache,
- apr_pool_t *pool);
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
/* Set the revision property list of revision REV in filesystem FS to
PROPLIST. Use SCRATCH_POOL for temporary allocations. */
Modified: subversion/trunk/subversion/libsvn_fs_x/verify.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/verify.c?rev=1657274&r1=1657273&r2=1657274&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/verify.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/verify.c Wed Feb 4 15:15:13 2015
@@ -713,7 +713,8 @@ verify_revprops(svn_fs_t *fs,
/* Access the svn:date revprop.
* This implies parsing all revprops for that revision. */
SVN_ERR(svn_fs_x__revision_prop(&date, fs, revision,
- SVN_PROP_REVISION_DATE, iterpool));
+ SVN_PROP_REVISION_DATE,
+ iterpool, iterpool));
/* The time stamp is the only revprop that, if given, needs to
* have a valid content. */