Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
c5362fa
supporting more filters for Client List and Client Kill
sarthakaggarwal97 Dec 20, 2024
90bbfc5
rebasing with updated client command
sarthakaggarwal97 Jan 15, 2025
e39704b
renaming pattern, channel, shard-channel
sarthakaggarwal97 Jan 15, 2025
7fdb526
support additional filters like db, tot-net-out, tot-net-in, lib-name…
sarthakaggarwal97 Jan 21, 2025
c1ec68c
skipping db tests in cluster mode
sarthakaggarwal97 Jan 21, 2025
6f9e270
idle refactor
sarthakaggarwal97 Mar 17, 2025
defc621
error upon invalid flag
sarthakaggarwal97 Mar 17, 2025
b5b5eea
clang format
sarthakaggarwal97 Mar 17, 2025
80c0f5b
removed unnecessary edits
sarthakaggarwal97 Mar 17, 2025
37ff080
amending some tests
sarthakaggarwal97 Mar 17, 2025
23929bc
addressing comments
sarthakaggarwal97 Mar 18, 2025
1eb6ff3
fix test
sarthakaggarwal97 Mar 18, 2025
4425e97
removing pubsub filters
sarthakaggarwal97 Mar 18, 2025
a51a525
addressing comments
sarthakaggarwal97 Mar 21, 2025
eaef81b
addressing review comments
sarthakaggarwal97 Apr 2, 2025
bb2ff42
minidle fix
sarthakaggarwal97 Apr 7, 2025
bc355eb
removing total-net-in total-net-out filters
sarthakaggarwal97 Apr 7, 2025
ecf51b5
minor nits
sarthakaggarwal97 Apr 9, 2025
1347cdb
supporting capa and ip filter
sarthakaggarwal97 Apr 10, 2025
4d71b74
help command update
sarthakaggarwal97 Apr 10, 2025
98cc88e
nit fix
sarthakaggarwal97 Apr 10, 2025
7699f5d
ip filter fix
sarthakaggarwal97 Apr 10, 2025
bb8832a
addressing comments
sarthakaggarwal97 Apr 11, 2025
ce6af68
Cleanup idle time filter
hpatro Apr 14, 2025
139050b
Fix filter by db test
hpatro Apr 14, 2025
0d59586
Update src/networking.c
hpatro Apr 14, 2025
a670bfc
Set client filters to NULL after free
hpatro Apr 14, 2025
4b7d0d7
tls test fix
sarthakaggarwal97 Apr 14, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions src/commands.def
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,7 @@ commandHistory CLIENT_KILL_History[] = {
{"8.0.0","`MAXAGE` option."},
{"8.0.0","Replaced `master` `TYPE` with `primary`. `master` still supported for backward compatibility."},
{"8.1.0","`ID` option accepts multiple IDs."},
{"9.0.0","Added filters NAME, IDLE, FLAGS, LIB-NAME, LIB-VER, DB, CAPA, and IP."},
};
#endif

