support negative filtering for client command filters#2378
support negative filtering for client command filters#2378soloestoy merged 3 commits intovalkey-io:unstablefrom
Conversation
Signed-off-by: zhaozhao.zz <[email protected]>
Signed-off-by: zhaozhao.zz <[email protected]>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #2378 +/- ##
============================================
+ Coverage 71.41% 71.53% +0.11%
============================================
Files 123 123
Lines 67132 67282 +150
============================================
+ Hits 47942 48129 +187
+ Misses 19190 19153 -37
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull Request Overview
This PR introduces comprehensive negative filtering support for CLIENT LIST and CLIENT KILL commands, adding 14 new NOT-* filter types that exclude clients matching specified criteria instead of including them. The implementation allows combining positive and negative filters for more granular client management.
Key changes:
- Added 14 new negative filter types (NOT-ID, NOT-MAXAGE, NOT-TYPE, etc.) for both CLIENT LIST and CLIENT KILL commands
- Extended the clientFilter structure to support parallel negative filtering fields
- Updated command documentation and argument definitions to reflect the new capabilities
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/networking.c | Core implementation of negative filtering logic in clientFilter struct and parsing/matching functions |
| tests/unit/introspection.tcl | Comprehensive test coverage for all new negative filter types and combinations |
| src/commands/client-list.json | Command specification updates for CLIENT LIST negative filters |
| src/commands/client-kill.json | Command specification updates for CLIENT KILL negative filters |
| src/commands.def | Command definition updates including argument counts and structures |
madolson
left a comment
There was a problem hiding this comment.
One high level comment, but the code looked mostly good. I liked some of the other improvements you made as well.
Signed-off-by: zhaozhao.zz <[email protected]>
|
@soloestoy it will need similar changes like #2362 right? |
it would introduce breaking change and needs further discussion, we can decide later |
for valkey-io/valkey#2378 --------- Signed-off-by: zhaozhao.zz <[email protected]> Co-authored-by: Viktor Söderqvist <[email protected]>
introduce negative filters for
CLIENT LISTandCLIENT KILLcommands:NOT-ID: Excludes clients in the IDs setNOT-TYPE: Excludes clients of the specified typeNOT-ADDR: Excludes clients of the specified address and portNOT-LADDR: Excludes clients connected to the specified local address and portNOT-USER: Excludes clients of the specified userNOT-FLAGS: Excludes clients with the specified flag stringNOT-NAME: Excludes clients with the specified nameNOT-LIB-NAME: Excludes clients using the specified library nameNOT-LIB-VER: Excludes clients with the specified library versionNOT-DB: Excludes clients with the specified database IDNOT-CAPA: Excludes clients with the specified capabilitiesNOT-IP: Excludes clients with the specified IP addressclose #1936
and fix the matching algorithm for flag 'N'.