diff options
author | Nick Vatamaniuc <vatamane@apache.org> | 2017-07-31 08:42:09 -0400 |
---|---|---|
committer | Nick Vatamaniuc <nickva@users.noreply.github.com> | 2017-09-13 11:50:18 -0400 |
commit | d9e2940839532a727c3e8dddf3e9f24fdd806fb1 (patch) | |
tree | 84ea648d005316bd06d139d08d5b8ccd9e158781 /dev | |
parent | ef8a934c1ca67092b06f0cee2e01871013bae4e5 (diff) | |
download | couchdb-d9e2940839532a727c3e8dddf3e9f24fdd806fb1.tar.gz |
Provide a more accurate size check for max_document_size limit
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. The size calculation approximates as well, since there is no
canonical json size as it depends on the encoder used.
Issue #659
Diffstat (limited to 'dev')
0 files changed, 0 insertions, 0 deletions