Expand Down Expand Up @@ -1342,12 +1343,20 @@ struct COMMAND_ARG CLIENT_KILL_filter_new_format_Subargs[] = {
{MAKE_ARG("laddr",ARG_TYPE_STRING,-1,"LADDR",NULL,"6.2.0",CMD_ARG_OPTIONAL,0,NULL),.display_text="ip:port"},
{MAKE_ARG("skipme",ARG_TYPE_ONEOF,-1,"SKIPME",NULL,NULL,CMD_ARG_OPTIONAL,2,NULL),.subargs=CLIENT_KILL_filter_new_format_skipme_Subargs},
{MAKE_ARG("maxage",ARG_TYPE_INTEGER,-1,"MAXAGE",NULL,"8.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("name",ARG_TYPE_STRING,-1,"NAME",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("idle",ARG_TYPE_INTEGER,-1,"IDLE",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("flags",ARG_TYPE_STRING,-1,"FLAGS",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("lib-name",ARG_TYPE_STRING,-1,"LIB-NAME",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("lib-ver",ARG_TYPE_STRING,-1,"LIB-VER",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("db",ARG_TYPE_INTEGER,-1,"DB",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("capa",ARG_TYPE_STRING,-1,"CAPA",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("ip",ARG_TYPE_STRING,-1,"IP",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
};

/* CLIENT KILL filter argument table */
struct COMMAND_ARG CLIENT_KILL_filter_Subargs[] = {
{MAKE_ARG("old-format",ARG_TYPE_STRING,-1,NULL,NULL,NULL,CMD_ARG_NONE,0,"2.8.12"),.display_text="ip:port"},
{MAKE_ARG("new-format",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_MULTIPLE,7,NULL),.subargs=CLIENT_KILL_filter_new_format_Subargs},
{MAKE_ARG("new-format",ARG_TYPE_ONEOF,-1,NULL,NULL,NULL,CMD_ARG_MULTIPLE,15,NULL),.subargs=CLIENT_KILL_filter_new_format_Subargs},
};

/* CLIENT KILL argument table */
Expand All @@ -1367,7 +1376,8 @@ commandHistory CLIENT_LIST_History[] = {
{"7.0.0","Added `resp`, `multi-mem`, `rbs` and `rbp` fields."},
{"7.0.3","Added `ssub` field."},
{"8.0.0","Replaced `master` `TYPE` with `primary`. `master` still supported for backward compatibility."},
{"8.1.0","Added filters USER, ADDR, LADDR, SKIPME, and MAXAGE"},
{"8.1.0","Added filters USER, ADDR, LADDR, SKIPME, and MAXAGE."},
{"9.0.0","Added filters NAME, IDLE, FLAGS, LIB-NAME, LIB-VER, DB, CAPA, and IP."},
};
#endif

Expand Down Expand Up @@ -1406,6 +1416,14 @@ struct COMMAND_ARG CLIENT_LIST_Args[] = {
{MAKE_ARG("laddr",ARG_TYPE_STRING,-1,"LADDR",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL),.display_text="ip:port"},
{MAKE_ARG("skipme",ARG_TYPE_ONEOF,-1,"SKIPME",NULL,"8.1.0",CMD_ARG_OPTIONAL,2,NULL),.subargs=CLIENT_LIST_skipme_Subargs},
{MAKE_ARG("maxage",ARG_TYPE_INTEGER,-1,"MAXAGE",NULL,"8.1.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("name",ARG_TYPE_STRING,-1,"NAME",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("idle",ARG_TYPE_INTEGER,-1,"IDLE",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("flags",ARG_TYPE_STRING,-1,"FLAGS",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("lib-name",ARG_TYPE_STRING,-1,"LIB-NAME",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("lib-ver",ARG_TYPE_STRING,-1,"LIB-VER",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("db",ARG_TYPE_INTEGER,-1,"DB",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("capa",ARG_TYPE_STRING,-1,"CAPA",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
{MAKE_ARG("ip",ARG_TYPE_STRING,-1,"IP",NULL,"9.0.0",CMD_ARG_OPTIONAL,0,NULL)},
};

/********** CLIENT NO_EVICT ********************/
Expand Down Expand Up @@ -1687,8 +1705,8 @@ struct COMMAND_STRUCT CLIENT_Subcommands[] = {
{MAKE_CMD("id","Returns the unique client ID of the connection.","O(1)","5.0.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_ID_History,0,CLIENT_ID_Tips,0,clientIDCommand,2,CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_ID_Keyspecs,0,NULL,0)},
{MAKE_CMD("import-source","Mark this client as an import source when server is in import mode.","O(1)","8.1.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_IMPORT_SOURCE_History,0,CLIENT_IMPORT_SOURCE_Tips,0,clientImportSourceCommand,3,CMD_NOSCRIPT|CMD_LOADING|CMD_STALE,ACL_CATEGORY_CONNECTION,CLIENT_IMPORT_SOURCE_Keyspecs,0,NULL,1),.args=CLIENT_IMPORT_SOURCE_Args},
{MAKE_CMD("info","Returns information about the connection.","O(1)","6.2.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_INFO_History,0,CLIENT_INFO_Tips,1,clientInfoCommand,2,CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_INFO_Keyspecs,0,NULL,0)},
{MAKE_CMD("kill","Terminates open connections.","O(N) where N is the number of client connections","2.4.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_KILL_History,8,CLIENT_KILL_Tips,0,clientKillCommand,-3,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_KILL_Keyspecs,0,NULL,1),.args=CLIENT_KILL_Args},
{MAKE_CMD("list","Lists open connections.","O(N) where N is the number of client connections","2.4.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_LIST_History,8,CLIENT_LIST_Tips,1,clientListCommand,-2,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_LIST_Keyspecs,0,NULL,7),.args=CLIENT_LIST_Args},
{MAKE_CMD("kill","Terminates open connections.","O(N) where N is the number of client connections","2.4.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_KILL_History,9,CLIENT_KILL_Tips,0,clientKillCommand,-3,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_KILL_Keyspecs,0,NULL,1),.args=CLIENT_KILL_Args},
{MAKE_CMD("list","Lists open connections.","O(N) where N is the number of client connections","2.4.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_LIST_History,9,CLIENT_LIST_Tips,1,clientListCommand,-2,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_LIST_Keyspecs,0,NULL,15),.args=CLIENT_LIST_Args},
{MAKE_CMD("no-evict","Sets the client eviction mode of the connection.","O(1)","7.0.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_NO_EVICT_History,0,CLIENT_NO_EVICT_Tips,0,clientNoEvictCommand,3,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_NO_EVICT_Keyspecs,0,NULL,1),.args=CLIENT_NO_EVICT_Args},
{MAKE_CMD("no-touch","Controls whether commands sent by the client affect the LRU/LFU of accessed keys.","O(1)","7.2.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_NO_TOUCH_History,0,CLIENT_NO_TOUCH_Tips,0,clientNoTouchCommand,3,CMD_NOSCRIPT|CMD_LOADING|CMD_STALE,ACL_CATEGORY_CONNECTION,CLIENT_NO_TOUCH_Keyspecs,0,NULL,1),.args=CLIENT_NO_TOUCH_Args},
{MAKE_CMD("pause","Suspends commands processing.","O(1)","3.0.0",CMD_DOC_NONE,NULL,NULL,"connection",COMMAND_GROUP_CONNECTION,CLIENT_PAUSE_History,1,CLIENT_PAUSE_Tips,0,clientPauseCommand,-3,CMD_ADMIN|CMD_NOSCRIPT|CMD_LOADING|CMD_STALE|CMD_SENTINEL,ACL_CATEGORY_CONNECTION,CLIENT_PAUSE_Keyspecs,0,NULL,2),.args=CLIENT_PAUSE_Args},
Expand Down
60 changes: 60 additions & 0 deletions src/commands/client-kill.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@
[
"8.1.0",
"`ID` option accepts multiple IDs."
],
[
"9.0.0",
"Added filters NAME, IDLE, FLAGS, LIB-NAME, LIB-VER, DB, CAPA, and IP."
]
],
"command_flags": [
Expand Down Expand Up @@ -162,6 +166,62 @@
"type": "integer",
"optional": true,
"since": "8.0.0"
},
{
"token": "NAME",
"name": "name",
"type": "string",
"optional": true,
"since": "9.0.0"
},
{
"token": "IDLE",
"name": "idle",
"type": "integer",
"optional": true,
"since": "9.0.0"
},
{
"token": "FLAGS",
"name": "flags",
"type": "string",
"optional": true,
"since": "9.0.0"
},
{
"token": "LIB-NAME",
"name": "lib-name",
"type": "string",
"optional": true,
"since": "9.0.0"
},
{
"token": "LIB-VER",
"name": "lib-ver",
"type": "string",
"optional": true,
"since": "9.0.0"
},
{
"token": "DB",
"name": "db",
"type": "integer",
"optional": true,
"since": "9.0.0"
},
{
"token": "CAPA",
"name": "capa",
"type": "string",
"optional": true,
"since": "9.0.0"
},
{
"token": "IP",
"name": "ip",
"type": "string",
"optional": true,
"since": "9.0.0"
}
]
}
Expand Down
62 changes: 61 additions & 1 deletion src/commands/client-list.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@
],
[
"8.1.0",
"Added filters USER, ADDR, LADDR, SKIPME, and MAXAGE"
"Added filters USER, ADDR, LADDR, SKIPME, and MAXAGE."
],
[
"9.0.0",
"Added filters NAME, IDLE, FLAGS, LIB-NAME, LIB-VER, DB, CAPA, and IP."
]
],
"command_flags": [
Expand Down Expand Up @@ -144,6 +148,62 @@
"type": "integer",
"optional": true,
"since": "8.1.0"
},
{
"token": "NAME",
"name": "name",
"type": "string",
"optional": true,
"since": "9.0.0"
},
{
"token": "IDLE",
"name": "idle",
"type": "integer",
"optional": true,
"since": "9.0.0"
},
{
"token": "FLAGS",
"name": "flags",
"type": "string",
"optional": true,
"since": "9.0.0"
},
{
"token": "LIB-NAME",
"name": "lib-name",
"type": "string",
"optional": true,
"since": "9.0.0"
},
{
"token": "LIB-VER",
"name": "lib-ver",
"type": "string",
"optional": true,
"since": "9.0.0"
},
{
"token": "DB",
"name": "db",
"type": "integer",
"optional": true,
"since": "9.0.0"
},
{
"token": "CAPA",
"name": "capa",
"type": "string",
"optional": true,
"since": "9.0.0"
},
{
"token": "IP",
"name": "ip",
"type": "string",
"optional": true,
"since": "9.0.0"
}
]
}
Expand Down
Loading
Loading