[
https://issues.apache.org/jira/browse/COUCHDB-1225?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066883#comment-13066883
]
Alex Koshelev commented on COUCHDB-1225:
----------------------------------------
Design doc looks like this:
{
"_id": "_design/admin",
"language": "erlang",
"views": {
"frame_by_channel": {
"map": "fun({Doc}) ->
{Channel} = couch_util:get_value(<<\"channel\">>, Doc),
Emit(couch_util:get_value(<<\"id\">>, Channel), null)
end."
},
"frame_by_program": {
"map": "fun({Doc}) ->
FuncInstance = fun({Instance}) ->
{Program} = couch_util:get_value(<<\"program\">>, Instance),
couch_util:get_value(<<\"id\">>, Program)
end,
lists:foreach(fun (Id)-> Emit(Id, null) end,
sets:to_list(sets:from_list(
lists:map(FuncInstance, couch_util:get_value(<<\"instances\">>,
Doc))
)))
end."
},
"frame_by_program_channel_day_region_start": {
"map": "fun({Doc}) ->
{Channel} = couch_util:get_value(<<\"channel\">>, Doc),
{Region} = couch_util:get_value(<<\"region\">>, Doc),
FuncInstance = fun({Instance}) ->
{Program} = couch_util:get_value(<<\"program\">>, Instance),
Emit([couch_util:get_value(<<\"id\">>, Program),
couch_util:get_value(<<\"id\">>, Channel),
couch_util:get_value(<<\"day\">>, Doc),
couch_util:get_value(<<\"id\">>, Region),
couch_util:get_value(<<\"start\">>, Instance)], null)
end,
lists:foreach(FuncInstance, couch_util:get_value(<<\"instances\">>,
Doc))
end."
},
"regions_by_channel": {
"map": "fun({Doc}) ->
{Channel} = couch_util:get_value(<<\"channel\">>, Doc),
{Region} = couch_util:get_value(<<\"region\">>, Doc),
Emit(couch_util:get_value(<<\"id\">>, Channel),
couch_util:get_value(<<\"id\">>, Region))
end.",
"reduce": "fun(Keys, Values, RR) ->
case RR of
false -> sets:to_list(sets:from_list(Values));
true -> sets:to_list(sets:from_list(lists:flatten(Values)))
end
end."
},
"regions_by_program": {
"map": "fun({Doc}) ->
{Region} = couch_util:get_value(<<\"region\">>, Doc),
FuncInstance = fun({Instance}) ->
{Program} = couch_util:get_value(<<\"program\">>, Instance),
couch_util:get_value(<<\"id\">>, Program)
end,
FuncId = fun(Id) ->
Emit(Id, couch_util:get_value(<<\"id\">>, Region))
end,
lists:foreach(FuncId,
sets:to_list(
sets:from_list(
lists:map(FuncInstance,
couch_util:get_value(<<\"instances\">>, Doc))
)
)
)
end.",
"reduce": "fun(Keys, Values, RR) ->
case RR of
false -> sets:to_list(sets:from_list(Values));
true -> sets:to_list(sets:from_list(lists:flatten(Values)))
end
end."
}
}
}
> missing_named_view error on existing design doc and view
> --------------------------------------------------------
>
> Key: COUCHDB-1225
> URL: https://issues.apache.org/jira/browse/COUCHDB-1225
> Project: CouchDB
> Issue Type: Bug
> Environment: Erlang 1:14.b.3
> CouchDB 1.2.0a-f7cc8fa-git
> Ubuntu Lucid 10.04 64bit
> Reporter: Alex Koshelev
>
> curl
> foo.bar:5984/cray_frame_11266/_design/admin/_view/regions_by_channel?limit=1
> {"error":"not_found","reason":"missing_named_view"}
> It worked some time ago but now there is constantly the error. If I restart
> CoucDB it will solve this issue. Updating the desing doc also solves the
> issue.
> With debug log level I get this messages:
> [Sat, 16 Jul 2011 23:40:44 GMT] [debug] [<0.898.3>] 'GET'
> /cray_frame_11266/_design/admin/_view/regions_by_channel?limit=1 {1,
>
> 1} from "93.158.159.91"
> Headers: [{'Accept',"*/*"},
> {'Host',"foo.bar:5984"},
> {'User-Agent',"curl/7.19.7 (x86_64-pc-linux-gnu) libcurl/7.19.7
> OpenSSL/0.9.8k zlib/1.2.3.3 libidn/1.15"}]
> [Sat, 16 Jul 2011 23:40:44 GMT] [debug] [<0.898.3>] OAuth Params:
> [{"limit","1"}]
> [Sat, 16 Jul 2011 23:40:44 GMT] [debug] [<0.898.3>] request_group {Pid, Seq}
> {<0.6419.0>,311}
> [Sat, 16 Jul 2011 23:40:44 GMT] [debug] [<0.898.3>] request_group {Pid, Seq}
> {<0.6419.0>,311}
> [Sat, 16 Jul 2011 23:40:44 GMT] [debug] [<0.898.3>] Minor error in HTTP
> request: {not_found,
> missing_named_view}
> [Sat, 16 Jul 2011 23:40:44 GMT] [debug] [<0.898.3>] Stacktrace:
> [{io_lib_pretty,cind_tag_tuple,7},
> {io_lib_pretty,while_fail,3},
> {io_lib_pretty,print,6},
> {io_lib_format,build,3},
> {io_lib_format,build,3},
> {io_lib_format,build,3},
> {io_lib_format,build,3},
> {io_lib_format,build,3}]
> [Sat, 16 Jul 2011 23:40:44 GMT] [info] [<0.898.3>] 0.0.0.0 - - GET
> /cray_frame_11266/_design/admin/_view/regions_by_channel?limit=1 404
> [Sat, 16 Jul 2011 23:40:44 GMT] [debug] [<0.898.3>] httpd 404 error response:
> {"error":"not_found","reason":"missing_named_view"}
> I've also tried to get _info about design doc and found that it have had zero
> data_size:
> > curl foo.bar:5984/cray_frame_11266/_design/admin/_info | python -mjson.tool
> {
> "name": "admin",
> "view_index": {
> "compact_running": false,
> "data_size": 0,
> "disk_size": 90241,
> "language": "erlang",
> "purge_seq": 0,
> "signature": "09b8b599cad584406b7aa5956b98a335",
> "update_seq": 311,
> "updater_running": false,
> "waiting_clients": 0,
> "waiting_commit": false
> }
> }
> In the same time another similar design doc works fine and has some data_size:
> > curl foo.bar:5984/cray_frame_11266/_design/web/_info | python -mjson.tool
> {
> "name": "web",
> "view_index": {
> "compact_running": false,
> "data_size": 7462075,
> "disk_size": 9138406,
> "language": "erlang",
> "purge_seq": 0,
> "signature": "7f01f0c843b3bbb79d00ec4ff8d43010",
> "update_seq": 311,
> "updater_running": false,
> "waiting_clients": 0,
> "waiting_commit": false
> }
> }
> Over the year ago Mark Anderson has asked similar questing in the thread
> called "Need help diagnosing couchdb view 404s" [1] but seams did not found
> any answer than.
> [1]: http://comments.gmane.org/gmane.comp.db.couchdb.user/8994
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira