[关键词]
[摘要]
互联网、社交、购物、金融等各类应用直接面临海量用户的高并发访问,传统的单点数据库逐渐成为这些应用系统的瓶颈,而众多互联网应用能够良好运行的主要原因是使用了基于集群环境的数据管理系统作支撑.与传统数据库系统相比,基于集群环境的数据库系统具有更好的扩展性和可用性,而日志复制是保证这些特性的核心组件.传统的主备架构的日志复制在异常情况下对未决事务日志处理不佳,导致数据副本之间存在不一致的风险.另外,分布式系统领域的一致性算法缺乏对事务一致性的处理,而且在选主时存在活锁、多主和频繁选主的问题,无法直接适用于事务日志复制.提出了一种集群环境下的事务日志复制策略和恢复机制,能够有效处理未提交日志,提供了强弱两种读一致性,并且提出一种轻量级的选主算法,可以避免出现以上的选主问题.在开源OceanBase分布式数据库系统中实现了上述机制,并使用基准测试工具对系统进行测试,通过一系列实验验证了系统的扩展性和可用性.
[Key word]
[Abstract]
Many applications such as social networking, online shopping and online finance may receive highly concurrent data access from massive Internet users. In this scenario, traditional single node database systems gradually become the bottleneck of the system, and the main reason for many successful Internet applications is the use of cluster-based data management systems. Compared with traditional database systems, cluster-based distributed database systems have better scalability and availability, and log replication is one of the core components to build these features. Master-slave based log replication cannot handle the uncertain logs while failure occurs, resulting in the risk of inconsistency among different copies. Consensus algorithms cannot be directly applied to the database system due to the lack of transaction consistency model, and they also have issues in leader election with livelock, as well as double master and continuous election problem. This paper introduces a log replication strategy and corresponding recovery technique for cluster environments, which can effectively process the uncertain logs and provide two read consistency options, i.e. strong and weak consistency. A lightweight master election algorithm is also presented to avoid the master election issues. The algorithms are implemented in the OceanBase distributed database system and tested using benchmark tool. Experiments show that the proposed method can improve the scalability and availability.
[中图分类号]
TP311
[基金项目]
国家高技术研究发展计划(863)(2015AA015307);国家自然科学基金(61332006,61432006,61672232);广西可信软件重点实验室研究课题(kx201602)