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 83CFB200C70 for ; Tue, 4 Apr 2017 23:32:59 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 82797160B90; Tue, 4 Apr 2017 21:32:59 +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 A3FCB160BAC for ; Tue, 4 Apr 2017 23:32:58 +0200 (CEST) Received: (qmail 34090 invoked by uid 500); 4 Apr 2017 21:32:57 -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 33632 invoked by uid 99); 4 Apr 2017 21:32:57 -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; Tue, 04 Apr 2017 21:32:57 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 341B7DFEE9; Tue, 4 Apr 2017 21:32:57 +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 Date: Tue, 04 Apr 2017 21:33:11 -0000 Message-Id: <82082a7ab8ae43639012535d636709b6@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [16/26] couch commit: updated refs/heads/COUCHDB-3288-remove-public-db-record to c515bca archived-at: Tue, 04 Apr 2017 21:32:59 -0000 fix compiler and dialyzer warnings Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/2d984b59 Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/2d984b59 Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/2d984b59 Branch: refs/heads/COUCHDB-3288-remove-public-db-record Commit: 2d984b59ed6886a179fd500efe9780a0d0ad62e3 Parents: 92c25a9 Author: Robert Newson Authored: Wed Mar 15 18:13:09 2017 +0000 Committer: Robert Newson Committed: Wed Mar 15 18:15:03 2017 +0000 ---------------------------------------------------------------------- src/couch_server.erl | 28 ++++++++++------------------ 1 file changed, 10 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/2d984b59/src/couch_server.erl ---------------------------------------------------------------------- diff --git a/src/couch_server.erl b/src/couch_server.erl index 1272e7a..1152300 100644 --- a/src/couch_server.erl +++ b/src/couch_server.erl @@ -359,7 +359,7 @@ handle_call({open_result, _T0, DbName, Error}, {FromPid, _Tag}, Server) -> [] -> % db was deleted during async open {reply, ok, Server}; - [#db{fd=ReqType, compactor_pid=Froms}=Db] -> + [#db{fd=ReqType, compactor_pid=Froms}] -> [gen_server:reply(From, Error) || From <- Froms], couch_log:info("open_result error ~p for ~s", [Error, DbName]), true = ets:delete(couch_dbs, DbName), @@ -378,13 +378,9 @@ handle_call({open, DbName, Options}, From, Server) -> DbNameList = binary_to_list(DbName), case check_dbname(Server, DbNameList) of ok -> - case maybe_close_lru_db(Server) of - {ok, Server2} -> - Filepath = get_full_filename(Server, DbNameList), - {noreply, open_async(Server2, From, DbName, Filepath, Options)}; - CloseError -> - {reply, CloseError, Server} - end; + {ok, Server2} = maybe_close_lru_db(Server), + Filepath = get_full_filename(Server, DbNameList), + {noreply, open_async(Server2, From, DbName, Filepath, Options)}; Error -> {reply, Error, Server} end; @@ -406,13 +402,9 @@ handle_call({create, DbName, Options}, From, Server) -> ok -> case ets:lookup(couch_dbs, DbName) of [] -> - case maybe_close_lru_db(Server) of - {ok, Server2} -> - {noreply, open_async(Server2, From, DbName, Filepath, - [create | Options])}; - CloseError -> - {reply, CloseError, Server} - end; + {ok, Server2} = maybe_close_lru_db(Server), + {noreply, open_async(Server2, From, DbName, Filepath, + [create | Options])}; [#db{fd=open}=Db] -> % We're trying to create a database while someone is in % the middle of trying to open it. We allow one creator @@ -436,14 +428,14 @@ handle_call({delete, DbName, Options}, _From, Server) -> Server2 = case ets:lookup(couch_dbs, DbName) of [] -> Server; - [#db{main_pid=Pid, compactor_pid=Froms} = Db] when is_list(Froms) -> + [#db{main_pid=Pid, compactor_pid=Froms}] when is_list(Froms) -> % icky hack of field values - compactor_pid used to store clients true = ets:delete(couch_dbs, DbName), true = ets:delete(couch_dbs_pid_to_name, Pid), exit(Pid, kill), [gen_server:reply(F, not_found) || F <- Froms], db_closed(Server); - [#db{main_pid=Pid} = Db] -> + [#db{main_pid=Pid}] -> true = ets:delete(couch_dbs, DbName), true = ets:delete(couch_dbs_pid_to_name, Pid), exit(Pid, kill), @@ -502,7 +494,7 @@ handle_info({'EXIT', _Pid, config_change}, Server) -> handle_info({'EXIT', Pid, Reason}, Server) -> case ets:lookup(couch_dbs_pid_to_name, Pid) of [{Pid, DbName}] -> - [#db{compactor_pid=Froms}=Db] = ets:lookup(couch_dbs, DbName), + [#db{compactor_pid=Froms}] = ets:lookup(couch_dbs, DbName), if Reason /= snappy_nif_not_loaded -> ok; true -> Msg = io_lib:format("To open the database `~s`, Apache CouchDB " "must be built with Erlang OTP R13B04 or higher.", [DbName]),