refactor the entire redis cache module#68819
Open
Sxderp wants to merge 1 commit intosaltstack:masterfrom
Open
Conversation
883a75c to
a805bd0
Compare
a805bd0 to
3278952
Compare
The old code used a complex mechanism for creating the tree hierarchy of the salt cache. The newer mechanism ustilizes a Redis sorted set as an index in which we can find subbanks by using a simple range scan. Additionally, individual keys have been replaced with singular hash maps for each bank. This reduces the amount of bookkeeping required.
3278952 to
0b7be3a
Compare
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.
The old code used a complex mechanism for creating the tree hierarchy of the salt cache. The newer mechanism ustilizes a Redis sorted set as an index in which we can find subbanks by using a simple range scan.
Additionally, individual keys have been replaced with singular hash maps for each bank. This reduces the amount of bookkeeping required.
What does this PR do?
Simplifies how the redis cache works. There is no longer any need to recursively build the tree structure. A sorted set is used to organize the banks and can be queried using a range command to find the appropriate sub-banks. No benchmarks have been performed but I believe it is more efficient in the
flushfunction and at least on pair with thelist_function due to the reduction in bookkeeping.This change is a change in functionality and it also changes some of the config options and therefore I'm targeting master rather than any current version. There are other PRs that try to fix the current implementation #67814. I think a clean start is the better option.
I wasn't sure the best way to create tests. I ended up mocking out a Redis server that implements the functions that the cache uses. It's not the best option but it works. I hope there's a way to run an actual redis instance during tests so real results can be checked at a later time.
What issues does this PR fix or reference?
A number of issues can be closed as a result of this PR.
#54734
#60899
#66193
#67250
Merge requirements satisfied?
[NOTICE] Bug fixes or features added to Salt require tests.
Commits signed with GPG?
No