You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Hyrum K Wright <hy...@wandisco.com> on 2012/03/19 21:48:03 UTC
ra_serf not providing a valid revision to delete_entry() upon update
[ warning: investigation is still ongoing, but I thought I'd report this here.]
I'm trying to debug the Ev2 shims over ra_dav. In doing so, I've
discovered an inconsistency between ra_serf and ra_neon (surprise!)
ra_neon provides a valid argument for the replaced_rev parameter of
the Ev1 delete_entry() function. The relevant code is in
libsvn_ra_neon/replay.c:
169 const char *path = svn_xml_get_attr_value("name", atts);
170 const char *crev = svn_xml_get_attr_value("rev", atts);
171
172 if (! path)
173 return MISSING_ATTR(nspace, elt_name, "name");
174 else if (! crev)
175 return MISSING_ATTR(nspace, elt_name, "rev");
176 else
177 {
178 dir_item_t *di = &TOP_DIR(rb);
179
180 SVN_ERR(rb->editor->delete_entry(path, SVN_STR_TO_REV(crev),
181 di->baton, di->pool));
182 }
183 }
184 break;
Apparently, ra_neon expects and finds a "rev" attribute on the
relevant XML element. However, the same code in ra_serf (update.c)
doesn't:
1556 else if ((state == OPEN_DIR || state == ADD_DIR) &&
1557 strcmp(name.name, "delete-entry") == 0)
1558 {
1559 const char *file_name;
1560 report_info_t *info;
1561 apr_pool_t *tmppool;
1562 const char *full_path;
1563
1564 file_name = svn_xml_get_attr_value("name", attrs);
1565
1566 if (!file_name)
1567 {
1568 return svn_error_create(
1569 SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
1570 _("Missing name attr in delete-entry element"));
1571 }
1572
1573 info = parser->state->private;
1574
1575 SVN_ERR(open_dir(info->dir));
1576
1577 tmppool = svn_pool_create(info->dir->dir_baton_pool);
1578
1579 full_path = svn_relpath_join(info->dir->name, file_name, tmppool);
1580
1581 SVN_ERR(info->dir->update_editor->delete_entry(full_path,
1582 SVN_INVALID_REVNUM,
1583 info->dir->dir_baton,
1584 tmppool));
1585
1586 svn_pool_destroy(tmppool);
1587 }
As you can see, ra_serf is unconditionally passing SVN_INVALID_REVNUM
to delete_entry(), which is what is causing the shims to fail over
ra_dav (when run with ra_serf).
I tried inserting analogous code to fetch the "rev" attribute in
ra_serf, but it appears that said attribute isn't available. I'm not
familiar enough with the protocol to know why it would be for ra_neon,
but not ra_serf, and I'm asking here in the hopes that somebody can
enlighten me. :)
-Hyrum
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Re: ra_serf not providing a valid revision to delete_entry() upon update
Posted by Hyrum K Wright <hy...@wandisco.com>.
On Mon, Mar 19, 2012 at 5:24 PM, Greg Stein <gs...@gmail.com> wrote:
> On Mon, Mar 19, 2012 at 18:16, Greg Stein <gs...@gmail.com> wrote:
>> On Mon, Mar 19, 2012 at 16:48, Hyrum K Wright <hy...@wandisco.com> wrote:
>>> [ warning: investigation is still ongoing, but I thought I'd report this here.]
>>>
>>> I'm trying to debug the Ev2 shims over ra_dav. In doing so, I've
>>> discovered an inconsistency between ra_serf and ra_neon (surprise!)
>>
>> ra_neon uses a "replay-report" while ra_serf uses an "update-report".
>> The former provides the rev= attribute.
>>
>> I don't know why Neon uses the replay-report instead of the
>> update-report. I dunno what the differences are.
>
> What operations are you using? And why is it different between the two RA runs?
I see this on history test 1 (among others) when running davautocheck
and compiled with the shims enabled. It happens run running 'svn up
-r1' when the working copy is at r2, and r2 had a file replacement.
I might have been wrong about which bit of ra_neon was driving the
delete_entry() handler. I'll double check that bit later this
evening.
-Hyrum
> Note: in neon/fetch.c:1845, I see that SVN_INVALID_REVNUM is passed to
> delete_entry(). That happens when ra_neon runs an update-report.
>
> Cheers,
> -g
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Re: ra_serf not providing a valid revision to delete_entry() upon update
Posted by Hyrum K Wright <hy...@wandisco.com>.
On Mon, Mar 19, 2012 at 8:03 PM, Hyrum K Wright
<hy...@wandisco.com> wrote:
> On Mon, Mar 19, 2012 at 5:24 PM, Greg Stein <gs...@gmail.com> wrote:
>> On Mon, Mar 19, 2012 at 18:16, Greg Stein <gs...@gmail.com> wrote:
>>> On Mon, Mar 19, 2012 at 16:48, Hyrum K Wright <hy...@wandisco.com> wrote:
>>>> [ warning: investigation is still ongoing, but I thought I'd report this here.]
>>>>
>>>> I'm trying to debug the Ev2 shims over ra_dav. In doing so, I've
>>>> discovered an inconsistency between ra_serf and ra_neon (surprise!)
>>>
>>> ra_neon uses a "replay-report" while ra_serf uses an "update-report".
>>> The former provides the rev= attribute.
>>>
>>> I don't know why Neon uses the replay-report instead of the
>>> update-report. I dunno what the differences are.
>>
>> What operations are you using? And why is it different between the two RA runs?
>>
>> Note: in neon/fetch.c:1845, I see that SVN_INVALID_REVNUM is passed to
>> delete_entry(). That happens when ra_neon runs an update-report.
>
> You are correct, this code path uses neon/fetch.c:1845 on the ra_neon
> side, not the snippet I cited earlier.
>
> So the information is getting dropped over *both* ra_dav clients, not
> just ra_serf. This is still a disconnect from that which is provided
> directly to the delete_entry() callback from the repository in
> reporter.c:916. This bit of data is getting dropped.
The reason this bit of data was being dropped is that the delta editor
defines this as an optional piece of data. :( r1302758 attempts to
paper around the issue in the compat shims.
-Hyrum
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Re: ra_serf not providing a valid revision to delete_entry() upon update
Posted by Hyrum K Wright <hy...@wandisco.com>.
On Mon, Mar 19, 2012 at 5:24 PM, Greg Stein <gs...@gmail.com> wrote:
> On Mon, Mar 19, 2012 at 18:16, Greg Stein <gs...@gmail.com> wrote:
>> On Mon, Mar 19, 2012 at 16:48, Hyrum K Wright <hy...@wandisco.com> wrote:
>>> [ warning: investigation is still ongoing, but I thought I'd report this here.]
>>>
>>> I'm trying to debug the Ev2 shims over ra_dav. In doing so, I've
>>> discovered an inconsistency between ra_serf and ra_neon (surprise!)
>>
>> ra_neon uses a "replay-report" while ra_serf uses an "update-report".
>> The former provides the rev= attribute.
>>
>> I don't know why Neon uses the replay-report instead of the
>> update-report. I dunno what the differences are.
>
> What operations are you using? And why is it different between the two RA runs?
>
> Note: in neon/fetch.c:1845, I see that SVN_INVALID_REVNUM is passed to
> delete_entry(). That happens when ra_neon runs an update-report.
You are correct, this code path uses neon/fetch.c:1845 on the ra_neon
side, not the snippet I cited earlier.
So the information is getting dropped over *both* ra_dav clients, not
just ra_serf. This is still a disconnect from that which is provided
directly to the delete_entry() callback from the repository in
reporter.c:916. This bit of data is getting dropped.
-Hyrum
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/
Re: ra_serf not providing a valid revision to delete_entry() upon update
Posted by Greg Stein <gs...@gmail.com>.
On Mon, Mar 19, 2012 at 18:16, Greg Stein <gs...@gmail.com> wrote:
> On Mon, Mar 19, 2012 at 16:48, Hyrum K Wright <hy...@wandisco.com> wrote:
>> [ warning: investigation is still ongoing, but I thought I'd report this here.]
>>
>> I'm trying to debug the Ev2 shims over ra_dav. In doing so, I've
>> discovered an inconsistency between ra_serf and ra_neon (surprise!)
>
> ra_neon uses a "replay-report" while ra_serf uses an "update-report".
> The former provides the rev= attribute.
>
> I don't know why Neon uses the replay-report instead of the
> update-report. I dunno what the differences are.
What operations are you using? And why is it different between the two RA runs?
Note: in neon/fetch.c:1845, I see that SVN_INVALID_REVNUM is passed to
delete_entry(). That happens when ra_neon runs an update-report.
Cheers,
-g
Re: ra_serf not providing a valid revision to delete_entry() upon update
Posted by Greg Stein <gs...@gmail.com>.
On Mon, Mar 19, 2012 at 16:48, Hyrum K Wright <hy...@wandisco.com> wrote:
> [ warning: investigation is still ongoing, but I thought I'd report this here.]
>
> I'm trying to debug the Ev2 shims over ra_dav. In doing so, I've
> discovered an inconsistency between ra_serf and ra_neon (surprise!)
ra_neon uses a "replay-report" while ra_serf uses an "update-report".
The former provides the rev= attribute.
I don't know why Neon uses the replay-report instead of the
update-report. I dunno what the differences are.
>...
Cheers,
-g
Re: ra_serf not providing a valid revision to delete_entry() upon update
Posted by Hyrum K Wright <hy...@wandisco.com>.
On Mon, Mar 19, 2012 at 3:48 PM, Hyrum K Wright
<hy...@wandisco.com> wrote:
> [ warning: investigation is still ongoing, but I thought I'd report this here.]
>
> I'm trying to debug the Ev2 shims over ra_dav. In doing so, I've
> discovered an inconsistency between ra_serf and ra_neon (surprise!)
>
> ra_neon provides a valid argument for the replaced_rev parameter of
> the Ev1 delete_entry() function. The relevant code is in
> libsvn_ra_neon/replay.c:
>
> 169 const char *path = svn_xml_get_attr_value("name", atts);
> 170 const char *crev = svn_xml_get_attr_value("rev", atts);
> 171
> 172 if (! path)
> 173 return MISSING_ATTR(nspace, elt_name, "name");
> 174 else if (! crev)
> 175 return MISSING_ATTR(nspace, elt_name, "rev");
> 176 else
> 177 {
> 178 dir_item_t *di = &TOP_DIR(rb);
> 179
> 180 SVN_ERR(rb->editor->delete_entry(path, SVN_STR_TO_REV(crev),
> 181 di->baton, di->pool));
> 182 }
> 183 }
> 184 break;
>
> Apparently, ra_neon expects and finds a "rev" attribute on the
> relevant XML element. However, the same code in ra_serf (update.c)
> doesn't:
>
> 1556 else if ((state == OPEN_DIR || state == ADD_DIR) &&
> 1557 strcmp(name.name, "delete-entry") == 0)
> 1558 {
> 1559 const char *file_name;
> 1560 report_info_t *info;
> 1561 apr_pool_t *tmppool;
> 1562 const char *full_path;
> 1563
> 1564 file_name = svn_xml_get_attr_value("name", attrs);
> 1565
> 1566 if (!file_name)
> 1567 {
> 1568 return svn_error_create(
> 1569 SVN_ERR_RA_DAV_MALFORMED_DATA, NULL,
> 1570 _("Missing name attr in delete-entry element"));
> 1571 }
> 1572
> 1573 info = parser->state->private;
> 1574
> 1575 SVN_ERR(open_dir(info->dir));
> 1576
> 1577 tmppool = svn_pool_create(info->dir->dir_baton_pool);
> 1578
> 1579 full_path = svn_relpath_join(info->dir->name, file_name, tmppool);
> 1580
> 1581 SVN_ERR(info->dir->update_editor->delete_entry(full_path,
> 1582 SVN_INVALID_REVNUM,
> 1583 info->dir->dir_baton,
> 1584 tmppool));
> 1585
> 1586 svn_pool_destroy(tmppool);
> 1587 }
>
> As you can see, ra_serf is unconditionally passing SVN_INVALID_REVNUM
> to delete_entry(), which is what is causing the shims to fail over
> ra_dav (when run with ra_serf).
>
> I tried inserting analogous code to fetch the "rev" attribute in
> ra_serf, but it appears that said attribute isn't available. I'm not
> familiar enough with the protocol to know why it would be for ra_neon,
> but not ra_serf, and I'm asking here in the hopes that somebody can
> enlighten me. :)
For the record, the patch I tried was:
[[[
Index: subversion/libsvn_ra_serf/update.c
===================================================================
--- subversion/libsvn_ra_serf/update.c (revision 1302583)
+++ subversion/libsvn_ra_serf/update.c (working copy)
@@ -1557,11 +1557,13 @@
strcmp(name.name, "delete-entry") == 0)
{
const char *file_name;
+ const char *crev;
report_info_t *info;
apr_pool_t *tmppool;
const char *full_path;
file_name = svn_xml_get_attr_value("name", attrs);
+ crev = svn_xml_get_attr_value("rev", attrs);
if (!file_name)
{
@@ -1579,7 +1581,7 @@
full_path = svn_relpath_join(info->dir->name, file_name, tmppool);
SVN_ERR(info->dir->update_editor->delete_entry(full_path,
- SVN_INVALID_REVNUM,
+ SVN_STR_TO_REV(crev),
info->dir->dir_baton,
tmppool));
]]]
-Hyrum
--
uberSVN: Apache Subversion Made Easy
http://www.uberSVN.com/