Bug #80347 | mysqldump backup restore fails due to invalid FTS_DOC_ID (Error 182 and 1030) | ||
---|---|---|---|
Submitted: | 12 Feb 2016 5:02 | Modified: | 8 Nov 2016 13:39 |
Reporter: | Emanuel Calvo (OCA) | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: FULLTEXT search | Severity: | S2 (Serious) |
Version: | 5.7.9, 5.7.11 | OS: | Any |
Assigned to: | CPU Architecture: | Any | |
Tags: | mysqldump |
[12 Feb 2016 5:02]
Emanuel Calvo
[12 Feb 2016 7:28]
MySQL Verification Team
Hello Emanuel, Thank you for the report and test case. Observed this with 5.7.11 build. Thanks, Umesh
[13 Feb 2016 22:35]
Emanuel Calvo
Hi Umesh, I dug a little bit on the bug and traced what's causing this error. The error happens at innobase/row/row0mysql.cc, when checking the difference. The problem looks like that mysqldump does not consider smaller chunks of inserts when backuping FTS_DOC_ID columns. 2016-02-13T22:11:53.125300Z 19 [ERROR] InnoDB: Doc ID 10002 is too big. Its difference with largest used Doc ID 1 cannot exceed or equal to 10000 Regards,
[13 Feb 2016 22:37]
Emanuel Calvo
From the code at innobase/row/row0mysql.cc is clear: /* Difference between Doc IDs are restricted within 4 bytes integer. See fts_get_encoded_len() */
[12 Oct 2016 16:43]
Emanuel Calvo
Just to confirm this is actually a serious issue, as it does not allow to restore backups using FTS_DOC_ID. Backups are useless for tables using explicit FTS_DOC_ID and with more than 4 bytes integer (rows>9999 if id is sequentially assigned). mysqldump should detect if FTS_DOC_ID is explicit and dump in smaller batches in order to do not overflow the permitted difference limitation imposed per fts_get_encoded_len() (innobase/row/row0mysql.cc).
[1 Nov 2016 2:44]
Brett Gardner
Smaller batches may not necessarily improve things. eg 1. Inserts record which receives FTS_DOC_ID = 100 2. 100,000 inserts are recorded 3. Records with id 101 -> 80000 are then deleted 4. Attempting to load a backup from mysqldump will fail as the gap between record with id 100 and 80001 is more than the allowed gap
[1 Nov 2016 13:01]
Emanuel Calvo
Brett, is expected to have this error if using mysqldump as the split needs to be done at backup time. You can try mydumper/myloader using the queries-per-transaction =< 999. It is a partial workaround, but it should work.
[8 Nov 2016 4:37]
Brett Gardner
I'm confused re your last statement. Isn't it illegal to load the following data FTS_DOC_ID, TextContent 1,"Some content" 100000,"Some other content" as there would be a gap of more than 65,535, regardless of how you attempt to load it? Or do you need to ensure that on reload that the FTS_DOC_ID's are reset, in which case they cannot be used as foreign keys in any other table? This situation is allowed to occur during the initial incremental load / deletion as the rows with the interim values still exist, but are marked as deleted so do not appear in any query results.
[8 Nov 2016 13:39]
Emanuel Calvo
Hi Brett, as specified, the difference between Doc IDs are restricted within 4 bytes integer PER TRANSACTION (the uppercase is not explicit, that's why I added it). You don't need to change the FTS_DOC_ID, although it is a limitation when inserting FTS rows. Regards,