InsertIntoTTLTask returns an SQL statement to insert a ttl task into mysql.tidb_ttl_task
(sctx sessionctx.Context, jobID string, tableID int64, scanID int, scanRangeStart []types.Datum, scanRangeEnd []types.Datum, expireTime time.Time, createdTime time.Time)
| 67 | |
| 68 | // InsertIntoTTLTask returns an SQL statement to insert a ttl task into mysql.tidb_ttl_task |
| 69 | func InsertIntoTTLTask(sctx sessionctx.Context, jobID string, tableID int64, scanID int, scanRangeStart []types.Datum, |
| 70 | scanRangeEnd []types.Datum, expireTime time.Time, createdTime time.Time) (string, []any, error) { |
| 71 | rangeStart, err := codec.EncodeKey(sctx.GetSessionVars().StmtCtx.TimeZone(), []byte{}, scanRangeStart...) |
| 72 | if err != nil { |
| 73 | return "", nil, err |
| 74 | } |
| 75 | rangeEnd, err := codec.EncodeKey(sctx.GetSessionVars().StmtCtx.TimeZone(), []byte{}, scanRangeEnd...) |
| 76 | if err != nil { |
| 77 | return "", nil, err |
| 78 | } |
| 79 | return insertIntoTTLTask, []any{jobID, tableID, int64(scanID), |
| 80 | rangeStart, rangeEnd, expireTime, createdTime}, nil |
| 81 | } |
| 82 | |
| 83 | // TaskStatus represents the current status of a task |
| 84 | type TaskStatus string |