Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lcwangchao committed Jan 29, 2023
1 parent 48c4120 commit 44a5cef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ttl/ttlworker/job_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const taskGCTemplate = `DELETE task FROM
ON task.job_id = job.current_job_id
WHERE job.table_id IS NULL`

const ttlJobHistoryGCTemplate = `DELETE FROM mysql.tidb_ttl_job_history WHERE create_time < CURDATE() - INTERVAL 30 DAY`
const ttlJobHistoryGCTemplate = `DELETE FROM mysql.tidb_ttl_job_history WHERE create_time < CURDATE() - INTERVAL 90 DAY`

const timeFormat = "2006-01-02 15:04:05"

Expand Down
12 changes: 7 additions & 5 deletions ttl/ttlworker/job_manager_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -558,11 +558,13 @@ func TestGCTTLHistory(t *testing.T) {
}

addHistory(1, 1)
addHistory(2, 29)
addHistory(3, 30)
addHistory(4, 31)
addHistory(5, 32)
addHistory(2, 30)
addHistory(3, 60)
addHistory(4, 89)
addHistory(5, 90)
addHistory(6, 91)
addHistory(7, 100)
se := session.NewSession(tk.Session(), tk.Session(), func(_ session.Session) {})
ttlworker.DoGC(context.TODO(), se)
tk.MustQuery("select job_id from mysql.tidb_ttl_job_history order by job_id asc").Check(testkit.Rows("1", "2", "3"))
tk.MustQuery("select job_id from mysql.tidb_ttl_job_history order by job_id asc").Check(testkit.Rows("1", "2", "3", "4", "5"))
}

0 comments on commit 44a5cef

Please sign in to comment.