From couchdb-commits-return-1160-apmail-incubator-couchdb-commits-archive=incubator.apache.org@incubator.apache.org Tue Oct 21 18:44:05 2008 Return-Path: Delivered-To: apmail-incubator-couchdb-commits-archive@locus.apache.org Received: (qmail 69555 invoked from network); 21 Oct 2008 18:44:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 21 Oct 2008 18:44:05 -0000 Received: (qmail 92491 invoked by uid 500); 21 Oct 2008 18:44:08 -0000 Delivered-To: apmail-incubator-couchdb-commits-archive@incubator.apache.org Received: (qmail 92424 invoked by uid 500); 21 Oct 2008 18:44:08 -0000 Mailing-List: contact couchdb-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-dev@incubator.apache.org Delivered-To: mailing list couchdb-commits@incubator.apache.org Received: (qmail 92415 invoked by uid 99); 21 Oct 2008 18:44:08 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Oct 2008 11:44:08 -0700 X-ASF-Spam-Status: No, hits=-1998.4 required=10.0 tests=ALL_TRUSTED,FRT_OFFER2 X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Oct 2008 18:43:06 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 2D1B42388961; Tue, 21 Oct 2008 11:43:45 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r706714 - in /incubator/couchdb/trunk: share/www/script/couch_tests.js src/couchdb/couch_btree.erl src/couchdb/couch_httpd_view.erl Date: Tue, 21 Oct 2008 18:43:44 -0000 To: couchdb-commits@incubator.apache.org From: damien@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20081021184345.2D1B42388961@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: damien Date: Tue Oct 21 11:43:42 2008 New Revision: 706714 URL: http://svn.apache.org/viewvc?rev=706714&view=rev Log: Fix for COUCHDB-99. Certain Skipped KeyValue pairs weren't being assembled into final values before being reduces. Modified: incubator/couchdb/trunk/share/www/script/couch_tests.js incubator/couchdb/trunk/src/couchdb/couch_btree.erl incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl Modified: incubator/couchdb/trunk/share/www/script/couch_tests.js URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/share/www/script/couch_tests.js?rev=706714&r1=706713&r2=706714&view=diff ============================================================================== --- incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] (original) +++ incubator/couchdb/trunk/share/www/script/couch_tests.js [utf-8] Tue Oct 21 11:43:42 2008 @@ -72,6 +72,10 @@ // Check _all_docs with descending=true var desc = db.allDocs({descending:true}); T(desc.total_rows == desc.rows.length); + + // Check _all_docs offset + var all = db.allDocs({startkey:"2"}); + T(all.offset == 2); // Test a simple map functions Modified: incubator/couchdb/trunk/src/couchdb/couch_btree.erl URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_btree.erl?rev=706714&r1=706713&r2=706714&view=diff ============================================================================== --- incubator/couchdb/trunk/src/couchdb/couch_btree.erl (original) +++ incubator/couchdb/trunk/src/couchdb/couch_btree.erl Tue Oct 21 11:43:42 2008 @@ -637,7 +637,8 @@ fun({Key, _}) -> less(Bt, StartKey, Key) end end, {LTKVs, GTEKVs} = lists:splitwith(DropFun, KVs), - stream_kv_node2(Bt, Reds, LTKVs, GTEKVs, Dir, Fun, Acc). + AssembleLTKVs = [assemble(Bt,K,V) || {K,V} <- LTKVs], + stream_kv_node2(Bt, Reds, AssembleLTKVs, GTEKVs, Dir, Fun, Acc). stream_kv_node2(_Bt, _Reds, _PrevKVs, [], _Dir, _Fun, Acc) -> {ok, Acc}; Modified: incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl URL: http://svn.apache.org/viewvc/incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=706714&r1=706713&r2=706714&view=diff ============================================================================== --- incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl (original) +++ incubator/couchdb/trunk/src/couchdb/couch_httpd_view.erl Tue Oct 21 11:43:42 2008 @@ -370,7 +370,6 @@ fun({{Key, DocId}, Value}, OffsetReds, {AccCount, AccSkip, Resp, AccRevRows}) -> - Offset = ReduceCountFun(OffsetReds), % I think we only need this call once per view PassedEnd = PassedEndFun(Key, DocId), case {PassedEnd, AccCount, AccSkip, Resp} of {true, _, _, _} -> @@ -383,6 +382,8 @@ {ok, {AccCount, AccSkip - 1, Resp, AccRevRows}}; {_, _, _, undefined} -> {ok, Resp2} = start_json_response(Req, 200), + io:format("OffsetReds:~p~n", [OffsetReds]), + Offset = ReduceCountFun(OffsetReds), JsonBegin = io_lib:format("{\"total_rows\":~w,\"offset\":~w,\"rows\":[\r\n", [TotalViewCount, Offset]), JsonObj = view_row_obj(Db, {{Key, DocId}, Value}, IncludeDocs),