nickva opened a new pull request #726: Provide a more accurate size check for 
max_document_size limit
URL: https://github.com/apache/couchdb/pull/726
 
 
   max_document_size currently checks document sizes based on Erlang's external
   term size of the jiffy-decoded document body. This makes sense because that's
   what used to store the data on disk and it's what manipulated by the CouchDB
   internals.
   
   However erlang term size is not always a good approximation of the size of 
json
   encoded data. Sometimes it can be way off (I've seen 30% off) and It's hard 
for
   users to estimate or check the external term size beforehand. So for example 
if
   max_document_size is 1MB, CouchDB might reject user's 600KB json document
   because Erlang's external term size of that document greater than 1MB.
   
   To fix the issue provide a module which calculates the encoded size of a json
   document.
   
   Issue #659
   
   * Opened this is an alternative to 
https://github.com/apache/couchdb/pull/660 to discuss the approaches. Would 
have to benchmark both cases. And maybe combine them as suggested by @davisp 
(count number of elements if it ends up being larger than some threshold then 
ask jiffy to encode it).
   
   * For floating point, maybe a good minimum calculation is just to say the 
size is 3 (or 4 if negative). This will underestimate in most cases.  And will 
account for scientific notation like 1e9.
 
----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to