You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by "Ramanadham, Radhika" <ra...@emc.com> on 2014/05/21 16:25:28 UTC

running views return nothing with couchdb1.5.1

Hi,

I have some code that creates DB, documents and design documents with views and lists.

When I run views, I don't know why, but it returns nothing and waits for ever. This is with couchdb1.5.1

When I run the same code against my another couchdb server, only difference being that the version is 1.5.0, it works perfect. All the views return the right responses and results.

Can anyone help me here? I am at a loss!

Below is a snippet of my design doc:

def createDesignDocForPerfStats():
    design = db.design('perfstats')
    resp = design.put(params={
        "_id":"_design/perfstats",
        "language": "javascript",
        "views":
        {
            "by_server": {
                "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit([doc.Hostname,doc.test_id],{ 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory, 'FileSystem':doc.FileSystem }) }"
            },
             "by_test_id": {
                "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit(doc.test_id,{ 'Server Name': doc.Hostname, 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory, 'FileSystem':doc.FileSystem }) }"
            },
             "by_testid_starttime": {
                "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server Name': doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory': doc.Memory, 'FileSystem':doc.FileSystem }) }"
            },
             #view is http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?group=true
             "server": {
                 "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",
                 "reduce": "function(keys, values) {return (null)}"
             },
            "cpu": {
                "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
                "reduce": "function(keys, values) "
                          "{ "
                          "avg = Math.round(sum(values)/values.length);"
                          "return(avg)"
                          " }"
            },
            #get avg cpu for all servers per time
            #http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_starttime?group=true
            "cpu_by_starttime": {
                "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) }",
                "reduce": "function(keys, values) "
                          "{ "
                          "avg = Math.round(sum(values)/values.length);"
                          "return(avg)"
                          " }"
            },
        },
        "lists":{
            "sort":"function(head, req) {"
                    "var row;"
                    "var rows=[];"
                    "while(row = getRow()) {"
                        "rows.push(row)"
                    "};"
                    "rows.sort(function(a,b) {"
                    "return b.value-a.value"
                    "});"
                    "send(JSON.stringify({\"rows\" : rows[0]}))"
            "}"
        }
    })

Re: running views return nothing with couchdb1.5.1

Posted by Mike Marino <mm...@gmail.com>.
Hi Rhadika,

I was unable to see what you sent, I think the list stripped the
attachments.

Have a look eg at:

http://server/_utils/status.html

You must be logged in as an admin, but you will see there if the views are
being built.

Cheers,
Mike

Am 21.05.2014 um 16:47 schrieb "Ramanadham, Radhika" <
radhika.ramanadham@emc.com>:

Thanks Mike. I will clean up my reduce functions once I get this resolved.



Reg the issue:  I am not sure where to look if views are building or not.









On the other hand, on couchdb server 1.5.0, I see the results:





-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com <mm...@gmail.com>]
Sent: Wednesday, May 21, 2014 10:32 AM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1



Hi Radhika,



What does the server status say in futon?  (i.e. does it note that the
views are building or not?)



One side comment, the reduce functions that you posted will likely not do
what you expect when a rereduce is run.  I would suggest using _stats
(preferable solution,
http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-reduce-functions

).



Cheers,

Mike





On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika <
radhika.ramanadham@emc.com> wrote:



> Hi,

>

> I have some code that creates DB, documents and design documents with

> views and lists.

>

> When I run views, I don't know why, but it returns nothing and waits

> for ever. This is with couchdb1.5.1

>

> When I run the same code against my another couchdb server, only

> difference being that the version is 1.5.0, it works perfect. All the

> views return the right responses and results.

>

> Can anyone help me here? I am at a loss!

>

> Below is a snippet of my design doc:

>

> def createDesignDocForPerfStats():

>     design = db.design('perfstats')

>     resp = design.put(params={

>         "_id":"_design/perfstats",

>         "language": "javascript",

>         "views":

>         {

>             "by_server": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.Hostname,doc.test_id],{

> 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory,

> 'FileSystem':doc.FileSystem }) }"

>             },

>              "by_test_id": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit(doc.test_id,{ 'Server Name': doc.Hostname,

> 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory,

> 'FileSystem':doc.FileSystem }) }"

>             },

>              "by_testid_starttime": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server Name':

> doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory':

> doc.Memory, 'FileSystem':doc.FileSystem }) }"

>             },

>              #view is

>
http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?group=true

>              "server": {

>                  "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",

>                  "reduce": "function(keys, values) {return (null)}"

>              },

>             "cpu": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit(doc.test_id, doc.CPU) }",

>                 "reduce": "function(keys, values) "

>                           "{ "

>                           "avg = Math.round(sum(values)/values.length);"

>                           "return(avg)"

>                           " }"

>             },

>             #get avg cpu for all servers per time

>             #

>
http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_starttime?group=true

>             "cpu_by_starttime": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) }",

>                 "reduce": "function(keys, values) "

>                           "{ "

>                           "avg = Math.round(sum(values)/values.length);"

>                           "return(avg)"

>                           " }"

>             },

>         },

>         "lists":{

>             "sort":"function(head, req) {"

>                     "var row;"

>                     "var rows=[];"

>                     "while(row = getRow()) {"

>                         "rows.push(row)"

>                     "};"

>                     "rows.sort(function(a,b) {"

>                     "return b.value-a.value"

>                     "});"

>                     "send(JSON.stringify({\"rows\" : rows[0]}))"

>             "}"

>         }

>     })

>

Re: running views return nothing with couchdb1.5.1

Posted by Mike Marino <mm...@gmail.com>.
On Wed, May 21, 2014 at 6:19 PM, Ramanadham, Radhika <
radhika.ramanadham@emc.com> wrote:

> I generally do a zypper install couchdb from the below repo which couchdb
> server built for suse linux enterprise 11, sp3.
>
> zypper addrepo
> http://download.opensuse.org/repositories/home:ZaWertun:db/SLE_11_SP3/home:ZaWertun:db.repo
>
> Is there any other repo from which I should get it?
>

I'm afraid I can't help you here, but perhaps others have experience on
which repo to use for SuSe.


>
> Also, what would be a faster way to get this working? And if I can get the
> file, I just put it under the right location and restart couchdb?
>

Once the library is in place and you can run couchjs, no need to restart.
 It will pick it up the next time you query the view and start the view
build.

RE: running views return nothing with couchdb1.5.1

Posted by "Ramanadham, Radhika" <ra...@emc.com>.
I generally do a zypper install couchdb from the below repo which couchdb server built for suse linux enterprise 11, sp3.

zypper addrepo http://download.opensuse.org/repositories/home:ZaWertun:db/SLE_11_SP3/home:ZaWertun:db.repo

Is there any other repo from which I should get it?

Also, what would be a faster way to get this working? And if I can get the file, I just put it under the right location and restart couchdb?

-----Original Message-----
From: Ramanadham, Radhika [mailto:radhika.ramanadham@emc.com] 
Sent: Wednesday, May 21, 2014 12:03 PM
To: user@couchdb.apache.org
Subject: RE: running views return nothing with couchdb1.5.1

Here is what I get. Looks like libmozjs.so is missing?

lglod078:/var/log/couchdb # which couchjs /usr/bin/couchjs lglod078:/var/log/couchdb # ldd `which couchjs`
        linux-vdso.so.1 (0x00007fffb13ff000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f2bf6d8b000)
        libmozjs.so => not found
        libplds4.so => /usr/lib64/libplds4.so (0x00007f2bf6b87000)
        libplc4.so => /usr/lib64/libplc4.so (0x00007f2bf6982000)
        libnspr4.so => /usr/lib64/libnspr4.so (0x00007f2bf6743000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f2bf6508000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f2bf6159000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2bf5f3b000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f2bf5d37000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f2bf5b2f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2bf708e000) lglod078:/var/log/couchdb # couchjs
couchjs: error while loading shared libraries: libmozjs.so: cannot open shared object file: No such file or directory lglod078:/var/log/couchdb #



-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com]
Sent: Wednesday, May 21, 2014 11:59 AM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1

Ok, that could indeed be an error from a library not find while running an external process (e.g. couchjs). Can you run couchjs?

:~> which couchjs
/usr/local/bin/couchjs
:~> ldd `which couchjs`
... should resolve all libaries ...
:~> couchjs



On Wed, May 21, 2014 at 5:50 PM, Ramanadham, Radhika < radhika.ramanadham@emc.com> wrote:

