[DistributedLock.Redis] Bugfix: respect IDatabase key prefix #65
Closed
skomis-mm wants to merge 6 commits intomadelson:release-2.0.1from
Closed
[DistributedLock.Redis] Bugfix: respect IDatabase key prefix #65skomis-mm wants to merge 6 commits intomadelson:release-2.0.1from
skomis-mm wants to merge 6 commits intomadelson:release-2.0.1from
Conversation
madelson
requested changes
Feb 23, 2021
Owner
madelson
left a comment
There was a problem hiding this comment.
@skomis-mm thanks for filing this! I'd like to publish a patch release for this. Some steps for doing that:
- Can you please change the target branch of this PR to point to the new
release-2.0.1branch I created instead ofmaster? - See the comment I left about adding a couple of source code comments.
- I'll want to add test coverage around this. You are welcome to do so but I can also do it if you'd like; just let me know. The cases I want to add are:
(a) Add a new provider inTestingRedisDatabaseProviders.cswhich has a single database using a key prefix, then run theTestSetupTestto add new combinatorial tests based on this provider. This will give assurance that all operations across all the Redis classes are key prefix friendly.
(b) Add a test toRedisSynchronizationCoreTestCases.csthat does the following: (i) sets the test's databases to just default server 0 with a key prefix P and creates a lock named N. (ii) sets the test's database to just default server 0 and creates a lock named N, (iii) creates a lock named P + N. (iv) demonstrates that locks 1 and 2 do not interact, but 1 and 3 do interact.
|
|
||
| public Task<RedisResult> ExecuteAsync(IDatabaseAsync database, TArgument argument, bool fireAndForget = false) => | ||
| this._script.EvaluateAsync(database, this._parameters(argument), flags: RedLockHelper.GetCommandFlags(fireAndForget)); | ||
| database.ScriptEvaluateAsync(this._script, this._parameters(argument), flags: RedLockHelper.GetCommandFlags(fireAndForget)); |
Owner
There was a problem hiding this comment.
Wow this change is super subtle. Is the idea that all other IDatabase methods will add the key prefix too? We do use non-script evaluations in a few places.
Contributor
Author
There was a problem hiding this comment.
Thats right, .WithKeyPrefix(..) returns IDatabase decorator with the key prefix as context data.
Contributor
Author
|
will re-branch from 2.0.1 |
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.
Fixes an issue with Redis keyspace isolation for locks using
WithKeyPrefixextension method onIDatabase: