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 <[email protected]> Authored: Tue Mar 13 18:49:36 2012 +0100 Committer: Jan Lehnardt <[email protected]> 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];
