nickva opened a new pull request #660: Provide a more accurate size check for 
max_document_size limit
URL: https://github.com/apache/couchdb/pull/660
 
 
   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.
   
   Re-encode the data using jiffy and check the size against that. That's a 
better
   check but will impact performance.
   
   Also this is also not an exact solution.Users' json encoder might insert more
   whitespace (say as indentation), or whitespace after commas, use a different
   algorithm for encoding floating point numbers (scientific notation, represent
   exact floating point numbers without a decimal point (5 instead of 5.0 etc.).
   So the size would still be off.
   
   Issue #659
   
 
----------------------------------------------------------------
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