You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Jason Davies (JIRA)" <ji...@apache.org> on 2009/01/05 14:39:44 UTC

[jira] Created: (COUCHDB-196) Bug in _all_docs when en_GB.UTF-8 locale is used: extra incorrect row returned when key is specified

Bug in _all_docs when en_GB.UTF-8 locale is used: extra incorrect row returned when key is specified
----------------------------------------------------------------------------------------------------

                 Key: COUCHDB-196
                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
             Project: CouchDB
          Issue Type: Bug
          Components: HTTP Interface
            Reporter: Jason Davies
         Attachments: collation_test.diff

I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.

After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".

I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which is probably related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by "Bob Dionne (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bob Dionne updated COUCHDB-196:
-------------------------------

    Attachment: view_coll.js

smaller test case that fails

> Bug in _all_docs: extra incorrect row returned when ?key= is specified
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_ids.diff, collation_test.2.diff, collation_test.diff, view_coll.js
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by "Chris Anderson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Anderson updated COUCHDB-196:
-----------------------------------

    Attachment: docid_collation.diff

Thanks for looking into this guys - here's the patch I'm showing to Damien before applying.

The only substantial difference is more testing. (I'm using less_json in the updater)

> Bug in _all_docs: extra incorrect row returned when ?key= is specified
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_ids.diff, collation_test.2.diff, collation_test.diff, couch_db_updater.diff, docid_collation.diff, view_coll.js
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by "Adam Kocoloski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662439#action_12662439 ] 

Adam Kocoloski commented on COUCHDB-196:
----------------------------------------

Hi Chris, I just caught the end of your discussion on IRC.  This seems like a reasonable compromise, although I haven't seen any numbers on Couch's ICU collation performance so I can't say whether it would make a noticeable difference.

> Bug in _all_docs: extra incorrect row returned when ?key= is specified
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_ids.diff, collation_test.2.diff, collation_test.diff, couch_db_updater.diff, docid_collation.diff, view_coll.js
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by "Bob Dionne (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12661974#action_12661974 ] 

Bob Dionne commented on COUCHDB-196:
------------------------------------

attached is a simpler test case that exhibits the bug. I stepped into this a bit in a debugger. The AdapterFun (line#-288 in couch_httpd_db) is called twice with oth records "Z" and "a", which the debug statements already confirm. Not too up on the code yet so I'm not sure if it's in couch_httpd_view:make_view_fold_fun or couch_db:enum_docs.  Here's what the state looks like the first time through:

http://gist.github.com/44721



> Bug in _all_docs: extra incorrect row returned when ?key= is specified
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_ids.diff, collation_test.2.diff, collation_test.diff
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by "Chris Anderson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Anderson resolved COUCHDB-196.
------------------------------------

    Resolution: Fixed

Resolved by r733116.

Docids do not use the same collation as string view keys, so the _all_docs view was getting endkeys wrong. Fixed so that all_doc uses the same comparison as doc insertion to handle endkeys.

> Bug in _all_docs: extra incorrect row returned when ?key= is specified
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_ids.diff, collation_test.2.diff, collation_test.diff, couch_db_updater.diff, docid_collation.diff, view_coll.js
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by Robert Dionne <di...@dionne-associates.com>.
Adam,

   I'm not sure it is identical though it looks to be. I definitely  
would replace it as you suggest if only to simplify the code. I just  
posted this to give Chris a place to start and hopefully something  
towards the answer. I'm sure sure there are not other places that  
also need to change.

   Thanks for noticing those glitches in the test cases, I was so  
thick in it I wouldn't have thought my solution was exposing  
something there, I just assumed I was wrong. Can't beat eyeballs

    It's a very nice piece of Elang code. I'm enjoying learning it.

Cheers,

Bob


On Jan 8, 2009, at 10:36 PM, Adam Kocoloski (JIRA) wrote:

>
>     [ https://issues.apache.org/jira/browse/COUCHDB-196? 
> page=com.atlassian.jira.plugin.system.issuetabpanels:comment- 
> tabpanel&focusedCommentId=12662235#action_12662235 ]
>
> Adam Kocoloski commented on COUCHDB-196:
> ----------------------------------------
>
> Hi Bob, thanks for looking into this.  I'd argue for replacing that  
> entire function with couch_view:less_json/2
>
> diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/ 
> couch_db_updater.erl
> index 049a354..38885f8 100644
> --- a/src/couchdb/couch_db_updater.erl
> +++ b/src/couchdb/couch_db_updater.erl
> @@ -253,13 +253,8 @@ init_db(DbName, Filepath, Fd, Header0) ->
>      Header = simple_upgrade_record(Header0, #db_header{}),
>      {ok, SummaryStream} = couch_stream:open 
> (Header#db_header.summary_stream_state, Fd),
>      ok = couch_stream:set_min_buffer(SummaryStream, 10000),
> -    Less =
> -        fun(A,B) when A==B -> false;
> -        (nil, _) -> true; % nil - special key sorts before all
> -        ({}, _) -> false; % {} -> special key sorts after all
> -        (A, B) -> A < B
> -        end,
> -
> +    Less = fun couch_view:less_json/2,
> +
>      {ok, IdBtree} = couch_btree:open 
> (Header#db_header.fulldocinfo_by_id_btree_state, Fd,
>          [{split, fun(X) -> btree_by_id_split(X) end},
>          {join, fun(X,Y) -> btree_by_id_join(X,Y) end},
>
>
> The DB behavior seems to be the same either way, and the fewer  
> places we have this collaction algorithm coded up the better.  I  
> looked into the 2 test suite failures that show up as a result of  
> applying either of these patches.  The failure in design docs  
> occurs because the test suite expects to find the document "_design/ 
> test" in the _all_docs view between "_design%2F" and "_design% 
> 2FZZZ".  That expectation is erroneous.  I'm not sure why it worked  
> before.
>
> The second failure occurs in view_include_docs where an _all_docs  
> view is queried with limit=2&skip=1.  In the trunk code _design  
> docs sort after docs with stringified integers for ids.  Your patch  
> causes the _design docs to sort first, which I believe is the  
> correct behavior.  Again, the test suite's expectation is probably  
> wrong.
>
>
>> Bug in _all_docs: extra incorrect row returned when ?key= is  
>> specified
>> --------------------------------------------------------------------- 
>> -
>>
>>                 Key: COUCHDB-196
>>                 URL: https://issues.apache.org/jira/browse/ 
>> COUCHDB-196
>>             Project: CouchDB
>>          Issue Type: Bug
>>          Components: HTTP Interface
>>            Reporter: Jason Davies
>>         Attachments: collation_ids.diff, collation_test.2.diff,  
>> collation_test.diff, couch_db_updater.diff, view_coll.js
>>
>>
>> I first noticed this when attempting to reverse the order of docs  
>> displayed in Futon, when listing the design docs.  When the order  
>> is reversed, non-design docs are displayed.
>> After digging deeper I discovered that querying _all_docs with  
>> key="Z" can potentially return two rows, with keys "Z" and "a".
>> I will attach a test case to reproduce this.  My locale is set to  
>> en_GB.UTF-8, which could be related to this problem.
>
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>


[jira] Commented: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by "Adam Kocoloski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662235#action_12662235 ] 

Adam Kocoloski commented on COUCHDB-196:
----------------------------------------

Hi Bob, thanks for looking into this.  I'd argue for replacing that entire function with couch_view:less_json/2

diff --git a/src/couchdb/couch_db_updater.erl b/src/couchdb/couch_db_updater.erl
index 049a354..38885f8 100644
--- a/src/couchdb/couch_db_updater.erl
+++ b/src/couchdb/couch_db_updater.erl
@@ -253,13 +253,8 @@ init_db(DbName, Filepath, Fd, Header0) ->
     Header = simple_upgrade_record(Header0, #db_header{}),
     {ok, SummaryStream} = couch_stream:open(Header#db_header.summary_stream_state, Fd),
     ok = couch_stream:set_min_buffer(SummaryStream, 10000),
-    Less =
-        fun(A,B) when A==B -> false;
-        (nil, _) -> true; % nil - special key sorts before all
-        ({}, _) -> false; % {} -> special key sorts after all
-        (A, B) -> A < B
-        end,
-            
+    Less = fun couch_view:less_json/2,
+    
     {ok, IdBtree} = couch_btree:open(Header#db_header.fulldocinfo_by_id_btree_state, Fd,
         [{split, fun(X) -> btree_by_id_split(X) end},
         {join, fun(X,Y) -> btree_by_id_join(X,Y) end},


The DB behavior seems to be the same either way, and the fewer places we have this collaction algorithm coded up the better.  I looked into the 2 test suite failures that show up as a result of applying either of these patches.  The failure in design docs occurs because the test suite expects to find the document "_design/test" in the _all_docs view between "_design%2F" and "_design%2FZZZ".  That expectation is erroneous.  I'm not sure why it worked before.

The second failure occurs in view_include_docs where an _all_docs view is queried with limit=2&skip=1.  In the trunk code _design docs sort after docs with stringified integers for ids.  Your patch causes the _design docs to sort first, which I believe is the correct behavior.  Again, the test suite's expectation is probably wrong.


> Bug in _all_docs: extra incorrect row returned when ?key= is specified
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_ids.diff, collation_test.2.diff, collation_test.diff, couch_db_updater.diff, view_coll.js
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-196) Bug in _all_docs when en_GB.UTF-8 locale is used: extra incorrect row returned when key is specified

Posted by "Jason Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jason Davies updated COUCHDB-196:
---------------------------------

    Attachment: collation_test.diff

Test for _all_docs that fails in my environment.

> Bug in _all_docs when en_GB.UTF-8 locale is used: extra incorrect row returned when key is specified
> ----------------------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_test.diff
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which is probably related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by "Jason Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jason Davies updated COUCHDB-196:
---------------------------------

    Attachment: collation_test.2.diff

Updated patch without extraneous console.log() statement.

> Bug in _all_docs: extra incorrect row returned when ?key= is specified
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_test.2.diff, collation_test.diff
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by "Chris Anderson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12662436#action_12662436 ] 

Chris Anderson commented on COUCHDB-196:
----------------------------------------

After discussing with Damien, it seems the issue is more subtle than we'd appreciated.

All-docs will continue to use Erlang binary comparisons instead of unicode collation. This is a tradeoff as write-speed is more important than human-friendly all-docs ordering.

However, the current system has a bug, which is that the all-docs http api is trying to use unicode collation on the endkeys, when it should be using binary comparisons. The fix should be relatively simple, but won't yield the exact same behavior for the list of docs as it does for the list of view keys.

> Bug in _all_docs: extra incorrect row returned when ?key= is specified
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_ids.diff, collation_test.2.diff, collation_test.diff, couch_db_updater.diff, docid_collation.diff, view_coll.js
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by "Jason Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jason Davies updated COUCHDB-196:
---------------------------------

    Description: 
I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.

After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".

I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

  was:
I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.

After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".

I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which is probably related to this problem.

        Summary: Bug in _all_docs: extra incorrect row returned when ?key= is specified  (was: Bug in _all_docs when en_GB.UTF-8 locale is used: extra incorrect row returned when key is specified)

Removed locale from title of bug as the test case failed for rboyd too, who has the en_US locale.  The non-design-doc problem occurred for him as well.

> Bug in _all_docs: extra incorrect row returned when ?key= is specified
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_test.diff
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by "Chris Anderson (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Chris Anderson updated COUCHDB-196:
-----------------------------------

    Attachment: collation_ids.diff

I've attached another patch (really just a snapshot of my working setup, with debug logging in the erl files and console.log in the tests)

It does indeed seem that collation by id is playing by different rules than collation by view key. I'm not done investigating this yet, but I agree, we should get to the bottom of it.

> Bug in _all_docs: extra incorrect row returned when ?key= is specified
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_ids.diff, collation_test.2.diff, collation_test.diff
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (COUCHDB-196) Bug in _all_docs: extra incorrect row returned when ?key= is specified

Posted by "Bob Dionne (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/COUCHDB-196?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bob Dionne updated COUCHDB-196:
-------------------------------

    Attachment: couch_db_updater.diff

This patch changes the use of A < B to couch_util:collate  which seems to fix the collation issue. It breaks a couple of other tests which need to be reviewed for correctness.

The main issue is that using A < B  fails for <<"a">> and <<"Z">>

> Bug in _all_docs: extra incorrect row returned when ?key= is specified
> ----------------------------------------------------------------------
>
>                 Key: COUCHDB-196
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-196
>             Project: CouchDB
>          Issue Type: Bug
>          Components: HTTP Interface
>            Reporter: Jason Davies
>         Attachments: collation_ids.diff, collation_test.2.diff, collation_test.diff, couch_db_updater.diff, view_coll.js
>
>
> I first noticed this when attempting to reverse the order of docs displayed in Futon, when listing the design docs.  When the order is reversed, non-design docs are displayed.
> After digging deeper I discovered that querying _all_docs with key="Z" can potentially return two rows, with keys "Z" and "a".
> I will attach a test case to reproduce this.  My locale is set to en_GB.UTF-8, which could be related to this problem.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.