MySQL5.6 create table原理分析
MySQL5.6之前的版本DDL是非原子的。也就是說對於複合的DDL,比如DROP TABLE t1, t2;執行過程中如果遇到server crash,有可能出現表t1被DROP掉了,但是t2沒有被DROP掉的情況。即便是一條DDL,比如CREATE TABLE t1(a int);也可能在server crash的情況下導致建表不完整,有可能在建表失敗的情況下遺留.frm或者.ibd檔案。
從原理流程圖中可以看出,create table先建立.frm檔案,再呼叫ha_create_table建立ibd檔案,如果建立成功則退出,否則將之前建立的frm檔案刪除。但是這裡就有問題了,如果建立完frm檔案後,server掛了,那麼frm檔案是建立成功了,但是ibd檔案沒有建立。這就是DDL非原子性導致的後果。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31493717/viewspace-2154424/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- create table of mysql databaseMySqlDatabase
- create a partition table using a exsit table
- Oracle Create Table as SelectOracle
- create table if not exists Waiting for table metadata lockAI
- sqlserver不能直接create table as select ......SQLServer
- create table進階學習(一)
- create table進階學習(三)
- create table進階學習(四)
- MySQL5.6複製原理圖MySql
- MySQL的create table as 與 like區別MySql
- VBA從Excel中生成Oracle create tableExcelOracle
- create table進階學習系列(八)
- create table進階學習系列(五)
- create table進階學習系列(七)
- create table進階學習系列(九)
- CREATE TABLE AS SELECT(CAST)(二)-ConceptAST
- use azure data studio to create external table for oracleOracle
- create table之storage選項initial和其它
- T-SQL的CREATE TABLE語法(下)SQL
- T-SQL的CREATE TABLE語法(上)SQL
- create table進階學習(二)_全域性臨時表_global temporary table
- oracle 19c 無法create table解決Oracle
- How to Quickly Create a Copy of a Table using Transact-SQLUISQL
- dual表與create table語句的關係
- CREATE TABLE AS SELECT(CAST)(一)-ORA-1652AST
- NOARCHIVE模式CREATE TABLE不記錄日誌呀Hive模式
- create table進階學習系列(十一)之cluster
- mysql5.6在匯入時報innodb_table_stats不存在MySql
- oracle10.2.0.4_create table_constraint_indexOracleAIIndex
- CREATE INDEX index1 ON table1(col1)Index
- ORA-39117: Type needed to create table is not included in this operation
- 資料庫審計(create/alter/drop table、user、tablespace)資料庫
- mysql5.6新特性GTID基本原理MySql
- [Oracle] Create table as 速度測試nologging+parallelOracleParallel
- ORACLE的Copy命令和create table,insert into的比較Oracle
- alter database ... create datafile的原理及用途Database
- CREATE INDEX ......ONLINE分析Index
- insert into select 與 create table as的用法和區別(轉)