arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2501.11252cs.SEcs.DBcs.PL
收藏

常量优化驱动的数据库系统测试

Constant Optimization Driven Database System Testing

Chi Zhang, Manuel Rigger

AI总结:

本文提出常量优化驱动的数据库测试(CODDTest),利用常量折叠和传播原理,通过替换谓词中的表达式为常量来检测DBMS逻辑错误,在五个成熟系统中发现45个新错误,其中24个为逻辑错误,11个仅由该方法检测到。

摘要:

逻辑错误是指可能导致数据库管理系统(DBMS)在给定查询时静默产生不正确结果的错误。这类错误非常严重,因为它们很容易被开发者和用户忽视,并且可能导致依赖DBMS的应用程序发生故障。在这项工作中,我们提出了常量优化驱动的数据库测试(CODDTest),作为一种检测DBMS中逻辑错误的新方法。该方法借鉴了编译器中两个著名的优化技术:常量折叠和常量传播。我们的关键洞察是,对于某个数据库状态和包含谓词的查询,我们可以通过将谓词中的表达式替换为常量来对谓词应用常量折叠,预期该谓词的结果保持不变;任何差异都表明DBMS中存在错误。我们在五个成熟且经过广泛测试的DBMS——SQLite、MySQL、CockroachDB、DuckDB和TiDB——上评估了CODDTest,并在其中发现了45个独特的、先前未知的错误。其中,24个是独特的逻辑错误。我们对最先进方法的手动分析表明,有11个逻辑错误只能由CODDTest检测到。我们相信CODDTest易于实现,并且可以在实践中广泛采用。

英文摘要:

Logic bugs are bugs that can cause database management systems (DBMSs) to silently produce incorrect results for given queries. Such bugs are severe, because they can easily be overlooked by both developers and users, and can cause applications that rely on the DBMSs to malfunction. In this work, we propose Constant-Optimization-Driven Database Testing (CODDTest) as a novel approach for detecting logic bugs in DBMSs. This method draws inspiration from two well-known optimizations in compilers: constant folding and constant propagation. Our key insight is that for a certain database state and query containing a predicate, we can apply constant folding on the predicate by replacing an expression in the predicate with a constant, anticipating that the results of this predicate remain unchanged; any discrepancy indicates a bug in the DBMS. We evaluated CODDTest on five mature and extensively-tested DBMSs-SQLite, MySQL, CockroachDB, DuckDB, and TiDB-and found 45 unique, previously unknown bugs in them. Out of these, 24 are unique logic bugs. Our manual analysis of the state-of-the-art approaches indicates that 11 logic bugs are detectable only by CODDTest. We believe that CODDTest is easy to implement, and can be widely adopted in practice.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