Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[yugabyte#13782] ysql: Import Build de-escaped JSON strings in larger…
… chunks during lexing Summary: Upstream commit was 3838fa269c15706df2b85ce2d6af8aacd5611655 commit message was : ``` During COPY BINARY with large JSONB blobs, it was found that half the time was spent parsing JSON, with much of that spent in separate appendStringInfoChar() calls for each input byte. Add lookahead loop to json_lex_string() to allow batching multiple bytes via appendBinaryStringInfo(). Also use this same logic when de-escaping is not done, to avoid code duplication. Report and proof of concept patch by Jelte Fennema, reworked by Andres Freund and John Naylor Discussion: https://www.postgresql.org/message-id/CAGECzQQuXbies_nKgSiYifZUjBk6nOf2%3DTSXqRjj2BhUh8CTeA%40mail.gmail.com Discussion: https://www.postgresql.org/message-id/flat/PR3PR83MB0476F098CBCF68AF7A1CA89FF7B49@PR3PR83MB0476.EURPRD83.prod.outlook.com ``` This revision also includes upstream commit d3117fc1a3e87717a57be0153408e5387e265e1b Fix out-of-bounds read in json_lex_string Commit 3838fa269 added a lookahead loop to allow building strings multiple bytes at a time. This loop could exit because it reached the end of input, yet did not check for that before checking if we reached the end of a valid string. To fix, put the end of string check back in the outer loop. Per Valgrind animal skink For the dataset from author, the performance gain is 18%. Test Plan: Existing test suite Reviewers: smishra, plee Reviewed By: plee Subscribers: yql Differential Revision: https://phabricator.dev.yugabyte.com/D19199
- Loading branch information