首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >导入TABLESPACE处于“系统锁定”状态

导入TABLESPACE处于“系统锁定”状态
EN

Database Administration用户
提问于 2017-02-22 08:58:02
回答 1查看 962关注 0票数 1

我们有一个带有Percona 5.7.15-9的开发数据库服务器.它使用多源GTID复制从两个不同的生产服务器复制两个模式。让我们将这些模式称为alicebob

在dev服务器上,我们克隆生产数据库的这个副本,以获得用于开发的数据库。它们被称为1_alice1_bob2_alice2_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查询,如何调试这种情况?

EN

回答 1

Database Administration用户

发布于 2019-06-22 10:39:52

我想你的桌子一定很大。最近,当我试图导入700克表时,也遇到了同样的问题。

检查错误日志,我发现导入正在进行阶段1。

代码语言:javascript
运行
复制
InnoDB: Phase I - Update all pages

检查官方文件。https://dev.mysql.com/doc/refman/8.0/en/tablespace-copying.html

当改变桌子..。导入TABLESPACE在目标实例上运行,导入算法对导入的每个表空间执行以下操作:

  • 检查每个表空间页是否损坏。
  • 更新每个页面上的空间ID和日志序列号(LSNs)。
  • 验证标志,并更新标题页的LSN。
  • Btree页面被更新。
  • 将页状态设置为脏,以便将其写入磁盘。

我认为更新每一页的LSN需要很长时间。

检查MySQL工作日志https://dev.mysql.com/worklog/task/?id=5522

代码语言:javascript
运行
复制
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.
}
票数 0
EN
页面原文内容由Database Administration提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://dba.stackexchange.com/questions/165147

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档