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

Replace Cassandra visibility TTL with explicit DELETE #2387

Merged
merged 7 commits into from
Jan 25, 2022

Conversation

alexshtin
Copy link
Member

@alexshtin alexshtin commented Jan 18, 2022

What changed?
Replace Cassandra visibility TTL with explicit DELETE.

Why?
Previously visibility records were deleted only when retention kicked in. For new DeleteWorklfowExecution API it is required to be able to delete visibility record in any given moment of time.

How did you test it?
Modify existing unit test. Will add integration tests for DeleteWorkflowExecution API in corresponding PR.

Potential risks
If Cassandra based visibility is used and workflow has many executions, new implementation is slower. No production environments should use Cassandra based visibility though.
No risks.

Is hotfix candidate?
No.

@alexshtin alexshtin requested a review from a team January 18, 2022 20:07
Comment on lines 441 to 443
// Primary key in closed_execution table has close_time which is not in the request.
// Query closed_execution table first (using secondary index by workflow_id) to get close_time.
// This is not very efficient if workflow has multiple executions.
Copy link
Member

Choose a reason for hiding this comment

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

I don't like this part, this is one extra read for every visibility delete. Did you try to put close_time into task?

Copy link
Member Author

@alexshtin alexshtin Jan 22, 2022

Choose a reason for hiding this comment

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

Changed. And I like new approach better than before.

Comment on lines 444 to 454
query := v.session.
Query(templateGetClosedWorkflowExecutionsByID,
request.NamespaceID.String(),
namespacePartition,
persistence.UnixMilliseconds(minTime),
persistence.UnixMilliseconds(maxTime),
request.WorkflowID).
Consistency(v.lowConslevel)
iter := query.Iter()

wfExecution, has := readClosedWorkflowExecutionRecord(iter)
Copy link
Member

Choose a reason for hiding this comment

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

Does this query handles pagination as well? If workflowID is a cron, you could have many RunIDs.

Copy link
Member Author

Choose a reason for hiding this comment

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

Not relevant anymore, but it turned out that default page size is 5000 (not unlimited, as I would expect it to be if not specified).

@alexshtin alexshtin force-pushed the feature/remove-visibility-ttl branch from dd9318c to e35f5eb Compare January 22, 2022 07:09
@alexshtin alexshtin force-pushed the feature/remove-visibility-ttl branch from e35f5eb to 26aeb85 Compare January 24, 2022 21:45
@alexshtin alexshtin merged commit ab519c9 into temporalio:master Jan 25, 2022
@alexshtin alexshtin deleted the feature/remove-visibility-ttl branch January 25, 2022 01:37
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.

2 participants