You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ja...@apache.org on 2018/03/05 17:03:16 UTC

[couchdb] branch fix/compaction-daemon updated (09674ed -> eab4095)

This is an automated email from the ASF dual-hosted git repository.

jan pushed a change to branch fix/compaction-daemon
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


    omit 09674ed  feat: demote view index opening/closing to log level debug
    omit 91f21ee  doc: add snooze_period doc to default.ini
    omit e8cdcb7  bump the compaction daemon check_interval to one hour
    omit 844cdca  fix: simplify config integer get
    omit 827d8e8  feat: introduce snooze_period to reduce compaction_daemon load.
     new 284ff15  feat: introduce snooze_period to reduce compaction_daemon load.
     new 354c622  fix: simplify config integer get
     new 445faf0  bump the compaction daemon check_interval to one hour
     new dc7eef9  doc: add snooze_period doc to default.ini
     new eab4095  feat: demote view index opening/closing to log level debug

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (09674ed)
            \
             N -- N -- N   refs/heads/fix/compaction-daemon (eab4095)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 5 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/couch/test/couchdb_compaction_daemon_tests.erl | 1 +
 1 file changed, 1 insertion(+)

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 02/05: fix: simplify config integer get

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch fix/compaction-daemon
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 354c62213d31ffeccc832fc523c201e74e5ea335
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Mon Mar 5 16:09:00 2018 +0100

    fix: simplify config integer get
---
 src/couch/src/couch_compaction_daemon.erl | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/src/couch/src/couch_compaction_daemon.erl b/src/couch/src/couch_compaction_daemon.erl
index 59555f1..21fb5d9 100644
--- a/src/couch/src/couch_compaction_daemon.erl
+++ b/src/couch/src/couch_compaction_daemon.erl
@@ -152,8 +152,7 @@ compact_loop(Parent) ->
     true ->
         receive {Parent, have_config} -> ok end;
     false ->
-        PausePeriod = list_to_integer(
-            config:get("compaction_daemon", "check_interval", "300")),
+        PausePeriod = config:get_integer("compaction_daemon", "check_interval", "300"),
         ok = timer:sleep(PausePeriod * 1000)
     end,
     compact_loop(Parent).

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 01/05: feat: introduce snooze_period to reduce compaction_daemon load.

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch fix/compaction-daemon
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 284ff1529830723f794c4893720f52722a8503ea
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Mon Mar 5 16:06:21 2018 +0100

    feat: introduce snooze_period to reduce compaction_daemon load.
    
    This commit introduces a snooze period for the compaction daemon
    to apply inbetween moving on from one database compaction to
    another, and from one view group to another.
    
    The result is that on db-per-user setups, the compaction daemon
    doesn’t cause a CPU spike every check_interval seconds.
---
 src/couch/src/couch_compaction_daemon.erl          | 8 ++++++--
 src/couch/test/couchdb_compaction_daemon_tests.erl | 1 +
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/couch/src/couch_compaction_daemon.erl b/src/couch/src/couch_compaction_daemon.erl
index 9371119..59555f1 100644
--- a/src/couch/src/couch_compaction_daemon.erl
+++ b/src/couch/src/couch_compaction_daemon.erl
@@ -126,6 +126,7 @@ handle_config_terminate(_Server, _Reason, _State) ->
     erlang:send_after(?RELISTEN_DELAY, whereis(?MODULE), restart_config_listener).
 
 compact_loop(Parent) ->
