summaryrefslogtreecommitdiff
path: root/src/couchdb
diff options
context:
space:
mode:
authorJohn Christopher Anderson <jchris@apache.org>2010-10-02 00:05:59 +0000
committerJohn Christopher Anderson <jchris@apache.org>2010-10-02 00:05:59 +0000
commit482c902e36ea8cef3039c2b0b3c8644bc18d5b57 (patch)
treef1849df6d5ee7bcb544f10de4cadcb15a7f89472 /src/couchdb
parent09baa8c43d241cee6b891e5174a7fc6d5e4b3fd2 (diff)
backport r1003701 (fix db file ref count in view generation
git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.0.x@1003718 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb')
-rw-r--r--src/couchdb/couch_view.erl8
-rw-r--r--src/couchdb/couch_view_group.erl7
2 files changed, 6 insertions, 9 deletions
diff --git a/src/couchdb/couch_view.erl b/src/couchdb/couch_view.erl
index 38c0a783..68f3bca9 100644
--- a/src/couchdb/couch_view.erl
+++ b/src/couchdb/couch_view.erl
@@ -29,9 +29,7 @@ start_link() ->
gen_server:start_link({local, couch_view}, couch_view, [], []).
get_temp_updater(DbName, Language, DesignOptions, MapSrc, RedSrc) ->
- % make temp group
- % do we need to close this db?
- {ok, _Db, Group} =
+ {ok, Group} =
couch_view_group:open_temp_group(DbName, Language, DesignOptions, MapSrc, RedSrc),
case gen_server:call(couch_view, {get_group_server, DbName, Group}) of
{ok, Pid} ->
@@ -41,10 +39,8 @@ get_temp_updater(DbName, Language, DesignOptions, MapSrc, RedSrc) ->
end.
get_group_server(DbName, GroupId) ->
- % get signature for group
case couch_view_group:open_db_group(DbName, GroupId) of
- % do we need to close this db?
- {ok, _Db, Group} ->
+ {ok, Group} ->
case gen_server:call(couch_view, {get_group_server, DbName, Group}) of
{ok, Pid} ->
Pid;
diff --git a/src/couchdb/couch_view_group.erl b/src/couchdb/couch_view_group.erl
index f01befdf..2db972fb 100644
--- a/src/couchdb/couch_view_group.erl
+++ b/src/couchdb/couch_view_group.erl
@@ -445,8 +445,8 @@ open_temp_group(DbName, Language, DesignOptions, MapSrc, RedSrc) ->
def=MapSrc,
reduce_funs= if RedSrc==[] -> []; true -> [{<<"_temp">>, RedSrc}] end,
options=DesignOptions},
-
- {ok, Db, set_view_sig(#group{name = <<"_temp">>, db=Db, views=[View],
+ couch_db:close(Db),
+ {ok, set_view_sig(#group{name = <<"_temp">>, views=[View],
def_lang=Language, design_options=DesignOptions})};
Error ->
Error
@@ -463,7 +463,8 @@ open_db_group(DbName, GroupId) ->
{ok, Db} ->
case couch_db:open_doc(Db, GroupId) of
{ok, Doc} ->
- {ok, Db, design_doc_to_view_group(Doc)};
+ couch_db:close(Db),
+ {ok, design_doc_to_view_group(Doc)};
Else ->
couch_db:close(Db),
Else