我们有一个带有Percona 5.7.15-9的开发数据库服务器.它使用多源GTID复制从两个不同的生产服务器复制两个模式。让我们将这些模式称为alice和bob。
在dev服务器上,我们克隆生产数据库的这个副本,以获得用于开发的数据库。它们被称为1_alice、1_bob、2_alice、2_bob等,它们都使用MySQL的同一个实例。为了快速克隆,我们使用Percona XtraBackup,如下所述:https://www.percona.com/doc/percona-xtrabackup/2.4/innobackupex/restoring_个人_表格_ibk.html
在过去,只有一个副本(alice),我们使用二进制日志位置进行复制,而不是使用GTID。这些时候,一切都运转得很好。有一天(我不知道确切时间)它坏了。
现在,当我执行ALTER TABLE 2_alice.access_group IMPORT TABLESPACE查询时,它会挂起“System”状态。并且可能从1分钟到1小时甚至更长时间处于这种状态(然后它就工作了)。没有更多的活动连接,只有两个副本,但它们不使用2_alice模式。
为什么要挂起IMPORT TABLESPACE查询,如何调试这种情况?
发布于 2019-06-22 10:39:52
我想你的桌子一定很大。最近,当我试图导入700克表时,也遇到了同样的问题。
检查错误日志,我发现导入正在进行阶段1。
InnoDB: Phase I - Update all pages检查官方文件。https://dev.mysql.com/doc/refman/8.0/en/tablespace-copying.html
当改变桌子..。导入TABLESPACE在目标实例上运行,导入算法对导入的每个表空间执行以下操作:
我认为更新每一页的LSN需要很长时间。
检查MySQL工作日志https://dev.mysql.com/worklog/task/?id=5522
Import algorithm
================
We scan the blocks in extents and modify individual blocks rather than using 
logical index structure.
foreach page in tablespace {
  1. Check each page for corruption.
  2. Update the space id and LSN on every page  --I think this is what "InnoDB: Phase I - Update all pages" does
     * For the header page
       - Validate the flags
       - Update the LSN
  3. On Btree pages
     * Set the index id
     * Update the max trx id
     * In a cluster index, update the system columns
     * In a cluster index, update the BLOB ptr, set the space id
     * Purge delete marked records, but only if they can be easily
       removed from the page
     * Keep a counter of number of rows, ie. non-delete-marked rows
     * Keep a counter of number of delete marked rows
     * Keep a counter of number of purge failure
     * If a page is stamped with an index id that isn't in the .cfg file
       we assume it is deleted and the page can be ignored.
     * We can't tell free pages from allocated paes (for now). Therefore
       the assumption is that the free pages are either empty or are logically
       consistent. TODO: Cache the extent bitmap and check free pages.
   4. Set the page state to dirty so that it will be written to disk.
}https://dba.stackexchange.com/questions/165147
复制相似问题