-
Notifications
You must be signed in to change notification settings - Fork 805
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
implemented functionality in timer ack manager & timer processor base to allow failover #648
Changes from 3 commits
1a1f0db
16f058c
a33303d
a3143d1
35f818f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,6 +44,11 @@ type ( | |
isWorkflowRunning bool | ||
timestamp time.Time | ||
} | ||
|
||
// error which will be thrown if the timer / transfer task should be | ||
// retries due to various of reasons | ||
taskRetryError struct{} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is weird to use an empty struct as an error. Can you instead use errors.New? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nop, i need to use a dedicated error so the worker can do retry accordingly. |
||
|
||
// Engine represents an interface for managing workflow execution history. | ||
Engine interface { | ||
common.Daemon | ||
|
@@ -105,6 +110,9 @@ type ( | |
NotifyNewTask() | ||
} | ||
|
||
// TODO the timer quque processor and the one below, timer processor | ||
// in combination are confusing, we should consider a better naming | ||
// convention, or at least come with a better name for this case. | ||
timerQueueProcessor interface { | ||
common.Daemon | ||
NotifyNewTimers(clusterName string, timerTask []persistence.Task) | ||
|
@@ -118,12 +126,11 @@ type ( | |
} | ||
|
||
timerQueueAckMgr interface { | ||
readRetryTimerTasks() []*persistence.TimerTaskInfo | ||
getFinishedChan() <-chan struct{} | ||
readTimerTasks() ([]*persistence.TimerTaskInfo, *persistence.TimerTaskInfo, bool, error) | ||
retryTimerTask(timerTask *persistence.TimerTaskInfo) | ||
completeTimerTask(timerTask *persistence.TimerTaskInfo) | ||
getAckLevel() TimerSequenceID | ||
updateAckLevel() | ||
isProcessNow(time.Time) bool | ||
} | ||
|
||
historyEventNotifier interface { | ||
|
@@ -133,3 +140,12 @@ type ( | |
UnwatchHistoryEvent(identifier *workflowIdentifier, subscriberID string) error | ||
} | ||
) | ||
|
||
// newTaskRetryError create a error which indicate the task should be retry | ||
func newTaskRetryError() *taskRetryError { | ||
return &taskRetryError{} | ||
} | ||
|
||
func (e *taskRetryError) Error() string { | ||
return "passive task should retry due to condition in mutable state is not met." | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any specific reason to remove pagination here? I think pagination through tasks is much more efficient then issuing a limit query each time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because the existing query is using
limit
https://github.com/uber/cadence/blob/master/common/persistence/cassandraPersistence.go#L546
we can change to use the pagination later, this is not a blocking issue