incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <jch...@apache.org>
Subject Re: svn commit: r1003701 - in /couchdb/trunk/src/couchdb: couch_view.erl couch_view_group.erl
Date Fri, 01 Oct 2010 23:36:17 GMT
On Fri, Oct 1, 2010 at 4:05 PM,  <jchris@apache.org> wrote:
> Author: jchris
> Date: Fri Oct  1 23:05:30 2010
> New Revision: 1003701
>
> URL: http://svn.apache.org/viewvc?rev=1003701&view=rev
> Log:
> close db handles after using them to get view groups
>

I think this patch will help with the compaction file-delete stuff. I
did that last view refactor before I understood completely how the
file ref counts worked. Sorry about that. Should be all better now.

> Modified:
>    couchdb/trunk/src/couchdb/couch_view.erl
>    couchdb/trunk/src/couchdb/couch_view_group.erl
>
> Modified: couchdb/trunk/src/couchdb/couch_view.erl
> URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view.erl?rev=1003701&r1=1003700&r2=1003701&view=diff
> ==============================================================================
> --- couchdb/trunk/src/couchdb/couch_view.erl (original)
> +++ couchdb/trunk/src/couchdb/couch_view.erl Fri Oct  1 23:05:30 2010
> @@ -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, Desig
>     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;
>
> Modified: couchdb/trunk/src/couchdb/couch_view_group.erl
> URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view_group.erl?rev=1003701&r1=1003700&r2=1003701&view=diff
> ==============================================================================
> --- couchdb/trunk/src/couchdb/couch_view_group.erl (original)
> +++ couchdb/trunk/src/couchdb/couch_view_group.erl Fri Oct  1 23:05:30 2010
> @@ -445,8 +445,8 @@ open_temp_group(DbName, Language, Design
>             def=MapSrc,
>             reduce_funs= if RedSrc==[] -> []; true -> [{<<"_temp">>,
RedSrc}] end,
>             options=DesignOptions},
> -
> -        {ok, Db, set_view_sig(#group{name = <<"_temp">>,lib={[]}, db=Db,
views=[View],
> +        couch_db:close(Db),
> +        {ok, set_view_sig(#group{name = <<"_temp">>,lib={[]}, db=Db,
views=[View],
>             def_lang=Language, design_options=DesignOptions})};
>     Error ->
>         Error
> @@ -480,7 +480,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
>
>
>



-- 
Chris Anderson
http://jchrisa.net
http://couch.io

Mime
View raw message