From f0aaa2c3c7f6bbb858b40a55267781f1bcde0f67 Mon Sep 17 00:00:00 2001 From: Filipe David Borba Manana Date: Thu, 16 Jun 2011 20:06:15 +0000 Subject: Merge revision 1136639 from trunk 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. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1136640 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_view_compactor.erl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/couchdb/couch_view_compactor.erl b/src/couchdb/couch_view_compactor.erl index 9a47f5f8..8eda43e9 100644 --- a/src/couchdb/couch_view_compactor.erl +++ b/src/couchdb/couch_view_compactor.erl @@ -50,8 +50,10 @@ compact_group(Group, EmptyGroup) -> Fun = fun({DocId, _ViewIdKeys} = KV, {Bt, Acc, 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, if TotalCopied rem 10000 =:= 0 -> couch_task_status:update("Copied ~p of ~p Ids (~p%)", -- cgit v1.2.3