Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3E6CE200C1D for ; Thu, 2 Feb 2017 00:27:23 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 3D0C2160B5E; Wed, 1 Feb 2017 23:27:23 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 87EC6160B46 for ; Thu, 2 Feb 2017 00:27:22 +0100 (CET) Received: (qmail 38608 invoked by uid 500); 1 Feb 2017 23:27:21 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 38599 invoked by uid 99); 1 Feb 2017 23:27:21 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Feb 2017 23:27:21 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8B371DFC9D; Wed, 1 Feb 2017 23:27:21 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: davisp@apache.org To: commits@couchdb.apache.org Message-Id: <081f9d141cfd42af931eb7ba1b0cb0e1@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: couch-index commit: updated refs/heads/COUCHDB-3288-remove-public-db-record to 81bcb1f [Forced Update!] Date: Wed, 1 Feb 2017 23:27:21 +0000 (UTC) archived-at: Wed, 01 Feb 2017 23:27:23 -0000 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 Authored: Wed Feb 1 15:27:04 2017 -0600 Committer: Paul J. Davis 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) ->