fix(extension): eliminate race-prone global registries in common/extension#3264
Open
xxs588 wants to merge 13 commits intoapache:developfrom
Open
fix(extension): eliminate race-prone global registries in common/extension#3264xxs588 wants to merge 13 commits intoapache:developfrom
xxs588 wants to merge 13 commits intoapache:developfrom
Conversation
7a46ab4 to
9eeded4
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## develop #3264 +/- ##
===========================================
+ Coverage 46.76% 48.33% +1.56%
===========================================
Files 295 467 +172
Lines 17172 34081 +16909
===========================================
+ Hits 8031 16474 +8443
- Misses 8287 16274 +7987
- Partials 854 1333 +479 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
|
@zbchi check this |
zbchi
approved these changes
Mar 18, 2026
Alanxtl
reviewed
Mar 18, 2026
| ) | ||
|
|
||
| var configCenterFactories = make(map[string]func() config_center.DynamicConfigurationFactory) | ||
| var configCenterFactories = NewRegistry[func() config_center.DynamicConfigurationFactory]("config center") |
Author
There was a problem hiding this comment.
已按建议修正:将 config_center_factory.go 中的 registry 名称从 config center 调整为 config center factory,避免语义歧义。
对应提交:bc5c9e01
本地验证:make fmt, make lint, go test -race ./common/extension/... 均通过。谢谢指正。
Align registry name with config center factory semantics for clearer diagnostics in extension registration lookup. Fixes: apache#3247
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Fixes #3247
This PR addresses Category-1 race conditions in
common/extensionby replacing unsafe global maps with a thread-safe genericRegistry[T]and migrating extension registries in atomic commits.Key changes:
common/extension/registry_type.go+registry_type_test.goRegister/Get/MustGet/Unregister/Snapshot/Namesregistry_directory, customizers, shutdown callbacks, service-name mapping)Local verification:
go test -race ./common/extension/...Checklist
develop