一句话:将查询分区测试预言用于图数据库,实现工具 GDBMeter,发现 40 个新缺陷且无误报。
图数据库管理系统(GDBMS)以图结构存储数据并高效查询节点及关系,但逻辑缺陷会导致查询返回错误结果,且往往难以察觉。本文的核心洞见是:曾用于关系数据库系统的 Query Partitioning 测试预言同样适用于 GDBMS。其思想是将原查询划分为多个子查询,这些子查询的结果组合后应能重建原查询结果;若不一致,则表明存在逻辑缺陷。作者实现了实用工具 GDBMeter,并在三个主流 GDBMS 上评估,共发现 40 个未知缺陷,其中 14 个为逻辑缺陷,其余为错误或崩溃缺陷;27 个已修复,35 个已确认。与基于差分测试的当前最优方法相比,Query Partitioning 未产生误报,并能在已有测试过的 Neo4j 和 JanusGraph 上额外发现 18 个缺陷。
Graph Database Management Systems (GDBMSs) store data as graphs and allow the efficient querying of nodes and their relationships. Logic bugs are bugs that cause a GDBMS to return an incorrect result for a given query (e.g., by returning incorrect nodes or relationships). The impact of such bugs can be severe, as they often go unnoticed. The core insight of this paper is that Query Partitioning, a test oracle that has been proposed to test Relational Database Systems, is applicable to testing GDBMSs as well. The core idea of Query Partitioning is that, given a query, multiple queries are derived whose results can be combined to reconstruct the given query’s result. Any discrepancy in the result indicates a logic bug. We have implemented this approach as a practical tool named GDBMeter and evaluated GDBMeter on three popular GDBMSs and found a total of 40 unique, previously unknown bugs. We consider 14 of them to be logic bugs, the others being error or crash bugs. Overall, 27 of the bugs have been fixed, and 35 confirmed. We compared our approach to the state-of-the-art approach to testing GDBMS, which relies on differential testing; we found that it results in a high number of false alarms, while Query Partitioning reported actual logic bugs without any false alarms. Furthermore, despite the previous efforts in testing Neo4j and JanusGraph, we found 18 additional bugs. The developers appreciate our work and plan to integrate GDBMeter into their testing process. We expect that this simple, yet effective approach and the practical tool will be used to test other GDBMSs.