Skip to content

yibin87/copr-test

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

89 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Coprocessor Tests

Copr-test is a collection of integration tests for the Coprocessor module of TiKV. Coprocessor executes TiDB push-down executors to improve performance.

Push Down Test

./push-down-test

Currently we only have push-down-test to test the Coprocessor module. Push-down-test exists to make sure that execution results are consistent between TiDB and Coprocessor. It works by executeing test cases on a standalone TiDB (with mocktikv) and on a TiDB cluster (with TiKV Coprocessor) and comparing the two execution results.

Currently TiKV Coprocessor supports two execution models, the non-vectorized, traditional model and the newer vectorized model. Requests that cannot be processed by the vectorized model will fallback to the traditional model. Thus push-down-test also makes sure that the two execution model produce same results, by comparing the following three combinations:

  • TiDB
  • TiDB + TiKV (Non-Vectorized)
  • TiDB + TiKV (Vectorized)

Function Whitelist

The Coprocessor module does not support all functions of TiDB (and some are implemented but not fully tested), so that TiDB whitelists the functions that can be pushed down to TiKV Coprocessor. In push-down-test however, we use failpoint to control the whitelist. The whitelist can be found in push-down-test/functions.txt in this repository. This means that you can test whether or not a specific TiKV Coprocessor function implementation produces identical results to TiDB by adding the function name into the push-down-test/functions.txt file, instead of modifying TiDB's source code. This is extremely useful when we only want to add an implementation at TiKV side but not enabling the push down at TiDB side for now.

Test Cases

We have already added some test cases generated by randgen in the push-down-test. Feel free to add new ones. Your test case should be placed in the push-down-test/sql directory and ends with .sql suffix. Subdirectories are also supported.

Run Tests Locally

Push-down-test will be run on our CI platform for TiKV PR automatically. You can also run it locally in order to debug easier. Before that, make sure that you have set up an environment to successfully build TiDB, PD and TiKV.

Sample step:

mkdir my_workspace
cd my_workspace

git clone --depth=1 https://github.com/pingcap/pd.git
git clone --depth=1 https://github.com/pingcap/tidb.git
git clone --depth=1 https://github.com/tikv/tikv.git
git clone https://github.com/tikv/copr-test.git

cd pd
make

cd ../tikv
make build  # This make take a while. Be patient.

cd ../copr-test
export pd_bin=`realpath ../pd/bin/pd-server`
export tikv_bin=`realpath ../tikv/target/debug/tikv-server`
export tidb_src_dir=`realpath ../tidb`
# Run all tests
make push-down-test

# You can run other target like `push-down-without-vec`
# which will start a `mysql` client to run `push-down-without-vec` only.
# You can reproduce failed SQL more conveniently
make push-down-without-vec

# If you want to clean the `push-down-test/build` directory and kill all the tidb/pd/tikv processes, run:
make clean

If you want to filter some test cases:

include=1_arith_1.sql make push-down-test
exclude=1_arith_1.sql make push-down-test

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 51.5%
  • Shell 46.9%
  • Makefile 1.6%