You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by "Robert Newson (JIRA)" <ji...@apache.org> on 2016/03/26 14:18:25 UTC

[jira] [Resolved] (COUCHDB-2900) CouchDB 2.0: raw collation order is not respected when a database has multiple shards

     [ https://issues.apache.org/jira/browse/COUCHDB-2900?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Robert Newson resolved COUCHDB-2900.
------------------------------------
    Resolution: Fixed

> CouchDB 2.0: raw collation order is not respected when a database has multiple shards
> -------------------------------------------------------------------------------------
>
>                 Key: COUCHDB-2900
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-2900
>             Project: CouchDB
>          Issue Type: Bug
>          Components: View Server Support
>            Reporter: Will Holley
>            Priority: Blocker
>              Labels: regression
>             Fix For: 2.0.0
>
>
> In CouchDB 1.X, specifying raw collation in a view definition changes the result order:
> {code}
> $ curl http://localhost:5984/nullsort -XPUT
> {"ok":true}
> $ curl http://localhost:5984/nullsort/_bulk_docs -XPOST -H'Content-Type:application/json' -d '{"docs":[{"test":1},{"test":null}]}'
> [{"ok":true,"id":"a9f86d3c33d25c15de6eca8578001d98","rev":"1-ea7a185b492abc69a6c8e0358d244a98"},{"ok":true,"id":"a9f86d3c33d25c15de6eca8578002c25","rev":"1-9b2a5b981a9dd0ad1b3a3e826498e9bb"}]
> $ curl http://localhost:5984/nullsort -XPOST -H'Content-Type:application/json' -d '{"_id": "_design/test","views":{"nullsort":{"map": "function (doc) {emit(doc.test, 1);}","options":{"collation": "raw"}}}}'
> {"ok":true,"id":"_design/test","rev":"1-2df3ab52426a7138b6898791024595d0"}
> $ curl http://localhost:5984/nullsort/_design/test/_view/nullsort
> {"total_rows":2,"offset":0,"rows":[
> {"id":"a9f86d3c33d25c15de6eca8578001d98","key":1,"value":1},
> {"id":"a9f86d3c33d25c15de6eca8578002c25","key":null,"value":1}
> ]}
> {code}
> In CouchDB 2.0, with n=1, q=4:
> {code}
> $ curl http://localhost:15984/nullsort -XPUT
> {"ok":true}
> $ curl http://localhost:15984/nullsort/_bulk_docs -XPOST -H'Content-Type:application/json' -d '{"docs":[{"test":1},{"test":null}]}'
> [{"ok":true,"id":"51cf4c5a56f86f524b0e36f52800029d","rev":"1-ea7a185b492abc69a6c8e0358d244a98"},{"ok":true,"id":"51cf4c5a56f86f524b0e36f528000d9c","rev":"1-9b2a5b981a9dd0ad1b3a3e826498e9bb"}]
> $ curl http://localhost:15984/nullsort -XPOST -H'Content-Type:application/json' -d '{"_id": "_design/test","views":{"nullsort":{"map": "function (doc) {emit(doc.test, 1);}","options":{"collation": "raw"}}}}'
> {"ok":true,"id":"_design/test","rev":"1-2df3ab52426a7138b6898791024595d0"}
> $ curl http://localhost:15984/nullsort/_design/test/_view/nullsort
> {"total_rows":2,"offset":0,"rows":[
> {"id":"51cf4c5a56f86f524b0e36f528000d9c","key":null,"value":1},
> {"id":"51cf4c5a56f86f524b0e36f52800029d","key":1,"value":1}
> ]}
> {code}
> Note that null is returned before 1.
> If q=1, the ordering matches CouchDB 1.X



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)