Skip to content

Conversation

@jrhea
Copy link

@jrhea jrhea commented Nov 6, 2025

Builds on @MariusVanDerWijden’s original PR (#31536) to allow --vmodule log level downgrades by reworking the GlogHandler to use an atomic.Pointer[*sync.Map] for the callsite cache. I think this will eliminate Clear() races, avoid stale entry reinserts, and reduce lock contention while preserving the functionality introduced in Marius’s PR.

Key changes
• Replaced siteCache sync.Map with cachePtr atomic.Pointer[*sync.Map]
• Vmodule and Verbosity now atomically swap in a new cache instead of calling Clear()
• Updated WithAttrs to share the active cache pointer

Additional changes addressing original PR review feedback
• Handle snapshots h.patterns, performs regex matching outside the lock, and stores only if still current
• Simplified locking to a single sync.Mutex
• Forwarded the original ctx to origin.Handle(ctx, r)

Closes: #30717

for _, rule := range curPatterns {
if rule.pattern.MatchString("+" + file) {
lvl, ok = rule.level, true
// TODO: Not breaking allows the last match to win. Is this what we want?
Copy link
Author

Choose a reason for hiding this comment

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

I had a question about this

@fjl fjl self-assigned this Nov 10, 2025
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.

Support environment variable to hide broadcasted raw transactions.

3 participants