couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject [45/50] [abbrv] git commit: Close view compaction file when compaction is canceled
Date Wed, 14 Mar 2012 22:28:02 GMT
Close view compaction file when compaction is canceled

Closes COUCHDB-1384


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/12a593c6
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/12a593c6
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/12a593c6

Branch: refs/heads/COUCHDB-1426
Commit: 12a593c61dc0f154f3ade65a50706a019103d680
Parents: c43fbc9
Author: Filipe David Borba Manana <fdmanana@apache.org>
Authored: Thu Jan 19 12:55:40 2012 +0000
Committer: Filipe David Borba Manana <fdmanana@apache.org>
Committed: Sun Jan 22 12:44:12 2012 +0000

----------------------------------------------------------------------
 src/couchdb/couch_view_group.erl |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/12a593c6/src/couchdb/couch_view_group.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_view_group.erl b/src/couchdb/couch_view_group.erl
index 769a69e..97fc512 100644
--- a/src/couchdb/couch_view_group.erl
+++ b/src/couchdb/couch_view_group.erl
@@ -168,7 +168,12 @@ handle_call({start_compact, CompactFun}, _From, #group_state{compactor_pid=nil}
     {ok, Fd} = open_index_file(compact, RootDir, DbName, GroupSig),
     NewGroup = reset_file(Db, Fd, DbName, Group),
     couch_db:close(Db),
-    Pid = spawn_link(fun() -> CompactFun(Group, NewGroup, DbName) end),
+    unlink(Fd),
+    Pid = spawn_link(fun() ->
+        link(Fd),
+        CompactFun(Group, NewGroup, DbName),
+        unlink(Fd)
+    end),
     {reply, {ok, Pid}, State#group_state{compactor_pid = Pid}};
 handle_call({start_compact, _}, _From, State) ->
     %% compact already running, this is a no-op


Mime
View raw message