You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by da...@apache.org on 2017/02/01 21:36:42 UTC
couch-mrview commit: updated
refs/heads/COUCHDB-3288-remove-public-db-record to 6a7a6fc
Repository: couchdb-couch-mrview
Updated Branches:
refs/heads/COUCHDB-3288-remove-public-db-record [created] 6a7a6fc36
Remove public db record
COUCHDB-3288
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/6a7a6fc3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/6a7a6fc3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/6a7a6fc3
Branch: refs/heads/COUCHDB-3288-remove-public-db-record
Commit: 6a7a6fc36f61dc30673881f49482223b9c342580
Parents: 15a1ae9
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Feb 1 15:36:16 2017 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 1 15:36:34 2017 -0600
----------------------------------------------------------------------
src/couch_mrview.erl | 14 +++++++-------
src/couch_mrview_http.erl | 10 +++++-----
src/couch_mrview_show.erl | 16 ++++++++++------
3 files changed, 22 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/6a7a6fc3/src/couch_mrview.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview.erl b/src/couch_mrview.erl
index 088327c..0f207fb 100644
--- a/src/couch_mrview.erl
+++ b/src/couch_mrview.erl
@@ -360,15 +360,12 @@ get_view_info(Db, DDoc, VName) ->
%% @doc refresh a view index
-refresh(#db{name=DbName}, DDoc) ->
- refresh(DbName, DDoc);
-
-refresh(Db, DDoc) ->
- UpdateSeq = couch_util:with_db(Db, fun(WDb) ->
+refresh(DbName, DDoc) when is_binary(DbName)->
+ UpdateSeq = couch_util:with_db(DbName, fun(WDb) ->
couch_db:get_update_seq(WDb)
end),
- case couch_index_server:get_index(couch_mrview_index, Db, DDoc) of
+ case couch_index_server:get_index(couch_mrview_index, DbName, DDoc) of
{ok, Pid} ->
case catch couch_index:get_state(Pid, UpdateSeq) of
{ok, _} -> ok;
@@ -376,7 +373,10 @@ refresh(Db, DDoc) ->
end;
Error ->
{error, Error}
- end.
+ end;
+
+refresh(Db, DDoc) ->
+ refresh(couch_db:name(Db), DDoc).
compact(Db, DDoc) ->
compact(Db, DDoc, []).
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/6a7a6fc3/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index 7e3fd78..e5638fe 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -103,11 +103,11 @@ handle_view_changes_req(#httpd{path_parts=[_,<<"_design">>,DDocName,<<"_view_cha
handle_view_req(#httpd{method='GET',
path_parts=[_, _, DDocName, _, VName, <<"_info">>]}=Req,
Db, _DDoc) ->
-
+ DbName = couch_db:name(Db),
DDocId = <<"_design/", DDocName/binary >>,
- {ok, Info} = couch_mrview:get_view_info(Db#db.name, DDocId, VName),
+ {ok, Info} = couch_mrview:get_view_info(DbName, DDocId, VName),
- FinalInfo = [{db_name, Db#db.name},
+ FinalInfo = [{db_name, DbName},
{ddoc, DDocId},
{view, VName}] ++ Info,
chttpd:send_json(Req, 200, {FinalInfo});
@@ -212,7 +212,7 @@ is_restricted(Db, _) ->
couch_db:is_system_db(Db).
is_public_fields_configured(Db) ->
- DbName = ?b2l(Db#db.name),
+ DbName = ?b2l(couch_db:name(Db)),
case config:get("couch_httpd_auth", "authentication_db", "_users") of
DbName ->
UsersDbPublic = config:get("couch_httpd_auth", "users_db_public", "false"),
@@ -237,7 +237,7 @@ do_all_docs_req(Req, Db, Keys, NS) ->
{ok, Resp} = couch_httpd:etag_maybe(Req, fun() ->
Max = chttpd:chunked_response_buffer_size(),
VAcc0 = #vacc{db=Db, req=Req, threshold=Max},
- DbName = ?b2l(Db#db.name),
+ DbName = ?b2l(couch_db:name(Db)),
UsersDbName = config:get("couch_httpd_auth",
"authentication_db",
"_users"),
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/6a7a6fc3/src/couch_mrview_show.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_show.erl b/src/couch_mrview_show.erl
index 52e07a7..47a38a2 100644
--- a/src/couch_mrview_show.erl
+++ b/src/couch_mrview_show.erl
@@ -366,13 +366,17 @@ json_apply_field({Key, NewValue}, [], Acc) ->
% This loads the db info if we have a fully loaded db record, but we might not
% have the db locally on this node, so then load the info through fabric.
-json_req_obj(Req, #db{main_pid=Pid}=Db) when is_pid(Pid) ->
- chttpd_external:json_req_obj(Req, Db);
json_req_obj(Req, Db) ->
- % use a separate process because we're already in a receive loop, and
- % json_req_obj calls fabric:get_db_info()
- spawn_monitor(fun() -> exit(chttpd_external:json_req_obj(Req, Db)) end),
- receive {'DOWN', _, _, _, JsonReq} -> JsonReq end.
+ case couch_db:is_clustered(Db) of
+ true ->
+ % use a separate process because we're already in a receive loop,
+ % and json_req_obj calls fabric:get_db_info()
+ JRO = fun() -> exit(chttpd_external:json_req_obj(Req, Db)) end,
+ spawn_monitor(JRO),
+ receive {'DOWN', _, _, _, JsonReq} -> JsonReq end;
+ false ->
+ chttpd_external:json_req_obj(Req, Db)
+ end.
last_chunk(Req, undefined) ->
chttpd:send_response(Req, 200, [], <<"">>);