操作③中的flush table ... for export会给test.tts表加上共享锁,并将purge coordinator thread(在并行复制中类似sql thread)停止,并且将脏页强制同步到磁盘,创建并将test.tts表的元数据写入.cfg文件;
FLUSH TABLES ... FOR EXPORT在error log中体现了这个过程:
[Note] InnoDB: Sync to disk of '"test"."tts"' started.
[Note] InnoDB: Stopping purge
[Note] InnoDB: Writing table metadata to './test/tts.cfg'
[Note] InnoDB: Table '"test"."tts"' flushed to disk
操作⑤执行unlock tables将③中的锁解除,此时.cfg文件被删掉,purge coordinator thread也会重新启动;(在做flush table ... for export时不能关闭session,避免锁释放造成.cfg文件删除)
UNLOCK TABLES在error log中记录为:
[Note] InnoDB: Deleting the meta-data file './test/tts.cfg'
[Note] InnoDB: Resuming purge
操作⑦则是通过import tablespace操作,将从vm1上传输过来的.ibd文件和导入到tts表中,此时.cfg文件也必须存在;
ALTER TABLE ... IMPORT TABLESPACE在error log中记录为:
[Note] InnoDB: Importing tablespace for table 'test/tts' that was exported from host 'vm01'
[Note] InnoDB: Phase I - Update all pages
[Note] InnoDB: Sync to disk
[Note] InnoDB: Sync to disk - done!
[Note] InnoDB: Phase III - Flush changes to disk
[Note] InnoDB: Phase IV - Flush complete
[Note] InnoDB: "test"."tts" autoinc value set to 786406
MySQL Transportable Tablespace(传输表空间) 使用详解
内容版权声明:除非注明,否则皆为本站原创文章。
转载注明出处:https://www.heiqu.com/f6d9c9e50f5dc03141d670f75459c7c2.html