You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2015/01/03 15:00:44 UTC
svn commit: r1649205 [16/30] - in /subversion/branches/authzperf: ./ build/
build/ac-macros/ notes/ subversion/bindings/ctypes-python/
subversion/bindings/cxxhl/
subversion/bindings/javahl/tests/org/apache/subversion/javahl/
subversion/bindings/swig/ s...
Modified: subversion/branches/authzperf/subversion/libsvn_fs_x/revprops.h
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_fs_x/revprops.h?rev=1649205&r1=1649204&r2=1649205&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_fs_x/revprops.h (original)
+++ subversion/branches/authzperf/subversion/libsvn_fs_x/revprops.h Sat Jan 3 14:00:41 2015
@@ -29,17 +29,14 @@
extern "C" {
#endif /* __cplusplus */
-/* Write the CURRENT revprop generation to disk for repository FS.
+/* Auto-create / replace the revprop generation file in FS with its
+ * initial contents. In any case, FS will not hold an open handle to
+ * it after this function succeeds.
*/
svn_error_t *
-svn_fs_x__write_revprop_generation_file(svn_fs_t *fs,
- apr_int64_t current,
+svn_fs_x__reset_revprop_generation_file(svn_fs_t *fs,
apr_pool_t *pool);
-/* Make sure the revprop_namespace member in FS is set. */
-svn_error_t *
-svn_fs_x__cleanup_revprop_namespace(svn_fs_t *fs);
-
/* In the filesystem FS, pack all revprop shards up to min_unpacked_rev.
*
* NOTE: Keep the old non-packed shards around until after the format bump.
@@ -77,6 +74,7 @@ svn_fs_x__upgrade_cleanup_pack_revprops(
apr_pool_t *scratch_pool);
/* Read the revprops for revision REV in FS and return them in *PROPERTIES_P.
+ * If BYPASS_CACHE is set, don't consult the disks but always read from disk.
*
* Allocations will be done in POOL.
*/
@@ -84,6 +82,7 @@ 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);
/* Set the revision property list of revision REV in filesystem FS to
Modified: subversion/branches/authzperf/subversion/libsvn_fs_x/temp_serializer.c
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_fs_x/temp_serializer.c?rev=1649205&r1=1649204&r2=1649205&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_fs_x/temp_serializer.c (original)
+++ subversion/branches/authzperf/subversion/libsvn_fs_x/temp_serializer.c Sat Jan 3 14:00:41 2015
@@ -134,9 +134,9 @@ deserialize_svn_string(void *buffer, svn
*/
static void
serialize_representation(svn_temp_serializer__context_t *context,
- representation_t * const *representation)
+ svn_fs_x__representation_t * const *representation)
{
- const representation_t * rep = *representation;
+ const svn_fs_x__representation_t * rep = *representation;
if (rep == NULL)
return;
@@ -203,7 +203,7 @@ typedef struct dir_data_t
apr_size_t len;
/* reference to the entries */
- svn_fs_dirent_t **entries;
+ svn_fs_x__dirent_t **entries;
/* size of the serialized entries and don't be too wasteful
* (needed since the entries are no longer in sequence) */
@@ -216,17 +216,16 @@ typedef struct dir_data_t
*/
static void
serialize_dir_entry(svn_temp_serializer__context_t *context,
- svn_fs_dirent_t **entry_p,
+ svn_fs_x__dirent_t **entry_p,
apr_uint32_t *length)
{
- svn_fs_dirent_t *entry = *entry_p;
+ svn_fs_x__dirent_t *entry = *entry_p;
apr_size_t initial_length = svn_temp_serializer__get_length(context);
svn_temp_serializer__push(context,
(const void * const *)entry_p,
- sizeof(svn_fs_dirent_t));
+ sizeof(svn_fs_x__dirent_t));
- svn_fs_x__id_serialize(context, &entry->id);
svn_temp_serializer__add_string(context, &entry->name);
*length = (apr_uint32_t)( svn_temp_serializer__get_length(context)
@@ -242,13 +241,14 @@ static svn_temp_serializer__context_t *
serialize_dir(apr_array_header_t *entries, apr_pool_t *pool)
{
dir_data_t dir_data;
- apr_size_t i = 0;
+ int i = 0;
svn_temp_serializer__context_t *context;
/* calculate sizes */
int count = entries->nelts;
apr_size_t over_provision = 2 + count / 4;
- apr_size_t entries_len = (count + over_provision) * sizeof(svn_fs_dirent_t*);
+ apr_size_t entries_len = (count + over_provision)
+ * sizeof(svn_fs_x__dirent_t*);
apr_size_t lengths_len = (count + over_provision) * sizeof(apr_uint32_t);
/* copy the hash entries to an auxiliary struct of known layout */
@@ -259,7 +259,7 @@ serialize_dir(apr_array_header_t *entrie
dir_data.lengths = apr_palloc(pool, lengths_len);
for (i = 0; i < count; ++i)
- dir_data.entries[i] = APR_ARRAY_IDX(entries, i, svn_fs_dirent_t *);
+ dir_data.entries[i] = APR_ARRAY_IDX(entries, i, svn_fs_x__dirent_t *);
/* Serialize that aux. structure into a new one. Also, provide a good
* estimate for the size of the buffer that we will need. */
@@ -296,11 +296,11 @@ static apr_array_header_t *
deserialize_dir(void *buffer, dir_data_t *dir_data, apr_pool_t *pool)
{
apr_array_header_t *result
- = apr_array_make(pool, dir_data->count, sizeof(svn_fs_dirent_t *));
+ = apr_array_make(pool, dir_data->count, sizeof(svn_fs_x__dirent_t *));
apr_size_t i;
apr_size_t count;
- svn_fs_dirent_t *entry;
- svn_fs_dirent_t **entries;
+ svn_fs_x__dirent_t *entry;
+ svn_fs_x__dirent_t **entries;
/* resolve the reference to the entries array */
svn_temp_deserializer__resolve(buffer, (void **)&dir_data->entries);
@@ -314,10 +314,9 @@ deserialize_dir(void *buffer, dir_data_t
/* pointer fixup */
svn_temp_deserializer__resolve(entry, (void **)&entry->name);
- svn_fs_x__id_deserialize(entry, (svn_fs_id_t **)&entry->id, pool);
/* add the entry to the hash */
- APR_ARRAY_PUSH(result, svn_fs_dirent_t *) = entry;
+ APR_ARRAY_PUSH(result, svn_fs_x__dirent_t *) = entry;
}
/* return the now complete hash */
@@ -326,9 +325,9 @@ deserialize_dir(void *buffer, dir_data_t
void
svn_fs_x__noderev_serialize(svn_temp_serializer__context_t *context,
- node_revision_t * const *noderev_p)
+ svn_fs_x__noderev_t * const *noderev_p)
{
- const node_revision_t *noderev = *noderev_p;
+ const svn_fs_x__noderev_t *noderev = *noderev_p;
if (noderev == NULL)
return;
@@ -338,8 +337,6 @@ svn_fs_x__noderev_serialize(svn_temp_ser
sizeof(*noderev));
/* serialize sub-structures */
- svn_fs_x__id_serialize(context, &noderev->id);
- svn_fs_x__id_serialize(context, &noderev->predecessor_id);
serialize_representation(context, &noderev->prop_rep);
serialize_representation(context, &noderev->data_rep);
@@ -354,10 +351,10 @@ svn_fs_x__noderev_serialize(svn_temp_ser
void
svn_fs_x__noderev_deserialize(void *buffer,
- node_revision_t **noderev_p,
+ svn_fs_x__noderev_t **noderev_p,
apr_pool_t *pool)
{
- node_revision_t *noderev;
+ svn_fs_x__noderev_t *noderev;
/* fixup the reference to the representation itself,
* if this is part of a parent structure. */
@@ -369,10 +366,6 @@ svn_fs_x__noderev_deserialize(void *buff
return;
/* fixup of sub-structures */
- svn_fs_x__id_deserialize(noderev, (svn_fs_id_t **)&noderev->id, pool);
- svn_fs_x__id_deserialize(noderev,
- (svn_fs_id_t **)&noderev->predecessor_id,
- pool);
svn_temp_deserializer__resolve(noderev, (void **)&noderev->prop_rep);
svn_temp_deserializer__resolve(noderev, (void **)&noderev->data_rep);
@@ -646,48 +639,7 @@ svn_fs_x__deserialize_properties(void **
return SVN_NO_ERROR;
}
-svn_error_t *
-svn_fs_x__serialize_id(void **data,
- apr_size_t *data_len,
- void *in,
- apr_pool_t *pool)
-{
- const svn_fs_id_t *id = in;
- svn_stringbuf_t *serialized;
-
- /* create an (empty) serialization context with plenty of buffer space */
- svn_temp_serializer__context_t *context =
- svn_temp_serializer__init(NULL, 0, 250, pool);
-
- /* serialize the id */
- svn_fs_x__id_serialize(context, &id);
-
- /* return serialized data */
- serialized = svn_temp_serializer__get(context);
- *data = serialized->data;
- *data_len = serialized->len;
-
- return SVN_NO_ERROR;
-}
-
-svn_error_t *
-svn_fs_x__deserialize_id(void **out,
- void *data,
- apr_size_t data_len,
- apr_pool_t *pool)
-{
- /* Copy the _full_ buffer as it also contains the sub-structures. */
- svn_fs_id_t *id = (svn_fs_id_t *)data;
-
- /* fixup of all pointers etc. */
- svn_fs_x__id_deserialize(id, &id, pool);
-
- /* done */
- *out = id;
- return SVN_NO_ERROR;
-}
-
-/** Caching node_revision_t objects. **/
+/** Caching svn_fs_x__noderev_t objects. **/
svn_error_t *
svn_fs_x__serialize_node_revision(void **buffer,
@@ -696,7 +648,7 @@ svn_fs_x__serialize_node_revision(void *
apr_pool_t *pool)
{
svn_stringbuf_t *serialized;
- node_revision_t *noderev = item;
+ svn_fs_x__noderev_t *noderev = item;
/* create an (empty) serialization context with plenty of (initial)
* buffer space. */
@@ -723,7 +675,7 @@ svn_fs_x__deserialize_node_revision(void
apr_pool_t *pool)
{
/* Copy the _full_ buffer as it also contains the sub-structures. */
- node_revision_t *noderev = (node_revision_t *)buffer;
+ svn_fs_x__noderev_t *noderev = (svn_fs_x__noderev_t *)buffer;
/* fixup of all pointers etc. */
svn_fs_x__noderev_deserialize(noderev, &noderev, pool);
@@ -800,7 +752,7 @@ svn_fs_x__get_sharded_offset(void **out,
* the number of valid entries in ENTRIES.
*/
static apr_size_t
-find_entry(svn_fs_dirent_t **entries,
+find_entry(svn_fs_x__dirent_t **entries,
const char *name,
apr_size_t count,
svn_boolean_t *found)
@@ -812,7 +764,7 @@ find_entry(svn_fs_dirent_t **entries,
for (middle = upper / 2; lower < upper; middle = (upper + lower) / 2)
{
- const svn_fs_dirent_t *entry =
+ const svn_fs_x__dirent_t *entry =
svn_temp_deserializer__ptr(entries, (const void *const *)&entries[middle]);
const char* entry_name =
svn_temp_deserializer__ptr(entry, (const void *const *)&entry->name);
@@ -828,7 +780,7 @@ find_entry(svn_fs_dirent_t **entries,
*found = FALSE;
if (lower < count)
{
- const svn_fs_dirent_t *entry =
+ const svn_fs_x__dirent_t *entry =
svn_temp_deserializer__ptr(entries, (const void *const *)&entries[lower]);
const char* entry_name =
svn_temp_deserializer__ptr(entry, (const void *const *)&entry->name);
@@ -852,7 +804,7 @@ svn_fs_x__extract_dir_entry(void **out,
svn_boolean_t found;
/* resolve the reference to the entries array */
- const svn_fs_dirent_t * const *entries =
+ const svn_fs_x__dirent_t * const *entries =
svn_temp_deserializer__ptr(data, (const void *const *)&dir_data->entries);
/* resolve the reference to the lengths array */
@@ -860,7 +812,7 @@ svn_fs_x__extract_dir_entry(void **out,
svn_temp_deserializer__ptr(data, (const void *const *)&dir_data->lengths);
/* binary search for the desired entry by name */
- apr_size_t pos = find_entry((svn_fs_dirent_t **)entries,
+ apr_size_t pos = find_entry((svn_fs_x__dirent_t **)entries,
name,
dir_data->count,
&found);
@@ -869,7 +821,7 @@ svn_fs_x__extract_dir_entry(void **out,
*out = NULL;
if (found)
{
- const svn_fs_dirent_t *source =
+ const svn_fs_x__dirent_t *source =
svn_temp_deserializer__ptr(entries, (const void *const *)&entries[pos]);
/* Entries have been serialized one-by-one, each time including all
@@ -880,13 +832,11 @@ svn_fs_x__extract_dir_entry(void **out,
apr_size_t size = lengths[pos];
/* copy & deserialize the entry */
- svn_fs_dirent_t *new_entry = apr_palloc(pool, size);
+ svn_fs_x__dirent_t *new_entry = apr_palloc(pool, size);
memcpy(new_entry, source, size);
svn_temp_deserializer__resolve(new_entry, (void **)&new_entry->name);
- svn_fs_x__id_deserialize(new_entry, (svn_fs_id_t **)&new_entry->id,
- pool);
- *(svn_fs_dirent_t **)out = new_entry;
+ *(svn_fs_x__dirent_t **)out = new_entry;
}
return SVN_NO_ERROR;
@@ -905,7 +855,7 @@ slowly_replace_dir_entry(void **data,
dir_data_t *dir_data = (dir_data_t *)*data;
apr_array_header_t *dir;
int idx = -1;
- svn_fs_dirent_t *entry;
+ svn_fs_x__dirent_t *entry;
SVN_ERR(svn_fs_x__deserialize_dir_entries((void **)&dir,
*data,
@@ -919,7 +869,8 @@ slowly_replace_dir_entry(void **data,
{
/* Replace ENTRY with / insert the NEW_ENTRY */
if (entry)
- APR_ARRAY_IDX(dir, idx, svn_fs_dirent_t *) = replace_baton->new_entry;
+ APR_ARRAY_IDX(dir, idx, svn_fs_x__dirent_t *)
+ = replace_baton->new_entry;
else
svn_sort__array_insert(dir, &replace_baton->new_entry, idx);
}
@@ -942,7 +893,7 @@ svn_fs_x__replace_dir_entry(void **data,
replace_baton_t *replace_baton = (replace_baton_t *)baton;
dir_data_t *dir_data = (dir_data_t *)*data;
svn_boolean_t found;
- svn_fs_dirent_t **entries;
+ svn_fs_x__dirent_t **entries;
apr_uint32_t *lengths;
apr_uint32_t length;
apr_size_t pos;
@@ -956,7 +907,7 @@ svn_fs_x__replace_dir_entry(void **data,
return slowly_replace_dir_entry(data, data_len, baton, pool);
/* resolve the reference to the entries array */
- entries = (svn_fs_dirent_t **)
+ entries = (svn_fs_x__dirent_t **)
svn_temp_deserializer__ptr((const char *)dir_data,
(const void *const *)&dir_data->entries);
@@ -1073,9 +1024,9 @@ svn_fs_x__deserialize_rep_header(void **
*/
static void
serialize_change(svn_temp_serializer__context_t *context,
- change_t * const *change_p)
+ svn_fs_x__change_t * const *change_p)
{
- const change_t * change = *change_p;
+ const svn_fs_x__change_t * change = *change_p;
if (change == NULL)
return;
@@ -1085,10 +1036,8 @@ serialize_change(svn_temp_serializer__co
sizeof(*change));
/* serialize sub-structures */
- svn_fs_x__id_serialize(context, &change->info.node_rev_id);
-
svn_temp_serializer__add_string(context, &change->path.data);
- svn_temp_serializer__add_string(context, &change->info.copyfrom_path);
+ svn_temp_serializer__add_string(context, &change->copyfrom_path);
/* return to the caller's nesting level */
svn_temp_serializer__pop(context);
@@ -1099,10 +1048,10 @@ serialize_change(svn_temp_serializer__co
*/
static void
deserialize_change(void *buffer,
- change_t **change_p,
+ svn_fs_x__change_t **change_p,
apr_pool_t *pool)
{
- change_t * change;
+ svn_fs_x__change_t * change;
/* fix-up of the pointer to the struct in question */
svn_temp_deserializer__resolve(buffer, (void **)change_p);
@@ -1112,15 +1061,11 @@ deserialize_change(void *buffer,
return;
/* fix-up of sub-structures */
- svn_fs_x__id_deserialize(change,
- (svn_fs_id_t **)&change->info.node_rev_id,
- pool);
-
svn_temp_deserializer__resolve(change, (void **)&change->path.data);
- svn_temp_deserializer__resolve(change, (void **)&change->info.copyfrom_path);
+ svn_temp_deserializer__resolve(change, (void **)&change->copyfrom_path);
}
-/* Auxiliary structure representing the content of a change_t array.
+/* Auxiliary structure representing the content of a svn_fs_x__change_t array.
This structure is much easier to (de-)serialize than an APR array.
*/
typedef struct changes_data_t
@@ -1129,7 +1074,7 @@ typedef struct changes_data_t
int count;
/* reference to the changes */
- change_t **changes;
+ svn_fs_x__change_t **changes;
} changes_data_t;
svn_error_t *
@@ -1144,23 +1089,20 @@ svn_fs_x__serialize_changes(void **data,
svn_stringbuf_t *serialized;
int i;
- /* initialize our auxiliary data structure */
+ /* initialize our auxiliary data structure and link it to the
+ * array elements */
changes.count = array->nelts;
- changes.changes = apr_palloc(pool, sizeof(change_t*) * changes.count);
-
- /* populate it with the array elements */
- for (i = 0; i < changes.count; ++i)
- changes.changes[i] = APR_ARRAY_IDX(array, i, change_t*);
+ changes.changes = (svn_fs_x__change_t **)array->elts;
/* serialize it and all its elements */
context = svn_temp_serializer__init(&changes,
sizeof(changes),
- changes.count * 100,
+ changes.count * 250,
pool);
svn_temp_serializer__push(context,
(const void * const *)&changes.changes,
- changes.count * sizeof(change_t*));
+ changes.count * sizeof(svn_fs_x__change_t*));
for (i = 0; i < changes.count; ++i)
serialize_change(context, &changes.changes[i]);
@@ -1184,20 +1126,23 @@ svn_fs_x__deserialize_changes(void **out
{
int i;
changes_data_t *changes = (changes_data_t *)data;
- apr_array_header_t *array = apr_array_make(pool, changes->count,
- sizeof(change_t *));
+ apr_array_header_t *array = apr_array_make(pool, 0,
+ sizeof(svn_fs_x__change_t *));
/* de-serialize our auxiliary data structure */
svn_temp_deserializer__resolve(changes, (void**)&changes->changes);
/* de-serialize each entry and add it to the array */
for (i = 0; i < changes->count; ++i)
- {
- deserialize_change(changes->changes,
- (change_t **)&changes->changes[i],
- pool);
- APR_ARRAY_PUSH(array, change_t *) = changes->changes[i];
- }
+ deserialize_change(changes->changes,
+ (svn_fs_x__change_t **)&changes->changes[i],
+ pool);
+
+ /* Use the changes buffer as the array's data buffer
+ * (DATA remains valid for at least as long as POOL). */
+ array->elts = (char *)changes->changes;
+ array->nelts = changes->count;
+ array->nalloc = changes->count;
/* done */
*out = array;
Modified: subversion/branches/authzperf/subversion/libsvn_fs_x/temp_serializer.h
URL: http://svn.apache.org/viewvc/subversion/branches/authzperf/subversion/libsvn_fs_x/temp_serializer.h?rev=1649205&r1=1649204&r2=1649205&view=diff
==============================================================================
--- subversion/branches/authzperf/subversion/libsvn_fs_x/temp_serializer.h (original)
+++ subversion/branches/authzperf/subversion/libsvn_fs_x/temp_serializer.h Sat Jan 3 14:00:41 2015
@@ -23,6 +23,7 @@
#ifndef SVN_LIBSVN_FS__TEMP_SERIALIZER_H
#define SVN_LIBSVN_FS__TEMP_SERIALIZER_H
+#include "private/svn_temp_serializer.h"
#include "fs.h"
/**
@@ -40,7 +41,7 @@ svn_fs_x__combine_number_and_string(apr_
*/
void
svn_fs_x__noderev_serialize(struct svn_temp_serializer__context_t *context,
- node_revision_t * const *noderev_p);
+ svn_fs_x__noderev_t * const *noderev_p);
/**
* Deserialize a @a noderev_p within the @a buffer and associate it with
@@ -48,7 +49,7 @@ svn_fs_x__noderev_serialize(struct svn_t
*/
void
svn_fs_x__noderev_deserialize(void *buffer,
- node_revision_t **noderev_p,
+ svn_fs_x__noderev_t **noderev_p,
apr_pool_t *pool);
/**
@@ -146,25 +147,7 @@ svn_fs_x__deserialize_properties(void **
apr_pool_t *pool);
/**
- * Implements #svn_cache__serialize_func_t for #svn_fs_id_t
- */
-svn_error_t *
-svn_fs_x__serialize_id(void **data,
- apr_size_t *data_len,
- void *in,
- apr_pool_t *pool);
-
-/**
- * Implements #svn_cache__deserialize_func_t for #svn_fs_id_t
- */
-svn_error_t *
-svn_fs_x__deserialize_id(void **out,
- void *data,
- apr_size_t data_len,
- apr_pool_t *pool);
-
-/**
- * Implements #svn_cache__serialize_func_t for #node_revision_t
+ * Implements #svn_cache__serialize_func_t for #svn_fs_x__noderev_t
*/
svn_error_t *
svn_fs_x__serialize_node_revision(void **buffer,
@@ -173,7 +156,7 @@ svn_fs_x__serialize_node_revision(void *
apr_pool_t *pool);
/**
- * Implements #svn_cache__deserialize_func_t for #node_revision_t
+ * Implements #svn_cache__deserialize_func_t for #svn_fs_x__noderev_t
*/
svn_error_t *
svn_fs_x__deserialize_node_revision(void **item,
@@ -212,7 +195,7 @@ svn_fs_x__get_sharded_offset(void **out,
/**
* Implements #svn_cache__partial_getter_func_t for a single
- * #svn_fs_dirent_t within a serialized directory contents hash,
+ * #svn_fs_x__dirent_t within a serialized directory contents hash,
* identified by its name (const char @a *baton).
*/
svn_error_t *
@@ -234,12 +217,12 @@ typedef struct replace_baton_t
const char *name;
/** directory entry to insert instead */
- svn_fs_dirent_t *new_entry;
+ svn_fs_x__dirent_t *new_entry;
} replace_baton_t;
/**
* Implements #svn_cache__partial_setter_func_t for a single
- * #svn_fs_dirent_t within a serialized directory contents hash,
+ * #svn_fs_x__dirent_t within a serialized directory contents hash,
* identified by its name in the #replace_baton_t in @a baton.
*/
svn_error_t *
@@ -268,7 +251,7 @@ svn_fs_x__deserialize_rep_header(void **
/**
* Implements #svn_cache__serialize_func_t for an #apr_array_header_t of
- * #change_t *.
+ * #svn_fs_x__change_t *.
*/
svn_error_t *
svn_fs_x__serialize_changes(void **data,
@@ -278,7 +261,7 @@ svn_fs_x__serialize_changes(void **data,
/**
* Implements #svn_cache__deserialize_func_t for an #apr_array_header_t of
- * #change_t *.
+ * #svn_fs_x__change_t *.
*/
svn_error_t *
svn_fs_x__deserialize_changes(void **out,