> Here is what I see in the log:
>
> [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] OS Process Error 
> <0.17168.143> :: {os_process_error,
>                                                        
> {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] 
> [<0.3093.3>] OS Process Error <0.17165.143> :: {os_process_error,
>                                                         
> {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] 
> OS Process Error <0.17176.143> :: {os_process_error,
>                                                        
> {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] 
> [<0.3093.3>] OS Process Error <0.17174.143> :: {os_process_error,
>                                                         
> {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] 
> OS Process Error <0.17172.143> :: {os_process_error,
>                                                        
> {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] 
> [<0.3093.3>] OS Process Error <0.17182.143> :: {os_process_error,
>                                                         
> {exit_status,127}}
>
> -----Original Message-----
> From: Mike Marino [mailto:mmarino@gmail.com]
> Sent: Wednesday, May 21, 2014 11:04 AM
> To: user@couchdb.apache.org
> Subject: Re: running views return nothing with couchdb1.5.1
>
> Ok, then for some reason your view can't be built.
>
> Can you output the log?  You should see error output when you request 
> the view.  (Best is to use friendpaste or something similar and send a
> link.)
>
> Am 21.05.2014 um 16:54 schrieb "Ramanadham, Radhika" <
> radhika.ramanadham@emc.com>:
>
> Sorry, looks like the images are filtered out.
>
>
>
> But, here is what gets returned- Error- An error occurred accessing 
> the view.
>
>
>
>
>
> *From:* Ramanadham, Radhika
> [mailto:radhika.ramanadham@emc.com<ra...@emc.com>]
>
> *Sent:* Wednesday, May 21, 2014 10:47 AM
> *To:* user@couchdb.apache.org
> *Subject:* RE: running views return nothing with couchdb1.5.1
>
>
>
> Thanks Mike. I will clean up my reduce functions once I get this resolved.
>
>
>
> Reg the issue:  I am not sure where to look if views are building or not.
>
>
>
>
>
>
>
>
>
> On the other hand, on couchdb server 1.5.0, I see the results:
>
>
>
>
>
> -----Original Message-----
> From: Mike Marino [mailto:mmarino@gmail.com <mm...@gmail.com>]
> Sent: Wednesday, May 21, 2014 10:32 AM
> To: user@couchdb.apache.org
> Subject: Re: running views return nothing with couchdb1.5.1
>
>
>
> Hi Radhika,
>
>
>
> What does the server status say in futon?  (i.e. does it note that the 
> views are building or not?)
>
>
>
> One side comment, the reduce functions that you posted will likely not 
> do what you expect when a rereduce is run.  I would suggest using 
> _stats (preferable solution, 
> http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-r
> educe-functions
>
> ).
>
>
>
> Cheers,
>
> Mike
>
>
>
>
>
> On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika < 
> radhika.ramanadham@emc.com> wrote:
>
>
>
> > Hi,
>
> >
>
> > I have some code that creates DB, documents and design documents 
> > with
>
> > views and lists.
>
> >
>
> > When I run views, I don't know why, but it returns nothing and waits
>
> > for ever. This is with couchdb1.5.1
>
> >
>
> > When I run the same code against my another couchdb server, only
>
> > difference being that the version is 1.5.0, it works perfect. All 
> > the
>
> > views return the right responses and results.
>
> >
>
> > Can anyone help me here? I am at a loss!
>
> >
>
> > Below is a snippet of my design doc:
>
> >
>
> > def createDesignDocForPerfStats():
>
> >     design = db.design('perfstats')
>
> >     resp = design.put(params={
>
> >         "_id":"_design/perfstats",
>
> >         "language": "javascript",
>
> >         "views":
>
> >         {
>
> >             "by_server": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.Hostname,doc.test_id],{
>
> > 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory,
>
> > 'FileSystem':doc.FileSystem }) }"
>
> >             },
>
> >              "by_test_id": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit(doc.test_id,{ 'Server Name': 
> > doc.Hostname,
>
> > 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory,
>
> > 'FileSystem':doc.FileSystem }) }"
>
> >             },
>
> >              "by_testid_starttime": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server
> Name':
>
> > doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory':
>
> > doc.Memory, 'FileSystem':doc.FileSystem }) }"
>
> >             },
>
> >              #view is
>
> >
>
> http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?gr
> oup=true
>
> >              "server": {
>
> >                  "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",
>
> >                  "reduce": "function(keys, values) {return (null)}"
>
> >              },
>
> >             "cpu": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
>
> >                 "reduce": "function(keys, values) "
>
> >                           "{ "
>
> >                           "avg = Math.round(sum(values)/values.length);"
>
> >                           "return(avg)"
>
> >                           " }"
>
> >             },
>
> >             #get avg cpu for all servers per time
>
> >             #
>
> >
>
> http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_sta
> rttime?group=true
>
> >             "cpu_by_starttime": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) 
> > }",
>
> >                 "reduce": "function(keys, values) "
>
> >                           "{ "
>
> >                           "avg = Math.round(sum(values)/values.length);"
>
> >                           "return(avg)"
>
> >                           " }"
>
> >             },
>
> >         },
>
> >         "lists":{
>
> >             "sort":"function(head, req) {"
>
> >                     "var row;"
>
> >                     "var rows=[];"
>
> >                     "while(row = getRow()) {"
>
> >                         "rows.push(row)"
>
> >                     "};"
>
> >                     "rows.sort(function(a,b) {"
>
> >                     "return b.value-a.value"
>
> >                     "});"
>
> >                     "send(JSON.stringify({\"rows\" : rows[0]}))"
>
> >             "}"
>
> >         }
>
> >     })
>
> >
>

RE: running views return nothing with couchdb1.5.1

Posted by "Ramanadham, Radhika" <ra...@emc.com>.
Thanks! I checked couchdb 1.5.0 and it has 

libmozjs.so => /usr/lib64/xulrunner-1.9.2/libmozjs.so (0x00007fb5adf25000)

My host which is running couchdb 1.5.1 has ' libmozjs.so' under  xulrunner-17.0.10 instead of  xulrunner-1.9.2.

For now, I just copied xulrunner-1.9.2/libmozjs.so from the host running couchdb 1.5.0 to the problem host and all the views work!!!

Thanks for all the help! Couldn’t have figured it out myself.

-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com] 
Sent: Wednesday, May 21, 2014 12:21 PM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1

Yeah, that's the problem.  libmozjs.so is either not installed or not in a path searched by the dynamic linker.  It's probably the latter, you can search for it using e.g. find, locate, etc and either generate a link to it e.g. in /usr/local/lib, or add the location to your search path.  Once you do that, just make sure you can run couchjs.  Once you can, couch should be able to build your views.


On Wed, May 21, 2014 at 6:03 PM, Ramanadham, Radhika < radhika.ramanadham@emc.com> wrote:

> Here is what I get. Looks like libmozjs.so is missing?
>
> lglod078:/var/log/couchdb # which couchjs /usr/bin/couchjs 
> lglod078:/var/log/couchdb # ldd `which couchjs`
>         linux-vdso.so.1 (0x00007fffb13ff000)
>         libm.so.6 => /lib64/libm.so.6 (0x00007f2bf6d8b000)
>         libmozjs.so => not found
>         libplds4.so => /usr/lib64/libplds4.so (0x00007f2bf6b87000)
>         libplc4.so => /usr/lib64/libplc4.so (0x00007f2bf6982000)
>         libnspr4.so => /usr/lib64/libnspr4.so (0x00007f2bf6743000)
>         libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f2bf6508000)
>         libc.so.6 => /lib64/libc.so.6 (0x00007f2bf6159000)
>         libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2bf5f3b000)
>         libdl.so.2 => /lib64/libdl.so.2 (0x00007f2bf5d37000)
>         librt.so.1 => /lib64/librt.so.1 (0x00007f2bf5b2f000)
>         /lib64/ld-linux-x86-64.so.2 (0x00007f2bf708e000) 
> lglod078:/var/log/couchdb # couchjs
> couchjs: error while loading shared libraries: libmozjs.so: cannot 
> open shared object file: No such file or directory 
> lglod078:/var/log/couchdb #
>
>
>
> -----Original Message-----
> From: Mike Marino [mailto:mmarino@gmail.com]
> Sent: Wednesday, May 21, 2014 11:59 AM
> To: user@couchdb.apache.org
> Subject: Re: running views return nothing with couchdb1.5.1
>
> Ok, that could indeed be an error from a library not find while 
> running an external process (e.g. couchjs). Can you run couchjs?
>
> :~> which couchjs
> /usr/local/bin/couchjs
> :~> ldd `which couchjs`
> ... should resolve all libaries ...
> :~> couchjs
>
>
>
> On Wed, May 21, 2014 at 5:50 PM, Ramanadham, Radhika < 
> radhika.ramanadham@emc.com> wrote:
>
> > Here is what I see in the log:
> >
> > [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] OS Process Error 
> > <0.17168.143> :: {os_process_error,
> >
> > {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] 
> > [<0.3093.3>] OS Process Error <0.17165.143> :: {os_process_error,
> >
> > {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] 
> > [<0.202.0>] OS Process Error <0.17176.143> :: {os_process_error,
> >
> > {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] 
> > [<0.3093.3>] OS Process Error <0.17174.143> :: {os_process_error,
> >
> > {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] 
> > [<0.202.0>] OS Process Error <0.17172.143> :: {os_process_error,
> >
> > {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] 
> > [<0.3093.3>] OS Process Error <0.17182.143> :: {os_process_error,
> >
> > {exit_status,127}}
> >
> > -----Original Message-----
> > From: Mike Marino [mailto:mmarino@gmail.com]
> > Sent: Wednesday, May 21, 2014 11:04 AM
> > To: user@couchdb.apache.org
> > Subject: Re: running views return nothing with couchdb1.5.1
> >
> > Ok, then for some reason your view can't be built.
> >
> > Can you output the log?  You should see error output when you 
> > request the view.  (Best is to use friendpaste or something similar 
> > and send a
> > link.)
> >
> > Am 21.05.2014 um 16:54 schrieb "Ramanadham, Radhika" <
> > radhika.ramanadham@emc.com>:
> >
> > Sorry, looks like the images are filtered out.
> >
> >
> >
> > But, here is what gets returned- Error- An error occurred accessing 
> > the view.
> >
> >
> >
> >
> >
> > *From:* Ramanadham, Radhika
> > [mailto:radhika.ramanadham@emc.com<ra...@emc.com>]
> >
> > *Sent:* Wednesday, May 21, 2014 10:47 AM
> > *To:* user@couchdb.apache.org
> > *Subject:* RE: running views return nothing with couchdb1.5.1
> >
> >
> >
> > Thanks Mike. I will clean up my reduce functions once I get this
> resolved.
> >
> >
> >
> > Reg the issue:  I am not sure where to look if views are building or not.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On the other hand, on couchdb server 1.5.0, I see the results:
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Mike Marino [mailto:mmarino@gmail.com <mm...@gmail.com>]
> > Sent: Wednesday, May 21, 2014 10:32 AM
> > To: user@couchdb.apache.org
> > Subject: Re: running views return nothing with couchdb1.5.1
> >
> >
> >
> > Hi Radhika,
> >
> >
> >
> > What does the server status say in futon?  (i.e. does it note that 
> > the views are building or not?)
> >
> >
> >
> > One side comment, the reduce functions that you posted will likely 
> > not do what you expect when a rereduce is run.  I would suggest 
> > using _stats (preferable solution, 
> > http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin
> > -r
> > educe-functions
> >
> > ).
> >
> >
> >
> > Cheers,
> >
> > Mike
> >
> >
> >
> >
> >
> > On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika < 
> > radhika.ramanadham@emc.com> wrote:
> >
> >
> >
> > > Hi,
> >
> > >
> >
> > > I have some code that creates DB, documents and design documents 
> > > with
> >
> > > views and lists.
> >
> > >
> >
> > > When I run views, I don't know why, but it returns nothing and 
> > > waits
> >
> > > for ever. This is with couchdb1.5.1
> >
> > >
> >
> > > When I run the same code against my another couchdb server, only
> >
> > > difference being that the version is 1.5.0, it works perfect. All 
> > > the
> >
> > > views return the right responses and results.
> >
> > >
> >
> > > Can anyone help me here? I am at a loss!
> >
> > >
> >
> > > Below is a snippet of my design doc:
> >
> > >
> >
> > > def createDesignDocForPerfStats():
> >
> > >     design = db.design('perfstats')
> >
> > >     resp = design.put(params={
> >
> > >         "_id":"_design/perfstats",
> >
> > >         "language": "javascript",
> >
> > >         "views":
> >
> > >         {
> >
> > >             "by_server": {
> >
> > >                 "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit([doc.Hostname,doc.test_id],{
> >
> > > 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory,
> >
> > > 'FileSystem':doc.FileSystem }) }"
> >
> > >             },
> >
> > >              "by_test_id": {
> >
> > >                 "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit(doc.test_id,{ 'Server Name':
> > > doc.Hostname,
> >
> > > 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory,
> >
> > > 'FileSystem':doc.FileSystem }) }"
> >
> > >             },
> >
> > >              "by_testid_starttime": {
> >
> > >                 "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 
> > > 'Server
> > Name':
> >
> > > doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory':
> >
> > > doc.Memory, 'FileSystem':doc.FileSystem }) }"
> >
> > >             },
> >
> > >              #view is
> >
> > >
> >
> > http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?
> > gr
> > oup=true
> >
> > >              "server": {
> >
> > >                  "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",
> >
> > >                  "reduce": "function(keys, values) {return (null)}"
> >
> > >              },
> >
> > >             "cpu": {
> >
> > >                 "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
> >
> > >                 "reduce": "function(keys, values) "
> >
> > >                           "{ "
> >
> > >                           "avg =
> Math.round(sum(values)/values.length);"
> >
> > >                           "return(avg)"
> >
> > >                           " }"
> >
> > >             },
> >
> > >             #get avg cpu for all servers per time
> >
> > >             #
> >
> > >
> >
> > http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_s
> > ta
> > rttime?group=true
> >
> > >             "cpu_by_starttime": {
> >
> > >                 "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) 
> > > }",
> >
> > >                 "reduce": "function(keys, values) "
> >
> > >                           "{ "
> >
> > >                           "avg =
> Math.round(sum(values)/values.length);"
> >
> > >                           "return(avg)"
> >
> > >                           " }"
> >
> > >             },
> >
> > >         },
> >
> > >         "lists":{
> >
> > >             "sort":"function(head, req) {"
> >
> > >                     "var row;"
> >
> > >                     "var rows=[];"
> >
> > >                     "while(row = getRow()) {"
> >
> > >                         "rows.push(row)"
> >
> > >                     "};"
> >
> > >                     "rows.sort(function(a,b) {"
> >
> > >                     "return b.value-a.value"
> >
> > >                     "});"
> >
> > >                     "send(JSON.stringify({\"rows\" : rows[0]}))"
> >
> > >             "}"
> >
> > >         }
> >
> > >     })
> >
> > >
> >
>

