dm: fix binlog 999999 test #7904
Workflow file for this run
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
name: DM Binlog 999999 | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
schedule: | |
- cron: '0 17-23 * * *' # run at minute 0 every hour from 01:00 ~ 07:00 UTC+8 | |
workflow_dispatch: | |
inputs: | |
pr: | |
description: 'Which PR do you want to trigger' | |
required: true | |
default: '' | |
jobs: | |
test-binlog-999999: | |
name: Test binlog 999999 | |
runs-on: ubuntu-20.04 | |
services: | |
docker: | |
image: docker:19.03.12 | |
options: >- | |
--privileged | |
steps: | |
- name: Set up Go env | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '1.23' | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Check out code by workflow dispatch | |
if: ${{ github.event.inputs.pr != '' }} | |
uses: actions/checkout@v2 | |
with: | |
ref: refs/pull/${{ github.event.inputs.pr }}/head | |
- name: Set DOCKER_HOST | |
run: echo "export DOCKER_HOST=unix:///var/run/docker.sock" >> $GITHUB_ENV | |
- name: Install docker-compose | |
run: | | |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | |
sudo chmod +x /usr/local/bin/docker-compose | |
- name: Cache go modules | |
uses: actions/cache@v2 | |
with: | |
path: ~/go/pkg/mod | |
key: ${{ runner.os }}-ticdc-${{ hashFiles('go.sum') }} | |
- name: Cache Tools | |
id: cache-tools | |
uses: actions/cache@v2 | |
with: | |
path: tools/bin | |
key: ${{ runner.os }}-ticdc-tools-${{ hashFiles('tools/check/go.sum') }} | |
- name: Build DM binary | |
run: make dm_integration_test_build | |
- name: Setup CI environment | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y curl | |
sudo docker-compose -f ./dm/tests/binlog_999999/docker-compose.yml up -d | |
curl http://download.pingcap.org/tidb-enterprise-tools-nightly-linux-amd64.tar.gz | tar xz | |
mv tidb-enterprise-tools-nightly-linux-amd64/bin/sync_diff_inspector bin/ | |
curl http://download.pingcap.org/tidb-nightly-linux-amd64.tar.gz | tar xz | |
mv tidb-nightly-linux-amd64/bin/tidb-server bin/ | |
curl -O https://dl.min.io/server/minio/release/linux-amd64/minio | |
chmod +x minio | |
mv minio bin/ | |
- name: Change binlog sequence number to 999998 | |
run: | | |
while ! mysqladmin -h127.0.0.1 -P3306 -p123456 -uroot ping --connect-timeout=1 > /dev/null 2>&1 ; do | |
echo "wait mysql" | |
sleep 1 | |
done | |
while ! mysqladmin -h127.0.0.1 -P3307 -p123456 -uroot ping --connect-timeout=1 > /dev/null 2>&1 ; do | |
echo "wait mysql" | |
sleep 1 | |
done | |
echo "reset master;" | mysql -uroot -h127.0.0.1 -P3306 -p123456 | |
echo "reset master;" | mysql -uroot -h127.0.0.1 -P3307 -p123456 | |
docker-compose -f ./dm/tests/binlog_999999/docker-compose.yml down | |
sudo mv /tmp/mysql1-data/mysql-bin.000001 /tmp/mysql1-data/mysql-bin.999998 | |
sudo bash -c "echo './mysql-bin.999998' > /tmp/mysql1-data/mysql-bin.index" | |
sudo mv /tmp/mysql2-data/mysql-bin.000001 /tmp/mysql2-data/mysql-bin.999998 | |
sudo bash -c "echo './mysql-bin.999998' > /tmp/mysql2-data/mysql-bin.index" | |
docker-compose -f ./dm/tests/binlog_999999/docker-compose.yml up -d | |
while ! mysqladmin -h127.0.0.1 -P3306 -p123456 -uroot ping --connect-timeout=1 > /dev/null 2>&1 ; do | |
echo "wait mysql" | |
sleep 1 | |
done | |
while ! mysqladmin -h127.0.0.1 -P3307 -p123456 -uroot ping --connect-timeout=1 > /dev/null 2>&1 ; do | |
echo "wait mysql" | |
sleep 1 | |
done | |
- name: Run test cases | |
run: | | |
RESET_MASTER=false make dm_integration_test CASE=incremental_mode | |
echo "show binary logs;" | mysql -uroot -h127.0.0.1 -P3306 -p123456 | grep -q "mysql-bin.1000000" | |
echo "show binary logs;" | mysql -uroot -h127.0.0.1 -P3307 -p123456 | grep -q "mysql-bin.1000000" | |
- name: Copy logs to hack permission | |
if: ${{ always() }} | |
run: | | |
mkdir ./logs | |
sudo cp -r -L /tmp/dm_test/incremental_mode/master/log ./logs/master | |
sudo cp -r -L /tmp/dm_test/incremental_mode/worker1/log ./logs/worker1 | |
sudo cp -r -L /tmp/dm_test/incremental_mode/worker2/log ./logs/worker2 | |
sudo chown -R runner ./logs | |
# Update logs as artifact seems not stable, so we set `continue-on-error: true` here. | |
- name: Upload logs | |
continue-on-error: true | |
uses: actions/upload-artifact@v4 | |
if: ${{ always() }} | |
with: | |
name: test-binlog-999999 | |
path: | | |
./logs | |
# Send Slack notification if failed. | |
# NOTE: With the exception of `GITHUB_TOKEN`, secrets are not passed to the runner when a workflow is triggered from a forked repository. | |
- name: Slack notification | |
if: ${{ failure() }} | |
env: | |
SLACK_WEBHOOK: ${{ secrets.SLACK_NOTIFY }} | |
uses: Ilshidur/[email protected] | |
with: | |
args: "binlog 999999 failed, see https://github.com/pingcap/tiflow/actions/runs/{{ GITHUB_RUN_ID }}" |