Skip to content

Commit 514883e

Browse files
refactor follower read api
Signed-off-by: marsishandsome <marsishandsome@gmail.com>
1 parent 762153a commit 514883e

File tree

18 files changed

+1286
-113
lines changed

18 files changed

+1286
-113
lines changed

.ci/integration_test.groovy

Lines changed: 78 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ def call(ghprbActualCommit, ghprbPullId, ghprbPullTitle, ghprbPullLink, ghprbPul
33
def TIDB_BRANCH = "release-4.0"
44
def TIKV_BRANCH = "release-4.0"
55
def PD_BRANCH = "release-4.0"
6+
def TIFLASH_BRANCH = "release-4.0"
7+
def TEST_TIFLASH = "true"
68

79
// parse tidb branch
810
def m1 = ghprbCommentBody =~ /tidb\s*=\s*([^\s\\]+)(\s|\\|$)/
@@ -25,6 +27,19 @@ def call(ghprbActualCommit, ghprbPullId, ghprbPullTitle, ghprbPullLink, ghprbPul
2527
}
2628
println "TIKV_BRANCH=${TIKV_BRANCH}"
2729

30+
// parse tiflash branch
31+
def m4 = ghprbCommentBody =~ /tiflash\s*=\s*([^\s\\]+)(\s|\\|$)/
32+
if (m4) {
33+
TIFLASH_BRANCH = "${m4[0][1]}"
34+
}
35+
println "TIFLASH_BRANCH=${TIFLASH_BRANCH}"
36+
37+
// parse test tiflash
38+
def m5 = ghprbCommentBody =~ /test-flash\s*=\s*([^\s\\]+)(\s|\\|$)/
39+
if (m5) {
40+
TEST_TIFLASH = "${m5[0][1]}"
41+
}
42+
2843
catchError {
2944
node ('build') {
3045
container("java") {
@@ -55,21 +70,66 @@ def call(ghprbActualCommit, ghprbPullId, ghprbPullTitle, ghprbPullLink, ghprbPul
5570
def pd_sha1 = sh(returnStdout: true, script: "curl ${FILE_SERVER_URL}/download/refs/pingcap/pd/${PD_BRANCH}/sha1").trim()
5671
sh "curl ${FILE_SERVER_URL}/download/builds/pingcap/pd/${pd_sha1}/centos7/pd-server.tar.gz | tar xz"
5772

73+
// tiflash
74+
if (TEST_TIFLASH != "false") {
75+
def tiflash_sha1 = sh(returnStdout: true, script: "curl ${FILE_SERVER_URL}/download/refs/pingcap/tiflash/${TIFLASH_BRANCH}/sha1").trim()
76+
sh "curl ${FILE_SERVER_URL}/download/builds/pingcap/tiflash/${TIFLASH_BRANCH}/${tiflash_sha1}/centos7/tiflash.tar.gz | tar xz"
77+
sh """
78+
cd tiflash
79+
tar -zcvf flash_cluster_manager.tgz flash_cluster_manager/
80+
rm ./flash_cluster_manager.tgz
81+
cd ..
82+
"""
83+
stash includes: "tiflash/**", name: "tiflash_binary"
84+
}
85+
86+
groovy.lang.Closure isv4 = { branch_name ->
87+
if (branch_name.startsWith("v4") || branch_name.startsWith("release-4") || branch_name == "master") {
88+
return true
89+
}
90+
return false
91+
}
92+
93+
if (isv4(TIDB_BRANCH) || isv4(TIKV_BRANCH) || isv4(PD_BRANCH)) {
94+
sh """
95+
rm /home/jenkins/agent/git/client-java/config/pd.toml
96+
rm /home/jenkins/agent/git/client-java/config/tikv.toml
97+
rm /home/jenkins/agent/git/client-java/config/tidb.toml
98+
99+
mv /home/jenkins/agent/git/client-java/config/pd-4.0.toml /home/jenkins/agent/git/client-java/config/pd.toml
100+
mv /home/jenkins/agent/git/client-java/config/tikv-4.0.toml /home/jenkins/agent/git/client-java/config/tikv.toml
101+
mv /home/jenkins/agent/git/client-java/config/tidb-4.0.toml /home/jenkins/agent/git/client-java/config/tidb.toml
102+
"""
103+
}
104+
58105
sh """
59106
killall -9 tidb-server || true
60107
killall -9 tikv-server || true
61108
killall -9 pd-server || true
109+
killall -9 tiflash || true
62110
killall -9 java || true
63111
sleep 10
64-
bin/pd-server --name=pd --data-dir=pd --config=../.ci/config/pd.toml &>pd.log &
112+
bin/pd-server --name=pd --data-dir=pd --config=../config/pd.toml &>pd.log &
65113
sleep 10
66-
bin/tikv-server --pd=127.0.0.1:2379 -s tikv --addr=0.0.0.0:20160 --advertise-addr=127.0.0.1:20160 --config=../.ci/config/tikv.toml &>tikv.log &
114+
bin/tikv-server --pd=127.0.0.1:2379 -s tikv --addr=0.0.0.0:20160 --advertise-addr=127.0.0.1:20160 --config=../config/tikv.toml &>tikv.log &
67115
sleep 10
68116
ps aux | grep '-server' || true
69117
curl -s 127.0.0.1:2379/pd/api/v1/status || true
70-
bin/tidb-server --store=tikv --path="127.0.0.1:2379" --config=../.ci/config/tidb.toml &>tidb.log &
118+
bin/tidb-server --store=tikv --path="127.0.0.1:2379" --config=../config/tidb.toml &>tidb.log &
71119
sleep 60
72120
"""
121+
122+
if (TEST_TIFLASH != "false") {
123+
sh """
124+
touch tiflash_cmd_line.log
125+
export LD_LIBRARY_PATH=/home/jenkins/agent/git/client-java/_run/tiflash
126+
ls -l \$LD_LIBRARY_PATH
127+
tiflash/tiflash server config --config-file ../config/tiflash.toml &>tiflash_cmd_line.log &
128+
ps aux | grep 'tiflash'
129+
sleep 60
130+
"""
131+
sh "ps aux | grep 'tiflash'"
132+
}
73133
}
74134
}
75135

@@ -87,6 +147,21 @@ def call(ghprbActualCommit, ghprbPullId, ghprbPullTitle, ghprbPullLink, ghprbPul
87147
sh "cat _run/pd.log"
88148
sh "cat _run/tikv.log"
89149
sh "cat _run/tidb.log"
150+
if (TEST_TIFLASH != "false") {
151+
sh """
152+
mkdir -p _run/tiflash/
153+
touch _run/tiflash_cmd_line.log
154+
touch _run/tiflash/tiflash_error.log
155+
touch _run/tiflash/tiflash.log
156+
touch _run/tiflash/tiflash_cluster_manager.log
157+
touch _run/tiflash/tiflash_tikv.log
158+
"""
159+
sh "cat _run/tiflash_cmd_line.log"
160+
sh "cat _run/tiflash/tiflash_error.log"
161+
sh "cat _run/tiflash/tiflash.log"
162+
sh "cat _run/tiflash/tiflash_cluster_manager.log"
163+
sh "cat _run/tiflash/tiflash_tikv.log"
164+
}
90165
throw err
91166
}
92167
}

config/pd-4.0.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[replication]
2+
enable-placement-rules = true
3+
max-replicas = 1

config/pd.toml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# PD Configuration.
2+
3+
name = "pd"
4+
data-dir = "default.pd"
5+
6+
client-urls = "http://127.0.0.1:2379"
7+
# if not set, use ${client-urls}
8+
advertise-client-urls = ""
9+
10+
peer-urls = "http://127.0.0.1:2380"
11+
# if not set, use ${peer-urls}
12+
advertise-peer-urls = ""
13+
14+
initial-cluster = "pd=http://127.0.0.1:2380"
15+
initial-cluster-state = "new"
16+
17+
lease = 3
18+
tso-save-interval = "3s"
19+
20+
[security]
21+
# Path of file that contains list of trusted SSL CAs. if set, following four settings shouldn't be empty
22+
cacert-path = ""
23+
# Path of file that contains X509 certificate in PEM format.
24+
cert-path = ""
25+
# Path of file that contains X509 key in PEM format.
26+
key-path = ""
27+
28+
[log]
29+
level = "info"
30+
31+
# log format, one of json, text, console
32+
#format = "text"
33+
34+
# disable automatic timestamps in output
35+
#disable-timestamp = false
36+
37+
# file logging
38+
[log.file]
39+
#filename = ""
40+
# max log file size in MB
41+
#max-size = 300
42+
# max log file keep days
43+
#max-days = 28
44+
# maximum number of old log files to retain
45+
#max-backups = 7
46+
# rotate log by day
47+
#log-rotate = true
48+
49+
[metric]
50+
# prometheus client push interval, set "0s" to disable prometheus.
51+
interval = "0s"
52+
# prometheus pushgateway address, leaves it empty will disable prometheus.
53+
# address = "pushgateway:9091"
54+
55+
[schedule]
56+
max-snapshot-count = 3
57+
max-pending-peer-count = 16
58+
max-store-down-time = "1h"
59+
leader-schedule-limit = 64
60+
region-schedule-limit = 16
61+
replica-schedule-limit = 24
62+
tolerant-size-ratio = 2.5
63+
64+
# customized schedulers, the format is as below
65+
# if empty, it will use balance-leader, balance-region, hot-region as default
66+
# [[schedule.schedulers]]
67+
# type = "evict-leader"
68+
# args = ["1"]
69+
70+
71+
[replication]
72+
# The number of replicas for each region.
73+
max-replicas = 3
74+
# The label keys specified the location of a store.
75+
# The placement priorities is implied by the order of label keys.
76+
# For example, ["zone", "rack"] means that we should place replicas to
77+
# different zones first, then to different racks if we don't have enough zones.
78+
location-labels = []

config/tidb-4.0.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# TiDB Configuration.
2+
3+
# When create table, split a separated region for it. It is recommended to
4+
# turn off this option if there will be a large number of tables created.
5+
split-table = true
6+
7+
# delay-clean-table-lock is used to control whether delayed-release the table lock in the abnormal situation. (Milliseconds)
8+
delay-clean-table-lock = 60000
9+
10+
# enable-table-lock is used to control table lock feature. Default is false, indicate the table lock feature is disabled.
11+
enable-table-lock = true
12+
13+
# alter-primary-key is used to control alter primary key feature. Default is false, indicate the alter primary key feature is disabled.
14+
# If it is true, we can add the primary key by "alter table", but we may not be able to drop the primary key.
15+
# In order to support "drop primary key" operation , this flag must be true and the table does not have the pkIsHandle flag.
16+
alter-primary-key = true
17+
18+
# index-limit is used to deal with compatibility issues. It can only be in [64, 64*8].
19+
index-limit = 512

0 commit comments

Comments
 (0)