-
Notifications
You must be signed in to change notification settings - Fork 131
add integration test for reparo #416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 6 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
47f7cb0
add test for reparo
8505334
make script executeable
2487cb8
make script executeable
35e413d
minor update
25a3450
minor update
47fe47e
remove useless comment
326917b
Merge branch 'master' into xiang/reparo_test
july2993 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,20 @@ | ||
| #!/bin/sh | ||
|
|
||
| set -ue | ||
|
|
||
| OUT_DIR=/tmp/tidb_binlog_test | ||
|
|
||
| killall reparo || true | ||
|
|
||
|
|
||
| config=${TEST_DIR-.}/reparo.toml | ||
| log=$OUT_DIR/reparo.log | ||
|
|
||
| echo "[$(date)] <<<<<< START IN TEST ${TEST_NAME-} FOR: $config >>>>>>" >> "$log" | ||
|
|
||
| if [ -f "$config" ] | ||
| then | ||
| reparo -config $config -log-file $log >> $log 2>&1 | ||
| else | ||
| reapro -log-file $log >> $log 2>&1 | ||
| fi |
This file contains hidden or 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,41 @@ | ||
| # drainer Configuration. | ||
|
|
||
| # addr (i.e. 'host:port') to listen on for drainer connections | ||
| # will register this addr into etcd | ||
| # addr = "127.0.0.1:8249" | ||
|
|
||
| # the interval time (in seconds) of detect pumps' status | ||
| detect-interval = 10 | ||
|
|
||
| # drainer meta data directory path | ||
| data-dir = "data.drainer" | ||
|
|
||
| # a comma separated list of PD endpoints | ||
| pd-urls = "http://127.0.0.1:2379" | ||
|
|
||
| # syncer Configuration. | ||
| [syncer] | ||
|
|
||
| # disable sync these schema | ||
| ignore-schemas = "INFORMATION_SCHEMA,PERFORMANCE_SCHEMA,mysql" | ||
|
|
||
| # number of binlog events in a transaction batch | ||
| txn-batch = 1 | ||
|
|
||
| # work count to execute binlogs | ||
| worker-count = 1 | ||
|
|
||
| disable-dispatch = false | ||
|
|
||
| # safe mode will split update to delete and insert | ||
| safe-mode = false | ||
|
|
||
| # downstream storage, equal to --dest-db-type | ||
| # valid values are "mysql", "pb", "tidb", "flash", "kafka" | ||
| db-type = "pb" | ||
|
|
||
| #[syncer.to] | ||
| #dir = "/data/data.drainer" | ||
| #compression = "gzip" | ||
|
|
||
|
|
This file contains hidden or 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,28 @@ | ||
| # drainer 输出的 protobuf 格式 binlog 文件的存储路径 | ||
| data-dir = "data.drainer" | ||
|
|
||
| # log-file = "" | ||
| # log-rotate = "hour" | ||
| log-level = "info" | ||
|
|
||
| # start-datetime and stop-datetime enable you to pick a range of binlog to reparo. | ||
| # The datetime format is like '2018-02-28 12:12:12'. | ||
| #start-datetime = "2018-10-24 00:00:00" | ||
| #stop-datetime = "2018-11-26 00:00:00" | ||
|
|
||
| # Start-tso is similar to start-datetime, but in pd-server tso format. e.g. 395181938313123110 | ||
| # Stop-tso is is similar to stop-datetime, but in pd-server tso format. e.g. 395181938313123110 | ||
| # start-tso = 0 | ||
| # stop-tso = 0 | ||
|
|
||
| # dest-type choose a destination, which value can be "mysql", "print". | ||
| # for print, it just prints decoded value. | ||
| dest-type = "mysql" | ||
| #compression = "gzip" | ||
|
|
||
| # 如果指定的 dest-type 为 mysql 或 tidb,需要配置 dest-db。 | ||
| [dest-db] | ||
| host = "127.0.0.1" | ||
| port = 3306 | ||
| user = "root" | ||
| password = "" |
This file contains hidden or 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,31 @@ | ||
| #!/bin/sh | ||
|
|
||
| set -e | ||
|
|
||
| cd "$(dirname "$0")" | ||
|
|
||
| run_drainer & | ||
|
|
||
| run_sql "DROP DATABASE IF EXISTS reparo_test;" | ||
| run_sql "CREATE DATABASE reparo_test" | ||
| run_sql "CREATE TABLE reparo_test.test(id int, name varchar(10), PRIMARY KEY(id))" | ||
|
|
||
| run_sql "INSERT INTO reparo_test.test VALUES(1, 'a'), (2, 'b')" | ||
| run_sql "INSERT INTO reparo_test.test VALUES(3, 'c'), (4, 'd')" | ||
| run_sql "UPDATE reparo_test.test SET name = 'bb' where id = 2" | ||
| run_sql "DELETE FROM reparo_test.test WHERE name = 'bb'" | ||
| run_sql "INSERT INTO reparo_test.test VALUES(5, 'e')" | ||
|
|
||
| sleep 5 | ||
|
|
||
| run_reparo & | ||
|
|
||
| sleep 5 | ||
|
|
||
| down_run_sql "SELECT count(*) FROM reparo_test.test" | ||
| check_contains "count(*): 4" | ||
|
|
||
| # clean up | ||
| run_sql "DROP DATABASE IF EXISTS reparo_test" | ||
|
|
||
| killall drainer |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this will release reparo in tidb binlog's package, pay attention to this