couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Geoghegan (JIRA)" <>
Subject [jira] Created: (COUCHDB-567) Erlang View with Reduce Fails on Large Number of documents
Date Wed, 11 Nov 2009 05:08:28 GMT
Erlang View with Reduce Fails on Large Number of documents

                 Key: COUCHDB-567
             Project: CouchDB
          Issue Type: Bug
    Affects Versions: 0.10
            Reporter: Sean Geoghegan

I have been having a problem with running Erlang views over a large dataset.  Whenever the
indexer goes to checkpoint it's process the following error occurs:

** Last message in was {'EXIT',<0.2220.0>,

This problem occurs regardless of the functionality of the map and reduce functions, it seems
to based on the time it takes to generate, or whatever causes the checkpoints to get written

I did some investigation into the problem by adding alot of LOG_INFO statements throughout
the code.  I was able to determine the following:
   * the Erlang View process is being held on to by the view updater for the entire duration
of the indexing, 
   * however after the first checkpoint is hit and the progress is written out, a reduce call
is made to the erlang view server, once this completes the view server is released back to
the cache using ret_os_process. 
   * when the next reduce cycle occurs the same erlang view server is returned by get_os_process
but it is first sent a reset message which clears all the functions in the view servers state.
   * when the next map cycles starts the view updater uses the same handle to the erlang view
server it had in the beginning. It assumes that the servers state is the same however it has
been reset so there are no view functions in the view server.  This causes the above error
when it then attempts to write out the result of a view function which doesn't exist in the

I was able to fix this problem by modifying line 139 of couch_view_updater.erl from this:

   {[], Group2, ViewEmptyKeyValues, []}

to this:

 {[], Group2#group{query_server=nil}, ViewEmptyKeyValues, []}

Which removes the view updater's handle to the erlang server proc, forcing it to get/create
a new one for each map cycle and setting up the view functions within the server.  I don't
know if this is the right way to do it, or if it has any bad side-effects, but it does prevent
the crash at least, and allow the indexing to complete correctly.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message