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/10 23:49:21 UTC

svn commit: r1156381 - /couchdb/trunk/src/couchdb/couch_server.erl

Author: fdmanana
Date: Wed Aug 10 21:49:20 2011
New Revision: 1156381

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

Leaving the tests however since it doesn't hurt.

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=1156381&r1=1156380&r2=1156381&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_server.erl (original)
+++ couchdb/trunk/src/couchdb/couch_server.erl Wed Aug 10 21:49:20 2011
@@ -316,13 +316,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),



Re: svn commit: r1156381 - /couchdb/trunk/src/couchdb/couch_server.erl

Posted by Filipe David Manana <fd...@apache.org>.
Forgot to mention, this issue was actually not happening in any Apache
CouchDB release. Apologies for the confusion. I'll update the comment.

On Wed, Aug 10, 2011 at 2:49 PM,  <fd...@apache.org> wrote:
> Author: fdmanana
> Date: Wed Aug 10 21:49:20 2011
> New Revision: 1156381
>
> URL: http://svn.apache.org/viewvc?rev=1156381&view=rev
> Log:
> Revert couch_server changes added in revision 1156360
>
> Leaving the tests however since it doesn't hurt.
>
> 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=1156381&r1=1156380&r2=1156381&view=diff
> ==============================================================================
> --- couchdb/trunk/src/couchdb/couch_server.erl (original)
> +++ couchdb/trunk/src/couchdb/couch_server.erl Wed Aug 10 21:49:20 2011
> @@ -316,13 +316,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),
>
>
>



-- 
Filipe David Manana,
fdmanana@gmail.com, fdmanana@apache.org

"Reasonable men adapt themselves to the world.
 Unreasonable men adapt the world to themselves.
 That's why all progress depends on unreasonable men."