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

Fix unloading shard after task id sanity check #2571

Merged
merged 3 commits into from
Mar 7, 2022
Merged

Conversation

dnr
Copy link
Member

@dnr dnr commented Mar 4, 2022

What changed?
In #2361, the shard would get unloaded without going through the controller, which would leave it in the controller's map in a stopped state. This makes it go through the controller. Also renamed the stop method to make it less confusing.

Why?
The consequences are pretty benign for now (wrong metrics on number of shards loaded/unloaded), but could be worse if the interaction between controller and context gets more complex.

How did you test it?
new unit test

Potential risks

Is hotfix candidate?

@dnr dnr requested a review from a team as a code owner March 4, 2022 18:31
@dnr dnr changed the title Unload fix Fix unloading shard after task id sanity check Mar 4, 2022
// stop should only be called by the controller.
func (s *ContextImpl) stop() {
// finishStop should only be called by the controller.
func (s *ContextImpl) finishStop() {
Copy link
Member

Choose a reason for hiding this comment

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

I usually name the method start with _ if i don't want others to call it, so it would be _stop(). That way, when people make calls to it, they will look closer.
But i'm not sure if that is best practice.

Copy link
Member Author

Choose a reason for hiding this comment

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

That feels like a Python idiom to me. There aren't any methods or functions named with initial underscore in this repo, except for some proto-generated code. I think this is fine (after fixing the test).

@dnr dnr merged commit df18e3d into temporalio:master Mar 7, 2022
@dnr dnr deleted the unload-fix branch March 7, 2022 20:12
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