From 2831a53515d0be4cd77a3acf18bb57abeb2651a4 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Wed, 30 Jun 2010 09:49:50 +0000 Subject: Bug fix when creating a DB with the option 'sys_db' and the number of current opened DBs corresponds to the max_open_dbs config parameter. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@959246 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_server.erl | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/couchdb/couch_server.erl b/src/couchdb/couch_server.erl index 65e4b7a0..f8b362dd 100644 --- a/src/couchdb/couch_server.erl +++ b/src/couchdb/couch_server.erl @@ -329,13 +329,19 @@ handle_call({create, DbName, Options}, From, Server) -> ok -> case ets:lookup(couch_dbs_by_name, DbName) of [] -> - case maybe_close_lru_db(Server) of - {ok, Server2} -> - Filepath = get_full_filename(Server, DbNameList), - {noreply, open_async(Server2, From, DbName, Filepath, + Filepath = get_full_filename(Server, DbNameList), + case lists:member(sys_db, Options) of + true -> + {noreply, open_async(Server, From, DbName, Filepath, + [create | Options])}; + false -> + case maybe_close_lru_db(Server) of + {ok, Server2} -> + {noreply, open_async(Server2, From, DbName, Filepath, [create | Options])}; - CloseError -> - {reply, CloseError, Server} + CloseError -> + {reply, CloseError, Server} + end end; [_AlreadyRunningDb] -> {reply, file_exists, Server} -- cgit v1.2.3