apache / apache/couchdb

keys quey does not work in partitioned DB

Open
#3,321 0 comments 0 reactions 0 assignees View on GitHub
bug needs-triage
Dominant language
Erlang
Stars
7k
Forks
1.1k
Avg merge
1d 16h
Merged PRs (30d)
9

Description

[NOTE]: # ( ^^ Provide a general summary of the issue in the title above. ^^ )

## Description

Hi, I'm using CouchDB 3.1.1 to store both partitioned and non-partitioned data in separate databases. When querying a custom view with **key** parameter, CouchDB works perfectly on both databases but when I try to use **keys** instead of **key** to query a reduce view on partitioned database, I get the following response (assuming the special characters in URL are escaped perfectly or a web browser (FF) used to query the DB)

## Steps to Reproduce

```
curl http://admin:PassWord@127.0.0.1:5984/PartitionedDB/_partition/user01/_design/folder_count/_view/folder_count?keys=["0","2"]&group=true
{"rows":[]}
```

```
curl http://admin:PassWord@127.0.0.1:5984/PartitionedDB/_partition/user01/_design/folder_count/_view/folder_count?key="0"
{"rows":[ {"key":null,"value":3} ]}
```

While that view is not empty:

```
curl http://admin:PassWord@127.0.0.1:5984/PartitionedDB/_partition/user01/_design/folder_count/_view/folder_count?group=true
{"rows":[
{"key":"0","value":3},
{"key":"1","value":12},
{"key":"2","value":1},
{"key":"3","value":3},
{"key":"31","value":1},
{"key":"311","value":3}
]}
```

## Expected Behaviour

Should display the result as the multiple keys query parameter does in non-partitioned DB

## Your Environment

OS: Windows 7 64bit
CouchDB 3.1.1

```
curl http://127.0.0.1:5984
{"couchdb":"Welcome","version":"3.1.1","git_sha":"ce596c65d","uuid":"f89258d2cbb860f8181311e52dedc5fd","features":["access-ready","partitioned","pluggable-storage-engines","reshard","scheduler"],"vendor":{"name":"The Apache Software Foundation"}}
```

* CouchDB version used: 3.1.1
* Browser name and version: Firefox 81.0 64-bit
* Operating system and version: Windows 7 64-bit

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the partitioned reduce-view requests with curl, comparing the `keys` and `key` parameters against the unfiltered grouped response shown in the issue. Trace the partitioned view query path for multiple-key handling; done means `keys=["0","2"]` returns the expected grouped rows instead of an empty result.

Written by the indexing model from the issue text.

Assessment

Tech stack
erlang
Domain
databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.