在线图表更新技术的改进与应用

The Improvement and Application of Online Schema Change

  • 摘要: 针对MySQL数据库在进行数据定义语言(DDL)操作时因锁表动作引起长时间业务阻塞的问题,实现了一种不阻塞读写事务的在线图表更新(OSC)方法。考虑到电商数据库对读写事务的可用性要求,OSC系统将具有原子性的DDL语句拆分成若干步骤,创建临时表分片拷贝全量数据,并利用触发器保证增量数据的一致性,在实现无锁更改表结构的同时,解决了业务长时间阻塞的问题。另外,针对OSC技术在应用场景中遇到的系列问题,提出了相应的改进方法,如预检测、防并发执行等,并结合淘宝实际数据库架构,提供了复杂场景下OSC技术的应用分析。

     

    Abstract: To solve the business blocking problem caused by DDL operation in MySQL database, an online schema change (OSC) method is implemented with non-blocking operation in reading and writing transactions.Considering the availability requirement of the electronic commerce database on the read and write transaction, OSC system divides atomic DDL statements into several successive steps, creates a temporary ghost table to make a copy of all data from the original table fragment by fragment, and adopts triggers to ensure data consistency incrementally, so as to realize schema change with non-lock and solve the problem of business long time blocking.In addition, aiming at solving the problems of the OSC system encountered in practical applications, a series of solutions are presented, such as pre-detection, concurrency execution prevention etc.Moreover, combined with the Taobao‘s database architecture, the analysis on the OSC‘s application in complex business scenarios is provided.

     

/

返回文章
返回