-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ping Yu <yuping@pingcap.com>
- Loading branch information
Showing
7 changed files
with
147 additions
and
6 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
# parameter 1: work directory | ||
# parameter 2: dst pd | ||
# parameter 3: total kvs | ||
# parameter 4: max check times | ||
|
||
CUR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
TLS_DIR=$(cd $CUR/../_certificates && pwd) | ||
|
||
workdir=$1 | ||
DOWN_PD=$2 | ||
TOTAL_KVS=$3 | ||
if [ $# -ge 4 ]; then | ||
check_time=$4 | ||
else | ||
check_time=50 | ||
fi | ||
PWD=$(pwd) | ||
|
||
if ! command -v rawkv_data &>/dev/null; then | ||
cd $CUR/../../.. | ||
make rawkv_data | ||
cd $PWD | ||
fi | ||
set +e | ||
|
||
cd $workdir | ||
i=0 | ||
while [ $i -lt $check_time ]; do | ||
rm -rf $workdir/rawkv_data/ | ||
rawkv_data totalkvs --dst-pd $DOWN_PD --count $TOTAL_KVS --ca-path=$TLS_DIR/ca.pem --cert-path=$TLS_DIR/client.pem --key-path=$TLS_DIR/client-key.pem | ||
ret=$? | ||
if [ "$ret" == 0 ]; then | ||
echo "check total-kvs successfully" | ||
break | ||
fi | ||
((i++)) | ||
echo "check total-kvs failed $i-th time, retry later" | ||
sleep 3 | ||
done | ||
|
||
if [ $i -ge $check_time ]; then | ||
echo "check total-kvs failed at last" | ||
exit 1 | ||
fi | ||
|
||
cd $PWD |
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,2 @@ | ||
[filter] | ||
key-pattern = "indexInfo_:_pf01_:_APD0101_:_0{15}[3-9]" |
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,49 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
CUR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) | ||
source $CUR/../_utils/test_prepare | ||
WORK_DIR=$OUT_DIR/$TEST_NAME | ||
CDC_BINARY=tikv-cdc.test | ||
SINK_TYPE=$1 | ||
UP_PD=http://$UP_PD_HOST_1:$UP_PD_PORT_1 | ||
DOWN_PD=http://$DOWN_PD_HOST:$DOWN_PD_PORT | ||
|
||
function run() { | ||
rm -rf $WORK_DIR && mkdir -p $WORK_DIR | ||
start_tidb_cluster --workdir $WORK_DIR | ||
cd $WORK_DIR | ||
|
||
start_ts=$(get_start_ts $UP_PD) | ||
run_cdc_server --workdir $WORK_DIR --binary $CDC_BINARY | ||
|
||
case $SINK_TYPE in | ||
tikv) SINK_URI="tikv://${DOWN_PD_HOST}:${DOWN_PD_PORT}" ;; | ||
*) SINK_URI="" ;; | ||
esac | ||
|
||
uuid="custom-changefeed-name" | ||
tikv-cdc cli changefeed create \ | ||
--start-ts=$start_ts \ | ||
--sink-uri="$SINK_URI" \ | ||
--changefeed-id="$uuid" \ | ||
--config $CUR/conf/changefeed.toml | ||
|
||
rawkv_op $UP_PD put 5000 | ||
|
||
# Filter configured in $CUR/conf/changefeed.toml will filter events with key >= 3000 | ||
# So wait for sync finished, pause changefeed, delete keys < 3000 for upstream, then check_sync_diff | ||
sleep 1 && check_total_kvs $WORK_DIR $DOWN_PD 2000 | ||
run_cdc_cli changefeed --changefeed-id $uuid pause | ||
rawkv_op $UP_PD delete 3000 | ||
|
||
check_sync_diff $WORK_DIR $UP_PD $DOWN_PD | ||
|
||
cleanup_process $CDC_BINARY | ||
} | ||
|
||
trap stop_tidb_cluster EXIT | ||
run $* | ||
check_logs $WORK_DIR | ||
echo "[$(date)] <<<<<< run test case $TEST_NAME success! >>>>>>" |
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