Re: running views return nothing with couchdb1.5.1

Posted by Mike Marino <mm...@gmail.com>.
Yeah, that's the problem.  libmozjs.so is either not installed or not in a
path searched by the dynamic linker.  It's probably the latter, you can
search for it using e.g. find, locate, etc and either generate a link to it
e.g. in /usr/local/lib, or add the location to your search path.  Once you
do that, just make sure you can run couchjs.  Once you can, couch should be
able to build your views.


On Wed, May 21, 2014 at 6:03 PM, Ramanadham, Radhika <
radhika.ramanadham@emc.com> wrote:

> Here is what I get. Looks like libmozjs.so is missing?
>
> lglod078:/var/log/couchdb # which couchjs
> /usr/bin/couchjs
> lglod078:/var/log/couchdb # ldd `which couchjs`
>         linux-vdso.so.1 (0x00007fffb13ff000)
>         libm.so.6 => /lib64/libm.so.6 (0x00007f2bf6d8b000)
>         libmozjs.so => not found
>         libplds4.so => /usr/lib64/libplds4.so (0x00007f2bf6b87000)
>         libplc4.so => /usr/lib64/libplc4.so (0x00007f2bf6982000)
>         libnspr4.so => /usr/lib64/libnspr4.so (0x00007f2bf6743000)
>         libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f2bf6508000)
>         libc.so.6 => /lib64/libc.so.6 (0x00007f2bf6159000)
>         libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2bf5f3b000)
>         libdl.so.2 => /lib64/libdl.so.2 (0x00007f2bf5d37000)
>         librt.so.1 => /lib64/librt.so.1 (0x00007f2bf5b2f000)
>         /lib64/ld-linux-x86-64.so.2 (0x00007f2bf708e000)
> lglod078:/var/log/couchdb # couchjs
> couchjs: error while loading shared libraries: libmozjs.so: cannot open
> shared object file: No such file or directory
> lglod078:/var/log/couchdb #
>
>
>
> -----Original Message-----
> From: Mike Marino [mailto:mmarino@gmail.com]
> Sent: Wednesday, May 21, 2014 11:59 AM
> To: user@couchdb.apache.org
> Subject: Re: running views return nothing with couchdb1.5.1
>
> Ok, that could indeed be an error from a library not find while running an
> external process (e.g. couchjs). Can you run couchjs?
>
> :~> which couchjs
> /usr/local/bin/couchjs
> :~> ldd `which couchjs`
> ... should resolve all libaries ...
> :~> couchjs
>
>
>
> On Wed, May 21, 2014 at 5:50 PM, Ramanadham, Radhika <
> radhika.ramanadham@emc.com> wrote:
>
> > Here is what I see in the log:
> >
> > [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] OS Process Error
> > <0.17168.143> :: {os_process_error,
> >
> > {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error]
> > [<0.3093.3>] OS Process Error <0.17165.143> :: {os_process_error,
> >
> > {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>]
> > OS Process Error <0.17176.143> :: {os_process_error,
> >
> > {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error]
> > [<0.3093.3>] OS Process Error <0.17174.143> :: {os_process_error,
> >
> > {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>]
> > OS Process Error <0.17172.143> :: {os_process_error,
> >
> > {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error]
> > [<0.3093.3>] OS Process Error <0.17182.143> :: {os_process_error,
> >
> > {exit_status,127}}
> >
> > -----Original Message-----
> > From: Mike Marino [mailto:mmarino@gmail.com]
> > Sent: Wednesday, May 21, 2014 11:04 AM
> > To: user@couchdb.apache.org
> > Subject: Re: running views return nothing with couchdb1.5.1
> >
> > Ok, then for some reason your view can't be built.
> >
> > Can you output the log?  You should see error output when you request
> > the view.  (Best is to use friendpaste or something similar and send a
> > link.)
> >
> > Am 21.05.2014 um 16:54 schrieb "Ramanadham, Radhika" <
> > radhika.ramanadham@emc.com>:
> >
> > Sorry, looks like the images are filtered out.
> >
> >
> >
> > But, here is what gets returned- Error- An error occurred accessing
> > the view.
> >
> >
> >
> >
> >
> > *From:* Ramanadham, Radhika
> > [mailto:radhika.ramanadham@emc.com<ra...@emc.com>]
> >
> > *Sent:* Wednesday, May 21, 2014 10:47 AM
> > *To:* user@couchdb.apache.org
> > *Subject:* RE: running views return nothing with couchdb1.5.1
> >
> >
> >
> > Thanks Mike. I will clean up my reduce functions once I get this
> resolved.
> >
> >
> >
> > Reg the issue:  I am not sure where to look if views are building or not.
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > On the other hand, on couchdb server 1.5.0, I see the results:
> >
> >
> >
> >
> >
> > -----Original Message-----
> > From: Mike Marino [mailto:mmarino@gmail.com <mm...@gmail.com>]
> > Sent: Wednesday, May 21, 2014 10:32 AM
> > To: user@couchdb.apache.org
> > Subject: Re: running views return nothing with couchdb1.5.1
> >
> >
> >
> > Hi Radhika,
> >
> >
> >
> > What does the server status say in futon?  (i.e. does it note that the
> > views are building or not?)
> >
> >
> >
> > One side comment, the reduce functions that you posted will likely not
> > do what you expect when a rereduce is run.  I would suggest using
> > _stats (preferable solution,
> > http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-r
> > educe-functions
> >
> > ).
> >
> >
> >
> > Cheers,
> >
> > Mike
> >
> >
> >
> >
> >
> > On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika <
> > radhika.ramanadham@emc.com> wrote:
> >
> >
> >
> > > Hi,
> >
> > >
> >
> > > I have some code that creates DB, documents and design documents
> > > with
> >
> > > views and lists.
> >
> > >
> >
> > > When I run views, I don't know why, but it returns nothing and waits
> >
> > > for ever. This is with couchdb1.5.1
> >
> > >
> >
> > > When I run the same code against my another couchdb server, only
> >
> > > difference being that the version is 1.5.0, it works perfect. All
> > > the
> >
> > > views return the right responses and results.
> >
> > >
> >
> > > Can anyone help me here? I am at a loss!
> >
> > >
> >
> > > Below is a snippet of my design doc:
> >
> > >
> >
> > > def createDesignDocForPerfStats():
> >
> > >     design = db.design('perfstats')
> >
> > >     resp = design.put(params={
> >
> > >         "_id":"_design/perfstats",
> >
> > >         "language": "javascript",
> >
> > >         "views":
> >
> > >         {
> >
> > >             "by_server": {
> >
> > >                 "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit([doc.Hostname,doc.test_id],{
> >
> > > 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory,
> >
> > > 'FileSystem':doc.FileSystem }) }"
> >
> > >             },
> >
> > >              "by_test_id": {
> >
> > >                 "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit(doc.test_id,{ 'Server Name':
> > > doc.Hostname,
> >
> > > 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory,
> >
> > > 'FileSystem':doc.FileSystem }) }"
> >
> > >             },
> >
> > >              "by_testid_starttime": {
> >
> > >                 "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server
> > Name':
> >
> > > doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory':
> >
> > > doc.Memory, 'FileSystem':doc.FileSystem }) }"
> >
> > >             },
> >
> > >              #view is
> >
> > >
> >
> > http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?gr
> > oup=true
> >
> > >              "server": {
> >
> > >                  "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",
> >
> > >                  "reduce": "function(keys, values) {return (null)}"
> >
> > >              },
> >
> > >             "cpu": {
> >
> > >                 "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
> >
> > >                 "reduce": "function(keys, values) "
> >
> > >                           "{ "
> >
> > >                           "avg =
> Math.round(sum(values)/values.length);"
> >
> > >                           "return(avg)"
> >
> > >                           " }"
> >
> > >             },
> >
> > >             #get avg cpu for all servers per time
> >
> > >             #
> >
> > >
> >
> > http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_sta
> > rttime?group=true
> >
> > >             "cpu_by_starttime": {
> >
> > >                 "map": "function(doc) { if ((doc.type ==
> >
> > > 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU)
> > > }",
> >
> > >                 "reduce": "function(keys, values) "
> >
> > >                           "{ "
> >
> > >                           "avg =
> Math.round(sum(values)/values.length);"
> >
> > >                           "return(avg)"
> >
> > >                           " }"
> >
> > >             },
> >
> > >         },
> >
> > >         "lists":{
> >
> > >             "sort":"function(head, req) {"
> >
> > >                     "var row;"
> >
> > >                     "var rows=[];"
> >
> > >                     "while(row = getRow()) {"
> >
> > >                         "rows.push(row)"
> >
> > >                     "};"
> >
> > >                     "rows.sort(function(a,b) {"
> >
> > >                     "return b.value-a.value"
> >
> > >                     "});"
> >
> > >                     "send(JSON.stringify({\"rows\" : rows[0]}))"
> >
> > >             "}"
> >
> > >         }
> >
> > >     })
> >
> > >
> >
>

