AlexanderKaraberov opened a new pull request #1165: Fix: validate_doc_update 
behaviour for Erlang functions
URL: https://github.com/apache/couchdb/pull/1165
 
 
   ## Overview
   
   When you implement `validate_doc_update` as an Erlang function it doesn't 
work because of a missing case clause, namely: when 
`couch_query_servers:try_compile()` calls `proc_prompt_raw()` which in turn 
calls `erlang:apply(Fun)` for a native function the return value of it is an 
atom `ok` or `true` but in case of JS function we have response code `1`. I 
added an additional guard check for all these situations in the 
`validate_doc_update` and now it works for Erlang functions as well. This was 
crucial in our case because JS functions are much slower and in our production 
system we are going to use validation functions implemented in Erlang.
   
   ## Testing recommendations
   
   Implement `validate_doc_update` as Erlang function in the design doc 
(`"language": "erlang"`), run CouchDB with `--enable-erlang-views` and update 
some docs in the db in order to trigger this call.
   
   ## Checklist
   
   - [ ] Code is written and works correctly;
   - [ ] Changes are covered by tests;
   - [ ] Documentation reflects the changes;
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to