couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1160965 - /couchdb/trunk/src/couchdb/couch_compaction_daemon.erl
Date Wed, 24 Aug 2011 02:41:32 GMT
Author: fdmanana
Date: Wed Aug 24 02:41:31 2011
New Revision: 1160965

URL: http://svn.apache.org/viewvc?rev=1160965&view=rev
Log:
Don't open database or view group if not needed
    
If we're not in the allowed time window for a compaction,
don't open the database or a view group because it will be
pointless.


Modified:
    couchdb/trunk/src/couchdb/couch_compaction_daemon.erl

Modified: couchdb/trunk/src/couchdb/couch_compaction_daemon.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_compaction_daemon.erl?rev=1160965&r1=1160964&r2=1160965&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_compaction_daemon.erl (original)
+++ couchdb/trunk/src/couchdb/couch_compaction_daemon.erl Wed Aug 24 02:41:31 2011
@@ -108,7 +108,12 @@ compact_loop(Parent) ->
                 nil ->
                     ok;
                 {ok, Config} ->
-                    maybe_compact_db(DbName, Config)
+                    case check_period(Config) of
+                    true ->
+                        maybe_compact_db(DbName, Config);
+                    false ->
+                        ok
+                    end
                 end,
                 {ok, Acc}
             end
@@ -183,10 +188,15 @@ maybe_compact_db(DbName, Config) ->
 maybe_compact_views(_DbName, [], _Config) ->
     ok;
 maybe_compact_views(DbName, [DDocName | Rest], Config) ->
-    case maybe_compact_view(DbName, DDocName, Config) of
-    ok ->
-        maybe_compact_views(DbName, Rest, Config);
-    timeout ->
+    case check_period(Config) of
+    true ->
+        case maybe_compact_view(DbName, DDocName, Config) of
+        ok ->
+            maybe_compact_views(DbName, Rest, Config);
+        timeout ->
+            ok
+        end;
+    false ->
         ok
     end.
 



Mime
View raw message