You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@couchdb.apache.org by "Alexandre Paulo (JIRA)" <ji...@apache.org> on 2012/04/23 17:31:34 UTC
[jira] [Created] (COUCHDB-1469) Filtered replication dies with
criteria values not "root"
Alexandre Paulo created COUCHDB-1469:
----------------------------------------
Summary: Filtered replication dies with criteria values not "root"
Key: COUCHDB-1469
URL: https://issues.apache.org/jira/browse/COUCHDB-1469
Project: CouchDB
Issue Type: Question
Components: Replication
Affects Versions: 1.2
Reporter: Alexandre Paulo
Priority: Minor
<< Excuse my english... I am portuguese >>
I have a document structure that goes like this:
{
"Location": {
"City": ...,
"Region": ...,
"Country": ...
}
}
I'd like to replicate my documents based on "Region", so, I wrote a filter function with
if (doc.Location.Region && doc.Location.Region == ...) {
return true;
} else {
return false;
}
But the replication dies with {"error":"changes_reader_died"}
I tested my function as a Map function on a view, just replacion "return true" with "emit (true)" and "return false" with "emit (false)" and it works fine.
After some testing I came to the conclusion that the replication filter function works fine with first-level fields (e.g. "doc.field") but dies with multi-level fields (e.g. "doc.parent.field")
In other words it does not compute "doc.Location.Region" on my filter function. I had to change my document structure to have "doc.Region".
Now my questions:
- is this a bug or is it intended to work this way?
- if it is intended why is it allowed on Map functions, but not on filter functions?
Thanks a lot!
<< Excuse my english... I am portuguese >>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1469) Filtered replication dies with
criteria values not "root"
Posted by "Alexandre Paulo (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259714#comment-13259714 ]
Alexandre Paulo commented on COUCHDB-1469:
------------------------------------------
Ups...
I feel like a n00b.
I did that and it works fine.
Now I am checking every branch of the tree :)
Thanks a lot
> Filtered replication dies with criteria values not "root"
> ---------------------------------------------------------
>
> Key: COUCHDB-1469
> URL: https://issues.apache.org/jira/browse/COUCHDB-1469
> Project: CouchDB
> Issue Type: Question
> Components: Replication
> Affects Versions: 1.2
> Reporter: Alexandre Paulo
> Priority: Minor
> Labels: replication, replication_crash_with_filter
>
> << Excuse my english... I am portuguese >>
> I have a document structure that goes like this:
> {
> "Location": {
> "City": ...,
> "Region": ...,
> "Country": ...
> }
> }
> I'd like to replicate my documents based on "Region", so, I wrote a filter function with
> if (doc.Location.Region && doc.Location.Region == ...) {
> return true;
> } else {
> return false;
> }
> But the replication dies with {"error":"changes_reader_died"}
> I tested my function as a Map function on a view, just replacion "return true" with "emit (true)" and "return false" with "emit (false)" and it works fine.
> After some testing I came to the conclusion that the replication filter function works fine with first-level fields (e.g. "doc.field") but dies with multi-level fields (e.g. "doc.parent.field")
> In other words it does not compute "doc.Location.Region" on my filter function. I had to change my document structure to have "doc.Region".
> Now my questions:
> - is this a bug or is it intended to work this way?
> - if it is intended why is it allowed on Map functions, but not on filter functions?
> Thanks a lot!
> << Excuse my english... I am portuguese >>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Closed] (COUCHDB-1469) Filtered replication dies with
criteria values not "root"
Posted by "Alexandre Paulo (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1469?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Alexandre Paulo closed COUCHDB-1469.
------------------------------------
Resolution: Not A Problem
> Filtered replication dies with criteria values not "root"
> ---------------------------------------------------------
>
> Key: COUCHDB-1469
> URL: https://issues.apache.org/jira/browse/COUCHDB-1469
> Project: CouchDB
> Issue Type: Question
> Components: Replication
> Affects Versions: 1.2
> Reporter: Alexandre Paulo
> Priority: Minor
> Labels: replication, replication_crash_with_filter
>
> << Excuse my english... I am portuguese >>
> I have a document structure that goes like this:
> {
> "Location": {
> "City": ...,
> "Region": ...,
> "Country": ...
> }
> }
> I'd like to replicate my documents based on "Region", so, I wrote a filter function with
> if (doc.Location.Region && doc.Location.Region == ...) {
> return true;
> } else {
> return false;
> }
> But the replication dies with {"error":"changes_reader_died"}
> I tested my function as a Map function on a view, just replacion "return true" with "emit (true)" and "return false" with "emit (false)" and it works fine.
> After some testing I came to the conclusion that the replication filter function works fine with first-level fields (e.g. "doc.field") but dies with multi-level fields (e.g. "doc.parent.field")
> In other words it does not compute "doc.Location.Region" on my filter function. I had to change my document structure to have "doc.Region".
> Now my questions:
> - is this a bug or is it intended to work this way?
> - if it is intended why is it allowed on Map functions, but not on filter functions?
> Thanks a lot!
> << Excuse my english... I am portuguese >>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1469) Filtered replication dies with
criteria values not "root"
Posted by "Dave Cottlehuber (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259766#comment-13259766 ]
Dave Cottlehuber commented on COUCHDB-1469:
-------------------------------------------
In this and a number of other areas such as view/filter/changes/replication, logging the doc.id that fails or generates an exception would be handy. Thoughts?
> Filtered replication dies with criteria values not "root"
> ---------------------------------------------------------
>
> Key: COUCHDB-1469
> URL: https://issues.apache.org/jira/browse/COUCHDB-1469
> Project: CouchDB
> Issue Type: Question
> Components: Replication
> Affects Versions: 1.2
> Reporter: Alexandre Paulo
> Priority: Minor
> Labels: replication, replication_crash_with_filter
>
> << Excuse my english... I am portuguese >>
> I have a document structure that goes like this:
> {
> "Location": {
> "City": ...,
> "Region": ...,
> "Country": ...
> }
> }
> I'd like to replicate my documents based on "Region", so, I wrote a filter function with
> if (doc.Location.Region && doc.Location.Region == ...) {
> return true;
> } else {
> return false;
> }
> But the replication dies with {"error":"changes_reader_died"}
> I tested my function as a Map function on a view, just replacion "return true" with "emit (true)" and "return false" with "emit (false)" and it works fine.
> After some testing I came to the conclusion that the replication filter function works fine with first-level fields (e.g. "doc.field") but dies with multi-level fields (e.g. "doc.parent.field")
> In other words it does not compute "doc.Location.Region" on my filter function. I had to change my document structure to have "doc.Region".
> Now my questions:
> - is this a bug or is it intended to work this way?
> - if it is intended why is it allowed on Map functions, but not on filter functions?
> Thanks a lot!
> << Excuse my english... I am portuguese >>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (COUCHDB-1469) Filtered replication dies with
criteria values not "root"
Posted by "Robert Newson (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/COUCHDB-1469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13259679#comment-13259679 ]
Robert Newson commented on COUCHDB-1469:
----------------------------------------
You'll be getting an exception for each doc that doesn't have a doc.Location. You should add guard clauses;
function(doc, req) {
return doc.Location && doc.Location.Region && doc.Location.Region === req.query.region;
}
http://wiki.apache.org/couchdb/Replication#Filtered_Replication
> Filtered replication dies with criteria values not "root"
> ---------------------------------------------------------
>
> Key: COUCHDB-1469
> URL: https://issues.apache.org/jira/browse/COUCHDB-1469
> Project: CouchDB
> Issue Type: Question
> Components: Replication
> Affects Versions: 1.2
> Reporter: Alexandre Paulo
> Priority: Minor
> Labels: replication, replication_crash_with_filter
>
> << Excuse my english... I am portuguese >>
> I have a document structure that goes like this:
> {
> "Location": {
> "City": ...,
> "Region": ...,
> "Country": ...
> }
> }
> I'd like to replicate my documents based on "Region", so, I wrote a filter function with
> if (doc.Location.Region && doc.Location.Region == ...) {
> return true;
> } else {
> return false;
> }
> But the replication dies with {"error":"changes_reader_died"}
> I tested my function as a Map function on a view, just replacion "return true" with "emit (true)" and "return false" with "emit (false)" and it works fine.
> After some testing I came to the conclusion that the replication filter function works fine with first-level fields (e.g. "doc.field") but dies with multi-level fields (e.g. "doc.parent.field")
> In other words it does not compute "doc.Location.Region" on my filter function. I had to change my document structure to have "doc.Region".
> Now my questions:
> - is this a bug or is it intended to work this way?
> - if it is intended why is it allowed on Map functions, but not on filter functions?
> Thanks a lot!
> << Excuse my english... I am portuguese >>
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira