couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r987257 - in /couchdb/trunk: share/www/script/test/view_update_seq.js src/couchdb/couch_view.erl
Date Thu, 19 Aug 2010 18:21:29 GMT
Author: fdmanana
Date: Thu Aug 19 18:21:28 2010
New Revision: 987257

URL: http://svn.apache.org/viewvc?rev=987257&view=rev
Log:
Fix behaviour of the view query option stale=update_after.
Somehow it was not working for all cases.

Issue found by Volker Mische. Thanks.


Modified:
    couchdb/trunk/share/www/script/test/view_update_seq.js
    couchdb/trunk/src/couchdb/couch_view.erl

Modified: couchdb/trunk/share/www/script/test/view_update_seq.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/view_update_seq.js?rev=987257&r1=987256&r2=987257&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/view_update_seq.js (original)
+++ couchdb/trunk/share/www/script/test/view_update_seq.js Thu Aug 19 18:21:28 2010
@@ -79,6 +79,17 @@ couchTests.view_update_seq = function(de
   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);

Modified: couchdb/trunk/src/couchdb/couch_view.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_view.erl?rev=987257&r1=987256&r2=987257&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_view.erl (original)
+++ couchdb/trunk/src/couchdb/couch_view.erl Thu Aug 19 18:21:28 2010
@@ -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



Mime
View raw message