mirror of
http://github.com/valkey-io/valkey
synced 2024-11-21 16:46:15 +00:00
Add a filter option to drop all cluster packets (#1252)
A minor debugging change that helped in the investigation of https://github.com/valkey-io/valkey/issues/1251. Basically there are some edge cases where we want to fully isolate a note from receiving packets, but can't suspend the process because we need it to continue sending outbound traffic. So, added a filter for that. Signed-off-by: Madelyn Olson <madelyneolson@gmail.com>
This commit is contained in:
parent
a102852d5e
commit
3c32ee1bda
@ -2981,7 +2981,7 @@ int clusterIsValidPacket(clusterLink *link) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (type == server.cluster_drop_packet_filter) {
|
||||
if (type == server.cluster_drop_packet_filter || server.cluster_drop_packet_filter == -2) {
|
||||
serverLog(LL_WARNING, "Dropping packet that matches debug drop filter");
|
||||
return 0;
|
||||
}
|
||||
@ -3070,7 +3070,8 @@ int clusterProcessPacket(clusterLink *link) {
|
||||
if (!clusterIsValidPacket(link)) {
|
||||
clusterMsg *hdr = (clusterMsg *)link->rcvbuf;
|
||||
uint16_t type = ntohs(hdr->type);
|
||||
if (server.debug_cluster_close_link_on_packet_drop && type == server.cluster_drop_packet_filter) {
|
||||
if (server.debug_cluster_close_link_on_packet_drop &&
|
||||
(type == server.cluster_drop_packet_filter || server.cluster_drop_packet_filter == -2)) {
|
||||
freeClusterLink(link);
|
||||
serverLog(LL_WARNING, "Closing link for matching packet type %hu", type);
|
||||
return 0;
|
||||
|
@ -432,7 +432,7 @@ void debugCommand(client *c) {
|
||||
" Some fields of the default behavior may be time consuming to fetch,",
|
||||
" and `fast` can be passed to avoid fetching them.",
|
||||
"DROP-CLUSTER-PACKET-FILTER <packet-type>",
|
||||
" Drop all packets that match the filtered type. Set to -1 allow all packets.",
|
||||
" Drop all packets that match the filtered type. Set to -1 allow all packets or -2 to drop all packets.",
|
||||
"CLOSE-CLUSTER-LINK-ON-PACKET-DROP <0|1>",
|
||||
" This is valid only when DROP-CLUSTER-PACKET-FILTER is set to a valid packet type.",
|
||||
" When set to 1, the cluster link is closed after dropping a packet based on the filter.",
|
||||
|
Loading…
Reference in New Issue
Block a user