@@ -197,9 +197,8 @@ func (b *mysqlBackend) GetWorkflowInstanceHistory(ctx context.Context, instance
197
197
func (b * mysqlBackend ) GetWorkflowInstanceState (ctx context.Context , instance * workflow.Instance ) (core.WorkflowInstanceState , error ) {
198
198
row := b .db .QueryRowContext (
199
199
ctx ,
200
- "SELECT completed_at FROM instances WHERE instance_id = ? AND execution_id = ? " ,
200
+ "SELECT completed_at FROM instances WHERE instance_id = ?" ,
201
201
instance .InstanceID ,
202
- instance .ExecutionID ,
203
202
)
204
203
205
204
var completedAt sql.NullTime
@@ -234,9 +233,8 @@ func createInstance(ctx context.Context, tx *sql.Tx, wfi *workflow.Instance, met
234
233
235
234
res , err := tx .ExecContext (
236
235
ctx ,
237
- "INSERT IGNORE INTO `instances` (instance_id, execution_id, parent_instance_id, parent_schedule_event_id, metadata) VALUES (?, ?, ?, ?, ?)" ,
236
+ "INSERT IGNORE INTO `instances` (instance_id, parent_instance_id, parent_schedule_event_id, metadata) VALUES (?, ?, ?, ?)" ,
238
237
wfi .InstanceID ,
239
- wfi .ExecutionID ,
240
238
parentInstanceID ,
241
239
parentEventID ,
242
240
string (metadataJson ),
@@ -296,7 +294,7 @@ func (b *mysqlBackend) GetWorkflowTask(ctx context.Context) (*task.Workflow, err
296
294
now := time .Now ()
297
295
row := tx .QueryRowContext (
298
296
ctx ,
299
- `SELECT i.id, i.instance_id, i.execution_id, i. parent_instance_id, i.parent_schedule_event_id, i.metadata, i.sticky_until
297
+ `SELECT i.id, i.instance_id, i.parent_instance_id, i.parent_schedule_event_id, i.metadata, i.sticky_until
300
298
FROM instances i
301
299
INNER JOIN pending_events pe ON i.instance_id = pe.instance_id
302
300
WHERE
@@ -313,12 +311,12 @@ func (b *mysqlBackend) GetWorkflowTask(ctx context.Context) (*task.Workflow, err
313
311
)
314
312
315
313
var id int
316
- var instanceID , executionID string
314
+ var instanceID string
317
315
var parentInstanceID * string
318
316
var parentEventID * int64
319
317
var metadataJson sql.NullString
320
318
var stickyUntil * time.Time
321
- if err := row .Scan (& id , & instanceID , & executionID , & parentInstanceID , & parentEventID , & metadataJson , & stickyUntil ); err != nil {
319
+ if err := row .Scan (& id , & instanceID , & parentInstanceID , & parentEventID , & metadataJson , & stickyUntil ); err != nil {
322
320
if err == sql .ErrNoRows {
323
321
return nil , nil
324
322
}
@@ -348,9 +346,9 @@ func (b *mysqlBackend) GetWorkflowTask(ctx context.Context) (*task.Workflow, err
348
346
349
347
var wfi * workflow.Instance
350
348
if parentInstanceID != nil {
351
- wfi = core .NewSubWorkflowInstance (instanceID , executionID , * parentInstanceID , * parentEventID )
349
+ wfi = core .NewSubWorkflowInstance (instanceID , * parentInstanceID , * parentEventID )
352
350
} else {
353
- wfi = core .NewWorkflowInstance (instanceID , executionID )
351
+ wfi = core .NewWorkflowInstance (instanceID )
354
352
}
355
353
356
354
var metadata * core.WorkflowMetadata
@@ -460,11 +458,10 @@ func (b *mysqlBackend) CompleteWorkflowTask(
460
458
461
459
res , err := tx .ExecContext (
462
460
ctx ,
463
- `UPDATE instances SET locked_until = NULL, sticky_until = ?, completed_at = ? WHERE instance_id = ? AND execution_id = ? AND worker = ?` ,
461
+ `UPDATE instances SET locked_until = NULL, sticky_until = ?, completed_at = ? WHERE instance_id = ? AND worker = ?` ,
464
462
time .Now ().Add (b .options .StickyTimeout ),
465
463
completedAt ,
466
464
instance .InstanceID ,
467
- instance .ExecutionID ,
468
465
b .workerName ,
469
466
)
470
467
if err != nil {
@@ -564,10 +561,9 @@ func (b *mysqlBackend) ExtendWorkflowTask(ctx context.Context, taskID string, in
564
561
until := time .Now ().Add (b .options .WorkflowLockTimeout )
565
562
res , err := tx .ExecContext (
566
563
ctx ,
567
- `UPDATE instances SET locked_until = ? WHERE instance_id = ? AND execution_id = ? AND worker = ?` ,
564
+ `UPDATE instances SET locked_until = ? WHERE instance_id = ? AND worker = ?` ,
568
565
until ,
569
566
instance .InstanceID ,
570
- instance .ExecutionID ,
571
567
b .workerName ,
572
568
)
573
569
if err != nil {
@@ -597,7 +593,7 @@ func (b *mysqlBackend) GetActivityTask(ctx context.Context) (*task.Activity, err
597
593
now := time .Now ()
598
594
res := tx .QueryRowContext (
599
595
ctx ,
600
- `SELECT activities.id, activity_id, activities.instance_id, activities.execution_id,
596
+ `SELECT activities.id, activity_id, activities.instance_id,
601
597
instances.metadata, event_type, timestamp, schedule_event_id, attributes, visible_at
602
598
FROM activities
603
599
INNER JOIN instances ON activities.instance_id = instances.instance_id
@@ -608,13 +604,13 @@ func (b *mysqlBackend) GetActivityTask(ctx context.Context) (*task.Activity, err
608
604
)
609
605
610
606
var id int64
611
- var instanceID , executionID string
607
+ var instanceID string
612
608
var attributes []byte
613
609
var metadataJson sql.NullString
614
610
event := & history.Event {}
615
611
616
612
if err := res .Scan (
617
- & id , & event .ID , & instanceID , & executionID , & metadataJson , & event .Type ,
613
+ & id , & event .ID , & instanceID , & metadataJson , & event .Type ,
618
614
& event .Timestamp , & event .ScheduleEventID , & attributes , & event .VisibleAt ); err != nil {
619
615
if err == sql .ErrNoRows {
620
616
return nil , nil
@@ -647,7 +643,7 @@ func (b *mysqlBackend) GetActivityTask(ctx context.Context) (*task.Activity, err
647
643
648
644
t := & task.Activity {
649
645
ID : event .ID ,
650
- WorkflowInstance : core .NewWorkflowInstance (instanceID , executionID ),
646
+ WorkflowInstance : core .NewWorkflowInstance (instanceID ),
651
647
Metadata : metadata ,
652
648
Event : event ,
653
649
}
@@ -672,10 +668,9 @@ func (b *mysqlBackend) CompleteActivityTask(ctx context.Context, instance *workf
672
668
// Remove activity
673
669
if res , err := tx .ExecContext (
674
670
ctx ,
675
- `DELETE FROM activities WHERE activity_id = ? AND instance_id = ? AND execution_id = ? AND worker = ?` ,
671
+ `DELETE FROM activities WHERE activity_id = ? AND instance_id = ? AND worker = ?` ,
676
672
id ,
677
673
instance .InstanceID ,
678
- instance .ExecutionID ,
679
674
b .workerName ,
680
675
); err != nil {
681
676
return fmt .Errorf ("completing activity: %w" , err )
@@ -739,10 +734,9 @@ func scheduleActivity(ctx context.Context, tx *sql.Tx, instance *core.WorkflowIn
739
734
_ , err = tx .ExecContext (
740
735
ctx ,
741
736
`INSERT INTO activities
742
- (activity_id, instance_id, execution_id, event_type, timestamp, schedule_event_id, attributes, visible_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)` ,
737
+ (activity_id, instance_id, event_type, timestamp, schedule_event_id, attributes, visible_at) VALUES (?, ?, ?, ?, ?, ?, ?)` ,
743
738
event .ID ,
744
739
instance .InstanceID ,
745
- instance .ExecutionID ,
746
740
event .Type ,
747
741
event .Timestamp ,
748
742
event .ScheduleEventID ,
0 commit comments