Skip to content
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

Merged
merged 3 commits into from
Dec 11, 2017
Merged

add support for sticky query #452

merged 3 commits into from
Dec 11, 2017

Conversation

wxing1292
Copy link
Contributor

@wxing1292 wxing1292 commented Dec 8, 2017

solves #405

client side change: cadence-workflow/cadence-go-client#308

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 557862d on sticky-query into ** on master**.

}

fmt.Println("matching query workflow request")
fmt.Println(matchingRequest)
fmt.Println("matching query workflow request")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove debugging leftover

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, forgot to cleanup

fmt.Println(matchingResp)
fmt.Println(matchingResp.GetStickyExecutionEnabled())
fmt.Println(matchingResp.Query)
fmt.Println("@@@@@@@@@@@@@@")

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need some cleanup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, forgot to cleanup

@@ -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) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this can be eliminated.

Copy link
Contributor Author

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

fmt.Println(matchingResp.Query)
fmt.Println("@@@@@@@@@@@@@@")
if matchingResp.GetStickyExecutionEnabled() && matchingResp.Query != nil {
// meaning sticky query, we should not return any events to worker
Copy link

@yiminc-zz yiminc-zz Dec 11, 2017

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -278,6 +278,7 @@ pollLoop:
resp := &h.RecordDecisionTaskStartedResponse{
PreviousStartedEventId: nextIDResp.EventId,
NextEventId: nextIDResp.EventId,
StickyExecutionEnabled: tCtx.queryTaskInfo.queryRequest.StickyExecutionEnabled,

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok got the idea.

@coveralls
Copy link

Coverage Status

Changes Unknown when pulling 0b000a3 on sticky-query into ** on master**.

Copy link

@yiminc-zz yiminc-zz left a 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.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.06%) to 66.466% when pulling f301794 on sticky-query into fffdc7e on master.

@wxing1292 wxing1292 merged commit 9314ff5 into master Dec 11, 2017
@wxing1292 wxing1292 deleted the sticky-query branch December 11, 2017 23:23
wxing1292 pushed a commit that referenced this pull request Dec 12, 2017
wxing1292 added a commit that referenced this pull request Dec 12, 2017
This reverts commit 9314ff5.

Revert sticky query server side change for release.
Will reapply after the release
wxing1292 pushed a commit that referenced this pull request Dec 13, 2017
wxing1292 added a commit that referenced this pull request Dec 16, 2017
* Revert "Revert "add support for sticky query (#452)" (#459)"

This reverts commit 4176791.

* use information from worker / client header to determine whether to use sticky query or not

* rename GetWorkflowNextEventID to GetMutableState, add persistence of client version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants