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 replication metric emitter shutdown #6117

Conversation

taylanisikdemir
Copy link
Member

@taylanisikdemir taylanisikdemir commented Jun 5, 2024

What changed?

MetricEmitterImpl was not waiting for underlying goroutine to finish before returning on Stop().

  • Switched to ctx/cancel/waitgroup based implementation
  • Used the same ctx in downstream calls so it doesn't stall on Stop
  • Added new unit tests and verified no goroutine is leaking after stop.

Why?
Stops should not leave goroutines behind.

Copy link

codecov bot commented Jun 5, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Project coverage is 71.03%. Comparing base (ce92cd8) to head (29e1c74).
Report is 1 commits behind head on master.

Additional details and impacted files
Files Coverage Δ
service/history/replication/metrics_emitter.go 81.94% <83.33%> (+34.25%) ⬆️

... and 8 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ce92cd8...29e1c74. Read the comment docs.

@coveralls
Copy link

coveralls commented Jun 5, 2024

Pull Request Test Coverage Report for Build 018feaa2-8fc3-4a42-84aa-10bd2ac726ee

Details

  • 12 of 14 (85.71%) changed or added relevant lines in 1 file are covered.
  • 34 unchanged lines in 11 files lost coverage.
  • Overall coverage increased (+0.03%) to 70.885%

Changes Missing Coverage Covered Lines Changed/Added Lines %
service/history/replication/metrics_emitter.go 12 14 85.71%
Files with Coverage Reduction New Missed Lines %
common/types/shared.go 1 39.88%
common/cache/lru.go 2 93.01%
common/persistence/sql/sqlplugin/mysql/task.go 2 73.68%
service/history/replication/task_processor.go 2 82.76%
common/persistence/sql/sqlplugin/mysql/db.go 2 79.49%
common/persistence/historyManager.go 2 66.67%
service/history/handler/handler.go 3 96.2%
tools/cli/admin_db_decode_thrift.go 3 69.23%
common/persistence/statsComputer.go 3 98.21%
common/task/fifo_task_scheduler.go 5 82.47%
Totals Coverage Status
Change from base Build 018fea84-767f-4b7b-b478-9c0ffa321880: 0.03%
Covered Lines: 105592
Relevant Lines: 148963

💛 - Coveralls

@taylanisikdemir taylanisikdemir enabled auto-merge (squash) June 5, 2024 23:48
@taylanisikdemir taylanisikdemir merged commit d05a926 into cadence-workflow:master Jun 6, 2024
20 checks passed
@taylanisikdemir taylanisikdemir deleted the taylan/replication_metric_emitter_stop_fix branch June 6, 2024 15:53
timl3136 pushed a commit to timl3136/cadence that referenced this pull request Jun 6, 2024
timl3136 pushed a commit to timl3136/cadence that referenced this pull request Jun 6, 2024
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