incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Marino <mmar...@gmail.com>
Subject Re: running views return nothing with couchdb1.5.1
Date Wed, 21 May 2014 15:03:56 GMT
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<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.









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





-----Original Message-----
From: Mike Marino [mailto:mmarino@gmail.com <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]}))"

>             "}"

>         }

>     })

>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message