@@ -63,7 +63,7 @@ const (
63
63
// resumeTaskByIDSQLTemplate is the SQL template for resuming a paused task by its ID
64
64
resumeTaskByIDSQLTemplate = `
65
65
UPDATE %s.%s
66
- SET status = 'running', last_heartbeat = %%?
66
+ SET status = 'running', last_heartbeat_ts = %%?
67
67
WHERE id = %%?`
68
68
69
69
// deleteRegistrationSQLTemplate is the SQL template for deleting a registration
@@ -81,7 +81,7 @@ const (
81
81
createNewTaskSQLTemplate = `
82
82
INSERT INTO %s.%s
83
83
(filter_strings, filter_hash, start_ts, restored_ts, upstream_cluster_id,
84
- with_sys_table, status, cmd, start_timestamp, last_heartbeat )
84
+ with_sys_table, status, cmd, task_start_ts, last_heartbeat_ts )
85
85
VALUES (%%?, MD5(%%?), %%?, %%?, %%?, %%?, 'running', %%?, %%?, %%?)`
86
86
)
87
87
@@ -126,6 +126,11 @@ type Registry struct {
126
126
heartbeatManager * HeartbeatManager
127
127
}
128
128
129
+ // getCurrentTimestamp returns the current time as time.Time
130
+ func getCurrentTimestamp () time.Time {
131
+ return time .Now ()
132
+ }
133
+
129
134
// NewRestoreRegistry creates a new registry using TiDB's session
130
135
func NewRestoreRegistry (g glue.Glue , dom * domain.Domain ) (* Registry , error ) {
131
136
se , err := g .CreateSession (dom .Store ())
@@ -236,7 +241,7 @@ func (r *Registry) ResumeOrCreateRegistration(ctx context.Context, info Registra
236
241
237
242
// strictly check for paused status
238
243
if status == string (TaskStatusPaused ) {
239
- currentTime := uint64 ( time . Now (). Unix () )
244
+ currentTime := getCurrentTimestamp ( )
240
245
updateSQL := fmt .Sprintf (resumeTaskByIDSQLTemplate , RestoreRegistryDBName , RestoreRegistryTableName )
241
246
_ , _ , err = execCtx .ExecRestrictedSQL (ctx , sessionOpts , updateSQL , currentTime , existingTaskID )
242
247
if err != nil {
@@ -260,7 +265,7 @@ func (r *Registry) ResumeOrCreateRegistration(ctx context.Context, info Registra
260
265
}
261
266
262
267
// no existing task found, create a new one
263
- currentTime := uint64 ( time . Now (). Unix () )
268
+ currentTime := getCurrentTimestamp ( )
264
269
insertSQL := fmt .Sprintf (createNewTaskSQLTemplate , RestoreRegistryDBName , RestoreRegistryTableName )
265
270
_ , _ , err = execCtx .ExecRestrictedSQL (ctx , sessionOpts , insertSQL ,
266
271
filterStrings , filterStrings , info .StartTS , info .RestoredTS ,
0 commit comments