-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Querying Nouveau index with >3 sort params results in badarith
error
#5453
Comments
Thank you for the report, unfortunately I cannot reproduce the error locally. the badarith seems to be part of the base64 encoding process which implies something interesting about what is being encoded. I don't think it's about the number of items in the sort order, that just happens to trigger a bug elsewhere. Could you provide some sample docs? I made one up based on your index function and I don't see how the details could matter, but clearly there's a difference between my setup and yours.
|
I am testing with docs that all have this set of fields (with random values): {
"_id": "03476254-7ca0-457c-b39f-7266516e8717",
"_rev": "1-0cd9bf8a77a686db365d58c41ccf61f7",
"type": "person",
"name": "malcolm",
"short_name": "Alex",
"date_of_birth": "1992-3-5",
"date_of_birth_method": "",
"ephemeral_dob": {
"dob_calendar": "1992-3-5",
"dob_method": "",
"dob_approx": "1992-04-03T17:44:27.928Z",
"dob_raw": "1992-3-5",
"dob_iso": "1992-3-5"
},
"sex": "male",
"phone": "+254755818055",
"phone_alternate": "",
"role": "patient",
"external_id": "",
"notes": "",
"meta": {
"created_by": "medic",
"created_by_person_uuid": "",
"created_by_place_uuid": ""
},
"reported_date": 1739891502334
} Playing around with this some more, I think the error is related to the number of hits found for the query and the With an empty DB, the query works fine. As I start adding docs with the above structure one-by-one the query still works. However, once I pass So, once I have |
That's interesting, I still can't repro even when adding documents, however I am not purging docs and I wonder if that's somehow related. Are you willing and able to modify the couchdb install to gather more information? I could propose a patch with additional logging. |
can you also state your couchdb and erlang versions please? |
derp, nvm, the image should tell me all that |
wondering if this is bookmark related, base64 vs urlsafe. dreyfus uses couch_util:encode/decodeBase64Url but nouveau doesn't (though I think it will have to...) |
think I figured it out. |
this line;
only works when jiffy:encode returns a binary. So the sorting/limit stuff is incidental, the output of jiffy for those inputs just happens to be represented as an iolist(). |
dreyfus uses the b64url NIF instead which always returns a binary. |
dreyfus used b64url to encode its bookmark which always returns a binary, so let's do that. also makes bookmarks easier to pass around. closes #5453
Description
Reading the docs for querying a Nouveau index it states that:
Unfortunately, when I try to use more than
3
fields in thesort
array on a query request, an error occurs in my Couch instance.Steps to Reproduce
I have created a design doc with a Nouveau index that has the following code:
Then, I am querying this index by POSTing the following body:
Unfortunately, the server responds with a
500
error and:In the logs from my CouchDB instance I see:
There are no errors in the Nouveau logs (only
200
successes).If I repeat the request with only 3 entries in the
sort
array, it succeeds (regardless of which field I remove from the array).Expected Behaviour
I expect the
sort
array to be able to support a reasonable amount of sort parameters (>3) without erroring.Your Environment
CouchDB Docker image built
FROM couchdb:3.4.2
Nouveau Docker image build
FROM couchdb:3.4.2-nouveau
Additional Context
I am new to Nouveau indexes and have been trying to closely follow the docs, but perhaps I missed something and am actually trying to do something in an improper way....
The text was updated successfully, but these errors were encountered: