couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r931731 - in /couchdb/trunk: share/www/script/test/list_views.js src/couchdb/couch_httpd_show.erl
Date Thu, 08 Apr 2010 00:07:22 GMT
Author: jchris
Date: Thu Apr  8 00:07:22 2010
New Revision: 931731

URL: http://svn.apache.org/viewvc?rev=931731&view=rev
Log:
fix last straggler view update_seq bugs, thanks tisba and bitdiddle for the report

Modified:
    couchdb/trunk/share/www/script/test/list_views.js
    couchdb/trunk/src/couchdb/couch_httpd_show.erl

Modified: couchdb/trunk/share/www/script/test/list_views.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/list_views.js?rev=931731&r1=931730&r2=931731&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/list_views.js (original)
+++ couchdb/trunk/share/www/script/test/list_views.js Thu Apr  8 00:07:22 2010
@@ -223,7 +223,10 @@ couchTests.list_views = function(debug) 
   xhr = CouchDB.request("GET", "/test_suite_db/_design/lists/_list/basicJSON/basicView");
   T(xhr.status == 200, "standard get should be 200");
   var resp = JSON.parse(xhr.responseText);
-  TEquals(resp.head, {total_rows:10, offset:0});
+  TEquals(10, resp.head.total_rows);
+  TEquals(0, resp.head.offset);
+  TEquals(11, resp.head.update_seq);
+  
   T(resp.rows.length == 10);
   TEquals(resp.rows[0], {"id": "0","key": 0,"value": "0"});
 

Modified: couchdb/trunk/src/couchdb/couch_httpd_show.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_show.erl?rev=931731&r1=931730&r2=931731&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_show.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_show.erl Thu Apr  8 00:07:22 2010
@@ -240,7 +240,7 @@ output_map_list(Req, Db, DDoc, LName, Vi
                             couch_httpd_view:make_key_options(QueryArgs2))
                     end, {ok, nil, FoldAccInit}, Keys)
             end,
-        finish_list(Req, QServer, Etag, FoldResult, StartListRespFun, RowCount)
+        finish_list(Req, QServer, Etag, FoldResult, StartListRespFun, CurrentSeq, RowCount)
     end).
 
 
@@ -277,7 +277,7 @@ output_reduce_list(Req, Db, DDoc, LName,
                             )    
                     end, {ok, FoldAccInit}, Keys)
             end,
-        finish_list(Req, QServer, Etag, FoldResult, StartListRespFun, null)
+        finish_list(Req, QServer, Etag, FoldResult, StartListRespFun, CurrentSeq, null)
     end).
 
 
@@ -348,7 +348,7 @@ send_non_empty_chunk(Resp, Chunk) ->
         _ -> send_chunk(Resp, Chunk)
     end.
 
-finish_list(Req, {Proc, _DDocId}, Etag, FoldResult, StartFun, TotalRows) ->
+finish_list(Req, {Proc, _DDocId}, Etag, FoldResult, StartFun, CurrentSeq, TotalRows) ->
     FoldResult2 = case FoldResult of
         {Limit, SkipCount, Response, RowAcc} ->
             {Limit, SkipCount, Response, RowAcc, nil};
@@ -358,7 +358,7 @@ finish_list(Req, {Proc, _DDocId}, Etag, 
     case FoldResult2 of
         {_, _, undefined, _, _} ->
             {ok, Resp, BeginBody} =
-                render_head_for_empty_list(StartFun, Req, Etag, TotalRows),
+                render_head_for_empty_list(StartFun, Req, Etag, CurrentSeq, TotalRows),
             [<<"end">>, Chunks] = couch_query_servers:proc_prompt(Proc, [<<"list_end">>]),
           
             Chunk = BeginBody ++ ?b2l(?l2b(Chunks)),
             send_non_empty_chunk(Resp, Chunk);
@@ -371,10 +371,10 @@ finish_list(Req, {Proc, _DDocId}, Etag, 
     last_chunk(Resp).
 
 
-render_head_for_empty_list(StartListRespFun, Req, Etag, null) ->
-    StartListRespFun(Req, Etag, []); % for reduce
-render_head_for_empty_list(StartListRespFun, Req, Etag, TotalRows) ->
-    StartListRespFun(Req, Etag, TotalRows, null, []).
+render_head_for_empty_list(StartListRespFun, Req, Etag, CurrentSeq, null) ->
+    StartListRespFun(Req, Etag, [], CurrentSeq); % for reduce
+render_head_for_empty_list(StartListRespFun, Req, Etag, CurrentSeq, TotalRows) ->
+    StartListRespFun(Req, Etag, TotalRows, null, [], CurrentSeq).
 
 
 % Maybe this is in the proplists API



Mime
View raw message