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:28:22 UTC

couch-index commit: updated refs/heads/COUCHDB-3288-remove-public-db-record to 7f4d5de

Repository: couchdb-couch-index
Updated Branches:
  refs/heads/COUCHDB-3288-remove-public-db-record [created] 7f4d5de4c


Remove public db record

COUCHDB-3288


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/commit/7f4d5de4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/7f4d5de4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/7f4d5de4

Branch: refs/heads/COUCHDB-3288-remove-public-db-record
Commit: 7f4d5de4cc77dcba8353eeff37861aadc3da6375
Parents: f0a6854
Author: Paul J. Davis <pa...@gmail.com>
Authored: Wed Feb 1 15:27:04 2017 -0600
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Wed Feb 1 15:28:10 2017 -0600

----------------------------------------------------------------------
 src/couch_index_server.erl | 18 +++++++++---------
 src/couch_index_util.erl   |  2 +-
 2 files changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/7f4d5de4/src/couch_index_server.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_server.erl b/src/couch_index_server.erl
index 4e86f5e..cbdfbe7 100644
--- a/src/couch_index_server.erl
+++ b/src/couch_index_server.erl
@@ -60,14 +60,13 @@ validate(DbName, DDoc) ->
     lists:foreach(ValidateFun, EnabledIndexers).
 
 
-get_index(Module, #db{name = <<"shards/", _/binary>> = DbName}, DDoc) ->
-    case is_record(DDoc, doc) of
-        true -> get_index(Module, DbName, DDoc, nil);
-        false -> get_index(Module, DbName, DDoc)
-    end;
+get_index(Module, <<"shards/", _/binary>> = DbName, DDoc)
+        when is_binary(DbName), is_record(DDoc, doc) ->
+    get_index(Module, DbName, DDoc, nil);
 get_index(Module, <<"shards/", _/binary>> = DbName, DDoc) ->
     {Pid, Ref} = spawn_monitor(fun() ->
-        exit(fabric:open_doc(mem3:dbname(DbName), DDoc, [ejson_body, ?ADMIN_CTX]))
+        OpenOpts = [ejson_body, ?ADMIN_CTX],
+        exit(fabric:open_doc(mem3:dbname(DbName), DDoc, OpenOpts))
     end),
     receive {'DOWN', Ref, process, Pid, {ok, Doc}} ->
         get_index(Module, DbName, Doc, nil);
@@ -77,9 +76,10 @@ get_index(Module, <<"shards/", _/binary>> = DbName, DDoc) ->
         erlang:demonitor(Ref, [flush]),
         {error, timeout}
     end;
-
-get_index(Module, DbName, DDoc) ->
-    get_index(Module, DbName, DDoc, nil).
+get_index(Module, DbName, DDoc) when is_binary(DbName) ->
+    get_index(Module, DbName, DDoc, nil);
+get_index(Module, Db, DDoc) ->
+    get_index(Module, couch_db:name(Db), DDoc).
 
 
 get_index(Module, DbName, DDoc, Fun) when is_binary(DbName) ->

http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/7f4d5de4/src/couch_index_util.erl
----------------------------------------------------------------------
diff --git a/src/couch_index_util.erl b/src/couch_index_util.erl
index 5694641..dcb33b5 100644
--- a/src/couch_index_util.erl
+++ b/src/couch_index_util.erl
@@ -25,7 +25,7 @@ root_dir() ->
 index_dir(Module, DbName) when is_binary(DbName) ->
     DbDir = "." ++ binary_to_list(DbName) ++ "_design",
     filename:join([root_dir(), DbDir, Module]);
-index_dir(Module, #db{}=Db) ->
+index_dir(Module, Db) ->
     index_dir(Module, couch_db:name(Db)).