RE: running views return nothing with couchdb1.5.1

Posted by "Ramanadham, Radhika" <ra...@emc.com>.
Here is what I get. Looks like libmozjs.so is missing?

lglod078:/var/log/couchdb # which couchjs
/usr/bin/couchjs
lglod078:/var/log/couchdb # ldd `which couchjs`
        linux-vdso.so.1 (0x00007fffb13ff000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f2bf6d8b000)
        libmozjs.so => not found
        libplds4.so => /usr/lib64/libplds4.so (0x00007f2bf6b87000)
        libplc4.so => /usr/lib64/libplc4.so (0x00007f2bf6982000)
        libnspr4.so => /usr/lib64/libnspr4.so (0x00007f2bf6743000)
        libcrypt.so.1 => /lib64/libcrypt.so.1 (0x00007f2bf6508000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f2bf6159000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f2bf5f3b000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f2bf5d37000)
        librt.so.1 => /lib64/librt.so.1 (0x00007f2bf5b2f000)
        /lib64/ld-linux-x86-64.so.2 (0x00007f2bf708e000)
lglod078:/var/log/couchdb # couchjs
couchjs: error while loading shared libraries: libmozjs.so: cannot open shared object file: No such file or directory
lglod078:/var/log/couchdb #



-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com] 
Sent: Wednesday, May 21, 2014 11:59 AM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1

Ok, that could indeed be an error from a library not find while running an external process (e.g. couchjs). Can you run couchjs?

:~> which couchjs
/usr/local/bin/couchjs
:~> ldd `which couchjs`
... should resolve all libaries ...
:~> couchjs



On Wed, May 21, 2014 at 5:50 PM, Ramanadham, Radhika < radhika.ramanadham@emc.com> wrote:

> Here is what I see in the log:
>
> [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] OS Process Error 
> <0.17168.143> :: {os_process_error,
>                                                        
> {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] 
> [<0.3093.3>] OS Process Error <0.17165.143> :: {os_process_error,
>                                                         
> {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] 
> OS Process Error <0.17176.143> :: {os_process_error,
>                                                        
> {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] 
> [<0.3093.3>] OS Process Error <0.17174.143> :: {os_process_error,
>                                                         
> {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] 
> OS Process Error <0.17172.143> :: {os_process_error,
>                                                        
> {exit_status,127}} [Wed, 21 May 2014 15:49:42 GMT] [error] 
> [<0.3093.3>] OS Process Error <0.17182.143> :: {os_process_error,
>                                                         
> {exit_status,127}}
>
> -----Original Message-----
> From: Mike Marino [mailto:mmarino@gmail.com]
> Sent: Wednesday, May 21, 2014 11:04 AM
> To: user@couchdb.apache.org
> Subject: Re: running views return nothing with couchdb1.5.1
>
> Ok, then for some reason your view can't be built.
>
> Can you output the log?  You should see error output when you request 
> the view.  (Best is to use friendpaste or something similar and send a 
> link.)
>
> Am 21.05.2014 um 16:54 schrieb "Ramanadham, Radhika" <
> radhika.ramanadham@emc.com>:
>
> Sorry, looks like the images are filtered out.
>
>
>
> But, here is what gets returned- Error- An error occurred accessing 
> the view.
>
>
>
>
>
> *From:* Ramanadham, Radhika
> [mailto:radhika.ramanadham@emc.com<ra...@emc.com>]
>
> *Sent:* Wednesday, May 21, 2014 10:47 AM
> *To:* user@couchdb.apache.org
> *Subject:* RE: running views return nothing with couchdb1.5.1
>
>
>
> Thanks Mike. I will clean up my reduce functions once I get this resolved.
>
>
>
> Reg the issue:  I am not sure where to look if views are building or not.
>
>
>
>
>
>
>
>
>
> On the other hand, on couchdb server 1.5.0, I see the results:
>
>
>
>
>
> -----Original Message-----
> From: Mike Marino [mailto:mmarino@gmail.com <mm...@gmail.com>]
> Sent: Wednesday, May 21, 2014 10:32 AM
> To: user@couchdb.apache.org
> Subject: Re: running views return nothing with couchdb1.5.1
>
>
>
> Hi Radhika,
>
>
>
> What does the server status say in futon?  (i.e. does it note that the 
> views are building or not?)
>
>
>
> One side comment, the reduce functions that you posted will likely not 
> do what you expect when a rereduce is run.  I would suggest using 
> _stats (preferable solution, 
> http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-r
> educe-functions
>
> ).
>
>
>
> Cheers,
>
> Mike
>
>
>
>
>
> On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika < 
> radhika.ramanadham@emc.com> wrote:
>
>
>
> > Hi,
>
> >
>
> > I have some code that creates DB, documents and design documents 
> > with
>
> > views and lists.
>
> >
>
> > When I run views, I don't know why, but it returns nothing and waits
>
> > for ever. This is with couchdb1.5.1
>
> >
>
> > When I run the same code against my another couchdb server, only
>
> > difference being that the version is 1.5.0, it works perfect. All 
> > the
>
> > views return the right responses and results.
>
> >
>
> > Can anyone help me here? I am at a loss!
>
> >
>
> > Below is a snippet of my design doc:
>
> >
>
> > def createDesignDocForPerfStats():
>
> >     design = db.design('perfstats')
>
> >     resp = design.put(params={
>
> >         "_id":"_design/perfstats",
>
> >         "language": "javascript",
>
> >         "views":
>
> >         {
>
> >             "by_server": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.Hostname,doc.test_id],{
>
> > 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory,
>
> > 'FileSystem':doc.FileSystem }) }"
>
> >             },
>
> >              "by_test_id": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit(doc.test_id,{ 'Server Name': 
> > doc.Hostname,
>
> > 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory,
>
> > 'FileSystem':doc.FileSystem }) }"
>
> >             },
>
> >              "by_testid_starttime": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server
> Name':
>
> > doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory':
>
> > doc.Memory, 'FileSystem':doc.FileSystem }) }"
>
> >             },
>
> >              #view is
>
> >
>
> http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?gr
> oup=true
>
> >              "server": {
>
> >                  "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",
>
> >                  "reduce": "function(keys, values) {return (null)}"
>
> >              },
>
> >             "cpu": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
>
> >                 "reduce": "function(keys, values) "
>
> >                           "{ "
>
> >                           "avg = Math.round(sum(values)/values.length);"
>
> >                           "return(avg)"
>
> >                           " }"
>
> >             },
>
> >             #get avg cpu for all servers per time
>
> >             #
>
> >
>
> http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_sta
> rttime?group=true
>
> >             "cpu_by_starttime": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) 
> > }",
>
> >                 "reduce": "function(keys, values) "
>
> >                           "{ "
>
> >                           "avg = Math.round(sum(values)/values.length);"
>
> >                           "return(avg)"
>
> >                           " }"
>
> >             },
>
> >         },
>
> >         "lists":{
>
> >             "sort":"function(head, req) {"
>
> >                     "var row;"
>
> >                     "var rows=[];"
>
> >                     "while(row = getRow()) {"
>
> >                         "rows.push(row)"
>
> >                     "};"
>
> >                     "rows.sort(function(a,b) {"
>
> >                     "return b.value-a.value"
>
> >                     "});"
>
> >                     "send(JSON.stringify({\"rows\" : rows[0]}))"
>
> >             "}"
>
> >         }
>
> >     })
>
> >
>

Re: running views return nothing with couchdb1.5.1

Posted by Mike Marino <mm...@gmail.com>.
Ok, that could indeed be an error from a library not find while running an
external process (e.g. couchjs). Can you run couchjs?

:~> which couchjs
/usr/local/bin/couchjs
:~> ldd `which couchjs`
... should resolve all libaries ...
:~> couchjs



On Wed, May 21, 2014 at 5:50 PM, Ramanadham, Radhika <
radhika.ramanadham@emc.com> wrote:

