CnosDB becomes the first time-series database to support sqllogictest, and its stability and reliability are further upgraded

 

The cloud-native time series database CnosDB introduces the sqllogictest integration framework. By integrating sqllogictest into CnosDB, developers can more easily test and verify the correctness of the database, and can quickly find and solve potential problems.

Recently, CnosDB, a cloud-native time-series database, has incorporated a new PR and introduced the Sqllogictest integration framework. By integrating sqllogictest into CnosDB, developers can more easily test and verify the correctness of the database, and can quickly find and solve potential problems. This new PR is of great significance to CnosDB, providing developers with more efficient and reliable testing tools. CnosDB has also become the first time series database integrated with sqllogictest, and its stability and reliability have been upgraded again.

About sqllogictest:

sqllogictest is an integrated test framework used to verify whether the SQL database engine calculates the correct results. It can execute various SQL queries, including testing the support of basic syntax, functions, operators and data types. sqllogictest only cares about the correctness of the query results, and does not pay attention to the performance of the database, indexes, transactions, concurrency, memory, and disk.

The main function of sqllogictest is to execute SQL queries and compare whether the expected results are consistent with the actual results. The framework can test various SQL queries, such as SELECT statement, INSERT statement, UPDATE statement, DELETE statement, CREATE TABLE statement and so on. sqllogictest can also verify whether the SQL engine supports various data types, operators and functions, and test whether different query statements have the expected effect.

It is worth noting that sqllogictest only focuses on the correctness of query results, without considering the performance or other aspects of the database. This means it does not test aspects such as query execution time, index usage, concurrency performance, or memory management. Therefore, sqllogictest is mainly used to ensure that the SQL engine can calculate the results correctly, not to evaluate the overall performance of the database.

Why CnosDB introduces sqllogictest:

The CnosDB technical team has always been committed to providing users with products with high stability and reliability. In order to achieve this goal, we focus on logical testing of the query engine, which is the top priority for improving stability and reliability. [Extended reading: CnosDB becomes the first cloud-native time-series database that supports SQLancer ] By introducing sqllogictest, the CnosDB team found the following benefits:

First of all, sqllogictest can help regression testing to ensure the stability of CnosDB products. Regression testing refers to checking whether the original function of the software remains intact after modification. When community developers change the code, they need to ensure that new bugs are not introduced as much as possible, and bugs that have been fixed will no longer appear. By using sqllogictest, the CnosDB team can quickly and efficiently test the modified code to ensure the stability of the CnosDB product.

Secondly, sqllogictest can help developers verify the correctness of SQL statements and find logical errors in the database. During the development process, developers often need to write SQL query statements to ensure that the query results are correct. By using sqllogictest, developers can perform logical tests on SQL queries, find potential bugs and problems, and fix them at an early stage.

Third, sqllogictest is very convenient to write integration tests and easy to view. Integration testing refers to testing whether the individual components of the entire system or application are working properly. By using sqllogictest, the CnosDB team can easily write integration tests to ensure that all components of CnosDB can work in harmony to ensure the integrity and consistency of the product.

Fourth, sqllogictest is written in the Rust programming language, which happens to be the same as CnosDB, which contributes to the development of the Rust language ecology. Rust is a fast, safe, and reliable programming language that, along with C++ and C, can be used to write high-performance infrastructure programs. The reason why the CnosDB team wrote CnosDB in Rust is that it provides better performance, security and reliability. [Extended reading: CnosDB Nirvana Rebirth: Abandoning Go, fully embracing Rust ]

Finally, sqllogictest is a mature open source project that can be used and modified freely. There are already many SQL-based databases or frameworks in use, such as DataFusion, and its stability and ease of use have been proven. By using sqllogictest, the CnosDB team can obtain support and help from the open source community to improve product quality and reliability.

Write SQL tests using sqllogictest:

The following describes the specific method of using sqllogictest to write SQL tests. The test file uses .slt as the extension.

  1. Verification statement executed successfully
statement ok
CREATE TABLE foo(a BIGINT, b BIGINT, TAGS(c));

statement ok
INSERT INTO TABLE foo(time, a, b, c) VALUES  (1, 1, 1, '1'), (2, 2, 2, '2') ;

2. Verify that the query statement is successful

query T
SELECT * FROM foo ORDER BY time;
----
1970-01-01T00:00:00.000000001 1 1 1
1970-01-01T00:00:00.000000002 2 2 2

T represents the text of the comparison result set.

3. The execution of the verification statement failed

statement error Database .* forbid drop
DROP DATABASE public;

Among them, error is followed by regular expressions, which are used to match various error messages.

In this way, through simple configuration, you can quickly use sqllogictest to help you check whether SQL has logical errors.

More usage methods can be viewed at https://github.com/cnosdb/cnosdb/tree/main/query_server/sqllogicaltests

https://github.com/risinglightdb/sqllogictest-rs

epilogue

The above is the whole content of CnosDB supporting sqllogictest. The pursuit of stability and reliability is never-ending for the technical team of CnosDB. Friends who love databases and database testing are welcome to pay attention to our WeChat official account, Bilibili video account and join our community. We will update the latest technical trends and technical inside information in time, and look forward to in-depth exchanges with you.

references

GitHub - risinglightdb/sqllogictest-rs: Sqllogictest parser and runner in Rust.

 

Introduction to CnosDB

CnosDB is an open source distributed time series database with high performance and high usability, which has been officially released and fully open sourced.

Welcome to our community website: https://www.cnosdb.com

Guess you like

Origin blog.csdn.net/CnosDB/article/details/130329804