You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2011/08/24 04:42:59 UTC

svn commit: r1160966 - /couchdb/trunk/src/couchdb/couch_compaction_daemon.erl

Author: fdmanana
Date: Wed Aug 24 02:42:58 2011
New Revision: 1160966

URL: http://svn.apache.org/viewvc?rev=1160966&view=rev
Log:
Add after clause to receive expression

When doing parallel view compaction, make sure the
respective process terminates when it exceeds the
allowed period window and strict_window is set to
true.

Modified:
    couchdb/trunk/src/couchdb/couch_compaction_daemon.erl

Modified: couchdb/trunk/src/couchdb/couch_compaction_daemon.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_compaction_daemon.erl?rev=1160966&r1=1160965&r2=1160966&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_compaction_daemon.erl (original)
+++ couchdb/trunk/src/couchdb/couch_compaction_daemon.erl Wed Aug 24 02:42:58 2011
@@ -144,6 +144,7 @@ maybe_compact_db(DbName, Config) ->
                 end),
                 ViewsMonRef = erlang:monitor(process, ViewsCompactPid);
             false ->
+                ViewsCompactPid = nil,
                 ViewsMonRef = nil
             end,
             DbMonRef = erlang:monitor(process, DbCompactPid),
@@ -175,6 +176,12 @@ maybe_compact_db(DbName, Config) ->
                 receive
                 {'DOWN', ViewsMonRef, process, _, _Reason} ->
                     ok
+                after TimeLeft + 1000 ->
+                    % Under normal circunstances, the view compaction process
+                    % should have finished already.
+                    erlang:demonitor(ViewsMonRef, [flush]),
+                    unlink(ViewsCompactPid),
+                    exit(ViewsCompactPid, kill)
                 end
             end;
         false ->