> Here is what I see in the log:
>
> [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] OS Process Error
> <0.17168.143> :: {os_process_error,
>                                                        {exit_status,127}}
> [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.3093.3>] OS Process Error
> <0.17165.143> :: {os_process_error,
>                                                         {exit_status,127}}
> [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] OS Process Error
> <0.17176.143> :: {os_process_error,
>                                                        {exit_status,127}}
> [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.3093.3>] OS Process Error
> <0.17174.143> :: {os_process_error,
>                                                         {exit_status,127}}
> [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] OS Process Error
> <0.17172.143> :: {os_process_error,
>                                                        {exit_status,127}}
> [Wed, 21 May 2014 15:49:42 GMT] [error] [<0.3093.3>] OS Process Error
> <0.17182.143> :: {os_process_error,
>                                                         {exit_status,127}}
>
> -----Original Message-----
> From: Mike Marino [mailto:mmarino@gmail.com]
> Sent: Wednesday, May 21, 2014 11:04 AM
> To: user@couchdb.apache.org
> Subject: Re: running views return nothing with couchdb1.5.1
>
> Ok, then for some reason your view can't be built.
>
> Can you output the log?  You should see error output when you request the
> view.  (Best is to use friendpaste or something similar and send a link.)
>
> Am 21.05.2014 um 16:54 schrieb "Ramanadham, Radhika" <
> radhika.ramanadham@emc.com>:
>
> Sorry, looks like the images are filtered out.
>
>
>
> But, here is what gets returned- Error- An error occurred accessing the
> view.
>
>
>
>
>
> *From:* Ramanadham, Radhika
> [mailto:radhika.ramanadham@emc.com<ra...@emc.com>]
>
> *Sent:* Wednesday, May 21, 2014 10:47 AM
> *To:* user@couchdb.apache.org
> *Subject:* RE: running views return nothing with couchdb1.5.1
>
>
>
> Thanks Mike. I will clean up my reduce functions once I get this resolved.
>
>
>
> Reg the issue:  I am not sure where to look if views are building or not.
>
>
>
>
>
>
>
>
>
> On the other hand, on couchdb server 1.5.0, I see the results:
>
>
>
>
>
> -----Original Message-----
> From: Mike Marino [mailto:mmarino@gmail.com <mm...@gmail.com>]
> Sent: Wednesday, May 21, 2014 10:32 AM
> To: user@couchdb.apache.org
> Subject: Re: running views return nothing with couchdb1.5.1
>
>
>
> Hi Radhika,
>
>
>
> What does the server status say in futon?  (i.e. does it note that the
> views are building or not?)
>
>
>
> One side comment, the reduce functions that you posted will likely not do
> what you expect when a rereduce is run.  I would suggest using _stats
> (preferable solution,
> http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-reduce-functions
>
> ).
>
>
>
> Cheers,
>
> Mike
>
>
>
>
>
> On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika <
> radhika.ramanadham@emc.com> wrote:
>
>
>
> > Hi,
>
> >
>
> > I have some code that creates DB, documents and design documents with
>
> > views and lists.
>
> >
>
> > When I run views, I don't know why, but it returns nothing and waits
>
> > for ever. This is with couchdb1.5.1
>
> >
>
> > When I run the same code against my another couchdb server, only
>
> > difference being that the version is 1.5.0, it works perfect. All the
>
> > views return the right responses and results.
>
> >
>
> > Can anyone help me here? I am at a loss!
>
> >
>
> > Below is a snippet of my design doc:
>
> >
>
> > def createDesignDocForPerfStats():
>
> >     design = db.design('perfstats')
>
> >     resp = design.put(params={
>
> >         "_id":"_design/perfstats",
>
> >         "language": "javascript",
>
> >         "views":
>
> >         {
>
> >             "by_server": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.Hostname,doc.test_id],{
>
> > 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory,
>
> > 'FileSystem':doc.FileSystem }) }"
>
> >             },
>
> >              "by_test_id": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit(doc.test_id,{ 'Server Name': doc.Hostname,
>
> > 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory,
>
> > 'FileSystem':doc.FileSystem }) }"
>
> >             },
>
> >              "by_testid_starttime": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server
> Name':
>
> > doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory':
>
> > doc.Memory, 'FileSystem':doc.FileSystem }) }"
>
> >             },
>
> >              #view is
>
> >
>
> http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?group=true
>
> >              "server": {
>
> >                  "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",
>
> >                  "reduce": "function(keys, values) {return (null)}"
>
> >              },
>
> >             "cpu": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
>
> >                 "reduce": "function(keys, values) "
>
> >                           "{ "
>
> >                           "avg = Math.round(sum(values)/values.length);"
>
> >                           "return(avg)"
>
> >                           " }"
>
> >             },
>
> >             #get avg cpu for all servers per time
>
> >             #
>
> >
>
> http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_starttime?group=true
>
> >             "cpu_by_starttime": {
>
> >                 "map": "function(doc) { if ((doc.type ==
>
> > 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) }",
>
> >                 "reduce": "function(keys, values) "
>
> >                           "{ "
>
> >                           "avg = Math.round(sum(values)/values.length);"
>
> >                           "return(avg)"
>
> >                           " }"
>
> >             },
>
> >         },
>
> >         "lists":{
>
> >             "sort":"function(head, req) {"
>
> >                     "var row;"
>
> >                     "var rows=[];"
>
> >                     "while(row = getRow()) {"
>
> >                         "rows.push(row)"
>
> >                     "};"
>
> >                     "rows.sort(function(a,b) {"
>
> >                     "return b.value-a.value"
>
> >                     "});"
>
> >                     "send(JSON.stringify({\"rows\" : rows[0]}))"
>
> >             "}"
>
> >         }
>
> >     })
>
> >
>

RE: running views return nothing with couchdb1.5.1

Posted by "Ramanadham, Radhika" <ra...@emc.com>.
Here is what I see in the log:

[Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] OS Process Error <0.17168.143> :: {os_process_error,
                                                       {exit_status,127}}
[Wed, 21 May 2014 15:49:42 GMT] [error] [<0.3093.3>] OS Process Error <0.17165.143> :: {os_process_error,
                                                        {exit_status,127}}
[Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] OS Process Error <0.17176.143> :: {os_process_error,
                                                       {exit_status,127}}
[Wed, 21 May 2014 15:49:42 GMT] [error] [<0.3093.3>] OS Process Error <0.17174.143> :: {os_process_error,
                                                        {exit_status,127}}
[Wed, 21 May 2014 15:49:42 GMT] [error] [<0.202.0>] OS Process Error <0.17172.143> :: {os_process_error,
                                                       {exit_status,127}}
[Wed, 21 May 2014 15:49:42 GMT] [error] [<0.3093.3>] OS Process Error <0.17182.143> :: {os_process_error,
                                                        {exit_status,127}}

-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com] 
Sent: Wednesday, May 21, 2014 11:04 AM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1

Ok, then for some reason your view can't be built.

Can you output the log?  You should see error output when you request the view.  (Best is to use friendpaste or something similar and send a link.)

Am 21.05.2014 um 16:54 schrieb "Ramanadham, Radhika" <
radhika.ramanadham@emc.com>:

Sorry, looks like the images are filtered out.



But, here is what gets returned- Error- An error occurred accessing the view.





*From:* Ramanadham, Radhika
[mailto:radhika.ramanadham@emc.com<ra...@emc.com>]

*Sent:* Wednesday, May 21, 2014 10:47 AM
*To:* user@couchdb.apache.org
*Subject:* RE: running views return nothing with couchdb1.5.1



Thanks Mike. I will clean up my reduce functions once I get this resolved.



Reg the issue:  I am not sure where to look if views are building or not.









On the other hand, on couchdb server 1.5.0, I see the results:





-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com <mm...@gmail.com>]
Sent: Wednesday, May 21, 2014 10:32 AM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1



Hi Radhika,



What does the server status say in futon?  (i.e. does it note that the views are building or not?)



One side comment, the reduce functions that you posted will likely not do what you expect when a rereduce is run.  I would suggest using _stats (preferable solution, http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-reduce-functions

).



Cheers,

Mike





On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika < radhika.ramanadham@emc.com> wrote:



> Hi,

>

> I have some code that creates DB, documents and design documents with

> views and lists.

>

> When I run views, I don't know why, but it returns nothing and waits

> for ever. This is with couchdb1.5.1

>

> When I run the same code against my another couchdb server, only

> difference being that the version is 1.5.0, it works perfect. All the

> views return the right responses and results.

>

> Can anyone help me here? I am at a loss!

>

> Below is a snippet of my design doc:

>

> def createDesignDocForPerfStats():

>     design = db.design('perfstats')

>     resp = design.put(params={

>         "_id":"_design/perfstats",

>         "language": "javascript",

>         "views":

>         {

>             "by_server": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.Hostname,doc.test_id],{

> 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory,

> 'FileSystem':doc.FileSystem }) }"

>             },

>              "by_test_id": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit(doc.test_id,{ 'Server Name': doc.Hostname,

> 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory,

> 'FileSystem':doc.FileSystem }) }"

>             },

>              "by_testid_starttime": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server Name':

> doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory':

> doc.Memory, 'FileSystem':doc.FileSystem }) }"

>             },

>              #view is

>
http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?group=true

>              "server": {

>                  "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",

>                  "reduce": "function(keys, values) {return (null)}"

>              },

>             "cpu": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit(doc.test_id, doc.CPU) }",

>                 "reduce": "function(keys, values) "

>                           "{ "

>                           "avg = Math.round(sum(values)/values.length);"

>                           "return(avg)"

>                           " }"

>             },

>             #get avg cpu for all servers per time

>             #

>
http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_starttime?group=true

>             "cpu_by_starttime": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) }",

>                 "reduce": "function(keys, values) "

>                           "{ "

>                           "avg = Math.round(sum(values)/values.length);"

>                           "return(avg)"

>                           " }"

>             },

>         },

>         "lists":{

>             "sort":"function(head, req) {"

>                     "var row;"

>                     "var rows=[];"

>                     "while(row = getRow()) {"

>                         "rows.push(row)"

>                     "};"

>                     "rows.sort(function(a,b) {"

>                     "return b.value-a.value"

>                     "});"

>                     "send(JSON.stringify({\"rows\" : rows[0]}))"

>             "}"

>         }

>     })

>

Re: running views return nothing with couchdb1.5.1

Posted by Mike Marino <mm...@gmail.com>.
Ok, then for some reason your view can't be built.

Can you output the log?  You should see error output when you request the
view.  (Best is to use friendpaste or something similar and send a link.)

Am 21.05.2014 um 16:54 schrieb "Ramanadham, Radhika" <
radhika.ramanadham@emc.com>:

Sorry, looks like the images are filtered out.



But, here is what gets returned- Error- An error occurred accessing the
view.





*From:* Ramanadham, Radhika
[mailto:radhika.ramanadham@emc.com<ra...@emc.com>]

*Sent:* Wednesday, May 21, 2014 10:47 AM
*To:* user@couchdb.apache.org
*Subject:* RE: running views return nothing with couchdb1.5.1



Thanks Mike. I will clean up my reduce functions once I get this resolved.



Reg the issue:  I am not sure where to look if views are building or not.









On the other hand, on couchdb server 1.5.0, I see the results:





-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com <mm...@gmail.com>]
Sent: Wednesday, May 21, 2014 10:32 AM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1



Hi Radhika,



What does the server status say in futon?  (i.e. does it note that the
views are building or not?)



One side comment, the reduce functions that you posted will likely not do
what you expect when a rereduce is run.  I would suggest using _stats
(preferable solution,
http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-reduce-functions

).



Cheers,

Mike





On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika <
radhika.ramanadham@emc.com> wrote:



> Hi,

>

> I have some code that creates DB, documents and design documents with

> views and lists.

>

> When I run views, I don't know why, but it returns nothing and waits

> for ever. This is with couchdb1.5.1

>

> When I run the same code against my another couchdb server, only

> difference being that the version is 1.5.0, it works perfect. All the

> views return the right responses and results.

>

> Can anyone help me here? I am at a loss!

>

> Below is a snippet of my design doc:

>

> def createDesignDocForPerfStats():

>     design = db.design('perfstats')

>     resp = design.put(params={

>         "_id":"_design/perfstats",

>         "language": "javascript",

>         "views":

>         {

>             "by_server": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.Hostname,doc.test_id],{

> 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory,

> 'FileSystem':doc.FileSystem }) }"

>             },

>              "by_test_id": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit(doc.test_id,{ 'Server Name': doc.Hostname,

> 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory,

> 'FileSystem':doc.FileSystem }) }"

>             },

>              "by_testid_starttime": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server Name':

> doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory':

> doc.Memory, 'FileSystem':doc.FileSystem }) }"

>             },

>              #view is

>
http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?group=true

