Couch DB在视图更改上给出了一个奇怪的例外

时间:2013-09-30 06:21:29

标签: couchdb

我在我的本地数据库上运行了沙发视图。通过一些奇怪的怪癖,其中一个视图开始发送包含以下内容的错误报告。

{error_report,<0.31.0>,
                   {<0.11889.0>,crash_report,
                    [[{initial_call,{couch_file,init,['Argument__1']}},
                      {pid,<0.11889.0>},
                      {registered_name,[]},
                      {error_info,
                       {exit,
                        {{badmatch,{error,eacces}},
                         [{couch_file,init,1},
                          {gen_server,init_it,6},
                          {proc_lib,init_p_do_apply,3}]},
                        [{gen_server,init_it,6},
                         {proc_lib,init_p_do_apply,3}]}},
                      {ancestors,[<0.11888.0>,<0.11887.0>]},
                      {messages,[]},
                      {links,[#Port<0.5466>,<0.11888.0>]},
                      {dictionary,[]},
                      {trap_exit,true},
                      {status,running},
                      {heap_size,377},
                      {stack_size,24},
                      {reductions,575}],
                     [{neighbour,
                       [{pid,<0.11887.0>},
                        {registered_name,[]},
                        {initial_call,{erlang,apply,2}},
                        {current_function,{proc_lib,sync_wait,2}},
                        {ancestors,[]},
                        {messages,[]},
                        {links,[<0.11869.0>,<0.11888.0>]},
                        {dictionary,[]},
                        {trap_exit,false},
                        {status,waiting},
                        {heap_size,233},
                        {stack_size,8},
                        {reductions,15}]},
                      {neighbour,
                       [{pid,<0.11888.0>},
                        {registered_name,[]},
                        {initial_call,{couch_index,init,['Argument__1']}},
                        {current_function,{proc_lib,sync_wait,2}},
                        {ancestors,[<0.11887.0>]},
                        {messages,
                         [{ack,<0.11889.0>,
                           {error,
                            {{badmatch,{error,eacces}},
                             [{couch_file,init,1},
                              {gen_server,init_it,6},
                              {proc_lib,init_p_do_apply,3}]}}}]},
                        {links,[<0.11887.0>,<0.11889.0>]},
                        {dictionary,[]},
                        {trap_exit,false},
                        {status,runnable},
                        {heap_size,4181},
                        {stack_size,33},
                        {reductions,1748}]}]]}}
 [error] [<0.11869.0>] ** Generic server couch_index_server terminating 
** Last message in was {'EXIT',<0.11887.0>,
                           {{badmatch,{error,eacces}},
                            [{couch_file,init,1},
                             {gen_server,init_it,6},
                             {proc_lib,init_p_do_apply,3}]}}
** When Server state == {st,"/var/lib/couchdb/1.3.0"}
** Reason for termination == 
** {{badmatch,{error,eacces}},
[{couch_file,init,1},{gen_server,init_it,6},{proc_lib,init_p_do_apply,3}]}
[Mon, 30 Sep 2013 06:03:40 GMT] [error] [<0.11869.0>] {error_report,<0.31.0>,
                      {<0.11869.0>,crash_report,
                       [[{initial_call,
                             {couch_index_server,init,['Argument__1']}},
                         {pid,<0.11869.0>},
                         {registered_name,couch_index_server},
                         {error_info,
                             {exit,
                                 {{badmatch,{error,eacces}},
                                  [{couch_file,init,1},
                                   {gen_server,init_it,6},
                                   {proc_lib,init_p_do_apply,3}]},
                                 [{gen_server,terminate,6},
                                  {proc_lib,init_p_do_apply,3}]}},
                         {ancestors,
                             [couch_secondary_services,couch_server_sup,
                              <0.32.0>]},
                         {messages,[]},
                         {links,[<0.11870.0>,<0.8687.0>]},
                         {dictionary,[]},
                         {trap_exit,true},
                         {status,running},
                         {heap_size,987},
                         {stack_size,24},
                         {reductions,495}],
                        [{neighbour,
                             [{pid,<0.11870.0>},
                              {registered_name,[]},
                              {initial_call,
                                  {couch_event_sup,init,['Argument__1']}},
                              {current_function,{gen_server,loop,6}},
                              {ancestors,
                                  [couch_index_server,
                                   couch_secondary_services,
                                   couch_server_sup,<0.32.0>]},
                              {messages,[]},
                              {links,[<0.11869.0>,<0.8682.0>]},
                              {dictionary,[]},
                              {trap_exit,false},
                              {status,waiting},
                              {heap_size,233},
                              {stack_size,9},
                              {reductions,32}]}]]}}
[Mon, 30 Sep 2013 06:03:40 GMT] [error] [<0.8687.0>] {error_report,<0.31.0>,
                     {<0.8687.0>,supervisor_report,
                      [{supervisor,{local,couch_secondary_services}},
                       {errorContext,child_terminated},
                       {reason,
                           {{badmatch,{error,eacces}},
                            [{couch_file,init,1},
                             {gen_server,init_it,6},
                             {proc_lib,init_p_do_apply,3}]}},
                       {offender,
                           [{pid,<0.11869.0>},
                            {name,index_server},
                            {mfargs,{couch_index_server,start_link,[]}},
                            {restart_type,permanent},
                            {shutdown,brutal_kill},
                            {child_type,worker}]}]}}
[Mon, 30 Sep 2013 06:03:40 GMT] [error] [<0.11069.0>] Uncaught error in HTTP request: {exit,
                                                   {{{badmatch,
                                                      {error,eacces}},
                                                     [{couch_file,init,1},
                                                      {gen_server,
                                                       init_it,6},
                                                      {proc_lib,
                                                       init_p_do_apply,
                                                       3}]},
                                                    {gen_server,call,
                                                     [couch_index_server,
                                                      {get_index,
                                                       {couch_mrview_index,
                                                        {mrst,
                                                         <<117,203,135,163,
                                                           183,160,137,85,
                                                           158,17,190,127,
                                                           58,84,144,172>>,
                                                         nil,undefined,
                                                         <<"kri008">>,
                                                         <<"_design/order">>,
                                                         <<"javascript">>,
                                                         [],
                                                         {[]},
                                                         [{mrview,0,0,0,
                                                           [<<"getAllOpen">>],
                                                           [],
 --------------------------------------------------------

[Mon, 30 Sep 2013 06:03:40 GMT] [info] [<0.11069.0>] Stacktrace: [{gen_server,call,3},
                              {couch_index_server,get_index,4},
                              {couch_mrview_util,get_view,4},
                              {couch_mrview,query_view,6},
                              {couch_httpd,etag_maybe,2},
                              {couch_mrview_http,design_doc_view,5},
                              {couch_httpd_db,do_db_req,2},
                              {couch_httpd,handle_request_int,5}]

要解决这个问题,我所做的就是通过在分号后添加空格来更新视图源代码并且错误消失。添加空格或任何不违反JavaScript语法的字符(即在视图源代码中向注释添加字母)将恢复上述错误并且Couch DB返回数据。如果我还原更改,它将再次开始给出上述错误。不幸的是,我为消除这个错误所做的改变没有意义。我尝试重新启动Couch DB并检查Couchdb .couch文件的权限。任何帮助将不胜感激。

更新:这是我用来从数据库中获取数据集的视图内容

function(doc) {
  if (doc.documentType == 'com.acme.Order' && (doc.lock != null)) {
    emit(doc.documentObject.createdTime, doc);
  }
}

1 个答案:

答案 0 :(得分:1)

好的,让我猜一想。你的文件是不是很大的对象?我想你可能会遇到执行mapdoc的视图服务器的超时。我会尝试更改您的视图,不要将文档作为值发出并重试,如下所示:

-emit(doc.documentObject.createdTime, doc);
+emit(doc.documentObject.createdTime, null);

这将为视图索引文件节省大量磁盘空间,您可以更快地创建它。

要让文档正文将 include_docs = true 添加到您的视图查询中。