-
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
add support for sticky query #452
Conversation
Changes Unknown when pulling 557862d on sticky-query into ** on master**. |
service/frontend/handler.go
Outdated
} | ||
|
||
fmt.Println("matching query workflow request") | ||
fmt.Println(matchingRequest) | ||
fmt.Println("matching query workflow request") |
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 debugging leftover
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.
sure, forgot to cleanup
service/frontend/handler.go
Outdated
fmt.Println(matchingResp) | ||
fmt.Println(matchingResp.GetStickyExecutionEnabled()) | ||
fmt.Println(matchingResp.Query) | ||
fmt.Println("@@@@@@@@@@@@@@") |
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.
need some cleanup
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.
sure, forgot to cleanup
service/frontend/handler.go
Outdated
@@ -1697,3 +1723,18 @@ func createServiceBusyError() *gen.ServiceBusyError { | |||
err.Message = "Too many outstanding requests to the cadence service" | |||
return err | |||
} | |||
|
|||
func (wh *WorkflowHandler) getWorkflowTypeTaskList(domainID string, execution *gen.WorkflowExecution) (*gen.WorkflowType, *gen.TaskList, error) { |
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.
this can be eliminated.
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.
why?
this is a helper function for workflow type and its corresponding task list
service/frontend/handler.go
Outdated
fmt.Println(matchingResp.Query) | ||
fmt.Println("@@@@@@@@@@@@@@") | ||
if matchingResp.GetStickyExecutionEnabled() && matchingResp.Query != nil { | ||
// meaning sticky query, we should not return any events to worker |
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.
This is FYI: your client side change will need to handle the case where the query task comes in with no history, but the cache is already evicted, in that case you have to reload the history from client side, but need to avoid putting that workflowExecutionContext into cache.
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.
i believe i have already handled that case:
handle of cache miss:
https://github.com/uber-go/cadence-client/blob/844db2a5659db29680c1bb8ea458b3dc3cc40f49/internal/internal_task_handlers.go#L496
avoiding cache:
https://github.com/uber-go/cadence-client/blob/844db2a5659db29680c1bb8ea458b3dc3cc40f49/internal/internal_task_handlers.go#L509
service/matching/matchingEngine.go
Outdated
@@ -278,6 +278,7 @@ pollLoop: | |||
resp := &h.RecordDecisionTaskStartedResponse{ | |||
PreviousStartedEventId: nextIDResp.EventId, | |||
NextEventId: nextIDResp.EventId, | |||
StickyExecutionEnabled: tCtx.queryTaskInfo.queryRequest.StickyExecutionEnabled, |
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.
rather than passing the flag StickyExecutionEnabled from frontend in the request, you can get it here by replacing the call GetWorkflowExecutionNextEventID() to DescWorkflowExecution(). Moreover, you can also get the workflow type from DescWorkflowExecution() and set it here so you don't need the set workflow type in frontend.
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.
ok got the idea.
Changes Unknown when pulling 0b000a3 on sticky-query into ** on master**. |
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.
lgtm, please land this after you verify the client change works with it.
This reverts commit 9314ff5.
solves #405
client side change: cadence-workflow/cadence-go-client#308