>              "server": {

>                  "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",

>                  "reduce": "function(keys, values) {return (null)}"

>              },

>             "cpu": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit(doc.test_id, doc.CPU) }",

>                 "reduce": "function(keys, values) "

>                           "{ "

>                           "avg = Math.round(sum(values)/values.length);"

>                           "return(avg)"

>                           " }"

>             },

>             #get avg cpu for all servers per time

>             #

>
http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_starttime?group=true

>             "cpu_by_starttime": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) }",

>                 "reduce": "function(keys, values) "

>                           "{ "

>                           "avg = Math.round(sum(values)/values.length);"

>                           "return(avg)"

>                           " }"

>             },

>         },

>         "lists":{

>             "sort":"function(head, req) {"

>                     "var row;"

>                     "var rows=[];"

>                     "while(row = getRow()) {"

>                         "rows.push(row)"

>                     "};"

>                     "rows.sort(function(a,b) {"

>                     "return b.value-a.value"

>                     "});"

>                     "send(JSON.stringify({\"rows\" : rows[0]}))"

>             "}"

>         }

>     })

>

RE: running views return nothing with couchdb1.5.1

Posted by "Ramanadham, Radhika" <ra...@emc.com>.
Sorry, looks like the images are filtered out.

But, here is what gets returned- Error- An error occurred accessing the view.

[cid:image001.png@01CF74E2.B19003B0]

From: Ramanadham, Radhika [mailto:radhika.ramanadham@emc.com]
Sent: Wednesday, May 21, 2014 10:47 AM
To: user@couchdb.apache.org
Subject: RE: running views return nothing with couchdb1.5.1


Thanks Mike. I will clean up my reduce functions once I get this resolved.



Reg the issue:  I am not sure where to look if views are building or not.



[cid:image001.jpg@01CF74E1.FF974100]







On the other hand, on couchdb server 1.5.0, I see the results:



[cid:image002.jpg@01CF74E1.FF974100]



-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com]
Sent: Wednesday, May 21, 2014 10:32 AM
To: user@couchdb.apache.org<ma...@couchdb.apache.org>
Subject: Re: running views return nothing with couchdb1.5.1



Hi Radhika,



What does the server status say in futon?  (i.e. does it note that the views are building or not?)



One side comment, the reduce functions that you posted will likely not do what you expect when a rereduce is run.  I would suggest using _stats (preferable solution, http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-reduce-functions

).



Cheers,

Mike





On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika < radhika.ramanadham@emc.com<ma...@emc.com>> wrote:



> Hi,

>

> I have some code that creates DB, documents and design documents with

> views and lists.

>

> When I run views, I don't know why, but it returns nothing and waits

> for ever. This is with couchdb1.5.1

>

> When I run the same code against my another couchdb server, only

> difference being that the version is 1.5.0, it works perfect. All the

> views return the right responses and results.

>

> Can anyone help me here? I am at a loss!

>

> Below is a snippet of my design doc:

>

> def createDesignDocForPerfStats():

>     design = db.design('perfstats')

>     resp = design.put(params={

>         "_id":"_design/perfstats",

>         "language": "javascript",

>         "views":

>         {

>             "by_server": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.Hostname,doc.test_id],{

> 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory,

> 'FileSystem':doc.FileSystem }) }"

>             },

>              "by_test_id": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit(doc.test_id,{ 'Server Name': doc.Hostname,

> 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory,

> 'FileSystem':doc.FileSystem }) }"

>             },

>              "by_testid_starttime": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server Name':

> doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory':

> doc.Memory, 'FileSystem':doc.FileSystem }) }"

>             },

>              #view is

> http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?group=true

>              "server": {

>                  "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",

>                  "reduce": "function(keys, values) {return (null)}"

>              },

>             "cpu": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit(doc.test_id, doc.CPU) }",

>                 "reduce": "function(keys, values) "

>                           "{ "

>                           "avg = Math.round(sum(values)/values.length);"

>                           "return(avg)"

>                           " }"

>             },

>             #get avg cpu for all servers per time

>             #

> http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_starttime?group=true

>             "cpu_by_starttime": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) }",

>                 "reduce": "function(keys, values) "

>                           "{ "

>                           "avg = Math.round(sum(values)/values.length);"

>                           "return(avg)"

>                           " }"

>             },

>         },

>         "lists":{

>             "sort":"function(head, req) {"

>                     "var row;"

>                     "var rows=[];"

>                     "while(row = getRow()) {"

>                         "rows.push(row)"

>                     "};"

>                     "rows.sort(function(a,b) {"

>                     "return b.value-a.value"

>                     "});"

>                     "send(JSON.stringify({\"rows\" : rows[0]}))"

>             "}"

>         }

>     })

>

RE: running views return nothing with couchdb1.5.1

Posted by "Ramanadham, Radhika" <ra...@emc.com>.
Thanks Mike. I will clean up my reduce functions once I get this resolved.



Reg the issue:  I am not sure where to look if views are building or not.



[cid:image001.jpg@01CF74E1.FF974100]







On the other hand, on couchdb server 1.5.0, I see the results:



[cid:image002.jpg@01CF74E1.FF974100]



-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com]
Sent: Wednesday, May 21, 2014 10:32 AM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1



Hi Radhika,



What does the server status say in futon?  (i.e. does it note that the views are building or not?)



One side comment, the reduce functions that you posted will likely not do what you expect when a rereduce is run.  I would suggest using _stats (preferable solution, http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-reduce-functions

).



Cheers,

Mike





On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika < radhika.ramanadham@emc.com<ma...@emc.com>> wrote:



> Hi,

>

> I have some code that creates DB, documents and design documents with

> views and lists.

>

> When I run views, I don't know why, but it returns nothing and waits

> for ever. This is with couchdb1.5.1

>

> When I run the same code against my another couchdb server, only

> difference being that the version is 1.5.0, it works perfect. All the

> views return the right responses and results.

>

> Can anyone help me here? I am at a loss!

>

> Below is a snippet of my design doc:

>

> def createDesignDocForPerfStats():

>     design = db.design('perfstats')

>     resp = design.put(params={

>         "_id":"_design/perfstats",

>         "language": "javascript",

>         "views":

>         {

>             "by_server": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.Hostname,doc.test_id],{

> 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory,

> 'FileSystem':doc.FileSystem }) }"

>             },

>              "by_test_id": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit(doc.test_id,{ 'Server Name': doc.Hostname,

> 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory,

> 'FileSystem':doc.FileSystem }) }"

>             },

>              "by_testid_starttime": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server Name':

> doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory':

> doc.Memory, 'FileSystem':doc.FileSystem }) }"

>             },

>              #view is

> http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?group=true

>              "server": {

>                  "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",

>                  "reduce": "function(keys, values) {return (null)}"

>              },

>             "cpu": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit(doc.test_id, doc.CPU) }",

>                 "reduce": "function(keys, values) "

>                           "{ "

>                           "avg = Math.round(sum(values)/values.length);"

>                           "return(avg)"

>                           " }"

>             },

>             #get avg cpu for all servers per time

>             #

> http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_starttime?group=true

>             "cpu_by_starttime": {

>                 "map": "function(doc) { if ((doc.type ==

> 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) }",

>                 "reduce": "function(keys, values) "

>                           "{ "

>                           "avg = Math.round(sum(values)/values.length);"

>                           "return(avg)"

>                           " }"

>             },

>         },

>         "lists":{

>             "sort":"function(head, req) {"

>                     "var row;"

>                     "var rows=[];"

>                     "while(row = getRow()) {"

>                         "rows.push(row)"

>                     "};"

>                     "rows.sort(function(a,b) {"

>                     "return b.value-a.value"

>                     "});"

>                     "send(JSON.stringify({\"rows\" : rows[0]}))"

>             "}"

>         }

>     })

>

Re: running views return nothing with couchdb1.5.1

Posted by Mike Marino <mm...@gmail.com>.
Hi Radhika,

You're right, _stats doesn't return the average directly, but it returns
e.g. the following JSON information:
...
{sum: 33772.231, count: 1344, min: 25.064, max: 25.166, sumsqr:
848634.685281}
...

 You can calculate the average in user software with sum/count.

I'm am pretty sure you will find that even with this minor requirement
(performing a single calculation on the user side), _stats will give you a
noticeable overall performance improvement.  Even if you absolutely *must*
return an average in your reduce function, you have to take care of the
case when rereduce is run as well as track the total count, e.g.:

       "reduce" : "function(keys, values, rereduce) {
           if (!rereduce) {
               var length = values.length;
               return [sum(values) / length, length];
           } else {
               var length = sum(values.map(function(v){return v[1]}));
               var avg = sum(values.map(function(v){
                          return v[0] * (v[1] / length) }));
               return [avg, length];
           }
        }"




On Thu, May 22, 2014 at 3:39 PM, Ramanadham, Radhika <
radhika.ramanadham@emc.com> wrote:

> Yes, the values are numeric.
>
> -----Original Message-----
> From: Simon Metson [mailto:simon@cloudant.com]
> Sent: Thursday, May 22, 2014 3:45 AM
> To: user@couchdb.apache.org
> Subject: Re: running views return nothing with couchdb1.5.1
>
> And make sure your values are numeric - you can't sum "20" but you can sum
> 20.
>
>
> On Thursday, 22 May 2014 at 02:21, Manokaran K wrote:
>
> > On Thu, May 22, 2014 at 6:27 AM, Ramanadham, Radhika
> > <ra...@emc.com> wrote:
> > > Hi Mike,
> > >
> > > Do, for one of the views, I need to return an average.
> > >
> > > So, my reduce function had -
> > >
> > > "cpu": {
> > > "map": "function(doc) { if ((doc.type == 'performance_stats'))
> > > emit(doc.test_id, doc.CPU) }",
> > > "reduce": "function(keys, values) "
> > > "{ "
> > > "avg = Math.round(sum(values)/values.length);"
> > > "return(avg)"
> > > " }"
> > >
> > > Now, if I want to use stats, which give me sum and count, I tried
> this, but doesn't work. What am I doing wrong?
> > >
> > > "cpu": {
> > > "map": "function(doc) { if ((doc.type == 'performance_stats'))
> > > emit(doc.test_id, doc.CPU) }",
> > > "reduce": "function(keys, values) "
> > > "{ "
> > > "avg = Math.round(_sum/_count);"
> > > "return(avg)"
> > > " }"
> > > -Radhika
> > >
> >
> >
> > Try this:
> >
> > "reduce": "_stats"
> >
> > Cheers,
> > mano
> >
> >
>
>
>

RE: running views return nothing with couchdb1.5.1

Posted by "Ramanadham, Radhika" <ra...@emc.com>.
Yes, the values are numeric.

