You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/02/14 16:28:32 UTC

[GitHub] AlexanderKaraberov opened a new pull request #1166: Fix: fix `badmatch` crash in couch_mrview_util.erl reduced_external_size()

AlexanderKaraberov opened a new pull request #1166: Fix: fix `badmatch` crash in couch_mrview_util.erl reduced_external_size()
URL: https://github.com/apache/couchdb/pull/1166
 
 
   ## Overview
   
   When we tested CouchDB 2.1 with our production DB which contains gazillion of different documents `couch_mrview_util:reduced_external_size()` crashed with `badmatch` error randomly because of some broken docs in our DB. This is because `full_reduce` returned response in the format `{_, _}` (no nested tuple)  and not `{ok, {_, _}}` as was expected there. After this crash CouchDB was broken completely for me. In order to fix this I added an additional "match-anything" case clause, because even if we had something really broken in our DB, CouchDB still should handle this more gracefully I believe. 
   
   P.S. I wasn't sure what is better: add a wildcard `_` after `{ok, {_, _}} -> 0` or  just replace latter with it. Feel free to suggest.
   
   ## Testing recommendations
   
   Unfortunately can't describe formal steps because this thing happened randomly for us several times on one of the production databases. But I think expecting that `full_reduce` may return another response is good instead of crashing Couch and polluting logs.
   
   ## 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:
users@infra.apache.org


With regards,
Apache Git Services