-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: some streams errors such as pkpatternmatchdel etc #2726
fix: some streams errors such as pkpatternmatchdel etc #2726
Conversation
WalkthroughThe changes introduce support for a new Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Storage
participant BaseFilter
participant PikaStreamMeta
Client->>Storage: Request to delete pattern match
Storage->>BaseFilter: Apply BaseMetaFilter with kStreams handling
BaseFilter->>PikaStreamMeta: Parse stream meta values
PikaStreamMeta-->>BaseFilter: Return parsed values
BaseFilter-->>Storage: Filtered results
Storage->>Client: Return accumulated results
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Outside diff range and nitpick comments (1)
src/storage/tests/keys_test.cc (1)
2606-2608
: Ensure clarity on the execution order of tests.The note about the scan test needing to execute first is crucial. Consider adding more details or explicitly setting up dependencies in the test framework to enforce this order.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- src/storage/src/base_filter.h (3 hunks)
- src/storage/src/pika_stream_meta_value.h (6 hunks)
- src/storage/src/redis_strings.cc (2 hunks)
- src/storage/src/storage.cc (1 hunks)
- src/storage/tests/keys_test.cc (1 hunks)
Files not summarized due to errors (1)
- src/storage/tests/keys_test.cc: Error: Message exceeds token limit
Files not reviewed due to errors (2)
- src/storage/src/base_filter.h (Error: Server error. Please try again later.)
- src/storage/src/pika_stream_meta_value.h (Error: Server error. Please try again later.)
Additional comments not posted (8)
src/storage/src/redis_strings.cc (1)
1595-1597
: Move variable assignments before condition checks to standardize data retrieval.This change helps to ensure that the
key
andmeta_value
are consistently set before they are used in various condition checks, which can improve the maintainability and predictability of the code. Please ensure that all subsequent uses of these variables take into account their earlier assignment.src/storage/src/storage.cc (1)
1400-1407
: The changes toStorage::PKPatternMatchDel
appear to correctly aggregate the results from multiple instances. Ensure that all instances consistently handle errors and return values.Verification successful
The changes to
Storage::PKPatternMatchDel
correctly aggregate results from multiple instances and handle errors consistently. The implementation inredis_strings.cc
also includes proper error handling and aggregation of results.
storage.cc
: Errors are checked withif (!s.ok()) { return s; }
and results are accumulated.redis_strings.cc
: Errors are checked withif (!s.ok()) { return s; }
and results are accumulated.Both implementations handle errors and return values consistently.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify that error handling is consistent across all instances in `Storage::PKPatternMatchDel`. # Test: Search for error handling patterns in `PKPatternMatchDel` implementations. rg --type cpp "PKPatternMatchDel" "src/storage/src/"Length of output: 473
Script:
#!/bin/bash # Extract the implementation of `PKPatternMatchDel` from `src/storage/src/storage.cc` ast-grep --lang cpp --pattern $'Status Storage::PKPatternMatchDel(const DataType& data_type, const std::string& pattern, int32_t* ret) { $$$ }' src/storage/src/storage.cc # Extract the implementation of `PKPatternMatchDel` from `src/storage/src/redis_strings.cc` ast-grep --lang cpp --pattern $'rocksdb::Status Redis::PKPatternMatchDel(const std::string& pattern, int32_t* ret) { $$$ }' src/storage/src/redis_strings.ccLength of output: 333
Script:
#!/bin/bash # Extract the implementation of `PKPatternMatchDel` from `src/storage/src/storage.cc` rg --context 10 --max-count 1 --no-heading "Status Storage::PKPatternMatchDel" src/storage/src/storage.cc # Extract the implementation of `PKPatternMatchDel` from `src/storage/src/redis_strings.cc` rg --context 10 --max-count 1 --no-heading "rocksdb::Status Redis::PKPatternMatchDel" src/storage/src/redis_strings.ccLength of output: 1340
Script:
#!/bin/bash # Extract more lines from the implementation of `PKPatternMatchDel` in `src/storage/src/storage.cc` rg --context 20 --max-count 1 --no-heading "Status Storage::PKPatternMatchDel" src/storage/src/storage.cc # Extract more lines from the implementation of `PKPatternMatchDel` in `src/storage/src/redis_strings.cc` rg --context 20 --max-count 1 --no-heading "rocksdb::Status Redis::PKPatternMatchDel" src/storage/src/redis_strings.ccLength of output: 2755
Script:
#!/bin/bash # Extract even more lines from the implementation of `PKPatternMatchDel` in `src/storage/src/redis_strings.cc` rg --context 40 --max-count 1 --no-heading "rocksdb::Status Redis::PKPatternMatchDel" src/storage/src/redis_strings.ccLength of output: 3289
Script:
#!/bin/bash # Extract even more lines from the implementation of `PKPatternMatchDel` in `src/storage/src/redis_strings.cc` rg --context 60 --max-count 1 --no-heading "rocksdb::Status Redis::PKPatternMatchDel" src/storage/src/redis_strings.ccLength of output: 4659
Script:
#!/bin/bash # Extract even more lines from the implementation of `PKPatternMatchDel` in `src/storage/src/redis_strings.cc` rg --context 80 --max-count 1 --no-heading "rocksdb::Status Redis::PKPatternMatchDel" src/storage/src/redis_strings.ccLength of output: 5580
src/storage/tests/keys_test.cc (6)
2098-2608
: Comprehensive testing for PKPatternMatchDel across data types.The test cases cover various scenarios including basic deletions, deletions with patterns, and deletions with expired keys across different data types (Strings, Sets, Hashes, ZSets, Lists). The use of assertions after each operation to verify the expected outcomes is well implemented. However, consider adding negative test cases or handling scenarios where operations might fail to ensure robustness.
2098-2120
: Thorough testing for string data type in various scenarios.The tests are well-structured and ensure that the functionality works as expected under different conditions. Good use of pattern matching and expiration scenarios to test the robustness of the deletion logic.
Also applies to: 2121-2137, 2138-2156, 2157-2173, 2174-2185
2186-2201
: Effective testing for set data type across various deletion scenarios.The test cases for Sets follow a similar pattern to the String tests and effectively validate the deletion logic under different conditions, including handling of expired keys.
Also applies to: 2202-2218, 2219-2237, 2238-2254, 2255-2278
2292-2306
: Comprehensive testing for hash data type in PKPatternMatchDel.These tests ensure that the deletion logic for hashes is robust, testing both simple and complex scenarios including pattern matching and expired entries.
Also applies to: 2307-2323, 2324-2342, 2343-2359, 2360-2383
2396-2411
: Thorough testing for ZSet deletions in various scenarios.The ZSet tests are well-constructed, covering basic deletions, pattern-specific deletions, and handling of expired keys, ensuring the functionality is thoroughly vetted.
Also applies to: 2412-2428, 2429-2447, 2448-2464, 2465-2488
2501-2516
: Effective testing for list data type in PKPatternMatchDel.The tests for Lists are robust, covering various scenarios including pattern matching and handling of expired keys to ensure the deletion logic is thoroughly tested.
Also applies to: 2517-2533, 2534-2552, 2553-2569, 2570-2593
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/storage/src/base_filter.h (5 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/storage/src/base_filter.h
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/storage/src/base_filter.h (5 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/storage/src/base_filter.h
9eb9d69
to
c6f2035
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- src/storage/src/base_filter.h (5 hunks)
Files skipped from review as they are similar to previous changes (1)
- src/storage/src/base_filter.h
…ation#2726) * fix pkpatternmatchdel error --------- Co-authored-by: wangshaoyi <wangshaoyi@360.cn>
Summary by CodeRabbit
New Features
kStreams
, enabling more efficient handling of stream data within filters.Bug Fixes
Refactor
Enhancements