You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2016/03/06 19:04:08 UTC
svn commit: r1733816 - in /subversion/trunk/subversion/libsvn_fs_x:
cached_data.c changes.c changes.h
Author: stefan2
Date: Sun Mar 6 18:04:08 2016
New Revision: 1733816
URL: http://svn.apache.org/viewvc?rev=1733816&view=rev
Log:
In FSX, read cached changed paths lists containers iteratively.
We simply need to tell the extractor function what range we want.
Everything else is already provided through the partial cache lookup
mechanism.
* subversion/libsvn_fs_x/changes.h
(svn_fs_x__changes_get_list_baton_t): New baton type.
(svn_fs_x__changes_get_list_func): This one now uses a "proper" baton.
* subversion/libsvn_fs_x/changes.c
(svn_fs_x__changes_get_list_func): Restrict the result to the requested
data block and limit its size to 100.
* subversion/libsvn_fs_x/cached_data.c
(svn_fs_x__get_changes): Update caller.
Modified:
subversion/trunk/subversion/libsvn_fs_x/cached_data.c
subversion/trunk/subversion/libsvn_fs_x/changes.c
subversion/trunk/subversion/libsvn_fs_x/changes.h
Modified: subversion/trunk/subversion/libsvn_fs_x/cached_data.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/cached_data.c?rev=1733816&r1=1733815&r2=1733816&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/cached_data.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/cached_data.c Sun Mar 6 18:04:08 2016
@@ -2840,10 +2840,12 @@ svn_fs_x__get_changes(apr_array_header_t
if (svn_fs_x__is_packed_rev(context->fs, context->revision))
{
apr_off_t offset;
- apr_uint32_t sub_item;
svn_fs_x__pair_cache_key_t key;
+ svn_fs_x__changes_get_list_baton_t baton;
+ baton.start = (int)context->next;
+ baton.eol = &context->eol;
- SVN_ERR(svn_fs_x__item_offset(&offset, &sub_item, context->fs,
+ SVN_ERR(svn_fs_x__item_offset(&offset, &baton.sub_item, context->fs,
context->revision_file,
&id, scratch_pool));
key.revision = svn_fs_x__packed_base_rev(context->fs,
@@ -2853,7 +2855,7 @@ svn_fs_x__get_changes(apr_array_header_t
SVN_ERR(svn_cache__get_partial((void **)&all, &found,
ffd->changes_container_cache, &key,
svn_fs_x__changes_get_list_func,
- &sub_item, result_pool));
+ &baton, result_pool));
}
else
{
Modified: subversion/trunk/subversion/libsvn_fs_x/changes.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/changes.c?rev=1733816&r1=1733815&r2=1733816&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/changes.c (original)
+++ subversion/trunk/subversion/libsvn_fs_x/changes.c Sun Mar 6 18:04:08 2016
@@ -21,6 +21,7 @@
*/
#include "svn_private_config.h"
+#include "svn_sorts.h"
#include "private/svn_packed_data.h"
@@ -445,8 +446,10 @@ svn_fs_x__changes_get_list_func(void **o
int last;
int i;
apr_array_header_t *list;
+ enum { BLOCK_SIZE = 100 };
- apr_uint32_t idx = *(apr_uint32_t *)baton;
+ svn_fs_x__changes_get_list_baton_t *b = baton;
+ apr_uint32_t idx = b->sub_item;
const svn_fs_x__changes_t *container = data;
/* resolve all the sub-container pointers we need */
@@ -477,6 +480,12 @@ svn_fs_x__changes_get_list_func(void **o
first = offsets[idx];
last = offsets[idx+1];
+ /* Restrict range to the block requested by the BATON.
+ * Tell the caller whether we reached the end of the list. */
+ first = MIN(first + b->start, last);
+ last = MIN(first + BLOCK_SIZE, last);
+ *b->eol = last == offsets[idx+1];
+
/* construct result */
list = apr_array_make(pool, last - first, sizeof(svn_fs_x__change_t*));
Modified: subversion/trunk/subversion/libsvn_fs_x/changes.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_fs_x/changes.h?rev=1733816&r1=1733815&r2=1733816&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_fs_x/changes.h (original)
+++ subversion/trunk/subversion/libsvn_fs_x/changes.h Sun Mar 6 18:04:08 2016
@@ -116,11 +116,25 @@ svn_fs_x__deserialize_changes_container(
apr_size_t data_len,
apr_pool_t *result_pool);
+/* Baton type to be used with svn_fs_x__changes_get_list_func. */
+typedef struct svn_fs_x__changes_get_list_baton_t
+{
+ /* Sub-item to query */
+ apr_uint32_t sub_item;
+
+ /* Deliver data starting from this index within the changes list. */
+ int start;
+
+ /* To be set by svn_fs_x__changes_get_list_func:
+ Did we deliver the last change in that list? */
+ svn_boolean_t *eol;
+} svn_fs_x__changes_get_list_baton_t;
+
/* Implements svn_cache__partial_getter_func_t for svn_fs_x__changes_t,
* setting *OUT to the change list (apr_array_header_t *) selected by
- * the apr_uint32_t index passed in as *BATON. This function is similar
- * to svn_fs_x__changes_get_list but operates on the cache serialized
- * representation of the container.
+ * the svn_fs_x__changes_get_list_baton_t passed in as *BATON. This
+ * function is similar to svn_fs_x__changes_get_list but operates on
+ * the cache serialized representation of the container.
*/
svn_error_t *
svn_fs_x__changes_get_list_func(void **out,