You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ra...@apache.org on 2011/11/09 11:07:20 UTC

[5/5] git commit: fix improper comparison on filtered changes

fix improper comparison on filtered changes

Regression caught by the changes js test.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/6213d064
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/6213d064
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/6213d064

Branch: refs/heads/master
Commit: 6213d064ef2467be9e6673df0fa71ffa9821ba4a
Parents: 866769f
Author: Randall Leeds <ra...@apache.org>
Authored: Wed Nov 9 01:16:36 2011 -0800
Committer: Randall Leeds <ra...@apache.org>
Committed: Wed Nov 9 01:40:56 2011 -0800

----------------------------------------------------------------------
 src/couchdb/couch_changes.erl |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/6213d064/src/couchdb/couch_changes.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_changes.erl b/src/couchdb/couch_changes.erl
index ab95481..267f3d7 100644
--- a/src/couchdb/couch_changes.erl
+++ b/src/couchdb/couch_changes.erl
@@ -328,7 +328,7 @@ send_lookup_changes(FullDocInfos, StartSeq, Dir, Db, Fun, Acc0) ->
     end,
     GreaterFun = case Dir of
     fwd ->
-        fun(A, B) -> A >= B end;
+        fun(A, B) -> A > B end;
     rev ->
         fun(A, B) -> A =< B end
     end,


Re: [5/5] git commit: fix improper comparison on filtered changes

Posted by Filipe David Manana <fd...@apache.org>.
On Wed, Nov 9, 2011 at 6:43 PM, Randall Leeds <ra...@gmail.com> wrote:
> On Wed, Nov 9, 2011 at 02:51, Filipe David Manana <fd...@apache.org> wrote:
>> Randall, which test exactly was failing in changes.js?
>
> It was the "andmore-only" section near the end:
> T(line.seq == 8)
> T(line.id == "andmore")
>
> The problem is that seq _should_ be strictly greater than since.
> If you look at couch_db:changes_since/5 and related functions, that
> module adds one to the sequence number in order to get this behavior.
> Only when using filters was this broken and became >=.

I think you're right. Looking at the test it seems it should always
fail, maybe I add a browser cache issue.

>
>>
>> I've never had such failure locally. If it's due to browser caching,
>> it would be a good idea to add a test to test/etap/073-changes.t
>
> I can add an etap test. I'm positive it's not browser caching because
> I identified and fixed it. Also, because I just committed a change to
> improve Futon's browser caching :).

Great! :)

>
>>
>> On Wed, Nov 9, 2011 at 10:07 AM,  <ra...@apache.org> wrote:
>>> fix improper comparison on filtered changes
>>>
>>> Regression caught by the changes js test.
>>>
>>>
>>> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
>>> Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/6213d064
>>> Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/6213d064
>>> Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/6213d064
>>>
>>> Branch: refs/heads/master
>>> Commit: 6213d064ef2467be9e6673df0fa71ffa9821ba4a
>>> Parents: 866769f
>>> Author: Randall Leeds <ra...@apache.org>
>>> Authored: Wed Nov 9 01:16:36 2011 -0800
>>> Committer: Randall Leeds <ra...@apache.org>
>>> Committed: Wed Nov 9 01:40:56 2011 -0800
>>>
>>> ----------------------------------------------------------------------
>>>  src/couchdb/couch_changes.erl |    2 +-
>>>  1 files changed, 1 insertions(+), 1 deletions(-)
>>> ----------------------------------------------------------------------
>>>
>>>
>>> http://git-wip-us.apache.org/repos/asf/couchdb/blob/6213d064/src/couchdb/couch_changes.erl
>>> ----------------------------------------------------------------------
>>> diff --git a/src/couchdb/couch_changes.erl b/src/couchdb/couch_changes.erl
>>> index ab95481..267f3d7 100644
>>> --- a/src/couchdb/couch_changes.erl
>>> +++ b/src/couchdb/couch_changes.erl
>>> @@ -328,7 +328,7 @@ send_lookup_changes(FullDocInfos, StartSeq, Dir, Db, Fun, Acc0) ->
>>>     end,
>>>     GreaterFun = case Dir of
>>>     fwd ->
>>> -        fun(A, B) -> A >= B end;
>>> +        fun(A, B) -> A > B end;
>>>     rev ->
>>>         fun(A, B) -> A =< B end
>>>     end,
>>>
>>>
>>
>>
>>
>> --
>> 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."
>>
>



