Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

Commit

Permalink
chore: remove no job in queue log (#1897)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ehco1996 authored Jul 21, 2021
1 parent caad97b commit fadd543
Show file tree
Hide file tree
Showing 8 changed files with 98 additions and 74 deletions.
13 changes: 3 additions & 10 deletions .github/workflows/binlog-999999.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,16 +113,9 @@ jobs:

- name: Feishu notification
if: ${{ failure() }}
uses: whatwewant/[email protected]
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
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/chaos-mesh.yml
Original file line number Diff line number Diff line change
Expand Up @@ -315,16 +315,9 @@ jobs:

- name: Feishu notification
if: ${{ failure() }}
uses: whatwewant/[email protected]
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
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/check-and-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,16 +82,9 @@ jobs:

- name: Feishu notification
if: ${{ failure() }}
uses: whatwewant/[email protected]
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
Expand Down
40 changes: 9 additions & 31 deletions .github/workflows/upgrade-via-tiup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,9 @@ jobs:

- name: Feishu notification
if: ${{ failure() }}
uses: whatwewant/[email protected]
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
Expand Down Expand Up @@ -177,16 +170,9 @@ jobs:

- name: Feishu notification
if: ${{ failure() }}
uses: whatwewant/[email protected]
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
Expand Down Expand Up @@ -249,17 +235,9 @@ jobs:

- name: Feishu notification
if: ${{ failure() }}
uses: whatwewant/[email protected]
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() }}
Expand Down
13 changes: 3 additions & 10 deletions .github/workflows/upstream-switch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,9 @@ jobs:

- name: Feishu notification
if: ${{ failure() }}
uses: whatwewant/[email protected]
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
Expand Down
6 changes: 4 additions & 2 deletions syncer/syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down
72 changes: 72 additions & 0 deletions tests/_utils/send_lark_notify.go
Original file line number Diff line number Diff line change
@@ -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))
}
2 changes: 1 addition & 1 deletion tests/metrics/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fadd543

Please sign in to comment.