zachlankton commented on code in PR #4152:
URL: https://github.com/apache/couchdb/pull/4152#discussion_r953035578
##########
src/fabric/src/fabric_view_all_docs.erl:
##########
@@ -286,6 +286,24 @@ all_docs_concurrency() ->
10
end.
+get_query_list(undefined) ->
+ [];
+get_query_list(List) when is_list(List) ->
+ List.
+validate_if_partition(Row, Acc) ->
+ QueryList = get_query_list(Acc#vacc.req#httpd.qs),
+ case couch_util:get_value("partition", QueryList) of
Review Comment:
I just discovered `chttpd:qs_value/2` ... will be refactoring this code.
##########
src/fabric/src/fabric_view_all_docs.erl:
##########
@@ -286,6 +286,24 @@ all_docs_concurrency() ->
10
end.
+get_query_list(undefined) ->
+ [];
+get_query_list(List) when is_list(List) ->
+ List.
+validate_if_partition(Row, Acc) ->
+ QueryList = get_query_list(Acc#vacc.req#httpd.qs),
+ case couch_util:get_value("partition", QueryList) of
+ undefined -> Row;
+ Id -> is_doc_in_partition(Row, Id)
+ end.
+is_doc_in_partition(Row, Id) ->
+ BinRowKey = Row#view_row.key,
+ IsDocInPartition = binary:match(BinRowKey, list_to_binary(Id)) /= nomatch,
Review Comment:
How do we feel about the way I am matching the `BinRowKey` with the
requested partition `Id` ?
This works, but wondering if it could be problematic in the future as a
partition key of `test` could also match the following row key:
`someOtherPartition:with-test-in-the-doc-id`
What would be the recommended way to extract the partition from the
`BinRowKey` and do an explicit match?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]