You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David Glasser <gl...@davidglasser.net> on 2008/02/14 20:06:34 UTC

mergeinfo API cleanup: questions

I'm working on cleaning up the mergeinfo API.  The key parts are
establishing the concepts of svn_mergeinfo_t and
svn_mergeinfo_catalog_t, and discouraging using any other data type
(other than svn_string_t) to pass the data around through public APIs.
 This lets us get rid of the dozens of docstrings saying "@a mergeinfo
is a hash mapping const char * keys starting with slashes to hashes
mapping const char * keys starting with slashes to apr_array_header_t
*s containing svn_merge_range_t *s sorted in ascending order", for
example.

I'm doing this on the mergeinfo-api-cleanup branch.

Here are some questions remaining for me:

* svn_rangelist_reverse and svn_mergeinfo_sort both trouble me: they
  imply that it's ever valid to pass around unsorted rangelists.
  svn_mergeinfo_sort is easy enough to privatize, but I have to admit
  I don't actually understand the point of svn_rangelist_reverse.
  It's used in essentially two places, in some rollback-related range
  math.  Is there some higher-level operation describing what's being
  done there which we could replace svn_rangelist_reverse with, and
  never expose "backwards" range lists outside of
  libsvn_subr/mergeinfo.c?

* svn_rangelist_count_revs, svn_rangelist_to_revs, and
  svn_range_compact are never used outside of the test suite.  Do we
  need them?  I guess the first two might hypothetically be useful to
  other clients.  What about svn_range_compact?

--dave

-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mergeinfo API cleanup: questions

Posted by David Glasser <gl...@davidglasser.net>.
On Feb 18, 2008 10:56 AM, Hyrum K. Wright <hy...@mail.utexas.edu> wrote:
>
> David Glasser wrote:
> > On Feb 18, 2008 10:38 AM, Hyrum K. Wright <hy...@mail.utexas.edu> wrote:
> >> Hyrum K. Wright wrote:
> >>> David Glasser wrote:
> >>> ...
> >>>> * svn_rangelist_count_revs, svn_rangelist_to_revs, and
> >>>>   svn_range_compact are never used outside of the test suite.  Do we
> >>>>   need them?  I guess the first two might hypothetically be useful to
> >>>>   other clients.  What about svn_range_compact?
> >>> The first two were originally were part of 'log -g'.  Their usefulness
> >>> may return before I'm finished with 'log -g', so I would wait until that
> >>> point to remove them.
> >> I've moved svn_rangelist_to_revs() to be a private function in
> >> libsvn_repos.  It may still get cut, and I'd like to keep it out of the
> >> public API.  svn_rangelist_count_revs() can be safely removed.
> >
> > Cool.
> >
> > btw, Hyrum and I talked about this on IRC the other day, but: I'm a
> > little worried that any codepath that uses svn_rangelist_to_revs (or
> > the new private version) is a potential DOS risk.  If somebody can
> > check in a mergeinfo prop (or otherwise get svn_rangelist_to_revs
> > applied a string) containing "1-1000000000", any call to that function
> > will make the server slowly allocate a large amount of memory...
>
> True.  I'm in the middle of a new rangelist-based algorithm to replace
> the need for rangelist_to_revs(), but if somebody else wants to take a
> look at it sooner, I'd have no objections.  The current implementation
> is there because it was easier to conceptualize and implement, and so
> that folks can test the functionality of 'log -g' while I work on the
> rangelist-based approach.

Right.  Or you could always just trim to youngest_rev at
rangelist_to_revs time, which at least puts somewhat of a bound on the
explosion.

--dave