-----Original Message-----
From: Simon Metson [mailto:simon@cloudant.com] 
Sent: Thursday, May 22, 2014 3:45 AM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1

And make sure your values are numeric - you can't sum "20" but you can sum 20.  


On Thursday, 22 May 2014 at 02:21, Manokaran K wrote:

> On Thu, May 22, 2014 at 6:27 AM, Ramanadham, Radhika 
> <ra...@emc.com> wrote:
> > Hi Mike,
> > 
> > Do, for one of the views, I need to return an average.
> > 
> > So, my reduce function had -
> > 
> > "cpu": {
> > "map": "function(doc) { if ((doc.type == 'performance_stats')) 
> > emit(doc.test_id, doc.CPU) }",
> > "reduce": "function(keys, values) "
> > "{ "
> > "avg = Math.round(sum(values)/values.length);"
> > "return(avg)"
> > " }"
> > 
> > Now, if I want to use stats, which give me sum and count, I tried this, but doesn't work. What am I doing wrong?
> > 
> > "cpu": {
> > "map": "function(doc) { if ((doc.type == 'performance_stats')) 
> > emit(doc.test_id, doc.CPU) }",
> > "reduce": "function(keys, values) "
> > "{ "
> > "avg = Math.round(_sum/_count);"
> > "return(avg)"
> > " }"
> > -Radhika
> > 
> 
> 
> Try this:
> 
> "reduce": "_stats"
> 
> Cheers,
> mano
> 
> 



Re: running views return nothing with couchdb1.5.1

Posted by Simon Metson <si...@cloudant.com>.
And make sure your values are numeric - you can't sum "20" but you can sum 20.  


On Thursday, 22 May 2014 at 02:21, Manokaran K wrote:

> On Thu, May 22, 2014 at 6:27 AM, Ramanadham, Radhika
> <ra...@emc.com> wrote:
> > Hi Mike,
> > 
> > Do, for one of the views, I need to return an average.
> > 
> > So, my reduce function had -
> > 
> > "cpu": {
> > "map": "function(doc) { if ((doc.type == 'performance_stats')) emit(doc.test_id, doc.CPU) }",
> > "reduce": "function(keys, values) "
> > "{ "
> > "avg = Math.round(sum(values)/values.length);"
> > "return(avg)"
> > " }"
> > 
> > Now, if I want to use stats, which give me sum and count, I tried this, but doesn't work. What am I doing wrong?
> > 
> > "cpu": {
> > "map": "function(doc) { if ((doc.type == 'performance_stats')) emit(doc.test_id, doc.CPU) }",
> > "reduce": "function(keys, values) "
> > "{ "
> > "avg = Math.round(_sum/_count);"
> > "return(avg)"
> > " }"
> > -Radhika
> > 
> 
> 
> Try this:
> 
> "reduce": "_stats"
> 
> Cheers,
> mano
> 
> 



RE: running views return nothing with couchdb1.5.1

Posted by "Ramanadham, Radhika" <ra...@emc.com>.
I am not sure how that would help as _stats doesn’t return average. Or is there a way to get the average?


-----Original Message-----
From: Manokaran K [mailto:manokaran@gmail.com] 
Sent: Wednesday, May 21, 2014 9:22 PM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1

On Thu, May 22, 2014 at 6:27 AM, Ramanadham, Radhika <ra...@emc.com> wrote:
> Hi  Mike,
>
> Do, for one of the views, I need to return an average.
>
> So, my reduce function had -
>
> "cpu": {
>                 "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
>                 "reduce": "function(keys, values) "
>                           "{ "
>                 "avg = Math.round(sum(values)/values.length);"
>                                "return(avg)"
>                           " }"
>
> Now, if I want to use stats, which give me sum and count, I tried this, but doesn't  work. What am I doing wrong?
>
> "cpu": {
>                 "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
>                 "reduce": "function(keys, values) "
>                           "{ "
>                 "avg = Math.round(_sum/_count);"
>                                "return(avg)"
>                           " }"
> -Radhika
>

Try this:

"reduce": "_stats"

Cheers,
mano


Re: running views return nothing with couchdb1.5.1

Posted by Manokaran K <ma...@gmail.com>.
On Thu, May 22, 2014 at 6:27 AM, Ramanadham, Radhika
<ra...@emc.com> wrote:
> Hi  Mike,
>
> Do, for one of the views, I need to return an average.
>
> So, my reduce function had -
>
> "cpu": {
>                 "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
>                 "reduce": "function(keys, values) "
>                           "{ "
>                 "avg = Math.round(sum(values)/values.length);"
>                                "return(avg)"
>                           " }"
>
> Now, if I want to use stats, which give me sum and count, I tried this, but doesn't  work. What am I doing wrong?
>
> "cpu": {
>                 "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
>                 "reduce": "function(keys, values) "
>                           "{ "
>                 "avg = Math.round(_sum/_count);"
>                                "return(avg)"
>                           " }"
> -Radhika
>

Try this:

"reduce": "_stats"

Cheers,
mano

RE: running views return nothing with couchdb1.5.1

Posted by "Ramanadham, Radhika" <ra...@emc.com>.
Hi  Mike,

Do, for one of the views, I need to return an average.

So, my reduce function had -

"cpu": {
                "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
                "reduce": "function(keys, values) "
                          "{ "
		"avg = Math.round(sum(values)/values.length);"
                               "return(avg)"
                          " }"

Now, if I want to use stats, which give me sum and count, I tried this, but doesn't  work. What am I doing wrong?

"cpu": {
                "map": "function(doc) { if ((doc.type == 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
                "reduce": "function(keys, values) "
                          "{ "
		"avg = Math.round(_sum/_count);"
                               "return(avg)"
                          " }"
-Radhika

-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com] 
Sent: Wednesday, May 21, 2014 10:32 AM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1

Hi Radhika,

What does the server status say in futon?  (i.e. does it note that the views are building or not?)

One side comment, the reduce functions that you posted will likely not do what you expect when a rereduce is run.  I would suggest using _stats (preferable solution, http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-reduce-functions
).

Cheers,
Mike


On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika < radhika.ramanadham@emc.com> wrote:

> Hi,
>
> I have some code that creates DB, documents and design documents with 
> views and lists.
>
> When I run views, I don't know why, but it returns nothing and waits 
> for ever. This is with couchdb1.5.1
>
> When I run the same code against my another couchdb server, only 
> difference being that the version is 1.5.0, it works perfect. All the 
> views return the right responses and results.
>
> Can anyone help me here? I am at a loss!
>
> Below is a snippet of my design doc:
>
> def createDesignDocForPerfStats():
>     design = db.design('perfstats')
>     resp = design.put(params={
>         "_id":"_design/perfstats",
>         "language": "javascript",
>         "views":
>         {
>             "by_server": {
>                 "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit([doc.Hostname,doc.test_id],{ 
> 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory, 
> 'FileSystem':doc.FileSystem }) }"
>             },
>              "by_test_id": {
>                 "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit(doc.test_id,{ 'Server Name': doc.Hostname, 
> 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory, 
> 'FileSystem':doc.FileSystem }) }"
>             },
>              "by_testid_starttime": {
>                 "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server Name':
> doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory': 
> doc.Memory, 'FileSystem':doc.FileSystem }) }"
>             },
>              #view is
> http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?group=true
>              "server": {
>                  "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",
>                  "reduce": "function(keys, values) {return (null)}"
>              },
>             "cpu": {
>                 "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
>                 "reduce": "function(keys, values) "
>                           "{ "
>                           "avg = Math.round(sum(values)/values.length);"
>                           "return(avg)"
>                           " }"
>             },
>             #get avg cpu for all servers per time
>             #
> http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_starttime?group=true
>             "cpu_by_starttime": {
>                 "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) }",
>                 "reduce": "function(keys, values) "
>                           "{ "
>                           "avg = Math.round(sum(values)/values.length);"
>                           "return(avg)"
>                           " }"
>             },
>         },
>         "lists":{
>             "sort":"function(head, req) {"
>                     "var row;"
>                     "var rows=[];"
>                     "while(row = getRow()) {"
>                         "rows.push(row)"
>                     "};"
>                     "rows.sort(function(a,b) {"
>                     "return b.value-a.value"
>                     "});"
>                     "send(JSON.stringify({\"rows\" : rows[0]}))"
>             "}"
>         }
>     })
>

RE: running views return nothing with couchdb1.5.1

Posted by "Ramanadham, Radhika" <ra...@emc.com>.
No, none :(
The documents and design docs get created OK and I see no difference in these docs compared to my docs on couchdb 1.5.0 version.
And I have 21 docs including the 2 design docs.

-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com] 
Sent: Wednesday, May 21, 2014 11:46 AM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1

Hi Rhadika,

Do any of your views work on the 1.5.1 box?  Is your couchjs process dying when the views are running?  (I've seen this due to libraries not being found, etc.)  Again, the output of the log would be helpful on the 1.5.1 box.

Cheers,
Mike


On Wed, May 21, 2014 at 5:40 PM, Ramanadham, Radhika < radhika.ramanadham@emc.com> wrote:

> I get "True" when I run GET /_config/query_server_config/reduce_limit  
> for
> both- couchdb server 1.5.0 and 1.5.1.
>
> Also, I just have a very simple design doc with 2 views. Even this 
> doesn’t work on couchdb 1.5.1 and works ok on cocuchdb 1.5.0
>
> def createDesignDocForErrors():
>     design = db.design('errors')
>     resp = design.put(params={
>         "_id":"_design/errors",
>         "language": "javascript",
>         "views":
>         {
>             "by_test_id": {
>                 #"map": "function(doc) { if (doc.type == 'error')  
> emit(doc.test_id, doc.errors) }"
>                 "map": "function(doc) { if (doc.type == 'error')  
> emit(doc.test_id, doc.error_count) }",
>                 "reduce" : "_sum"
>             },
>
>             #
> http://10.247.32.72:5984/longevity/_design/errors/_view/by_testid_starttime?group=true
>             "by_testid_starttime": {
>                 "map": "function(doc) { if (doc.type == 'error')  
> emit([doc.test_id,doc.start_time], doc.error_count) }",
>                 "reduce" : "function(keys, values) {return (values[0])}"
>             }
>         }
>      })
>
> I can't run this view either. Says, problem accessing a view.
>
> -----Original Message-----
> From: Dave Cottlehuber [mailto:dch@jsonified.com]
> Sent: Wednesday, May 21, 2014 11:34 AM
> To: user@couchdb.apache.org
> Subject: Re: running views return nothing with couchdb1.5.1
>
>
> > Hi Radhika,
> >
> > What does the server status say in futon? (i.e. does it note that 
> > the views are building or not?)
> >
> > One side comment, the reduce functions that you posted will likely 
> > not do what you expect when a rereduce is run. I would suggest using 
> > _stats (preferable solution, 
> > http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin
> > -r
> > educe-functions
> > ).
> >
> > Cheers,
> > Mike
> >
>
> As Mike pointed out, you will see noticeably better performance using 
> the builtin function.
>
> Do you see any errors, in particular Reduce output must shrink more 
> rapidly or reduce_overflow_error ?
>
>
> https://couchdb.readthedocs.org/en/latest/couchapp/views/nosql.html#ag
> gregate-functions
>
>
> It’s possible you have a different config on each box, for the reduce 
> heuristic;
>
> GET /_config/query_server_config/reduce_limit is what you would be 
> looking to compare between the boxes.
>
> Thanks Bob & Alex for reminding me of the error messages!
>
> A+
> Dave
>
>
>
>

