Details
-
Bug
-
Resolution: Won't Fix
-
Minor
-
3.0
-
Security Level: Public
-
None
-
Untriaged
Description
in couch-kvstore/couch-kvstore.cc we perform the following check in line 250 on every incoming value to see if it is valid JSON or not. Since, in 3.0 we also receive the datatype from 3.0 clients we can skip this check is we already know from the datatype field that it is not JSON. So, from the datatype field that is set in line 253 if the value indicates BINARY_COMPRESSED or JSON_COMPRESSED we can skip the check. However, couple of things to note:
1)If the datatype is 0, we should still run the check since the doc might be coming from a 2.x client that is not flex metadata aware.
2)We should answer the question of whether we should validate JSONness for JSON_COMPRESSED by uncompressing and checking.
couch-kvstore/couch-kvstore.cc snippet:
249 if (vlen) {
250 isjson = isJSON(value);
251 dbDoc.data.buf = const_cast<char *>(value->getData());
252 dbDoc.data.size = vlen;
253 datatype = it.getDataType();