summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2010-08-19 18:21:28 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2010-08-19 18:21:28 +0000
commit83f5171b8c2c8d30a9858e98679c045dc8a53a28 (patch)
tree80fcb7fa3139cae919acdc742c3546ada08c1240
parent678cd66689ad9ea2f5c47f41af6bf3b9ae0a3c59 (diff)
Fix behaviour of the view query option stale=update_after.
Somehow it was not working for all cases. Issue found by Volker Mische. Thanks. git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@987257 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--share/www/script/test/view_update_seq.js11
-rw-r--r--src/couchdb/couch_view.erl7
2 files changed, 14 insertions, 4 deletions
diff --git a/share/www/script/test/view_update_seq.js b/share/www/script/test/view_update_seq.js
index 9b07a777..a002536c 100644
--- a/share/www/script/test/view_update_seq.js
+++ b/share/www/script/test/view_update_seq.js
@@ -79,6 +79,17 @@ couchTests.view_update_seq = function(debug) {
T(resp.rows.length == 1);
T(resp.update_seq == 101);
+ // wait 5 seconds for the next assertions to pass in very slow machines
+ var t0 = new Date(), t1;
+ do {
+ CouchDB.request("GET", "/");
+ t1 = new Date();
+ } while ((t1 - t0) < 5000);
+
+ resp = db.view('test/all_docs', {limit: 1, stale: "ok", update_seq: true});
+ T(resp.rows.length == 1);
+ T(resp.update_seq == 103);
+
resp = db.view('test/all_docs', {limit: 1, update_seq:true});
T(resp.rows.length == 1);
T(resp.update_seq == 103);
diff --git a/src/couchdb/couch_view.erl b/src/couchdb/couch_view.erl
index 189bd98f..35bc80b6 100644
--- a/src/couchdb/couch_view.erl
+++ b/src/couchdb/couch_view.erl
@@ -61,15 +61,14 @@ get_group(Db, GroupId, Stale) ->
update_after -> 0;
_Else -> couch_db:get_update_seq(Db)
end,
- Result = {ok, Group} = couch_view_group:request_group(
- get_group_server(couch_db:name(Db), GroupId),
- MinUpdateSeq),
+ GroupPid = get_group_server(couch_db:name(Db), GroupId),
+ Result = couch_view_group:request_group(GroupPid, MinUpdateSeq),
case Stale of
update_after ->
% best effort, process might die
spawn(fun() ->
LastSeq = couch_db:get_update_seq(Db),
- couch_view_group:request_group(Group, LastSeq)
+ couch_view_group:request_group(GroupPid, LastSeq)
end);
_ ->
ok