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

[couchdb] branch 3417-add-compaction-logging updated (ee22bb6 -> d6d53ac)

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

tonysun83 pushed a change to branch 3417-add-compaction-logging
in repository https://gitbox.apache.org/repos/asf/couchdb.git.

     omits  ee22bb6   change to notice level
     omits  7e6032d   add compaction logging
       new  d6d53ac   add compaction logging

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   (ee22bb6)
            \
             N -- N -- N   refs/heads/3417-add-compaction-logging (d6d53ac)

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 "omits" are not gone; other references still
refer to them.  Any revisions marked "discards" are gone forever.

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


Summary of changes:

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <co...@couchdb.apache.org>'].

[couchdb] 01/01: add compaction logging

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

tonysun83 pushed a commit to branch 3417-add-compaction-logging
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit d6d53acc2f9552b7357d328f8bedf8d3ce9849af
Author: Tony Sun <to...@cloudant.com>
AuthorDate: Wed May 10 21:16:13 2017 -0700

    add compaction logging
    
    To predict future compaction results, we log pre-compaction and
    post-compaction file sizes. These log results will be used as data
    points for regression analysis.
    
    COUCHDB-3417
---
 src/couch/src/couch_db_updater.erl              |  9 ++++++---
 src/couch_mrview/src/couch_mrview_compactor.erl | 11 ++++++++++-
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/couch/src/couch_db_updater.erl b/src/couch/src/couch_db_updater.erl
index 7872635..bb8e9da 100644
--- a/src/couch/src/couch_db_updater.erl
+++ b/src/couch/src/couch_db_updater.erl
@@ -218,7 +218,7 @@ handle_cast(start_compact, Db) ->
         % compact currently running, this is a no-op
         {noreply, Db}
     end;
-handle_cast({compact_done, CompactFilepath}, #db{filepath=Filepath}=Db) ->
+handle_cast({compact_done, CompactFilepath}, #db{filepath=Filepath,fd=Fd}=Db) ->
     {ok, NewFd} = couch_file:open(CompactFilepath),
     {ok, NewHeader0} = couch_file:read_header(NewFd),
     NewHeader = couch_db_header:set(NewHeader0, [
@@ -242,8 +242,11 @@ handle_cast({compact_done, CompactFilepath}, #db{filepath=Filepath}=Db) ->
             revs_limit = Db#db.revs_limit
         }),
 
-        couch_log:debug("CouchDB swapping files ~s and ~s.",
-                        [Filepath, CompactFilepath]),
+        {ok, Pre} = couch_file:bytes(Fd),
+        {ok, Post} = couch_file:bytes(NewFd),
+
+        couch_log:notice("Compaction swap for db: ~s ~p ~p", [Filepath,
+                Pre, Post]),
         ok = file:rename(CompactFilepath, Filepath ++ ".compact"),
         RootDir = config:get("couchdb", "database_dir", "."),
         couch_file:delete(RootDir, Filepath),
diff --git a/src/couch_mrview/src/couch_mrview_compactor.erl b/src/couch_mrview/src/couch_mrview_compactor.erl
index fabe289..c1b2fbc 100644
--- a/src/couch_mrview/src/couch_mrview_compactor.erl
+++ b/src/couch_mrview/src/couch_mrview_compactor.erl
@@ -275,8 +275,12 @@ update_task(VID, #acc{changes=Changes, total_changes=Total}=Acc, ChangesInc) ->
 
 swap_compacted(OldState, NewState) ->
     #mrst{
+        fd = Fd
+    } = OldState,
+    #mrst{
         sig=Sig,
-        db_name=DbName
+        db_name=DbName,
+        fd=NewFd
     } = NewState,
 
     link(NewState#mrst.fd),
@@ -285,6 +289,11 @@ swap_compacted(OldState, NewState) ->
     RootDir = couch_index_util:root_dir(),
     IndexFName = couch_mrview_util:index_file(DbName, Sig),
     CompactFName = couch_mrview_util:compaction_file(DbName, Sig),
+
+    {ok, Pre} = couch_file:bytes(Fd),
+    {ok, Post} = couch_file:bytes(NewFd),
+    couch_log:notice("Compaction swap for view ~s ~p ~p", [IndexFName,
+        Pre, Post]),
     ok = couch_file:delete(RootDir, IndexFName),
     ok = file:rename(CompactFName, IndexFName),
 

-- 
To stop receiving notification emails like this one, please contact
"commits@couchdb.apache.org" <co...@couchdb.apache.org>.