Author: fdmanana
Date: Wed Jun 30 09:49:50 2010
New Revision: 959246
URL: http://svn.apache.org/viewvc?rev=959246&view=rev
Log:
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.
Modified:
couchdb/trunk/src/couchdb/couch_server.erl
Modified: couchdb/trunk/src/couchdb/couch_server.erl
URL:
http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_server.erl?rev=959246&r1=959245&r2=959246&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_server.erl (original)
+++ couchdb/trunk/src/couchdb/couch_server.erl Wed Jun 30 09:49:50 2010
@@ -329,13 +329,19 @@ handle_call({create, DbName, Options}, F
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}