You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Ronan Jouchet <ro...@cadensimaging.com> on 2016/01/13 20:43:37 UTC

Clarifications on CouchDB "index disabling" behavior on view errors/exceptions

Hi.

The CouchDB Guide ( http://guide.couchdb.org/draft/tour.html ) mentions 
that:
> when a map function fails regularly (due to a missing required field
> or other JavaScript exception), CouchDB shuts off its indexing to
> prevent any further resource usage

But neither the official doc, nor my Google-fu could provide details:

1. Is this still true as of CouchDB 1.6.1 / 2.0alpha?

2. Which JS errors/exceptions cause a view to be "disabled", exactly?

2.a. In particular, just accessing a non-existent key of a `doc` object
      is not considered an error, right? It evaluates to `undefined`
      faithfully to vanilla JS behavior, correct? Said differently,
          `if (doc.species && doc.species === 'human')`
      is equivalent to:
          `if (doc.species === 'human')` , right?

3. How can I "re-enable" a "disabled" view?

Thanks :)

-- 
Ronan

Re: Clarifications on CouchDB "index disabling" behavior on view errors/exceptions

Posted by Ronan Jouchet <ro...@cadensimaging.com>.
Hi Robert.

Good to know! I created oreilly/couchdb-guide#pr549, "tour.html: remove 
false claim that engine "shuts off indexing" on view errors":
https://github.com/oreilly/couchdb-guide/pull/549

Additional comments/knowledge welcome there. Also, moving this thread to 
couchdb-dev, as it'd benefit from developer confirmation/refutation.

Thanks.

Ronan

On 01/13/2016 06:05 PM, Robert Samuel Newson wrote:
> Hi,
>
> Interesting find. I don’t believe this was ever true, the view engine
> will continue to build in the face of exceptions being thrown for
> every single document it encounters.
>
> B.
>
>> On 13 Jan 2016, at 19:43, Ronan Jouchet
>> <ro...@cadensimaging.com> wrote:
>>
>> Hi.
>>
>> The CouchDB Guide ( http://guide.couchdb.org/draft/tour.html )
>> mentions that:
>>> when a map function fails regularly (due to a missing required
>>> field or other JavaScript exception), CouchDB shuts off its
>>> indexing to prevent any further resource usage
>>
>> But neither the official doc, nor my Google-fu could provide
>> details:
>>
>> 1. Is this still true as of CouchDB 1.6.1 / 2.0alpha?
>>
>> 2. Which JS errors/exceptions cause a view to be "disabled",
>> exactly?
>>
>> 2.a. In particular, just accessing a non-existent key of a `doc`
>> object is not considered an error, right? It evaluates to
>> `undefined` faithfully to vanilla JS behavior, correct? Said
>> differently, `if (doc.species && doc.species === 'human')` is
>> equivalent to: `if (doc.species === 'human')` , right?
>>
>> 3. How can I "re-enable" a "disabled" view?
>>
>> Thanks :)
>>
>> -- Ronan
>

Re: Clarifications on CouchDB "index disabling" behavior on view errors/exceptions

Posted by Robert Samuel Newson <rn...@apache.org>.
Hi,

Interesting find. I don’t believe this was ever true, the view engine will continue to build in the face of exceptions being thrown for every single document it encounters.

B.

> On 13 Jan 2016, at 19:43, Ronan Jouchet <ro...@cadensimaging.com> wrote:
> 
> Hi.
> 
> The CouchDB Guide ( http://guide.couchdb.org/draft/tour.html ) mentions that:
>> when a map function fails regularly (due to a missing required field
>> or other JavaScript exception), CouchDB shuts off its indexing to
>> prevent any further resource usage
> 
> But neither the official doc, nor my Google-fu could provide details:
> 
> 1. Is this still true as of CouchDB 1.6.1 / 2.0alpha?
> 
> 2. Which JS errors/exceptions cause a view to be "disabled", exactly?
> 
> 2.a. In particular, just accessing a non-existent key of a `doc` object
>     is not considered an error, right? It evaluates to `undefined`
>     faithfully to vanilla JS behavior, correct? Said differently,
>         `if (doc.species && doc.species === 'human')`
>     is equivalent to:
>         `if (doc.species === 'human')` , right?
> 
> 3. How can I "re-enable" a "disabled" view?
> 
> Thanks :)
> 
> -- 
> Ronan