Skip to content

Conversation

@mgravell
Copy link
Contributor

@mgravell mgravell commented Feb 27, 2024

Resolve redis cache naming inconsistencies

The cache intent is included in the connection metadata ... or should be.

  • rev SE.Redis; among other fixes, this resolves an issue with some client identifier strings being ignored at the server
  • consistently apply identifier in cache setup
    • this was applied in async connect, but not sync connect
    • this was not applied if the factory callback was used (Aspire uses this)
  • avoid cloning the configuration options (breaks key-rotation scenarios)
  • adds (opt-in) RESP3 support (via lib-rev), and assorted lib fixes

manual test evidence (from running tests with a pause in):

> redis-cli client list
...
id=348 ... resp=2 lib-name=SE.Redis-aspnet-DC lib-ver=2.7.27.49176
id=345 ... resp=2 lib-name=SE.Redis-aspnet-DC lib-ver=2.7.27.49176

- ensure sync/async connect use consistent path
@ghost ghost added the area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework label Feb 27, 2024
@mgravell mgravell marked this pull request as draft February 27, 2024 16:09
- use new AddLibraryNameSuffix API (2.7.27)
- do not use ConfigurationOptions.Clone() - impacts key rotation
- attach suffix even if ConnectionMultiplexerFactory used (Aspire)
- revert changes to Baseline.Designer.props
@mgravell mgravell marked this pull request as ready for review February 28, 2024 16:49
@mgravell
Copy link
Contributor Author

mgravell commented Feb 28, 2024

SignalR (test fail) should just be some using directive gymnastics; will look at tomorrow

internal ConfigurationOptions GetConfiguredOptions(string libSuffix)
internal ConfigurationOptions GetConfiguredOptions()
{
var options = ConfigurationOptions?.Clone() ?? ConfigurationOptions.Parse(Configuration!);
Copy link
Member

Choose a reason for hiding this comment

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

I know you said it breaks something to call Clone. But we call Clone because this ConfigurationOptions can be used elsewhere and we modify the settings which could cause issues with the other uses of the same options reference.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BrennanConroy the thing potentially it breaks can fundamentally cause access to the servers to be lost (key rotation for managed identity); let me review the azure redis documentation to see if we can find a compromise here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@BrennanConroy this Clone() is a recent addition; I'm not concerned by sharing the connect-fail change here, so IMO we're restoring the correct behaviour here;

@mgravell mgravell enabled auto-merge (squash) February 29, 2024 17:21
@mgravell mgravell merged commit 7874b36 into main Feb 29, 2024
@mgravell mgravell deleted the marc/redis-cache-name-fix branch February 29, 2024 18:30
@mgravell
Copy link
Contributor Author

mgravell commented Mar 7, 2024

/backport to release/8.0

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2024

Started backporting to release/8.0: https://github.com/dotnet/aspnetcore/actions/runs/8189114024

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2024

@mgravell backporting to release/8.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --ignore-whitespace --keep-non-patch changes.patch

Applying: - SE.Redis lib update - ensure sync/async connect use consistent path
Using index info to reconstruct a base tree...
M	eng/Baseline.Designer.props
M	eng/Versions.props
M	src/Caching/StackExchangeRedis/src/RedisCache.cs
Falling back to patching base and 3-way merge...
Auto-merging src/Caching/StackExchangeRedis/src/RedisCache.cs
Auto-merging eng/Versions.props
Auto-merging eng/Baseline.Designer.props
CONFLICT (content): Merge conflict in eng/Baseline.Designer.props
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 - SE.Redis lib update - ensure sync/async connect use consistent path
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2024

@mgravell an error occurred while backporting to release/8.0, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

mgravell added a commit that referenced this pull request Mar 7, 2024
* - rev to SE.Redis 2.7.27
- use new AddLibraryNameSuffix API (2.7.27)
- do not use ConfigurationOptions.Clone() - impacts key rotation
- attach suffix even if ConnectionMultiplexerFactory used (Aspire)
wtgodbe pushed a commit that referenced this pull request Mar 12, 2024
…ncy (#54413)

* Caching: SE.Redis update and fix naming inconsistency (#54239)

* - rev to SE.Redis 2.7.27
- use new AddLibraryNameSuffix API (2.7.27)
- do not use ConfigurationOptions.Clone() - impacts key rotation
- attach suffix even if ConnectionMultiplexerFactory used (Aspire)

* nit extra ;
eerhardt added a commit to eerhardt/aspire that referenced this pull request Apr 12, 2024
- Fix Redis output and distributed caching tests in response to new tracing events emitted from dotnet/aspnetcore#54239
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-infrastructure Includes: MSBuild projects/targets, build scripts, CI, Installers and shared framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants