Building a Whitelist Tool for Testing DM

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 构建测试dm的白名单工具

| username: TiDB_C罗

[TiDB Usage Environment] Production Environment / Testing / Poc
[TiDB Version]
[Reproduction Path] What operations were performed to cause the issue
[Encountered Issue: Problem Phenomenon and Impact]
[Resource Configuration]
I saw several posts in the forum about whitelist issues not meeting expectations and not reporting errors. I also have corresponding needs in my work and have a limited understanding of the rule principles. Although I can set the dm worker’s log level to debug, each test is quite costly. So, I decided to look into the source code and was determined to write a tool to verify whether the whitelist results meet expectations.
As expected, what I thought of has already been implemented by the official team. I found that a small tool can be built from the source code: https://github.com/pingcap/tidb/blob/master/util/table-filter/README.md
However, when downloading, I often get the following error:

github.com/pingcap/tidb/util/table-filter: module github.com/pingcap/tidb@latest found (v2.0.11+incompatible), but does not contain package github.com/pingcap/tidb/util/table-filter

Has anyone used this tool? How do you handle this?

| username: 大飞哥online | Original post link

Haven’t played it :rofl:
Waiting to observe

| username: 天蓝色的小九 | Original post link

I haven’t played it.

| username: 有猫万事足 | Original post link

I tried to compile it. If you directly download this file, the compilation will report this error.

It should be that the version pointed to by the module github.com/pingcap/tidb@latest is too low.

Directly download the source code of tidb, put this test file into the root directory of the source code, and I named this test file tf.go.

Then go to the source code directory and directly go build tf.go.

The running effect is as follows:

22222

This is indeed a relatively simple way to verify the filtering rules, although it has a bit of a threshold. :+1:

| username: TiDB_C罗 | Original post link

I did the same. I put TiDB’s filter and table-filter into DM to run.