Bug #92114 | Partial Updates of JSON Values | ||
---|---|---|---|
Submitted: | 22 Aug 2018 1:22 | Modified: | 10 Jun 2021 4:05 |
Reporter: | chen chen (OCA) | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Server: JSON | Severity: | S3 (Non-critical) |
Version: | 8.0.12 | OS: | Any |
Assigned to: | Jon Stephens | CPU Architecture: | Any |
[22 Aug 2018 1:22]
chen chen
[5 Sep 2018 10:18]
MySQL Verification Team
Hello Chen, Thank you for the report and test case. Thanks, Umesh
[30 Nov 2018 14:07]
Knut Anders Hatlen
Posted by developer: I don't think this is a code bug. Since there is not enough space for the updated value inside the existing JSON document, a full update is performed when storing the updated document in the table. This can be seen by the fact that JSON_STORAGE_SIZE(c1) increases from 29 to 51 and JSON_STORAGE_FREE(c1) is 0 after the update. This is in agreement with the documentation. The reporter mentions that mysqlbinlog shows a partial update despite this. This is because the binlog will contain logical diffs instead of physical row images when binlog_row_value_options is set to 'PARTIAL_JSON', in order to reduce the amount of log to send to the slaves. This is done regardless of whether there is enough space in the original document to do a partial update when writing the updated column value to the table. This could be clarified in the documentation: https://dev.mysql.com/doc/refman/8.0/en/replication-options-binary-log.html#sysvar_binlog_... currently says: "This works for an UPDATE statement which modifies a JSON column using any sequence of JSON_SET(), JSON_REPLACE(), and JSON_REMOVE(). If the modification requires more space than the full document, or if the server is unable to generate a partial update, the full document is used instead." The part about "requires more space" should be removed, because the size is not taken into consideration when determining if the binlog should use partial or full format. https://dev.mysql.com/doc/refman/8.0/en/json.html#json-partial-updates - The last two bullets ("All changes replace existing array or object values with new ones, and do not add any new elements to the parent object or array" and "The value being replaced must be at least as large as the replacement value") do not apply to the partial binlog format. They are requirement for doing partial update of the physical column values in the table, but the partial binlog format can be used even if those two requirements are not met.
[10 Jun 2021 4:05]
Jon Stephens
Fixed in mysqldoc rev 69996. Closed.