github.com/pingcap/tiflow@v0.0.0-20240520035814-5bf52d54e205/tests/integration_tests/mq_sink_lost_callback/run.sh (about) 1 #!/bin/bash 2 3 set -eu 4 5 CUR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) 6 source $CUR/../_utils/test_prepare 7 WORK_DIR=$OUT_DIR/$TEST_NAME 8 CDC_BINARY=cdc.test 9 SINK_TYPE=$1 10 11 CDC_COUNT=3 12 DB_COUNT=4 13 14 function test_mq_sink_lost_callback() { 15 rm -rf $WORK_DIR && mkdir -p $WORK_DIR 16 17 start_tidb_cluster --workdir $WORK_DIR 18 19 run_sql "DROP DATABASE if exists mq_sink_lost_callback;" ${UP_TIDB_HOST} ${UP_TIDB_PORT} 20 run_sql "CREATE DATABASE mq_sink_lost_callback;" ${UP_TIDB_HOST} ${UP_TIDB_PORT} 21 run_sql "CREATE TABLE mq_sink_lost_callback.t (a int not null primary key);" ${UP_TIDB_HOST} ${UP_TIDB_PORT} 22 23 cd $WORK_DIR 24 export GO_FAILPOINTS='github.com/pingcap/tiflow/cdc/sink/dmlsink/mq/MQSinkGetPartitionError=2*return(true)' 25 run_cdc_server --workdir $WORK_DIR --binary $CDC_BINARY --loglevel "info" 26 27 TOPIC_NAME="ticdc-kafka-message-test-$RANDOM" 28 SINK_URI="kafka://127.0.0.1:9092/$TOPIC_NAME?protocol=open-protocol&partition-num=4&kafka-version=${KAFKA_VERSION}&max-message-bytes=12582912" 29 run_cdc_cli changefeed create --sink-uri="$SINK_URI" 30 31 run_sql "INSERT INTO mq_sink_lost_callback.t (a) values (1);" ${UP_TIDB_HOST} ${UP_TIDB_PORT} 32 run_sql "INSERT INTO mq_sink_lost_callback.t (a) values (2);" ${UP_TIDB_HOST} ${UP_TIDB_PORT} 33 run_sql "INSERT INTO mq_sink_lost_callback.t (a) values (3);" ${UP_TIDB_HOST} ${UP_TIDB_PORT} 34 run_sql "INSERT INTO mq_sink_lost_callback.t (a) values (4);" ${UP_TIDB_HOST} ${UP_TIDB_PORT} 35 run_sql "INSERT INTO mq_sink_lost_callback.t (a) values (5);" ${UP_TIDB_HOST} ${UP_TIDB_PORT} 36 37 if [ "$SINK_TYPE" == "kafka" ]; then 38 run_kafka_consumer $WORK_DIR "kafka://127.0.0.1:9092/$TOPIC_NAME?protocol=open-protocol&partition-num=4&version=${KAFKA_VERSION}" 39 fi 40 check_sync_diff $WORK_DIR $CUR/conf/diff_config.toml 41 42 cleanup_process $CDC_BINARY 43 stop_tidb_cluster 44 } 45 46 function run() { 47 # test kafka sink only in this case 48 if [ "$SINK_TYPE" != "kafka" ]; then 49 return 50 fi 51 52 test_mq_sink_lost_callback $* 53 } 54 55 trap stop_tidb_cluster EXIT 56 check_logs $WORK_DIR 57 echo "[$(date)] <<<<<< run test case $TEST_NAME success! >>>>>>"