-
Notifications
You must be signed in to change notification settings - Fork 198
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
close #713
- Loading branch information
Showing
7 changed files
with
142 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# Diff Configuration. | ||
|
||
######################### Global config ######################### | ||
|
||
# how many goroutines are created to check data | ||
check-thread-count = 4 | ||
|
||
# set false if just want compare data by checksum, will skip select data when checksum is not equal. | ||
# set true if want compare all different rows, will slow down the total compare time. | ||
export-fix-sql = true | ||
|
||
# ignore check table's data | ||
check-struct-only = false | ||
|
||
######################### Databases config ######################### | ||
[data-sources] | ||
[data-sources.tidb1] | ||
host = "127.0.0.1" | ||
port = 4001 | ||
user = "root" | ||
password = "" | ||
# remove comment if use tidb's snapshot data | ||
# snapshot = "2016-10-08 16:45:26" | ||
|
||
[data-sources.tidb] | ||
host = "127.0.0.1" | ||
port = 4000 | ||
user = "root" | ||
password = "" | ||
# remove comment if use tidb's snapshot data | ||
# snapshot = "2016-10-08 16:45:26" | ||
|
||
######################### Task config ######################### | ||
[task] | ||
# 1 fix sql: fix-target-TIDB1.sql | ||
# 2 log: sync-diff.log | ||
# 3 summary: summary.txt | ||
# 4 checkpoint: a dir | ||
output-dir = "/tmp/tidb_tools_test/sync_diff_inspector/output" | ||
|
||
source-instances = ["tidb1"] | ||
|
||
target-instance = "tidb" | ||
|
||
# tables need to check. | ||
target-check-tables = ["expression_test.diff"] | ||
|
||
target-configs = ["config1"] | ||
|
||
######################### Table config ######################### | ||
[table-configs.config1] | ||
target-tables = ["test1.v"] | ||
range = "TRUE" | ||
chunk-size = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/sh | ||
|
||
set -ex | ||
|
||
cd "$(dirname "$0")" | ||
OUT_DIR=/tmp/tidb_tools_test/sync_diff_inspector/output | ||
FIX_DIR=/tmp/tidb_tools_test/sync_diff_inspector/fixsql | ||
rm -rf $OUT_DIR | ||
rm -rf $FIX_DIR | ||
mkdir -p $OUT_DIR | ||
mkdir -p $FIX_DIR | ||
|
||
for port in 4000 4001; do | ||
mysql -uroot -h 127.0.0.1 -P $port -e "create database if not exists expression_test;" | ||
mysql -uroot -h 127.0.0.1 -P $port -e "create table expression_test.diff(\`a\`\`;sad\` int, id int);" | ||
mysql -uroot -h 127.0.0.1 -P $port -e "alter table expression_test.diff add index i1((\`a\`\`;sad\` + 1 + \`a\`\`;sad\`));" | ||
mysql -uroot -h 127.0.0.1 -P $port -e "insert into expression_test.diff values (1,1),(2,2),(3,3);" | ||
done | ||
|
||
echo "check result should be pass" | ||
sync_diff_inspector --config=./config.toml > $OUT_DIR/expression_diff.output | ||
check_contains "check pass!!!" $OUT_DIR/sync_diff.log | ||
rm -rf $OUT_DIR/* |