summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjiangph <jiangph@cn.ibm.com>2019-02-13 14:44:27 +0800
committerjiangph <jiangph@cn.ibm.com>2019-02-13 14:44:27 +0800
commitc0151d3294d0da0b7813759db4b7f4de41015a8b (patch)
treea6fef935cf4179e4a0a0c60ba538b82f304dd380
parente699fe6859eb4fb32eafbd637cda1fc7d5e9043a (diff)
downloadcouchdb-1648-offset-not-null.tar.gz
Not set offset with null as default for _all_docs1648-offset-not-null
Revert the change of setting offset with null for _all_docs when keys is set in request to avoid compatibility of returned response where offset with 0 is expected. Fixes #1648
-rw-r--r--src/chttpd/test/chttpd_db_test.erl4
-rw-r--r--src/fabric/src/fabric_view_all_docs.erl4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/chttpd/test/chttpd_db_test.erl b/src/chttpd/test/chttpd_db_test.erl
index 2708aa033..fc12dc419 100644
--- a/src/chttpd/test/chttpd_db_test.erl
+++ b/src/chttpd/test/chttpd_db_test.erl
@@ -234,7 +234,7 @@ should_return_update_seq_when_set_on_all_docs(Url) ->
{ResultJson} = ?JSON_DECODE(RespBody),
?assertNotEqual(undefined,
couch_util:get_value(<<"update_seq">>, ResultJson)),
- ?assertNotEqual(undefined,
+ ?assertEqual(undefined,
couch_util:get_value(<<"offset">>, ResultJson))
end).
@@ -248,7 +248,7 @@ should_not_return_update_seq_when_unset_on_all_docs(Url) ->
{ResultJson} = ?JSON_DECODE(RespBody),
?assertEqual(undefined,
couch_util:get_value(<<"update_seq">>, ResultJson)),
- ?assertNotEqual(undefined,
+ ?assertEqual(undefined,
couch_util:get_value(<<"offset">>, ResultJson))
end).
diff --git a/src/fabric/src/fabric_view_all_docs.erl b/src/fabric/src/fabric_view_all_docs.erl
index 9049eaa90..a1e062358 100644
--- a/src/fabric/src/fabric_view_all_docs.erl
+++ b/src/fabric/src/fabric_view_all_docs.erl
@@ -99,9 +99,9 @@ go(DbName, Options, QueryArgs, Callback, Acc0) ->
{'DOWN', Ref, _, _, {ok, TotalRows}} ->
Meta = case UpdateSeq of
false ->
- [{total, TotalRows}, {offset, null}];
+ [{total, TotalRows}];
true ->
- [{total, TotalRows}, {offset, null}, {update_seq, null}]
+ [{total, TotalRows}, {update_seq, null}]
end,
{ok, Acc1} = Callback({meta, Meta}, Acc0),
{ok, Acc2} = doc_receive_loop(