couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Robert Newson <rnew...@apache.org>
Subject Re: possible replication issue
Date Thu, 09 Feb 2012 12:27:09 GMT
First, I acknowledge I'm wandering in halfway on this topic, however I
don't much like the idea of baking BC knowledge into couchdb. The
sequence value in all versions of couchdb and bigcouch are valid JSON,
it's either a number, a string or an array. CouchDB prior to 1.2.x was
agnostic to this and 1.2 should be too.

On 9 February 2012 12:15, Bob Dionne <dionne@dionne-associates.com> wrote:
> Filipe,
>
> That seems to work fine[1]. I've tried it on both the 1.2.x and master branches and it
works with bigcouch-0.4
>
> Cheers,
>
> Bob
>
> [1] https://gist.github.com/1779568
>
> On Feb 8, 2012, at 8:52 PM, Bob Dionne wrote:
>
>> Filipe,
>>
>> couch_replicator_api_wrap does like the best place to do this. I'll try this out
in the morning and let you know.
>>
>> Thanks also for the explanation about query_args_to_string. Makes sense.
>>
>> Best,
>>
>> Bob
>>
>> On Feb 8, 2012, at 6:20 PM, Filipe David Manana wrote:
>>
>>> On Wed, Feb 8, 2012 at 9:31 PM, Bob Dionne <dionne@dionne-associates.com>
wrote:
>>>> Hi Filipe,
>>>>
>>>> I ran into a possible issue replicating from BC 0.4 to CouchDB 1.2.x (someone
needs to verify this is a problem and not my local setup).
>>>>
>>>> The issue seems to be the treatment of sequence numbers like [2,<<"foo">>].
The latest in 1.2.x of couch_replicator_httpc:send_req runs ?b2l(iolist_to_binary(...)) over
that seq and eventually full_url trundles on down to mochiweb_util:quote_plus which loses
the brackets and converts the 2 to a %02
>>>
>>> Hi Bob,
>>>
>>> I'm assuming this is related to _changes feed request "since" parameter.
>>> In general, couch_replicator_httpc doesn't do query parameter value
>>> encoding (other then percent encoding), that task is left to
>>> couch_replicator_api_wrap.erl - for e.g. some requests require JSON
>>> encoded values, like open_revs for doc GETs, and others not, like the
>>> feed parameter for _changes.
>>>
>>> If it applies only for that request, I would go for something less
>>> abstract like (untested) for example:
>>>
>>> http://friendpaste.com/6aWgbQaBjMeR9pIshWr5rl
>>>
>>> And you can't replace the list comprehension in couch_replicator_httpc
>>> because there the goal is only to make sure the values are
>>> lists/strings - when OAuth auth is used, the OAuth signature must be
>>> computed with the query parameter values unencoded and as
>>> strings/lists - percent encoding must happen after computing the OAuth
>>> signature.
>>>
>>> regards,
>>>
>>>>
>>>> I can get around this [1] by converting [2,<<"foo">>] to "2-foo"
which is the old format, but this is clearly a workaround. Perhaps this should be fixed in
mochiweb_util ?
>>>>
>>>> As an aside I noticed mochiweb_util:urlencode  does exactly what you have
in query_to_str_args so those funs can probably go away.
>>>>
>>>> Cheers,
>>>>
>>>> Bob
>>>>
>>>> [1] https://gist.github.com/1772911
>>>
>>>
>>>
>>> --
>>> Filipe David Manana,
>>>
>>> "Reasonable men adapt themselves to the world.
>>> Unreasonable men adapt the world to themselves.
>>> That's why all progress depends on unreasonable men."
>>
>

Mime
View raw message