Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
Description
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used.
A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with unsafe --no-lock option (MDEV-15636)
So, there are problems which we currently have with backup in presence of Innodb DDL.
- Tables created during backup are not there after prepare (with/without lock-ddl-per-table)
- Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy.
- If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed.
- Tables that are renamed during backup, do not show up after prepare, if rename happens after table was copied.
- Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id.
- Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup"
- Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently.
A possible fix to some of those problems would be to
- Tolerate missing files during innodb copy - missing files can happen when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table.
- At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from parallel CREATE or RENAME.
- We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP.
- Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time. This is be tricky for streaming backup, since xbstream format does not support multiple copies of the same file , and does not have any "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one.
Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. marko, any idea on that?
"ALTER TABLE or OPTIMIZE TABLE was executed during backup" must be taken care by Innodb however.
Attachments
Issue Links
- includes
-
MDEV-12116 Tables created during backup may be missed after restore
-
- Closed
-
-
MDEV-16519 mariabackup --backup fails with concurrent RENAME TABLE
-
- Closed
-
-
MDEV-16762 mariabackup --lock-ddl-per-table can not create backup safely when RENAME TABLE happens many times during the backup stage
-
- Closed
-
- is duplicated by
-
MDEV-19322 mariabackup gets an InnoDB assertion failure
-
- Closed
-
- relates to
-
MDEV-17029 mariabackup fails under load with schema changes
-
- Closed
-
-
MDEV-19768 Mariabackup should write warning during backup if server does not have innodb_log_optimize_ddl=OFF set
-
- Open
-
-
MDEV-15636 mariabackup --lock-ddl-per-table hangs in FLUSH TABLES due to MDL conflict if ALTER TABLE issued
-
- Closed
-
-
MDEV-16809 Allow full redo logging for ALTER TABLE
-
- Closed
-
-
MDEV-17947 mariabackup SST encounters InnoDB tablespace errors during prepare, ignores them, server crashes
-
- Closed
-
-
MDEV-18336 Remove backup_fix_ddl() during backup
-
- Open
-
-
MDEV-19747 Deprecate and ignore innodb_log_optimize_ddl
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Summary | Backup Innodb fails , or is inconsistent, if DDL statements run during backup | mariabackup : allow DDL on Innodb tables, without --lock-ddl-per-table |
Affects Version/s | 10.1 [ 16100 ] | |
Affects Version/s | 10.2 [ 14601 ] | |
Affects Version/s | 10.3 [ 22126 ] |
Affects Version/s | 10.2 [ 14601 ] | |
Affects Version/s | 10.1 [ 16100 ] | |
Affects Version/s | 10.3 [ 22126 ] | |
Issue Type | Bug [ 1 ] | Task [ 3 ] |
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.3 [ 22126 ] |
Description |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only tables that exist at the start of backup are locked. Another one is that it will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements runs, and to resolve the deadlock, we either KILL user's DDL query, or omit FTWRL with *unsafe* --no-lock option ( # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" |
Comment |
[ There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only tables that exist at the start of backup are locked. Another one is that it will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements runs, and to resolve the deadlock, we either KILL user's DDL query, or omit FTWRL with *unsafe* --no-lock option ( # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" ] |
Link |
This issue relates to |
Description |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only tables that exist at the start of backup are locked. Another one is that it will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements runs, and to resolve the deadlock, we either KILL user's DDL query, or omit FTWRL with *unsafe* --no-lock option ( # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only tables that exist at the start of backup are locked. Another one is that it will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements runs, and to resolve the deadlock, we either KILL user's DDL query, or omit FTWRL with *unsafe* --no-lock option ( # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" |
Description |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only tables that exist at the start of backup are locked. Another one is that it will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements runs, and to resolve the deadlock, we either KILL user's DDL query, or omit FTWRL with *unsafe* --no-lock option ( # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. |
Description |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * allow files to be missing during innodb copy (this happens when drop or rename runs in parallel), and allow MDL lock failures. * At the end of backup, under protection of FTWRL (at the stage where frm and MyISAM files are copied). rescan data directory, looking for Innodb tablespaces that are not already in the backup, and copy them . This will pick up new tables, created during backup, or renamed tables. * I think, for the recreated tables, that have changed tablespace ids at the end of backup, we'd might need to copy them to again, at the end of backup. So of the above can be taken care by recovery, but I'm not really sure how this would work. [~marko], any idea on that- "ALTER TABLE or OPTIMIZE TABLE was executed during backup" must be taken care by recovery. |
Description |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * allow files to be missing during innodb copy (this happens when drop or rename runs in parallel), and allow MDL lock failures. * At the end of backup, under protection of FTWRL (at the stage where frm and MyISAM files are copied). rescan data directory, looking for Innodb tablespaces that are not already in the backup, and copy them . This will pick up new tables, created during backup, or renamed tables. * I think, for the recreated tables, that have changed tablespace ids at the end of backup, we'd might need to copy them to again, at the end of backup. So of the above can be taken care by recovery, but I'm not really sure how this would work. [~marko], any idea on that- "ALTER TABLE or OPTIMIZE TABLE was executed during backup" must be taken care by recovery. |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * allow files to be missing during innodb copy - missing files can happens when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from CREATE during backup, or RENAMEd tables. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time at the end of backup. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by recovery however. |
Description |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * allow files to be missing during innodb copy - missing files can happens when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from CREATE during backup, or RENAMEd tables. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time at the end of backup. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by recovery however. |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * allow files to be missing during innodb copy - missing files can happens when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from CREATE during backup, or RENAMEd tables. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time at the end of backup. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by recovery however. |
Description |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was renamed. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * allow files to be missing during innodb copy - missing files can happens when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from CREATE during backup, or RENAMEd tables. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time at the end of backup. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by recovery however. |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was copied. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * allow files to be missing during innodb copy - missing files can happens when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from CREATE during backup, or RENAMEd tables. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time at the end of backup. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by Innodb however. |
Description |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was copied. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * allow files to be missing during innodb copy - missing files can happens when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from CREATE during backup, or RENAMEd tables. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time at the end of backup. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by Innodb however. |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was copied. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * Tolerate missing files during innodb copy - missing files can happen when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table. * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from CREATE during backup, or RENAMEd tables. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time at the end of backup. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by Innodb however. |
Description |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was copied. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * Tolerate missing files during innodb copy - missing files can happen when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table. * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from CREATE during backup, or RENAMEd tables. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time at the end of backup. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by Innodb however. |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was copied. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * Tolerate missing files during innodb copy - missing files can happen when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table. * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from CREATE during backup, or RENAMEd tables. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by Innodb however. |
Summary | mariabackup : allow DDL on Innodb tables, without --lock-ddl-per-table | mariabackup : allow consistent backup, in presence of concurrent DDL, also without --lock-ddl-per-table |
Description |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was copied. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * Tolerate missing files during innodb copy - missing files can happen when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table. * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from CREATE during backup, or RENAMEd tables. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by Innodb however. |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was copied. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * Tolerate missing files during innodb copy - missing files can happen when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table. * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from parallel CREATE or RENAME. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by Innodb however. |
Link |
This issue includes |
Link |
This issue includes |
Link |
This issue includes |
Description |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was copied. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * Tolerate missing files during innodb copy - missing files can happen when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table. * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from parallel CREATE or RENAME. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time. This is be tricky for streaming backup, since xbstream format does not support multiple copies , or "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by Innodb however. |
There is a lot of problems with mariabackup, if DDL statements are executed in parallel to backup.
Some of them show up even if --lock-ddl-per-table is used. A fundamental problem with lock-ddl-per-table is that only those tables, that exist at the start of backup, are MDL-locked. Another problem is that mariabackup will deadlock during backup's "FLUSH TABLE WITH READ LOCKS", if concurrent DDL statements run. To resolve this deadlock, we either KILL user's DDL query, or user has the option to omit FTWRL with *unsafe* --no-lock option ( So, there are problems which we currently have with backup in presence of Innodb DDL. # Tables created during backup are not there after prepare (with/without lock-ddl-per-table) # Tables dropped during backup might show up after prepare (without lock-ddl-per-table), or backup fails if file that was at the start of backup, is not found during copy. # If lock-ddl-per-table is used, acquiring MDL lock will fail, if the table is concurrently being dropped or renamed. # Tables that are renamed during backup, do not show up after prepare, if rename happens after table was copied. # Tables that are recreated (dropped, and created under the same name) during backup,after tablespace copy, break prepare due to different tablespace id. # Backup fails with "ALTER TABLE or OPTIMIZE TABLE was executed during backup" # Concurrent multi-rename is prone to race condition, for example table t1 can be missed from backup, if RENAME TABLE t1 to t2, t3 to t1 runs concurrently. A possible fix to some of those problems would be to * Tolerate missing files during innodb copy - missing files can happen when DROP or RENAME runs in parallel. Also allow MDL lock failures in --lock-ddl-per-table. * At the end of backup, under protection of FTWRL, during the stage when frm and MyISAM files are copied, rescan data directory, looking for Innodb tablespaces, and copy those that are not already in backup. This will pick up tables from parallel CREATE or RENAME. * We might need to remove orphan (frm-less) .ibd files in prepare - there can be some left due to RENAME, or DROP. * Recreated (DROP/CREATE) tablespaces, that have changed tablespace ids at the end of backup. We might need to copy them to backup second time. This is be tricky for streaming backup, since xbstream format does not support multiple copies of the same file , and does not have any "delete" command. One way to workaround it, it to give second copy special extension, e.g "ibd.new" , so that "prepare" would know it can replace old copy with the new one. Maybe some of the above can be taken care by Innodb recovery, I'm not really sure how this would work. [~marko], any idea on that? "ALTER TABLE or OPTIMIZE TABLE was executed during backup" *must* be taken care by Innodb however. |
Link |
This issue relates to |
Attachment | 0001-MDEV-16791-Trace-file-operations-during-backup.patch [ 45935 ] |
Fix Version/s | 10.2.18 [ 23112 ] | |
Fix Version/s | 10.3.10 [ 23140 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Link |
This issue relates to |
Link |
This issue relates to |
Link | This issue relates to MDEV-18336 [ MDEV-18336 ] |
Link |
This issue is duplicated by |
Link |
This issue relates to |
Link | This issue relates to MDEV-19768 [ MDEV-19768 ] |
Workflow | MariaDB v3 [ 88504 ] | MariaDB v4 [ 133632 ] |
Zendesk Related Tickets | 198383 |
I think we should meet the lessened risk from xtrabackup implementation (ie the point and ways where it can fail) and then work to lower risk even more.