diff --git a/.github/workflows/binlog-999999.yml b/.github/workflows/binlog-999999.yml index fc23e1cb60..e4df4e53ee 100644 --- a/.github/workflows/binlog-999999.yml +++ b/.github/workflows/binlog-999999.yml @@ -113,16 +113,9 @@ jobs: - name: Feishu notification if: ${{ failure() }} - uses: whatwewant/action-robot-feishu@v0.0.10 - with: - url: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} - title: FIX ME - text: | - repository: ${{ github.repository }} - committer: ${{ github.actor }} - compare: ${{ github.event.compare }} - job status: ${{ job.status }} - job url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + env: + FEISHU_BOT_WEBHOOK_URL: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} + run: go run tests/_utils/send_lark_notify.go # Debug via SSH if previous steps failed - name: Set up tmate session diff --git a/.github/workflows/chaos-mesh.yml b/.github/workflows/chaos-mesh.yml index f28b1d1db8..4cf4e723f2 100644 --- a/.github/workflows/chaos-mesh.yml +++ b/.github/workflows/chaos-mesh.yml @@ -315,16 +315,9 @@ jobs: - name: Feishu notification if: ${{ failure() }} - uses: whatwewant/action-robot-feishu@v0.0.10 - with: - url: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} - title: FIX ME - text: | - repository: ${{ github.repository }} - committer: ${{ github.actor }} - compare: ${{ github.event.compare }} - job status: ${{ job.status }} - job url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + env: + FEISHU_BOT_WEBHOOK_URL: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} + run: go run tests/_utils/send_lark_notify.go # Debug via SSH if previous steps failed - name: Set up tmate session diff --git a/.github/workflows/check-and-build.yml b/.github/workflows/check-and-build.yml index cf73cda9ae..874ccb9147 100644 --- a/.github/workflows/check-and-build.yml +++ b/.github/workflows/check-and-build.yml @@ -82,16 +82,9 @@ jobs: - name: Feishu notification if: ${{ failure() }} - uses: whatwewant/action-robot-feishu@v0.0.10 - with: - url: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} - title: FIX ME - text: | - repository: ${{ github.repository }} - committer: ${{ github.actor }} - compare: ${{ github.event.compare }} - job status: ${{ job.status }} - job url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + env: + FEISHU_BOT_WEBHOOK_URL: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} + run: go run tests/_utils/send_lark_notify.go lint: name: Lint diff --git a/.github/workflows/upgrade-via-tiup.yml b/.github/workflows/upgrade-via-tiup.yml index 2ce9d9f0c9..0d61f457f5 100644 --- a/.github/workflows/upgrade-via-tiup.yml +++ b/.github/workflows/upgrade-via-tiup.yml @@ -55,16 +55,9 @@ jobs: - name: Feishu notification if: ${{ failure() }} - uses: whatwewant/action-robot-feishu@v0.0.10 - with: - url: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} - title: FIX ME - text: | - repository: ${{ github.repository }} - committer: ${{ github.actor }} - compare: ${{ github.event.compare }} - job status: ${{ job.status }} - job url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + env: + FEISHU_BOT_WEBHOOK_URL: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} + run: go run tests/_utils/send_lark_notify.go # Debug via SSH if previous steps failed - name: Set up tmate session @@ -177,16 +170,9 @@ jobs: - name: Feishu notification if: ${{ failure() }} - uses: whatwewant/action-robot-feishu@v0.0.10 - with: - url: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} - title: FIX ME - text: | - repository: ${{ github.repository }} - committer: ${{ github.actor }} - compare: ${{ github.event.compare }} - job status: ${{ job.status }} - job url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + env: + FEISHU_BOT_WEBHOOK_URL: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} + run: go run tests/_utils/send_lark_notify.go # Debug via SSH if previous steps failed - name: Set up tmate session @@ -249,17 +235,9 @@ jobs: - name: Feishu notification if: ${{ failure() }} - uses: whatwewant/action-robot-feishu@v0.0.10 - with: - url: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} - title: FIX ME - text: | - repository: ${{ github.repository }} - committer: ${{ github.actor }} - compare: ${{ github.event.compare }} - job status: ${{ job.status }} - job url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} - + env: + FEISHU_BOT_WEBHOOK_URL: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} + run: go run tests/_utils/send_lark_notify.go # Debug via SSH if previous steps failed - name: Set up tmate session if: ${{ failure() }} diff --git a/.github/workflows/upstream-switch.yml b/.github/workflows/upstream-switch.yml index ee7a38c0ad..36bac8f531 100644 --- a/.github/workflows/upstream-switch.yml +++ b/.github/workflows/upstream-switch.yml @@ -77,16 +77,9 @@ jobs: - name: Feishu notification if: ${{ failure() }} - uses: whatwewant/action-robot-feishu@v0.0.10 - with: - url: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} - title: FIX ME - text: | - repository: ${{ github.repository }} - committer: ${{ github.actor }} - compare: ${{ github.event.compare }} - job status: ${{ job.status }} - job url: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}} + env: + FEISHU_BOT_WEBHOOK_URL: ${{ secrets.FEISHU_BOT_WEBHOOK_URL }} + run: go run tests/_utils/send_lark_notify.go # Debug via SSH if previous steps failed - name: Set up tmate session diff --git a/syncer/syncer.go b/syncer/syncer.go index 72004ceb3e..e86d332591 100644 --- a/syncer/syncer.go +++ b/syncer/syncer.go @@ -1348,9 +1348,11 @@ func (s *Syncer) syncDML( successF() clearF() } else { + failpoint.Inject("noJobInQueueLog", func() { + tctx.L().Debug("no job in queue, update lag to zero", zap.String( + "workerLagKey", workerLagKey), zap.Int64("current ts", time.Now().Unix())) + }) // update lag metric even if there is no job in the queue - tctx.L().Debug("no job in queue, update lag to zero", - zap.String("workerLagKey", workerLagKey), zap.Int64("current ts", time.Now().Unix())) s.updateReplicationLag(nil, workerLagKey) } } diff --git a/tests/_utils/send_lark_notify.go b/tests/_utils/send_lark_notify.go new file mode 100644 index 0000000000..dcb9bea570 --- /dev/null +++ b/tests/_utils/send_lark_notify.go @@ -0,0 +1,72 @@ +package main + +import ( + "bytes" + "fmt" + "io/ioutil" + "net/http" + "os" +) + +func main() { + url := os.Getenv("FEISHU_BOT_WEBHOOK_URL") + repo := os.Getenv("GITHUB_REPOSITORY") + committer := os.Getenv("GITHUB_ACTOR") + jobID := os.Getenv("GITHUB_RUN_ID") + jobURL := fmt.Sprintf("https://github.com/%s/actions/runs/%s", repo, jobID) + msgTMPL := ` + { + "msg_type": "post", + "content": { + "post": { + "zh_cn": { + "title": "FIX ME", + "content": [ + [ + { + "tag": "text", + "text": "repo :" + }, + { + "tag": "text", + "text": "%s" + } + ], + [ + { + "tag": "text", + "text": "committer :" + }, + { + "tag": "text", + "text": "%s" + } + ], + [ + { + "tag": "text", + "text": "url :" + }, + { + "tag": "a", + "text": "link", + "href": "%s" + } + ] + ] + } + } + } + }` + jsonStr := fmt.Sprintf(msgTMPL, repo, committer, jobURL) + req, err := http.NewRequest("POST", url, bytes.NewBuffer([]byte(jsonStr))) + req.Header.Set("Content-Type", "application/json") + client := &http.Client{} + resp, err := client.Do(req) + if err != nil { + panic(err) + } + defer resp.Body.Close() + body, _ := ioutil.ReadAll(resp.Body) + fmt.Println("response Body:", string(body)) +} diff --git a/tests/metrics/run.sh b/tests/metrics/run.sh index 47d1c61659..a99dd86416 100755 --- a/tests/metrics/run.sh +++ b/tests/metrics/run.sh @@ -90,7 +90,7 @@ function run() { echo "check zero job done!" kill_dm_worker - export GO_FAILPOINTS="github.com/pingcap/dm/syncer/changeTickerInterval=return(5)" + export GO_FAILPOINTS="github.com/pingcap/dm/syncer/changeTickerInterval=return(5);github.com/pingcap/dm/syncer/noJobInQueueLog=return(true)" # First set the ticker interval to 5s -> expect the execSQL interval to be greater than 5s # At 5s, the first no job log will appear in the log # At 6s, the ticker has already waited 1s and the ticker goes to 1/5th of the way