couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dav...@apache.org
Subject couch-index commit: updated refs/heads/COUCHDB-3288-remove-public-db-record to 81bcb1f [Forced Update!]
Date Wed, 01 Feb 2017 23:27:21 GMT
Repository: couchdb-couch-index
Updated Branches:
  refs/heads/COUCHDB-3288-remove-public-db-record 7f4d5de4c -> 81bcb1f84 (forced update)


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/81bcb1f8
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/tree/81bcb1f8
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/diff/81bcb1f8

Branch: refs/heads/COUCHDB-3288-remove-public-db-record
Commit: 81bcb1f843df55bdb6e9c82837f589489ebbea09
Parents: f0a6854
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
Authored: Wed Feb 1 15:27:04 2017 -0600
Committer: Paul J. Davis <paul.joseph.davis@gmail.com>
Committed: Wed Feb 1 17:27:10 2017 -0600

----------------------------------------------------------------------
 src/couch_index_server.erl            | 18 +++++++++---------
 src/couch_index_util.erl              |  2 +-
 test/couch_index_compaction_tests.erl |  3 ++-
 3 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/81bcb1f8/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/81bcb1f8/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)).
 
 

http://git-wip-us.apache.org/repos/asf/couchdb-couch-index/blob/81bcb1f8/test/couch_index_compaction_tests.erl
----------------------------------------------------------------------
diff --git a/test/couch_index_compaction_tests.erl b/test/couch_index_compaction_tests.erl
index 0787151..18dd9ff 100644
--- a/test/couch_index_compaction_tests.erl
+++ b/test/couch_index_compaction_tests.erl
@@ -23,7 +23,8 @@ setup() ->
     ?assertNot(is_opened(Db)),
     {Db, IndexerPid}.
 
-fake_index(#db{name = DbName} = Db) ->
+fake_index(Db) ->
+    DbName = couch_db:name(Db),
     ok = meck:new([test_index], [non_strict]),
     ok = meck:expect(test_index, init, ['_', '_'], {ok, 10}),
     ok = meck:expect(test_index, open, fun(_Db, State) ->


Mime
View raw message