Open silvpol opened 2 years ago
Thanks for your report, @silvpol. Yeah it does look like a bug.
Does it fail with a single document or do we need to create a certain number of them?
@nickva I have tested and it also happens in a db with just a single doc.
Inserting custom reduce funtion via API is not restricted and causes ALL views in the given design doc to fail with the same error message, which is rather scary.
I have also tried to update design doc via Fauxton and it shows warning that partitioned DB doesn't support custom reduce. This points to a known limitation but it would be good to add it somewhere in the API docs.
@silvpol That makes sense.
It is quite embarrassing, it seems we never intended to support partitioned db custom reduces but added a check in Fauxton only, but not the internal design doc updater validation logic.
The fix here it seems is to update the ddoc validation logic to conform to what we intended.
Added an integration tests which demonstrates it as well: https://github.com/apache/couchdb/pull/3957
Fauxton indicates we don't intend to support it
Its very essential feature we need custom reducer in partition db , shifting from normal db to partitioneddb would break our few features from platform
@nickva I can't see the logic behind not supporting custom reduce functions in partitioned DBs? Why? Partitioned DBs make a whole lot of sense e.g. in accounting apps, so you can easily separate the various accounting periods. But not being able to use custom reduce functions kind of kills the purpose of going with couchDB map/reduce in the first place.
Will this feature be added with the next release?
In a partitioned DB using custom reduce function doesn't work, all queries to that view fail with 500 error. Creating exact same view in non-partitioned db works. Built in reduce funtions work fine though.
@silvpol , did you find any way around that limitation yet? Or does one have to move back to non-partitioned DB for real?
@trickkiste I have changed data design a bit to make it work with built in functions, using an array type to emit intermediate calculations and _stats function to achive what I wanted. It's a bit clunky but works good enough.
Description
In a partitioned DB using custom reduce function doesn't work, all queries to that view fail with 500 error. Creating exact same view in non-partitioned db works. Built in reduce funtions work fine though.
Steps to Reproduce
Expected Behaviour
Custom reduce functions should work fine on partitioned DB or should be documented non-working
Your Environment
Docker Compose setup with three nodes using Docker Hub
couchdb:3
imageAdditional Context
Design doc:
Error returned:
Docker Compose setup:
docker setup.zip