+    SnoozePeriod = config:get_integer("compaction_daemon", "snooze_period", 3),
     {ok, _} = couch_server:all_databases(
         fun(DbName, Acc) ->
             case ets:info(?CONFIG_ETS, size) =:= 0 of
@@ -138,7 +139,8 @@ compact_loop(Parent) ->
                 {ok, Config} ->
                     case check_period(Config) of
                     true ->
-                        maybe_compact_db(Parent, DbName, Config);
+                        maybe_compact_db(Parent, DbName, Config),
+                        ok = timer:sleep(SnoozePeriod * 1000);
                     false ->
                         ok
                     end
@@ -229,7 +231,9 @@ maybe_compact_views(DbName, [DDocName | Rest], Config) ->
             maybe_compact_views(DbName, Rest, Config);
         timeout ->
             ok
-        end;
+        end,
+        SnoozePeriod = config:get_integer("compaction_daemon", "snooze_period", 3),
+        ok = timer:sleep(SnoozePeriod * 1000);
     false ->
         ok
     end.
diff --git a/src/couch/test/couchdb_compaction_daemon_tests.erl b/src/couch/test/couchdb_compaction_daemon_tests.erl
index 47f35a0..c10ddee 100644
--- a/src/couch/test/couchdb_compaction_daemon_tests.erl
+++ b/src/couch/test/couchdb_compaction_daemon_tests.erl
@@ -24,6 +24,7 @@
 start() ->
     Ctx = test_util:start_couch(),
     ok = config:set("compaction_daemon", "check_interval", "3", false),
+    ok = config:set("compaction_daemon", "snooze_period", "0", false),
     ok = config:set("compaction_daemon", "min_file_size", "100000", false),
     ok = config:delete("compactions", "_default", false),
     ok = meck:new(?MODS_TO_MOCK, [passthrough]),

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 04/05: doc: add snooze_period doc to default.ini

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch fix/compaction-daemon
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit dc7eef9bcd35a4bb3d482b4432dbd67e4de7c12f
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Mon Mar 5 16:12:14 2018 +0100

    doc: add snooze_period doc to default.ini
---
 rel/overlay/etc/default.ini | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini
index 892fc9a..ec3e223 100644
--- a/rel/overlay/etc/default.ini
+++ b/rel/overlay/etc/default.ini
@@ -438,6 +438,12 @@ check_interval = 3600
 ; compaction will not happen. Very small files always have a very high
 ; fragmentation therefore it's not worth to compact them.
 min_file_size = 131072
+; With lots of databases and/or with lots of design docs in one or more
+; databases, the compaction_daemon can create significant CPU load when
+; checking whether databases and view indexes need compacting. The
+; snooze_period setting ensures a smoother CPU load. Defaults to
+; 3 seconds wait.
+; snooze_period = 3
 
 [compactions]
 ; List of compaction rules for the compaction daemon.

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 03/05: bump the compaction daemon check_interval to one hour

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch fix/compaction-daemon
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 445faf083fcda8365ddc2e6332b78dbaa550c93a
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Mon Mar 5 16:10:08 2018 +0100

    bump the compaction daemon check_interval to one hour
---
 rel/overlay/etc/default.ini               | 2 +-
 src/couch/src/couch_compaction_daemon.erl | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/rel/overlay/etc/default.ini b/rel/overlay/etc/default.ini
index 4017a0c..892fc9a 100644
--- a/rel/overlay/etc/default.ini
+++ b/rel/overlay/etc/default.ini
@@ -433,7 +433,7 @@ ssl_certificate_max_depth = 3
 [compaction_daemon]
 ; The delay, in seconds, between each check for which database and view indexes
 ; need to be compacted.
-check_interval = 300
+check_interval = 3600
 ; If a database or view index file is smaller then this value (in bytes),
 ; compaction will not happen. Very small files always have a very high
 ; fragmentation therefore it's not worth to compact them.
diff --git a/src/couch/src/couch_compaction_daemon.erl b/src/couch/src/couch_compaction_daemon.erl
index 21fb5d9..200c3fd 100644
--- a/src/couch/src/couch_compaction_daemon.erl
+++ b/src/couch/src/couch_compaction_daemon.erl
@@ -152,7 +152,7 @@ compact_loop(Parent) ->
     true ->
         receive {Parent, have_config} -> ok end;
     false ->
-        PausePeriod = config:get_integer("compaction_daemon", "check_interval", "300"),
+        PausePeriod = config:get_integer("compaction_daemon", "check_interval", 3600),
         ok = timer:sleep(PausePeriod * 1000)
     end,
     compact_loop(Parent).

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.

[couchdb] 05/05: feat: demote view index opening/closing to log level debug

Posted by ja...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

jan pushed a commit to branch fix/compaction-daemon
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit eab40959853b8811d5c71e3048d8aa8d365b56bf
Author: Jan Lehnardt <ja...@apache.org>
AuthorDate: Mon Mar 5 16:15:51 2018 +0100

    feat: demote view index opening/closing to log level debug
---
 src/couch_index/src/couch_index.erl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/couch_index/src/couch_index.erl b/src/couch_index/src/couch_index.erl
index b3a800f..8fba0a2 100644
--- a/src/couch_index/src/couch_index.erl
+++ b/src/couch_index/src/couch_index.erl
@@ -104,7 +104,7 @@ init({Mod, IdxState}) ->
                 Mod:get(idx_name, IdxState),
                 couch_index_util:hexsig(Mod:get(signature, IdxState))
             ],
-            couch_log:info("Opening index for db: ~s idx: ~s sig: ~p", Args),
+            couch_log:debug("Opening index for db: ~s idx: ~s sig: ~p", Args),
             proc_lib:init_ack({ok, self()}),
             gen_server:enter_loop(?MODULE, [], State);
         Other ->
@@ -131,7 +131,7 @@ terminate(Reason0, State) ->
         couch_index_util:hexsig(Mod:get(signature, IdxState)),
         Reason
     ],
-    couch_log:info("Closing index for db: ~s idx: ~s sig: ~p because ~r", Args),
+    couch_log:debug("Closing index for db: ~s idx: ~s sig: ~p because ~r", Args),
     ok.
 
 
@@ -366,7 +366,7 @@ handle_info(maybe_close, State) ->
     end;
 handle_info({'DOWN', _, _, _Pid, _}, #st{mod=Mod, idx_state=IdxState}=State) ->
     Args = [Mod:get(db_name, IdxState), Mod:get(idx_name, IdxState)],
-    couch_log:info("Index shutdown by monitor notice for db: ~s idx: ~s", Args),
+    couch_log:debug("Index shutdown by monitor notice for db: ~s idx: ~s", Args),
     catch send_all(State#st.waiters, shutdown),
     {stop, normal, State#st{waiters=[]}}.
 

-- 
To stop receiving notification emails like this one, please contact
jan@apache.org.