Skip to content

Preserve sharedCommandLatencyRecorder in DefaultClientResources.mutate() #4032 - #4033

Merged
a-TODO-rov merged 2 commits into
redis:mainfrom
sonic8-8:fix/4032-mutate-shared-latency-recorder
Nov 27, 2026
Merged

a-TODO-rov merged 2 commits into
redis:mainfrom
sonic8-8:fix/4032-mutate-shared-latency-recorder

Conversation

@sonic8-8

@sonic8-8 sonic8-8 commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Closes #4032

Summary

DefaultClientResources.mutate() set sharedCommandLatencyCollector from sharedEventLoopGroupProvider. As a result, shutdown() on a mutated copy shut down a user-provided CommandLatencyCollector, or did not shut down the default collector. The copy now takes the flag from sharedCommandLatencyRecorder, as it already does for the timer and the event executor group.

Testing

Two new tests in DefaultClientResourcesUnitTests cover both directions. A copy of resources with a user-provided collector does not shut that collector down. A copy of resources with only a user-provided EventLoopGroupProvider owns the default collector. Both tests fail on main and pass with this change, and ./mvnw test passes on JDK 21.

Make sure that:

  • You have read the contribution guidelines.
  • You have created a feature request first to discuss your contribution intent. Please reference the feature request ticket number in the pull request.
  • You applied code formatting rules using the mvn formatter:format target. Don’t submit any formatting related changes.
  • You submit test cases (unit or integration tests) that back your changes.

Note

Low Risk
One-line logic fix in mutate() plus unit tests; aligns shutdown behavior with existing patterns for timer and event executor sharing.

Overview
Fixes DefaultClientResources.mutate() so the builder’s sharedCommandLatencyCollector flag is copied from sharedCommandLatencyRecorder instead of sharedEventLoopGroupProvider.

That wrong assignment made shutdown on a mutated copy either shut down a user-supplied CommandLatencyRecorder or skip shutting down an owned default collector, depending on how the event loop provider was configured.

Adds two unit tests: mutating resources with a user-provided recorder must not call shutdown() on that recorder; mutating when only the event loop provider is user-supplied must treat the default recorder as owned (sharedCommandLatencyRecorder == false).

Reviewed by Cursor Bugbot for commit bf06254. Bugbot is set up for automated code reviews on this repo. Configure here.

…e() redis#4032

mutate() set sharedCommandLatencyCollector from
sharedEventLoopGroupProvider. shutdown() on the copy then shut down a
user-provided CommandLatencyCollector, or did not shut down the
default collector.

We now copy the flag from sharedCommandLatencyRecorder.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-27T10:49:13.036956Z b242296 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@a-TODO-rov
a-TODO-rov merged commit 546bc25 into redis:main Nov 27, 2026
10 checks passed
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.

A copy from ClientResources.mutate() shuts down a user-provided CommandLatencyCollector

2 participants