couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r961857 - in /couchdb/branches/1.0.x/src/couchdb: couch_db.erl couch_db_updater.erl
Date Thu, 08 Jul 2010 18:11:48 GMT
Author: jchris
Date: Thu Jul  8 18:11:47 2010
New Revision: 961857

URL: http://svn.apache.org/viewvc?rev=961857&view=rev
Log:
Fix for occasional failed tests caused by responding with 202 success to compaction requests
before the compaction actually begins.

Modified:
    couchdb/branches/1.0.x/src/couchdb/couch_db.erl
    couchdb/branches/1.0.x/src/couchdb/couch_db_updater.erl

Modified: couchdb/branches/1.0.x/src/couchdb/couch_db.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/couchdb/couch_db.erl?rev=961857&r1=961856&r2=961857&view=diff
==============================================================================
--- couchdb/branches/1.0.x/src/couchdb/couch_db.erl (original)
+++ couchdb/branches/1.0.x/src/couchdb/couch_db.erl Thu Jul  8 18:11:47 2010
@@ -103,7 +103,7 @@ monitor(#db{main_pid=MainPid}) ->
     erlang:monitor(process, MainPid).
 
 start_compact(#db{update_pid=Pid}) ->
-    gen_server:cast(Pid, start_compact).
+    gen_server:call(Pid, start_compact).
 
 delete_doc(Db, Id, Revisions) ->
     DeletedDocs = [#doc{id=Id, revs=[Rev], deleted=true} || Rev <- Revisions],

Modified: couchdb/branches/1.0.x/src/couchdb/couch_db_updater.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/couchdb/couch_db_updater.erl?rev=961857&r1=961856&r2=961857&view=diff
==============================================================================
--- couchdb/branches/1.0.x/src/couchdb/couch_db_updater.erl (original)
+++ couchdb/branches/1.0.x/src/couchdb/couch_db_updater.erl Thu Jul  8 18:11:47 2010
@@ -143,21 +143,22 @@ handle_call({purge_docs, IdRevs}, _From,
 
     ok = gen_server:call(Db2#db.main_pid, {db_updated, Db2}),
     couch_db_update_notifier:notify({updated, Db#db.name}),
-    {reply, {ok, (Db2#db.header)#db_header.purge_seq, IdRevsPurged}, Db2}.
-
-
-handle_cast(start_compact, Db) ->
+    {reply, {ok, (Db2#db.header)#db_header.purge_seq, IdRevsPurged}, Db2};
+handle_call(start_compact, _From, Db) ->
     case Db#db.compactor_pid of
     nil ->
         ?LOG_INFO("Starting compaction for db \"~s\"", [Db#db.name]),
         Pid = spawn_link(fun() -> start_copy_compact(Db) end),
         Db2 = Db#db{compactor_pid=Pid},
         ok = gen_server:call(Db#db.main_pid, {db_updated, Db2}),
-        {noreply, Db2};
+        {reply, ok, Db2};
     _ ->
         % compact currently running, this is a no-op
-        {noreply, Db}
-    end;
+        {reply, ok, Db}
+    end.
+
+
+
 handle_cast({compact_done, CompactFilepath}, #db{filepath=Filepath}=Db) ->
     {ok, NewFd} = couch_file:open(CompactFilepath),
     {ok, NewHeader} = couch_file:read_header(NewFd),



Mime
View raw message