Return-Path: X-Original-To: apmail-couchdb-commits-archive@www.apache.org Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6F0909F78 for ; Tue, 13 Mar 2012 17:54:36 +0000 (UTC) Received: (qmail 62105 invoked by uid 500); 13 Mar 2012 17:54:36 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 62069 invoked by uid 500); 13 Mar 2012 17:54:36 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 62060 invoked by uid 99); 13 Mar 2012 17:54:36 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 13 Mar 2012 17:54:36 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id F3BE36D9E; Tue, 13 Mar 2012 17:54:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jan@apache.org To: commits@couchdb.apache.org X-Mailer: ASF-Git Admin Mailer Subject: git commit: Fix view etag calculation regression introduced by fb7225 Message-Id: <20120313175435.F3BE36D9E@tyr.zones.apache.org> Date: Tue, 13 Mar 2012 17:54:35 +0000 (UTC) Updated Branches: refs/heads/1.2.x 623e4950e -> 4098fee35 Fix view etag calculation regression introduced by fb7225 The optimisation relied on creating batches of documents to be sent to the view server. The implementation created the batch in a foldl function instead of a foldr function causing the wrong update sequence to be persisted because the write assumes the last item in the list to have the largest sequence. Thanks to Filipe for guiding the research. Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/4098fee3 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/4098fee3 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/4098fee3 Branch: refs/heads/1.2.x Commit: 4098fee352dae62e51bd4b3217cbd5bd074aa8da Parents: 623e495 Author: Jan Lehnardt Authored: Tue Mar 13 18:49:36 2012 +0100 Committer: Jan Lehnardt Committed: Tue Mar 13 18:49:36 2012 +0100 ---------------------------------------------------------------------- share/www/script/test/etags_views.js | 4 ++-- src/couchdb/couch_view_updater.erl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/4098fee3/share/www/script/test/etags_views.js ---------------------------------------------------------------------- diff --git a/share/www/script/test/etags_views.js b/share/www/script/test/etags_views.js index 6d8e97b..0d374f9 100644 --- a/share/www/script/test/etags_views.js +++ b/share/www/script/test/etags_views.js @@ -112,7 +112,7 @@ couchTests.etags_views = function(debug) { restartServer(); xhr = CouchDB.request("GET", "/test_suite_db/_design/etags/_view/basicView"); var etag2 = xhr.getResponseHeader("etag"); - T(etag1 == etag2); + TEquals(etag2, etag1, "etag should be the same after restart 1"); // reduce view xhr = CouchDB.request("GET", "/test_suite_db/_design/etags/_view/withReduce"); @@ -155,7 +155,7 @@ couchTests.etags_views = function(debug) { restartServer(); xhr = CouchDB.request("GET", "/test_suite_db/_design/etags/_view/withReduce"); var etag2 = xhr.getResponseHeader("etag"); - T(etag1 == etag2); + TEquals(etag2, etag1, "etag should be the same after restart 2"); // confirm ETag changes with different POST bodies xhr = CouchDB.request("POST", "/test_suite_db/_design/etags/_view/basicView", http://git-wip-us.apache.org/repos/asf/couchdb/blob/4098fee3/src/couchdb/couch_view_updater.erl ---------------------------------------------------------------------- diff --git a/src/couchdb/couch_view_updater.erl b/src/couchdb/couch_view_updater.erl index 73a61fc..4aee586 100644 --- a/src/couchdb/couch_view_updater.erl +++ b/src/couchdb/couch_view_updater.erl @@ -166,7 +166,7 @@ do_maps(#group{query_server = Qs} = Group, MapQueue, WriteQueue) -> couch_work_queue:close(WriteQueue), couch_query_servers:stop_doc_map(Group#group.query_server); {ok, Queue} -> - Items = lists:foldl( + Items = lists:foldr( fun({Seq, #doc{id = Id, deleted = true}}, Acc) -> Item = {Seq, Id, []}, [Item | Acc];