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

Improve history queue components shutdowns #5525

Conversation

taylanisikdemir
Copy link
Contributor

@taylanisikdemir taylanisikdemir commented Dec 22, 2023

What changed?
History's timer and transfer queues are not handling shutdowns properly. This PR will make it slightly better but a proper handling of shutdowns will require bigger refactoring to ensure honoring process level shutdown deadline and ordering of Stop calls. We will most likely achieve that by integration with Fx at some point.

Changes:

  • Introduce QueueProcessorEnableGracefulSyncShutdown dynamic config. Default is false. When set to true
    • Synchronously shut down components (get rid of go Stop() calls)
    • Fix ordering of Stop calls so last attempt to complete tasks may actually work (it's always failing today due to misordered calls)

Misc readability changes:

  • Get rid of some named loop breaks. Fix buggy breaks associated with this.
  • Get rid of some multiline functions

Why?
A recent bug shows that there are timer tasks left behind during failover. Handling Stop()s properly may prevent that from happening but will dig deeper on potential ack level consistency problems.

How did you test it?
Set QueueProcessorEnableGracefulSyncShutdown: true in unit tests.

Potential risks
Should be minimal but just to be on safe side put the changes behind dynamic config so we can slowly roll this out and rollback if we see issues.

@taylanisikdemir taylanisikdemir force-pushed the taylan/history_queue_shutdown_improve branch from 1f288f7 to 8c4a2b9 Compare December 23, 2023 02:23
@taylanisikdemir taylanisikdemir merged commit cc766a3 into cadence-workflow:master Dec 26, 2023
16 checks passed
@taylanisikdemir taylanisikdemir deleted the taylan/history_queue_shutdown_improve branch December 26, 2023 16: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