Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion dev/run
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,10 @@ def boot_haproxy(ctx):
def hack_default_ini(ctx, node, contents):

contents = re.sub(
"^\[httpd\]$", "[httpd]\nenable = true", contents, flags=re.MULTILINE,
"^\[httpd\]$",
"[httpd]\nenable = true",
contents,
flags=re.MULTILINE,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this change for? Looks like styling which we shouldn't mix.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Line's too long, required change to make python black happy. It is unrelated but needs to go in because otherwise tests fail. Don't give him grief on this one.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah! Fair enough.

)

if ctx["enable_erlang_views"]:
Expand Down
9 changes: 6 additions & 3 deletions src/couch_mrview/src/couch_mrview_util.erl
Original file line number Diff line number Diff line change
Expand Up @@ -425,9 +425,12 @@ validate_args(#mrst{} = State, Args0) ->


apply_limit(ViewPartitioned, Args) ->
LimitType = case ViewPartitioned of
true -> "partition_query_limit";
false -> "query_limit"
Options = Args#mrargs.extra,
IgnorePQLimit = lists:keyfind(ignore_partition_query_limit, 1, Options),
LimitType = case {ViewPartitioned, IgnorePQLimit} of
{true, false} -> "partition_query_limit";
{true, _} -> "query_limit";
{false, _} -> "query_limit"
end,

MaxLimit = config:get_integer("query_server_config",
Expand Down
6 changes: 5 additions & 1 deletion src/mango/src/mango_cursor_view.erl
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,11 @@ base_args(#cursor{index = Idx, selector = Selector} = Cursor) ->
start_key = StartKey,
end_key = EndKey,
include_docs = true,
extra = [{callback, {?MODULE, view_cb}}, {selector, Selector}]
extra = [
{callback, {?MODULE, view_cb}},
{selector, Selector},
{ignore_partition_query_limit, true}
]
}.


Expand Down
53 changes: 53 additions & 0 deletions test/elixir/test/partition_mango_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,59 @@ defmodule PartitionMangoTest do
assert_correct_partition(partitions, "foo")
end

@tag :with_partitioned_db
test "partitioned query with query server config set", context do
db_name = context[:db_name]
create_partition_docs(db_name)
create_index(db_name, ["value"])

# this is to test that we bypass partition_query_limit for mango
set_config({"query_server_config", "partition_query_limit", "1"})

url = "/#{db_name}/_partition/foo/_find"

resp =
Couch.post(
url,
body: %{
selector: %{
value: %{
"$gte": 6,
"$lt": 16
}
},
limit: 3
}
)

assert resp.status_code == 200
partitions = get_partitions(resp)
assert length(partitions) == 3
assert_correct_partition(partitions, "foo")

%{:body => %{"bookmark" => bookmark}} = resp

resp =
Couch.post(
url,
body: %{
selector: %{
value: %{
"$gte": 6,
"$lt": 16
}
},
limit: 3,
bookmark: bookmark
}
)

assert resp.status_code == 200
partitions = get_partitions(resp)
assert length(partitions) == 2
assert_correct_partition(partitions, "foo")
end

@tag :with_partitioned_db
test "global query uses global index", context do
db_name = context[:db_name]
Expand Down