unknown_error when querying a view after deleting keys
I'm running Couchbase 2.0 Beta (build-1723) on Ubuntu and connecting to it using the couchbase python client, a memcachecd python client and the memc module through NginX.
I have issues accessing views after deleting keys through the python memcached api (I have tried 'delete_multi' and looping over multiple 'delete' calls). I also get the same error when hitting the rest API through a web-browser:
For example:
http://127.0.0.1:8092/webcache/_design/cache/_view/cachegroups?stale=false&reduce=false&key=[%22userid%22,%223f840a8e5378e90fc4006222%22]
The following error is returned.
{"error":"unknown_error","reason":"badarg"}
The exact same query will work again after a few seconds.
Does anyone else get this problem, or is this a known issue?
I have tried a build on here (windows 64 bit 2.0.0 enterprise edition (build-1915) ) The problem still manifests itself in this build, and in several earlier builds.
I do have more info for the developers though... The bug happens under the following conditions:
- A reduce function exists
- There are no keys emitted from the map function (because of conditions within the map function)
- A view query is issued with stale=false, reduce=false
Then the following output is emitted:
{"error":"unknown_error","reason":"badarg"}
expected output:
{"total_rows":0,"rows":[]}
Note: If the reduce function is removed or a built-in is specified then the problem does not manifest itself. I have tried replacing my reduce function with the count sample from the couchbase website (for sanity). But since we specify reduce=false in the view query the presence or not of a reduce function should not affect the output... but it does!
Any ideas on this and if this problem will be fixed for the next release?
Hi,
This error happens on build 1916 as well (tested on Windows 7 64bit) but it doesn't happen on developer preview 4
Steps to reproduce:
create a view with map function:
function (doc, meta) { }
and reduce function:
function (key, values, rereduce) { return 0; }
In my case, the design doc is called test and view is called empty and CB is installed locally with default options so I browse there:
http://localhost:8092/default/_design/dev_test/_view/empty?reduce=false&...
And I get:
{"error":"unknown_error","reason":"badarg"}
If you remove the reduce function or replace it with any of the builtin _count,_sum or _stats, you get the expected result:
{"total_rows":0,"rows":[]}
This happens with or without docs in the bucket and on both dev/productions views.
This is, of course, an extreme case where the map function never emit any result to prove that the bug exist.
In normal environments, map functions almost always emit data but in some cases where emit is conditional, it could happen that no data is emitted, leading to this bug.
Thanks for the link I have tried a build on here (windows 64 bit 2.0.0 enterprise edition (build-1915) ) The problem still manifests itself in this build, and in several earlier builds.
I do have more info for the developers though... The bug happens under the following conditions:
- A reduce function exists
- There are no keys emitted from the map function (because of conditions within the map function)
- A view query is issued with stale=false, reduce=false
Then the following output is emitted:
{"error":"unknown_error","reason":"badarg"}
expected output:
{"total_rows":0,"rows":[
<strong>] }</strong>
Note: If the reduce function is removed or a built-in is specified then the problem does not manifest itself. I have tried replacing my reduce function with the count sample from the couchbase website (for sanity). But since we specify reduce=false in the view query the presence or not of a reduce function should not affect the output... but it does!
Any ideas on this and if this problem will be fixed for the next release?
The bug filed for this issue http://www.couchbase.com/issues/browse/MB-7055 has been fixed. Please try a build after 1931 (e.g. 1937).
Hi Peter,
A similar issue was fixed in later builds. Can you please download and try with more recent stable version (build 1870) and let me know if that helps.
Its available for download from the below link:
http://builds.hq.northscale.net/latestbuilds/couchbase-server-community_...
The 32bit version is also available on the link if you are using that.
Deep