-- 
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."

Re: [5/5] git commit: fix improper comparison on filtered changes

Posted by Randall Leeds <ra...@gmail.com>.
On Wed, Nov 9, 2011 at 02:51, Filipe David Manana <fd...@apache.org> wrote:
> Randall, which test exactly was failing in changes.js?

It was the "andmore-only" section near the end:
T(line.seq == 8)
T(line.id == "andmore")

The problem is that seq _should_ be strictly greater than since.
If you look at couch_db:changes_since/5 and related functions, that
module adds one to the sequence number in order to get this behavior.
Only when using filters was this broken and became >=.

>
> I've never had such failure locally. If it's due to browser caching,
> it would be a good idea to add a test to test/etap/073-changes.t

I can add an etap test. I'm positive it's not browser caching because
I identified and fixed it. Also, because I just committed a change to
improve Futon's browser caching :).

>
> On Wed, Nov 9, 2011 at 10:07 AM,  <ra...@apache.org> wrote:
>> fix improper comparison on filtered changes
>>
>> Regression caught by the changes js test.
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/6213d064
>> Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/6213d064
>> Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/6213d064
>>
>> Branch: refs/heads/master
>> Commit: 6213d064ef2467be9e6673df0fa71ffa9821ba4a
>> Parents: 866769f
>> Author: Randall Leeds <ra...@apache.org>
>> Authored: Wed Nov 9 01:16:36 2011 -0800
>> Committer: Randall Leeds <ra...@apache.org>
>> Committed: Wed Nov 9 01:40:56 2011 -0800
>>
>> ----------------------------------------------------------------------
>>  src/couchdb/couch_changes.erl |    2 +-
>>  1 files changed, 1 insertions(+), 1 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/couchdb/blob/6213d064/src/couchdb/couch_changes.erl
>> ----------------------------------------------------------------------
>> diff --git a/src/couchdb/couch_changes.erl b/src/couchdb/couch_changes.erl
>> index ab95481..267f3d7 100644
>> --- a/src/couchdb/couch_changes.erl
>> +++ b/src/couchdb/couch_changes.erl
>> @@ -328,7 +328,7 @@ send_lookup_changes(FullDocInfos, StartSeq, Dir, Db, Fun, Acc0) ->
>>     end,
>>     GreaterFun = case Dir of
>>     fwd ->
>> -        fun(A, B) -> A >= B end;
>> +        fun(A, B) -> A > B end;
>>     rev ->
>>         fun(A, B) -> A =< B end
>>     end,
>>
>>
>
>
>
> --
> 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."
>

Re: [5/5] git commit: fix improper comparison on filtered changes

Posted by Filipe David Manana <fd...@apache.org>.
Randall, which test exactly was failing in changes.js?

I've never had such failure locally. If it's due to browser caching,
it would be a good idea to add a test to test/etap/073-changes.t

On Wed, Nov 9, 2011 at 10:07 AM,  <ra...@apache.org> wrote:
> fix improper comparison on filtered changes
>
> Regression caught by the changes js test.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
> Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/6213d064
> Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/6213d064
> Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/6213d064
>
> Branch: refs/heads/master
> Commit: 6213d064ef2467be9e6673df0fa71ffa9821ba4a
> Parents: 866769f
> Author: Randall Leeds <ra...@apache.org>
> Authored: Wed Nov 9 01:16:36 2011 -0800
> Committer: Randall Leeds <ra...@apache.org>
> Committed: Wed Nov 9 01:40:56 2011 -0800
>
> ----------------------------------------------------------------------
>  src/couchdb/couch_changes.erl |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/couchdb/blob/6213d064/src/couchdb/couch_changes.erl
> ----------------------------------------------------------------------
> diff --git a/src/couchdb/couch_changes.erl b/src/couchdb/couch_changes.erl
> index ab95481..267f3d7 100644
> --- a/src/couchdb/couch_changes.erl
> +++ b/src/couchdb/couch_changes.erl
> @@ -328,7 +328,7 @@ send_lookup_changes(FullDocInfos, StartSeq, Dir, Db, Fun, Acc0) ->
>     end,
>     GreaterFun = case Dir of
>     fwd ->
> -        fun(A, B) -> A >= B end;
> +        fun(A, B) -> A > B end;
>     rev ->
>         fun(A, B) -> A =< B end
>     end,
>
>



-- 
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."