-
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
history service should do event reordering making sure corresponding … #601
Conversation
// So both should not be buffered. Ref: historyEngine, search for "workflow.DecisionTypeCancelTimer" | ||
workflow.EventTypeTimerCanceled, | ||
workflow.EventTypeCancelTimerFailed, | ||
// workflow.EventTypeWorkflowExecutionFailed, |
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.
remove this.
@@ -378,26 +378,48 @@ func (e *mutableStateBuilder) createNewHistoryEvent(eventType workflow.EventType | |||
} | |||
|
|||
func (e *mutableStateBuilder) shouldBufferEvent(eventType workflow.EventType) bool { | |||
if !e.HasInFlightDecisionTask() { |
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.
Is removing this safe? This changes the logic.
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.
from what i see in the code logic
prev:
if no decision on the fly, just assign the event ID
if decision on the fly, postpone until decision is done.
now:
if events in the list, assign event ID
if events not in the list, assign event ID when there is no decision on the fly, by FlushBufferedEvents():
https://github.com/uber/cadence/blob/master/service/history/mutableStateBuilder.go#L157
So let us consider several cases:
-
no decision on the fly
prev: event ID will be assign immediately
now: events in the list will be assigned an ID immediately, events not in the list will be assigned an ID when FlushBufferedEvents is called, which is before persistence of mutable state. -
decision on the fly
prev: only several event will assign ID immediately
now: in addition, other events will be assign ID immediately:
category a:
EventTypeDecisionTaskScheduled
EventTypeDecisionTaskStarted
EventTypeWorkflowExecutionStarted
category b:
EventTypeActivityTaskScheduled
EventTypeActivityTaskCancelRequested
EventTypeTimerStarted
EventTypeTimerCanceled
EventTypeCancelTimerFailed
EventTypeRequestCancelExternalWorkflowExecutionInitiated
EventTypeMarkerRecorded
EventTypeStartChildWorkflowExecutionInitiated
EventTypeSignalExternalWorkflowExecutionInitiated
category a is obvious
category b is the events generated by decision, which can only happen when a decision is complete.
so overall i think it is safe.
…events for decision will have exactly the same order and no irrelevant event will be inserted in between, so client can predict the event ID of a corresponding decision.
7e114ae
to
ee9a025
Compare
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.
Let's hold onto this change until we cut a release.
…e is an decision event on the fly
ee9a025
to
ad56773
Compare
…events for decision will have exactly the same order and no irrelevant event will be inserted in between, so client can predict the event ID of a corresponding decision.
tested using canary
counterpart: #600