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/06/16 22:04:57 UTC

svn commit: r1136639 - /couchdb/trunk/src/couchdb/couch_view_compactor.erl

Author: fdmanana
Date: Thu Jun 16 20:04:57 2011
New Revision: 1136639

URL: http://svn.apache.org/viewvc?rev=1136639&view=rev
Log:
Human readable message on view compaction error

When a view has duplicated document IDs in the main btree,
the view compactor exists. Unfortunatelly its exit reason is
not human readable because it's an IOList.
This patch improves the error message and logs it with an
'error' level.

Issue reported by Mike Leddy in ticket COUCHDB-999.


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

Modified: couchdb/trunk/src/couchdb/couch_view_compactor.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view_compactor.erl?rev=1136639&r1=1136638&r2=1136639&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_view_compactor.erl (original)
+++ couchdb/trunk/src/couchdb/couch_view_compactor.erl Thu Jun 16 20:04:57 2011
@@ -54,8 +54,10 @@ compact_group(Group, EmptyGroup) ->
     Fun = fun({DocId, _ViewIdKeys} = KV,
             {Bt, Acc, AccSize, TotalCopied, LastId}) ->
         if DocId =:= LastId -> % COUCHDB-999
-            Msg = "Duplicates of ~s detected in ~s ~s - rebuild required",
-            exit(io_lib:format(Msg, [DocId, DbName, GroupId]));
+            ?LOG_ERROR("Duplicates of document `~s` detected in view group `~s`"
+                ", database `~s` - view rebuild, from scratch, is required",
+                [DocId, GroupId, DbName]),
+            exit({view_duplicated_id, DocId});
         true -> ok end,
         AccSize2 = AccSize + ?term_size(KV),
         if AccSize2 >= BufferSize ->