forked from pingcap/tidb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support table filter (black-white-list) (pingcap#84)
* vendor: added pingcap/tidb-enterprise-tools/pkg/filter * mydumper: accept black-white-list filtering
- Loading branch information
Showing
20 changed files
with
609 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
create database firstdb; |
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 @@ | ||
create table `first` (id int primary key); |
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 @@ | ||
insert into `first` values (8273); |
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 @@ | ||
insert into `first` values (6855); |
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 @@ | ||
create table `second` (id int primary key); |
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 @@ | ||
create table `second` values (909); |
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 @@ | ||
create database seconddb; |
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 @@ | ||
create table `fourth` (id int primary key); |
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 @@ | ||
insert into `fourth` values (3256), (5457); |
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 @@ | ||
create table `third` (id int primary key); |
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 @@ | ||
insert into `third` values (6339); |
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,35 @@ | ||
[lightning] | ||
check-requirements = false | ||
file = "/tmp/lightning_test_result/lightning.log" | ||
level = "info" | ||
|
||
[[black-white-list.ignore-tables]] | ||
db-name = "firstdb" | ||
tbl-name = "~." | ||
|
||
[[black-white-list.do-tables]] | ||
db-name = "~." | ||
tbl-name = "second" | ||
|
||
[[black-white-list.do-tables]] | ||
db-name = "seconddb" | ||
tbl-name = "fourth" | ||
|
||
[tikv-importer] | ||
addr = "127.0.0.1:8808" | ||
|
||
[mydumper] | ||
data-source-dir = "tests/black-white-list/data" | ||
|
||
[tidb] | ||
host = "127.0.0.1" | ||
port = 4000 | ||
user = "root" | ||
status-port = 10080 | ||
pd-addr = "127.0.0.1:2379" | ||
log-level = "error" | ||
|
||
[post-restore] | ||
checksum = true | ||
compact = false | ||
analyze = false |
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,26 @@ | ||
[lightning] | ||
check-requirements = false | ||
file = "/tmp/lightning_test_result/lightning.log" | ||
level = "info" | ||
|
||
[black-white-list] | ||
do-dbs = ["~^f"] | ||
|
||
[tikv-importer] | ||
addr = "127.0.0.1:8808" | ||
|
||
[mydumper] | ||
data-source-dir = "tests/black-white-list/data" | ||
|
||
[tidb] | ||
host = "127.0.0.1" | ||
port = 4000 | ||
user = "root" | ||
status-port = 10080 | ||
pd-addr = "127.0.0.1:2379" | ||
log-level = "error" | ||
|
||
[post-restore] | ||
checksum = true | ||
compact = false | ||
analyze = false |
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,28 @@ | ||
#!/bin/sh | ||
|
||
# Check if black-white-list works. | ||
|
||
set -eux | ||
|
||
run_sql 'DROP DATABASE IF EXISTS firstdb;' | ||
run_sql 'DROP DATABASE IF EXISTS seconddb;' | ||
run_lightning 'firstdb-only' | ||
run_sql 'SHOW DATABASES;' | ||
check_contains 'Database: firstdb' | ||
check_not_contains 'Database: seconddb' | ||
run_sql 'SHOW TABLES IN firstdb;' | ||
check_contains 'Tables_in_firstdb: first' | ||
check_contains 'Tables_in_firstdb: second' | ||
|
||
run_sql 'DROP DATABASE IF EXISTS firstdb;' | ||
run_sql 'DROP DATABASE IF EXISTS seconddb;' | ||
run_lightning 'even-table-only' | ||
run_sql 'SHOW DATABASES;' | ||
check_contains 'Database: firstdb' | ||
check_contains 'Database: seconddb' | ||
run_sql 'SHOW TABLES IN firstdb;' | ||
check_not_contains 'Tables_in_firstdb: first' | ||
check_contains 'Tables_in_firstdb: second' | ||
run_sql 'SHOW TABLES IN seconddb;' | ||
check_not_contains 'Tables_in_seconddb: third' | ||
check_contains 'Tables_in_seconddb: fourth' |
Oops, something went wrong.