-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mergeinfo API cleanup: questions

Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
David Glasser wrote:
> On Feb 18, 2008 10:38 AM, Hyrum K. Wright <hy...@mail.utexas.edu> wrote:
>> Hyrum K. Wright wrote:
>>> David Glasser wrote:
>>> ...
>>>> * svn_rangelist_count_revs, svn_rangelist_to_revs, and
>>>>   svn_range_compact are never used outside of the test suite.  Do we
>>>>   need them?  I guess the first two might hypothetically be useful to
>>>>   other clients.  What about svn_range_compact?
>>> The first two were originally were part of 'log -g'.  Their usefulness
>>> may return before I'm finished with 'log -g', so I would wait until that
>>> point to remove them.
>> I've moved svn_rangelist_to_revs() to be a private function in
>> libsvn_repos.  It may still get cut, and I'd like to keep it out of the
>> public API.  svn_rangelist_count_revs() can be safely removed.
> 
> Cool.
> 
> btw, Hyrum and I talked about this on IRC the other day, but: I'm a
> little worried that any codepath that uses svn_rangelist_to_revs (or
> the new private version) is a potential DOS risk.  If somebody can
> check in a mergeinfo prop (or otherwise get svn_rangelist_to_revs
> applied a string) containing "1-1000000000", any call to that function
> will make the server slowly allocate a large amount of memory...

True.  I'm in the middle of a new rangelist-based algorithm to replace
the need for rangelist_to_revs(), but if somebody else wants to take a
look at it sooner, I'd have no objections.  The current implementation
is there because it was easier to conceptualize and implement, and so
that folks can test the functionality of 'log -g' while I work on the
rangelist-based approach.

-Hyrum


Re: mergeinfo API cleanup: questions

Posted by David Glasser <gl...@davidglasser.net>.
On Feb 18, 2008 10:38 AM, Hyrum K. Wright <hy...@mail.utexas.edu> wrote:
>
> Hyrum K. Wright wrote:
> > David Glasser wrote:
> > ...
> >> * svn_rangelist_count_revs, svn_rangelist_to_revs, and
> >>   svn_range_compact are never used outside of the test suite.  Do we
> >>   need them?  I guess the first two might hypothetically be useful to
> >>   other clients.  What about svn_range_compact?
> >
> > The first two were originally were part of 'log -g'.  Their usefulness
> > may return before I'm finished with 'log -g', so I would wait until that
> > point to remove them.
>
> I've moved svn_rangelist_to_revs() to be a private function in
> libsvn_repos.  It may still get cut, and I'd like to keep it out of the
> public API.  svn_rangelist_count_revs() can be safely removed.

Cool.

btw, Hyrum and I talked about this on IRC the other day, but: I'm a
little worried that any codepath that uses svn_rangelist_to_revs (or
the new private version) is a potential DOS risk.  If somebody can
check in a mergeinfo prop (or otherwise get svn_rangelist_to_revs
applied a string) containing "1-1000000000", any call to that function
will make the server slowly allocate a large amount of memory...

--dave


-- 
David Glasser | glasser@davidglasser.net | http://www.davidglasser.net/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: mergeinfo API cleanup: questions

Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
Hyrum K. Wright wrote:
> David Glasser wrote:
> ...
>> * svn_rangelist_count_revs, svn_rangelist_to_revs, and
>>   svn_range_compact are never used outside of the test suite.  Do we
>>   need them?  I guess the first two might hypothetically be useful to
>>   other clients.  What about svn_range_compact?
> 
> The first two were originally were part of 'log -g'.  Their usefulness
> may return before I'm finished with 'log -g', so I would wait until that
> point to remove them.

I've moved svn_rangelist_to_revs() to be a private function in
libsvn_repos.  It may still get cut, and I'd like to keep it out of the
public API.  svn_rangelist_count_revs() can be safely removed.

-Hyrum


Re: mergeinfo API cleanup: questions

Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
David Glasser wrote:
...
> * svn_rangelist_count_revs, svn_rangelist_to_revs, and
>   svn_range_compact are never used outside of the test suite.  Do we
>   need them?  I guess the first two might hypothetically be useful to
>   other clients.  What about svn_range_compact?

The first two were originally were part of 'log -g'.  Their usefulness
may return before I'm finished with 'log -g', so I would wait until that
point to remove them.

-Hyrum