MCPcopy
hub / github.com/pingcap/tidb / InsertIntoTTLTask

Function InsertIntoTTLTask

pkg/ttl/cache/task.go:69–81  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

67
68// InsertIntoTTLTask returns an SQL statement to insert a ttl task into mysql.tidb_ttl_task
69func 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
84type TaskStatus string

Callers 6

TestRowToTTLTaskFunction · 0.92
TestInsertIntoTTLTaskFunction · 0.92
TestParallelLockNewTaskFunction · 0.92
TestLockTableFunction · 0.92
lockNewJobMethod · 0.92

Calls 3

EncodeKeyFunction · 0.92
TimeZoneMethod · 0.80
GetSessionVarsMethod · 0.65

Tested by 5

TestRowToTTLTaskFunction · 0.74
TestInsertIntoTTLTaskFunction · 0.74
TestParallelLockNewTaskFunction · 0.74
TestLockTableFunction · 0.74