@@ -416,6 +416,23 @@ func (m *taskManager) lockScanTask(se session.Session, task *cache.TTLTask, now
416
416
return errors .WithStack (errTooManyRunningTasks )
417
417
}
418
418
419
+ if task .OwnerID != "" {
420
+ logutil .Logger (m .ctx ).Info (
421
+ "try to lock a heartbeat timeout task" ,
422
+ zap .String ("jobID" , task .JobID ),
423
+ zap .Int64 ("scanID" , task .ScanID ),
424
+ zap .String ("prevOwner" , task .OwnerID ),
425
+ zap .Time ("lastHeartbeat" , task .OwnerHBTime ),
426
+ )
427
+ } else if task .State != nil && task .State .PreviousOwner != "" {
428
+ logutil .Logger (m .ctx ).Info (
429
+ "try to lock a task resigned from another instance" ,
430
+ zap .String ("jobID" , task .JobID ),
431
+ zap .Int64 ("scanID" , task .ScanID ),
432
+ zap .String ("prevOwner" , task .State .PreviousOwner ),
433
+ )
434
+ }
435
+
419
436
intest .Assert (se .GetSessionVars ().Location ().String () == now .Location ().String ())
420
437
sql , args := setTTLTaskOwnerSQL (task .JobID , task .ScanID , m .id , now )
421
438
_ , err = se .ExecuteSQL (ctx , sql , args ... )
0 commit comments