diff options
author | Robert Dionne <bob@cloudant.com> | 2010-11-22 19:48:29 -0500 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2010-12-09 15:30:03 -0500 |
commit | ab65f7b8add60ac0a6f9baac25d770ca8297a7a5 (patch) | |
tree | 6e76b6429eb6f26cc23b4cff59b14110b3d3d366 /apps | |
parent | 5c3161d57b1d2d7953497c24be09112b6bcf71b6 (diff) |
Support per-shard view compaction w/ non-local design docs, closes #16
Diffstat (limited to 'apps')
-rw-r--r-- | apps/couch/src/couch_view.erl | 3 | ||||
-rw-r--r-- | apps/couch/src/couch_view_group.erl | 18 |
2 files changed, 8 insertions, 13 deletions
diff --git a/apps/couch/src/couch_view.erl b/apps/couch/src/couch_view.erl index 8615ea35..9de86b82 100644 --- a/apps/couch/src/couch_view.erl +++ b/apps/couch/src/couch_view.erl @@ -44,8 +44,7 @@ get_temp_updater(DbName, Language, DesignOptions, MapSrc, RedSrc) -> 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/apps/couch/src/couch_view_group.erl b/apps/couch/src/couch_view_group.erl index 8b79af63..377e7516 100644 --- a/apps/couch/src/couch_view_group.erl +++ b/apps/couch/src/couch_view_group.erl @@ -440,17 +440,13 @@ set_view_sig(#group{ G#group{sig=couch_util:md5(term_to_binary({Views, Language, DesignOptions}))}. open_db_group(DbName, GroupId) -> - case couch_db:open_int(DbName, []) of - {ok, Db} -> - case couch_db:open_doc(Db, GroupId) of - {ok, Doc} -> - {ok, Db, design_doc_to_view_group(Doc)}; - Else -> - couch_db:close(Db), - Else - end; - Else -> - Else + {Pid, Ref} = spawn_monitor(fun() -> + exit(fabric:open_doc(mem3:dbname(DbName), GroupId, [])) + end), + receive {'DOWN', Ref, process, Pid, {ok, Doc}} -> + {ok, design_doc_to_view_group(Doc)}; + {'DOWN', Ref, process, Pid, Error} -> + Error end. get_group_info(State) -> |