You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* support reuse orchestration id
* add test
* fix tests
* implement new design
* clean up
* refactory
* minor updates
* minor updates
* refactor
* improve tests
* correct variable name
* refactory
more refactory
refactory
* minor refactory
* refactor option pattern
* formatting - clean up
* update changelog.md
* clean up
Copy file name to clipboardExpand all lines: CHANGELOG.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
5
5
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
8
+
## [Unreleased]
9
+
10
+
### Changed
11
+
12
+
- Support reusing orchestration id ([#46](https://github.com/microsoft/durabletask-go/pull/46)) - contributed by [@kaibocai](https://github.com/kaibocai)
// purge orchestration in ['COMPLETED', 'FAILED', 'TERMINATED']
570
+
dbResult, err:=tx.ExecContext(ctx, "DELETE FROM Instances WHERE [InstanceID] = ? AND [RuntimeStatus] IN ('COMPLETED', 'FAILED', 'TERMINATED')", string(id))
571
+
iferr!=nil {
572
+
returnfmt.Errorf("failed to delete from the Instances table: %w", err)
573
+
}
574
+
575
+
rowsAffected, err:=dbResult.RowsAffected()
576
+
iferr!=nil {
577
+
returnfmt.Errorf("failed to get rows affected in Instances delete operation: %w", err)
578
+
}
579
+
ifrowsAffected==0 {
580
+
returnapi.ErrNotCompleted
581
+
}
582
+
} else {
583
+
// clean up orchestration in all [RuntimeStatus]
584
+
_, err:=tx.ExecContext(ctx, "DELETE FROM Instances WHERE [InstanceID] = ?", string(id))
585
+
iferr!=nil {
586
+
returnfmt.Errorf("failed to delete from the Instances table: %w", err)
587
+
}
588
+
}
589
+
590
+
_, err:=tx.ExecContext(ctx, "DELETE FROM History WHERE [InstanceID] = ?", string(id))
591
+
iferr!=nil {
592
+
returnfmt.Errorf("failed to delete from History table: %w", err)
593
+
}
594
+
595
+
_, err=tx.ExecContext(ctx, "DELETE FROM NewEvents WHERE [InstanceID] = ?", string(id))
596
+
iferr!=nil {
597
+
returnfmt.Errorf("failed to delete from NewEvents table: %w", err)
598
+
}
599
+
600
+
_, err=tx.ExecContext(ctx, "DELETE FROM NewTasks WHERE [InstanceID] = ?", string(id))
601
+
iferr!=nil {
602
+
returnfmt.Errorf("failed to delete from NewTasks table: %w", err)
row:=tx.QueryRowContext(ctx, "SELECT 1 FROM Instances WHERE [InstanceID] = ?", string(id))
841
-
iferr:=row.Err(); err!=nil {
842
-
returnfmt.Errorf("failed to query for instance existence: %w", err)
843
-
}
844
-
845
-
varunusedint
846
-
iferr:=row.Scan(&unused); err==sql.ErrNoRows {
847
-
returnapi.ErrInstanceNotFound
848
-
} elseiferr!=nil {
849
-
returnfmt.Errorf("failed to scan instance existence: %w", err)
850
-
}
851
-
852
-
dbResult, err:=tx.ExecContext(ctx, "DELETE FROM Instances WHERE [InstanceID] = ? AND [RuntimeStatus] IN ('COMPLETED', 'FAILED', 'TERMINATED')", string(id))
853
-
iferr!=nil {
854
-
returnfmt.Errorf("failed to delete from the Instances table: %w", err)
855
-
}
856
-
857
-
rowsAffected, err:=dbResult.RowsAffected()
858
-
iferr!=nil {
859
-
returnfmt.Errorf("failed to get rows affected in Instances delete operation: %w", err)
860
-
}
861
-
ifrowsAffected==0 {
862
-
returnapi.ErrNotCompleted
863
-
}
864
-
865
-
_, err=tx.ExecContext(ctx, "DELETE FROM History WHERE [InstanceID] = ?", string(id))
866
-
iferr!=nil {
867
-
returnfmt.Errorf("failed to delete from History table: %w", err)
0 commit comments