summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/www/script/test/all_docs.js3
-rw-r--r--share/www/script/test/replication.js4
-rw-r--r--src/couchdb/couch_httpd_db.erl17
3 files changed, 10 insertions, 14 deletions
diff --git a/share/www/script/test/all_docs.js b/share/www/script/test/all_docs.js
index ab443605..34c20921 100644
--- a/share/www/script/test/all_docs.js
+++ b/share/www/script/test/all_docs.js
@@ -65,7 +65,8 @@ couchTests.all_docs = function(debug) {
// the deletion should make doc id 1 have the last seq num
T(changes.results.length == 4);
T(changes.results[3].id == "1");
- T(changes.results[3].deleted);
+ // we've removed deletions from the changes feed as they are on the doc record not the doc_info
+ T(!changes.results[3].deleted);
// do an update
var doc2 = db.open("3");
diff --git a/share/www/script/test/replication.js b/share/www/script/test/replication.js
index 210ffa2c..c08d128b 100644
--- a/share/www/script/test/replication.js
+++ b/share/www/script/test/replication.js
@@ -100,12 +100,12 @@ couchTests.replication = function(debug) {
};
this.afterAB1 = function(dbA, dbB) {
- var rows = dbB.changes().results;
+ var rows = dbB.changes({include_docs:true}).results;
var rowCnt = 0;
for (var i=0; i < rows.length; i++) {
if (rows[i].id == "del1") {
rowCnt += 1;
- T(rows[i].deleted == true);
+ T(rows[i].doc._deleted == true);
}
};
T(rowCnt == 1);
diff --git a/src/couchdb/couch_httpd_db.erl b/src/couchdb/couch_httpd_db.erl
index 1adda839..d0960936 100644
--- a/src/couchdb/couch_httpd_db.erl
+++ b/src/couchdb/couch_httpd_db.erl
@@ -74,13 +74,11 @@ start_sending_changes(Resp, _Else) ->
handle_changes_req(#httpd{method='GET',path_parts=[DbName|_]}=Req, Db) ->
{FilterFun, EndFilterFun} = make_filter_funs(Req, Db),
- {ok, Info} = couch_db:get_db_info(Db),
- Seq = proplists:get_value(update_seq, Info),
{Dir, StartSeq} = case couch_httpd:qs_value(Req, "descending", "false") of
"false" ->
{fwd, list_to_integer(couch_httpd:qs_value(Req, "since", "0"))};
"true" ->
- {rev, Seq}; % super big value, should use current db seq
+ {rev, 1000000000000000}; % super big value, should use current db seq
_Bad -> throw({bad_request, "descending must be true or false"})
end,
ResponseType = couch_httpd:qs_value(Req, "feed", "normal"),
@@ -106,6 +104,7 @@ handle_changes_req(#httpd{method='GET',path_parts=[DbName|_]}=Req, Db) ->
get_rest_db_updated() % clean out any remaining update messages
end;
true ->
+ {ok, Info} = couch_db:get_db_info(Db),
CurrentEtag = couch_httpd:make_etag(Info),
couch_httpd:etag_respond(Req, CurrentEtag, fun() ->
% send the etag
@@ -163,19 +162,19 @@ keep_sending_changes(#httpd{user_ctx=UserCtx,path_parts=[DbName|_]}=Req, Resp,
end.
changes_enumerator(DocInfos, {Db, _, _, FilterFun, Resp, "continuous", IncludeDocs}) ->
- [#doc_info{id=Id, high_seq=Seq, revs=[#rev_info{rev=#rev_info{deleted=Del}=Rev}|_]}|_] = DocInfos,
+ [#doc_info{id=Id, high_seq=Seq, revs=[#rev_info{rev=Rev}|_]}|_] = DocInfos,
Results0 = [FilterFun(DocInfo) || DocInfo <- DocInfos],
Results = [Result || Result <- Results0, Result /= null],
case Results of
[] ->
{ok, {Db, Seq, nil, FilterFun, Resp, "continuous", IncludeDocs}};
_ ->
- send_chunk(Resp, [?JSON_ENCODE(changes_row(Db, Seq, Id, Del, Results, Rev, IncludeDocs))
+ send_chunk(Resp, [?JSON_ENCODE(changes_row(Db, Seq, Id, Results, Rev, IncludeDocs))
|"\n"]),
{ok, {Db, Seq, nil, FilterFun, Resp, "continuous", IncludeDocs}}
end;
changes_enumerator(DocInfos, {Db, _, Prepend, FilterFun, Resp, _, IncludeDocs}) ->
- [#doc_info{id=Id, high_seq=Seq, revs=[#rev_info{rev=#rev_info{deleted=Del}=Rev}|_]}|_] = DocInfos,
+ [#doc_info{id=Id, high_seq=Seq, revs=[#rev_info{rev=Rev}|_]}|_] = DocInfos,
Results0 = [FilterFun(DocInfo) || DocInfo <- DocInfos],
Results = [Result || Result <- Results0, Result /= null],
case Results of
@@ -183,22 +182,18 @@ changes_enumerator(DocInfos, {Db, _, Prepend, FilterFun, Resp, _, IncludeDocs})
{ok, {Db, Seq, Prepend, FilterFun, Resp, nil, IncludeDocs}};
_ ->
send_chunk(Resp, [Prepend, ?JSON_ENCODE(
- changes_row(Db, Seq, Id, Del, Results, Rev, IncludeDocs))]),
+ changes_row(Db, Seq, Id, Results, Rev, IncludeDocs))]),
{ok, {Db, Seq, <<",\n">>, FilterFun, Resp, nil, IncludeDocs}}
end.
changes_row(Db, Seq, Id, Results, Rev, true) ->
{[{seq,Seq},{id,Id},
{changes,Results}] ++
- deleted_item(Del) ++
couch_httpd_view:doc_member(Db, Id, Rev)};
changes_row(_, Seq, Id, Results, _, false) ->
{[{seq,Seq},{id,Id},
{changes,Results}]}.
-deleted_item(true) -> [{deleted,true}];
-deleted_item(_) -> [].
-
send_changes(Req, Resp, Db, Dir, StartSeq, Prepend, ResponseType, FilterFun, End) ->
Style = list_to_existing_atom(
couch_httpd:qs_value(Req, "style", "main_only")),