Re: running views return nothing with couchdb1.5.1

Posted by Mike Marino <mm...@gmail.com>.
Hi Rhadika,

Do any of your views work on the 1.5.1 box?  Is your couchjs process dying
when the views are running?  (I've seen this due to libraries not being
found, etc.)  Again, the output of the log would be helpful on the 1.5.1
box.

Cheers,
Mike


On Wed, May 21, 2014 at 5:40 PM, Ramanadham, Radhika <
radhika.ramanadham@emc.com> wrote:

> I get "True" when I run GET /_config/query_server_config/reduce_limit  for
> both- couchdb server 1.5.0 and 1.5.1.
>
> Also, I just have a very simple design doc with 2 views. Even this doesn’t
> work on couchdb 1.5.1 and works ok on cocuchdb 1.5.0
>
> def createDesignDocForErrors():
>     design = db.design('errors')
>     resp = design.put(params={
>         "_id":"_design/errors",
>         "language": "javascript",
>         "views":
>         {
>             "by_test_id": {
>                 #"map": "function(doc) { if (doc.type == 'error')
>  emit(doc.test_id, doc.errors) }"
>                 "map": "function(doc) { if (doc.type == 'error')
>  emit(doc.test_id, doc.error_count) }",
>                 "reduce" : "_sum"
>             },
>
>             #
> http://10.247.32.72:5984/longevity/_design/errors/_view/by_testid_starttime?group=true
>             "by_testid_starttime": {
>                 "map": "function(doc) { if (doc.type == 'error')
>  emit([doc.test_id,doc.start_time], doc.error_count) }",
>                 "reduce" : "function(keys, values) {return (values[0])}"
>             }
>         }
>      })
>
> I can't run this view either. Says, problem accessing a view.
>
> -----Original Message-----
> From: Dave Cottlehuber [mailto:dch@jsonified.com]
> Sent: Wednesday, May 21, 2014 11:34 AM
> To: user@couchdb.apache.org
> Subject: Re: running views return nothing with couchdb1.5.1
>
>
> > Hi Radhika,
> >
> > What does the server status say in futon? (i.e. does it note that the
> > views are building or not?)
> >
> > One side comment, the reduce functions that you posted will likely not
> > do what you expect when a rereduce is run. I would suggest using
> > _stats (preferable solution,
> > http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-r
> > educe-functions
> > ).
> >
> > Cheers,
> > Mike
> >
>
> As Mike pointed out, you will see noticeably better performance using the
> builtin function.
>
> Do you see any errors, in particular Reduce output must shrink more
> rapidly or reduce_overflow_error ?
>
>
> https://couchdb.readthedocs.org/en/latest/couchapp/views/nosql.html#aggregate-functions
>
>
> It’s possible you have a different config on each box, for the reduce
> heuristic;
>
> GET /_config/query_server_config/reduce_limit is what you would be looking
> to compare between the boxes.
>
> Thanks Bob & Alex for reminding me of the error messages!
>
> A+
> Dave
>
>
>
>

RE: running views return nothing with couchdb1.5.1

Posted by "Ramanadham, Radhika" <ra...@emc.com>.
I get "True" when I run GET /_config/query_server_config/reduce_limit  for both- couchdb server 1.5.0 and 1.5.1.

Also, I just have a very simple design doc with 2 views. Even this doesn’t work on couchdb 1.5.1 and works ok on cocuchdb 1.5.0

def createDesignDocForErrors():
    design = db.design('errors')
    resp = design.put(params={
        "_id":"_design/errors",
        "language": "javascript",
        "views":
        {
            "by_test_id": {
                #"map": "function(doc) { if (doc.type == 'error')  emit(doc.test_id, doc.errors) }"
                "map": "function(doc) { if (doc.type == 'error')  emit(doc.test_id, doc.error_count) }",
                "reduce" : "_sum"
            },

            #http://10.247.32.72:5984/longevity/_design/errors/_view/by_testid_starttime?group=true
            "by_testid_starttime": {
                "map": "function(doc) { if (doc.type == 'error')  emit([doc.test_id,doc.start_time], doc.error_count) }",
                "reduce" : "function(keys, values) {return (values[0])}"
            }
        }
     })

I can't run this view either. Says, problem accessing a view.

-----Original Message-----
From: Dave Cottlehuber [mailto:dch@jsonified.com] 
Sent: Wednesday, May 21, 2014 11:34 AM
To: user@couchdb.apache.org
Subject: Re: running views return nothing with couchdb1.5.1

 
> Hi Radhika,
>  
> What does the server status say in futon? (i.e. does it note that the 
> views are building or not?)
>  
> One side comment, the reduce functions that you posted will likely not 
> do what you expect when a rereduce is run. I would suggest using 
> _stats (preferable solution, 
> http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-r
> educe-functions
> ).
>  
> Cheers,
> Mike
>  

As Mike pointed out, you will see noticeably better performance using the builtin function.  

Do you see any errors, in particular Reduce output must shrink more rapidly or reduce_overflow_error ? 

https://couchdb.readthedocs.org/en/latest/couchapp/views/nosql.html#aggregate-functions 

It’s possible you have a different config on each box, for the reduce heuristic;  

GET /_config/query_server_config/reduce_limit is what you would be looking to compare between the boxes.

Thanks Bob & Alex for reminding me of the error messages!

A+
Dave




Re: running views return nothing with couchdb1.5.1

Posted by Dave Cottlehuber <dc...@jsonified.com>.
 
> Hi Radhika,
>  
> What does the server status say in futon? (i.e. does it note that the
> views are building or not?)
>  
> One side comment, the reduce functions that you posted will likely not do
> what you expect when a rereduce is run. I would suggest using _stats
> (preferable solution,
> http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-reduce-functions
> ).
>  
> Cheers,
> Mike
>  

As Mike pointed out, you will see noticeably better performance using the builtin function.  

Do you see any errors, in particular Reduce output must shrink more rapidly or reduce_overflow_error ? 

https://couchdb.readthedocs.org/en/latest/couchapp/views/nosql.html#aggregate-functions 

It’s possible you have a different config on each box, for the reduce heuristic;  

GET /_config/query_server_config/reduce_limit is what you would be looking to compare between the boxes.

Thanks Bob & Alex for reminding me of the error messages!

A+
Dave



Re: running views return nothing with couchdb1.5.1

Posted by Mike Marino <mm...@gmail.com>.
Hi Radhika,

What does the server status say in futon?  (i.e. does it note that the
views are building or not?)

One side comment, the reduce functions that you posted will likely not do
what you expect when a rereduce is run.  I would suggest using _stats
(preferable solution,
http://couchdb.readthedocs.org/en/latest/couchapp/ddocs.html#builtin-reduce-functions
).

Cheers,
Mike


On Wed, May 21, 2014 at 4:25 PM, Ramanadham, Radhika <
radhika.ramanadham@emc.com> wrote:

> Hi,
>
> I have some code that creates DB, documents and design documents with
> views and lists.
>
> When I run views, I don't know why, but it returns nothing and waits for
> ever. This is with couchdb1.5.1
>
> When I run the same code against my another couchdb server, only
> difference being that the version is 1.5.0, it works perfect. All the views
> return the right responses and results.
>
> Can anyone help me here? I am at a loss!
>
> Below is a snippet of my design doc:
>
> def createDesignDocForPerfStats():
>     design = db.design('perfstats')
>     resp = design.put(params={
>         "_id":"_design/perfstats",
>         "language": "javascript",
>         "views":
>         {
>             "by_server": {
>                 "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit([doc.Hostname,doc.test_id],{
> 'Start_time':doc.start_time ,'CPU': doc.CPU, 'Memory': doc.Memory,
> 'FileSystem':doc.FileSystem }) }"
>             },
>              "by_test_id": {
>                 "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit(doc.test_id,{ 'Server Name': doc.Hostname,
> 'Start_time':doc.start_time, 'CPU': doc.CPU, 'Memory': doc.Memory,
> 'FileSystem':doc.FileSystem }) }"
>             },
>              "by_testid_starttime": {
>                 "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit([doc.test_id, doc.start_time],{ 'Server Name':
> doc.Hostname, 'TestID':doc.test_id, 'CPU': doc.CPU, 'Memory': doc.Memory,
> 'FileSystem':doc.FileSystem }) }"
>             },
>              #view is
> http://10.247.32.71:5984/longevity/_design/perfstats51/_view/server?group=true
>              "server": {
>                  "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit([doc.test_id, doc.Hostname],null ) }",
>                  "reduce": "function(keys, values) {return (null)}"
>              },
>             "cpu": {
>                 "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit(doc.test_id, doc.CPU) }",
>                 "reduce": "function(keys, values) "
>                           "{ "
>                           "avg = Math.round(sum(values)/values.length);"
>                           "return(avg)"
>                           " }"
>             },
>             #get avg cpu for all servers per time
>             #
> http://10.247.32.72:5984/longevity/_design/perfstats1/_view/cpu_by_starttime?group=true
>             "cpu_by_starttime": {
>                 "map": "function(doc) { if ((doc.type ==
> 'performance_stats'))  emit([doc.test_id,doc.start_time], doc.CPU) }",
>                 "reduce": "function(keys, values) "
>                           "{ "
>                           "avg = Math.round(sum(values)/values.length);"
>                           "return(avg)"
>                           " }"
>             },
>         },
>         "lists":{
>             "sort":"function(head, req) {"
>                     "var row;"
>                     "var rows=[];"
>                     "while(row = getRow()) {"
>                         "rows.push(row)"
>                     "};"
>                     "rows.sort(function(a,b) {"
>                     "return b.value-a.value"
>                     "});"
>                     "send(JSON.stringify({\"rows\" : rows[0]}))"
>             "}"
>         }
>     })
>