You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2011/08/11 00:01:34 UTC

svn commit: r1156385 - /couchdb/branches/1.1.x/src/couchdb/couch_server.erl

Author: fdmanana
Date: Wed Aug 10 22:01:33 2011
New Revision: 1156385

URL: http://svn.apache.org/viewvc?rev=1156385&view=rev
Log:
Revert couch_server changes added in revision 1156361

Leaving the tests however since it doesn't hurt.


Modified:
    couchdb/branches/1.1.x/src/couchdb/couch_server.erl

Modified: couchdb/branches/1.1.x/src/couchdb/couch_server.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_server.erl?rev=1156385&r1=1156384&r2=1156385&view=diff
==============================================================================
--- couchdb/branches/1.1.x/src/couchdb/couch_server.erl (original)
+++ couchdb/branches/1.1.x/src/couchdb/couch_server.erl Wed Aug 10 22:01:33 2011
@@ -314,13 +314,11 @@ handle_call({open, DbName, Options}, {Fr
         {reply, couch_db:open_ref_counted(MainPid, FromPid), Server}
     end;
 handle_call({create, DbName, Options}, From, Server) ->
-    FileName = get_full_filename(Server, ?b2l(DbName)),
-    case file:open(FileName, [read]) of
-    {ok, Fd} ->
-        ok = file:close(Fd),
-        {reply, file_exists, Server};
-    Error ->
-        open_db(DbName, Server, [create | Options], From)
+    case ets:lookup(couch_dbs_by_name, DbName) of
+    [] ->
+        open_db(DbName, Server, [create | Options], From);
+    [_AlreadyRunningDb] ->
+        {reply, file_exists, Server}
     end;
 handle_call({delete, DbName, _Options}, _From, Server) ->
     DbNameList = binary_to_list(DbName),