2024-03-21 09:30:47 -04:00
# SPDX-FileCopyrightText: 2024 Redict Contributors
# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo <antirez at gmail dot com>
#
# SPDX-License-Identifier: BSD-3-Clause
2024-03-21 15:11:44 -04:00
# SPDX-License-Identifier: LGPL-3.0-only
2024-03-21 09:30:47 -04:00
2011-07-11 10:04:18 -04:00
start_server { tags { " s l o w l o g " } overrides { slowlog-log-slower-than 1000000 } } {
2011-07-01 09:49:17 -04:00
test { SLOWLOG - check that it starts with an empty log} {
2021-06-09 08:13:24 -04:00
if { $::external } {
r slowlog reset
}
2011-07-01 09:49:17 -04:00
r slowlog len
} { 0 }
test { SLOWLOG - only logs commands taking more time than specified} {
r config set slowlog-log-slower-than 100000
r ping
assert_equal [ r slowlog len] 0
r debug sleep 0.2
assert_equal [ r slowlog len] 1
2021-06-09 08:13:24 -04:00
} { } { needs : debug}
2011-07-01 09:49:17 -04:00
2024-01-22 19:01:04 -05:00
test { SLOWLOG - zero max length is correctly handled} {
r SLOWLOG reset
r config set slowlog-max-len 0
r config set slowlog-log-slower-than 0
for { set i 0 } { $i < 100 } { incr i} {
r ping
}
r slowlog len
} { 0 }
2011-07-01 09:49:17 -04:00
test { SLOWLOG - max entries is correctly handled} {
r config set slowlog-log-slower-than 0
r config set slowlog-max-len 10
for { set i 0 } { $i < 100 } { incr i} {
r ping
}
r slowlog len
} { 10 }
test { SLOWLOG - GET optional argument to limit output len works} {
2023-12-13 08:28:13 -05:00
2023-04-25 03:17:21 -04:00
assert_equal 5 [ llength [ r slowlog get 5 ] ]
assert_equal 10 [ llength [ r slowlog get - 1 ] ]
assert_equal 10 [ llength [ r slowlog get 20 ] ]
}
2011-07-01 09:49:17 -04:00
test { SLOWLOG - RESET subcommand works} {
r config set slowlog-log-slower-than 100000
r slowlog reset
r slowlog len
} { 0 }
test { SLOWLOG - logged entry sanity check} {
2017-06-15 06:57:54 -04:00
r client setname foobar
2011-07-01 09:49:17 -04:00
r debug sleep 0.2
set e [ lindex [ r slowlog get] 0 ]
2017-06-15 06:57:54 -04:00
assert_equal [ llength $e ] 6
2021-06-09 08:13:24 -04:00
if { ! $::external } {
2024-01-22 19:01:04 -05:00
assert_equal [ lindex $e 0 ] 106
2021-06-09 08:13:24 -04:00
}
2011-07-01 09:49:17 -04:00
assert_equal [ expr { [ lindex $e 2 ] > 100000 } ] 1
assert_equal [ lindex $e 3 ] { debug sleep 0.2 }
2017-06-15 06:57:54 -04:00
assert_equal { foobar } [ lindex $e 5 ]
2021-06-09 08:13:24 -04:00
} { } { needs : debug}
2012-04-21 13:20:03 -04:00
2021-03-16 01:00:29 -04:00
test { SLOWLOG - Certain commands are omitted that contain sensitive information} {
2023-12-13 08:28:13 -05:00
r config set slowlog-max-len 100
2021-03-16 01:00:29 -04:00
r config set slowlog-log-slower-than 0
r slowlog reset
2021-12-13 11:39:04 -05:00
catch { r acl setuser " s l o w l o g t e s t u s e r " + get + set} _
2023-12-13 08:28:13 -05:00
r config set masteruser " "
2021-03-16 01:00:29 -04:00
r config set masterauth " "
2023-12-13 08:28:13 -05:00
r config set requirepass " "
r config set tls-key-file-pass " "
r config set tls-client-key-file-pass " "
2021-05-19 11:23:54 -04:00
r acl setuser slowlog-test-user + get + set
2023-12-13 08:28:13 -05:00
r acl getuser slowlog-test-user
r acl deluser slowlog-test-user non-existing-user
2021-03-16 01:00:29 -04:00
r config set slowlog-log-slower-than 0
2022-04-24 05:16:30 -04:00
r config set slowlog-log-slower-than - 1
2023-12-13 08:28:13 -05:00
set slowlog_resp [ r slowlog get - 1 ]
2021-03-16 01:00:29 -04:00
# Make sure normal configs work, but the two sensitive
2021-05-19 11:23:54 -04:00
# commands are omitted or redacted
2023-12-13 08:28:13 -05:00
assert_equal 11 [ llength $slowlog_resp ]
assert_equal { slowlog reset} [ lindex [ lindex $slowlog_resp 10 ] 3 ]
assert_equal { acl setuser ( redacted ) ( redacted ) ( redacted ) } [ lindex [ lindex $slowlog_resp 9 ] 3 ]
assert_equal { config set masteruser ( redacted ) } [ lindex [ lindex $slowlog_resp 8 ] 3 ]
assert_equal { config set masterauth ( redacted ) } [ lindex [ lindex $slowlog_resp 7 ] 3 ]
assert_equal { config set requirepass ( redacted ) } [ lindex [ lindex $slowlog_resp 6 ] 3 ]
assert_equal { config set tls-key-file-pass ( redacted ) } [ lindex [ lindex $slowlog_resp 5 ] 3 ]
assert_equal { config set tls-client-key-file-pass ( redacted ) } [ lindex [ lindex $slowlog_resp 4 ] 3 ]
2022-04-24 05:16:30 -04:00
assert_equal { acl setuser ( redacted ) ( redacted ) ( redacted ) } [ lindex [ lindex $slowlog_resp 3 ] 3 ]
2023-12-13 08:28:13 -05:00
assert_equal { acl getuser ( redacted ) } [ lindex [ lindex $slowlog_resp 2 ] 3 ]
assert_equal { acl deluser ( redacted ) ( redacted ) } [ lindex [ lindex $slowlog_resp 1 ] 3 ]
2022-04-24 05:16:30 -04:00
assert_equal { config set slowlog-log-slower-than 0 } [ lindex [ lindex $slowlog_resp 0 ] 3 ]
2021-06-09 08:13:24 -04:00
} { } { needs : repl}
2021-03-16 01:00:29 -04:00
2021-05-19 11:23:54 -04:00
test { SLOWLOG - Some commands can redact sensitive fields} {
r config set slowlog-log-slower-than 0
r slowlog reset
r migrate [ srv 0 host] [ srv 0 port] key 9 5000
r migrate [ srv 0 host] [ srv 0 port] key 9 5000 AUTH user
r migrate [ srv 0 host] [ srv 0 port] key 9 5000 AUTH2 user password
2022-04-24 05:16:30 -04:00
r config set slowlog-log-slower-than - 1
set slowlog_resp [ r slowlog get]
2021-05-19 11:23:54 -04:00
# Make sure all 3 commands were logged, but the sensitive fields are omitted
2022-04-24 05:16:30 -04:00
assert_equal 4 [ llength $slowlog_resp ]
assert_match { * key 9 5000 } [ lindex [ lindex $slowlog_resp 2 ] 3 ]
assert_match { * key 9 5000 AUTH ( redacted ) } [ lindex [ lindex $slowlog_resp 1 ] 3 ]
assert_match { * key 9 5000 AUTH2 ( redacted ) ( redacted ) } [ lindex [ lindex $slowlog_resp 0 ] 3 ]
2021-06-09 08:13:24 -04:00
} { } { needs : repl}
2021-05-19 11:23:54 -04:00
2020-11-10 16:50:03 -05:00
test { SLOWLOG - Rewritten commands are logged as their original command} {
r config set slowlog-log-slower-than 0
# Test rewriting client arguments
r sadd set a b c d e
r slowlog reset
# SPOP is rewritten as DEL when all keys are removed
r spop set 10
assert_equal { spop set 10 } [ lindex [ lindex [ r slowlog get] 0 ] 3 ]
# Test replacing client arguments
r slowlog reset
# GEOADD is replicated as ZADD
r geoadd cool-cities - 122.33207 47.60621 Seattle
assert_equal { geoadd cool-cities - 122.33207 47.60621 Seattle} [ lindex [ lindex [ r slowlog get] 0 ] 3 ]
# Test replacing a single command argument
r set A 5
r slowlog reset
# GETSET is replicated as SET
r getset a 5
assert_equal { getset a 5 } [ lindex [ lindex [ r slowlog get] 0 ] 3 ]
# INCRBYFLOAT calls rewrite multiple times, so it's a special case
r set A 0
r slowlog reset
# INCRBYFLOAT is replicated as SET
r INCRBYFLOAT A 1.0
assert_equal { INCRBYFLOAT A 1.0 } [ lindex [ lindex [ r slowlog get] 0 ] 3 ]
2021-03-25 04:20:27 -04:00
# blocked BLPOP is replicated as LPOP
2024-03-21 05:56:59 -04:00
set rd [ redict_deferring_client ]
2021-03-25 04:20:27 -04:00
$rd blpop l 0
2021-06-09 08:13:24 -04:00
wait_for_blocked_clients_count 1 50 100
2021-03-25 04:20:27 -04:00
r multi
r lpush l foo
r slowlog reset
r exec
$rd read
$rd close
assert_equal { blpop l 0 } [ lindex [ lindex [ r slowlog get] 0 ] 3 ]
2020-11-10 16:50:03 -05:00
}
2012-04-21 13:20:03 -04:00
test { SLOWLOG - commands with too many arguments are trimmed} {
r config set slowlog-log-slower-than 0
r slowlog reset
r sadd set 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
2021-06-09 08:13:24 -04:00
set e [ lindex [ r slowlog get] end-1]
2012-04-21 13:20:03 -04:00
lindex $e 3
} { sadd set 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 { ... ( 2 more arguments) } }
test { SLOWLOG - too long arguments are trimmed} {
r config set slowlog-log-slower-than 0
r slowlog reset
set arg [ string repeat A 129 ]
r sadd set foo $arg
2021-06-09 08:13:24 -04:00
set e [ lindex [ r slowlog get] end-1]
2012-04-21 13:20:03 -04:00
lindex $e 3
} { sadd set foo { AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA... ( 1 more bytes) } }
2013-01-19 06:52:05 -05:00
test { SLOWLOG - EXEC is not logged, just executed commands} {
r config set slowlog-log-slower-than 100000
r slowlog reset
assert_equal [ r slowlog len] 0
r multi
r debug sleep 0.2
r exec
assert_equal [ r slowlog len] 1
set e [ lindex [ r slowlog get] 0 ]
assert_equal [ lindex $e 3 ] { debug sleep 0.2 }
2021-06-09 08:13:24 -04:00
} { } { needs : debug}
2017-06-15 06:57:54 -04:00
2020-11-08 01:32:38 -05:00
test { SLOWLOG - can clean older entries} {
2017-06-15 06:57:54 -04:00
r client setname lastentry_client
r config set slowlog-max-len 1
r debug sleep 0.2
assert { [ llength [ r slowlog get] ] == 1 }
set e [ lindex [ r slowlog get] 0 ]
assert_equal { lastentry_client } [ lindex $e 5 ]
2021-06-09 08:13:24 -04:00
} { } { needs : debug}
2018-07-13 05:51:06 -04:00
test { SLOWLOG - can be disabled} {
2019-05-14 10:54:59 -04:00
r config set slowlog-max-len 1
2018-07-13 05:51:06 -04:00
r config set slowlog-log-slower-than 1
r slowlog reset
2019-05-14 10:54:59 -04:00
r debug sleep 0.2
assert_equal [ r slowlog len] 1
2018-07-13 05:51:06 -04:00
r config set slowlog-log-slower-than - 1
r slowlog reset
r debug sleep 0.2
assert_equal [ r slowlog len] 0
2021-06-09 08:13:24 -04:00
} { } { needs : debug}
2021-06-14 09:46:45 -04:00
test { SLOWLOG - count must be >= - 1 } {
assert_error " E R R c o u n t s h o u l d b e g r e a t e r t h a n o r e q u a l t o - 1 " { r slowlog get - 2 }
assert_error " E R R c o u n t s h o u l d b e g r e a t e r t h a n o r e q u a l t o - 1 " { r slowlog get - 222 }
}
test { SLOWLOG - get all slow logs} {
r config set slowlog-log-slower-than 0
r config set slowlog-max-len 3
r slowlog reset
r set key test
r sadd set a b c
r incr num
r lpush list a
assert_equal [ r slowlog len] 3
assert_equal 0 [ llength [ r slowlog get 0 ] ]
assert_equal 1 [ llength [ r slowlog get 1 ] ]
assert_equal 3 [ llength [ r slowlog get - 1 ] ]
assert_equal 3 [ llength [ r slowlog get 3 ] ]
}
reprocess command when client is unblocked on keys (#11012)
*TL;DR*
---------------------------------------
Following the discussion over the issue [#7551](https://github.com/redis/redis/issues/7551)
We decided to refactor the client blocking code to eliminate some of the code duplications
and to rebuild the infrastructure better for future key blocking cases.
*In this PR*
---------------------------------------
1. reprocess the command once a client becomes unblocked on key (instead of running
custom code for the unblocked path that's different than the one that would have run if
blocking wasn't needed)
2. eliminate some (now) irrelevant code for handling unblocking lists/zsets/streams etc...
3. modify some tests to intercept the error in cases of error on reprocess after unblock (see
details in the notes section below)
4. replace '$' on the client argv with current stream id. Since once we reprocess the stream
XREAD we need to read from the last msg and not wait for new msg in order to prevent
endless block loop.
5. Added statistics to the info "Clients" section to report the:
* `total_blocking_keys` - number of blocking keys
* `total_blocking_keys_on_nokey` - number of blocking keys which have at least 1 client
which would like
to be unblocked on when the key is deleted.
6. Avoid expiring unblocked key during unblock. Previously we used to lookup the unblocked key
which might have been expired during the lookup. Now we lookup the key using NOTOUCH and
NOEXPIRE to avoid deleting it at this point, so propagating commands in blocked.c is no longer needed.
7. deprecated command flags. We decided to remove the CMD_CALL_STATS and CMD_CALL_SLOWLOG
and make an explicit verification in the call() function in order to decide if stats update should take place.
This should simplify the logic and also mitigate existing issues: for example module calls which are
triggered as part of AOF loading might still report stats even though they are called during AOF loading.
*Behavior changes*
---------------------------------------------------
1. As this implementation prevents writing dedicated code handling unblocked streams/lists/zsets,
since we now re-process the command once the client is unblocked some errors will be reported differently.
The old implementation used to issue
``UNBLOCKED the stream key no longer exists``
in the following cases:
- The stream key has been deleted (ie. calling DEL)
- The stream and group existed but the key type was changed by overriding it (ie. with set command)
- The key not longer exists after we swapdb with a db which does not contains this key
- After swapdb when the new db has this key but with different type.
In the new implementation the reported errors will be the same as if the command was processed after effect:
**NOGROUP** - in case key no longer exists, or **WRONGTYPE** in case the key was overridden with a different type.
2. Reprocessing the command means that some checks will be reevaluated once the
client is unblocked.
For example, ACL rules might change since the command originally was executed and
will fail once the client is unblocked.
Another example is OOM condition checks which might enable the command to run and
block but fail the command reprocess once the client is unblocked.
3. One of the changes in this PR is that no command stats are being updated once the
command is blocked (all stats will be updated once the client is unblocked). This implies
that when we have many clients blocked, users will no longer be able to get that information
from the command stats. However the information can still be gathered from the client list.
**Client blocking**
---------------------------------------------------
the blocking on key will still be triggered the same way as it is done today.
in order to block the current client on list of keys, the call to
blockForKeys will still need to be made which will perform the same as it is today:
* add the client to the list of blocked clients on each key
* keep the key with a matching list node (position in the global blocking clients list for that key)
in the client private blocking key dict.
* flag the client with CLIENT_BLOCKED
* update blocking statistics
* register the client on the timeout table
**Key Unblock**
---------------------------------------------------
Unblocking a specific key will be triggered (same as today) by calling signalKeyAsReady.
the implementation in that part will stay the same as today - adding the key to the global readyList.
The reason to maintain the readyList (as apposed to iterating over all clients blocked on the specific key)
is in order to keep the signal operation as short as possible, since it is called during the command processing.
The main change is that instead of going through a dedicated code path that operates the blocked command
we will just call processPendingCommandsAndResetClient.
**ClientUnblock (keys)**
---------------------------------------------------
1. Unblocking clients on keys will be triggered after command is
processed and during the beforeSleep
8. the general schema is:
9. For each key *k* in the readyList:
```
For each client *c* which is blocked on *k*:
in case either:
1. *k* exists AND the *k* type matches the current client blocking type
OR
2. *k* exists and *c* is blocked on module command
OR
3. *k* does not exists and *c* was blocked with the flag
unblock_on_deleted_key
do:
1. remove the client from the list of clients blocked on this key
2. remove the blocking list node from the client blocking key dict
3. remove the client from the timeout list
10. queue the client on the unblocked_clients list
11. *NEW*: call processCommandAndResetClient(c);
```
*NOTE:* for module blocked clients we will still call the moduleUnblockClientByHandle
which will queue the client for processing in moduleUnblockedClients list.
**Process Unblocked clients**
---------------------------------------------------
The process of all unblocked clients is done in the beforeSleep and no change is planned
in that part.
The general schema will be:
For each client *c* in server.unblocked_clients:
* remove client from the server.unblocked_clients
* set back the client readHandler
* continue processing the pending command and input buffer.
*Some notes regarding the new implementation*
---------------------------------------------------
1. Although it was proposed, it is currently difficult to remove the
read handler from the client while it is blocked.
The reason is that a blocked client should be unblocked when it is
disconnected, or we might consume data into void.
2. While this PR mainly keep the current blocking logic as-is, there
might be some future additions to the infrastructure that we would
like to have:
- allow non-preemptive blocking of client - sometimes we can think
that a new kind of blocking can be expected to not be preempt. for
example lets imagine we hold some keys on disk and when a command
needs to process them it will block until the keys are uploaded.
in this case we will want the client to not disconnect or be
unblocked until the process is completed (remove the client read
handler, prevent client timeout, disable unblock via debug command etc...).
- allow generic blocking based on command declared keys - we might
want to add a hook before command processing to check if any of the
declared keys require the command to block. this way it would be
easier to add new kinds of key-based blocking mechanisms.
Co-authored-by: Oran Agra <oran@redislabs.com>
Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
2023-01-01 16:35:42 -05:00
test { SLOWLOG - blocking command is reported only after unblocked} {
# Cleanup first
r del mylist
# create a test client
2024-03-21 05:56:59 -04:00
set rd [ redict_deferring_client ]
reprocess command when client is unblocked on keys (#11012)
*TL;DR*
---------------------------------------
Following the discussion over the issue [#7551](https://github.com/redis/redis/issues/7551)
We decided to refactor the client blocking code to eliminate some of the code duplications
and to rebuild the infrastructure better for future key blocking cases.
*In this PR*
---------------------------------------
1. reprocess the command once a client becomes unblocked on key (instead of running
custom code for the unblocked path that's different than the one that would have run if
blocking wasn't needed)
2. eliminate some (now) irrelevant code for handling unblocking lists/zsets/streams etc...
3. modify some tests to intercept the error in cases of error on reprocess after unblock (see
details in the notes section below)
4. replace '$' on the client argv with current stream id. Since once we reprocess the stream
XREAD we need to read from the last msg and not wait for new msg in order to prevent
endless block loop.
5. Added statistics to the info "Clients" section to report the:
* `total_blocking_keys` - number of blocking keys
* `total_blocking_keys_on_nokey` - number of blocking keys which have at least 1 client
which would like
to be unblocked on when the key is deleted.
6. Avoid expiring unblocked key during unblock. Previously we used to lookup the unblocked key
which might have been expired during the lookup. Now we lookup the key using NOTOUCH and
NOEXPIRE to avoid deleting it at this point, so propagating commands in blocked.c is no longer needed.
7. deprecated command flags. We decided to remove the CMD_CALL_STATS and CMD_CALL_SLOWLOG
and make an explicit verification in the call() function in order to decide if stats update should take place.
This should simplify the logic and also mitigate existing issues: for example module calls which are
triggered as part of AOF loading might still report stats even though they are called during AOF loading.
*Behavior changes*
---------------------------------------------------
1. As this implementation prevents writing dedicated code handling unblocked streams/lists/zsets,
since we now re-process the command once the client is unblocked some errors will be reported differently.
The old implementation used to issue
``UNBLOCKED the stream key no longer exists``
in the following cases:
- The stream key has been deleted (ie. calling DEL)
- The stream and group existed but the key type was changed by overriding it (ie. with set command)
- The key not longer exists after we swapdb with a db which does not contains this key
- After swapdb when the new db has this key but with different type.
In the new implementation the reported errors will be the same as if the command was processed after effect:
**NOGROUP** - in case key no longer exists, or **WRONGTYPE** in case the key was overridden with a different type.
2. Reprocessing the command means that some checks will be reevaluated once the
client is unblocked.
For example, ACL rules might change since the command originally was executed and
will fail once the client is unblocked.
Another example is OOM condition checks which might enable the command to run and
block but fail the command reprocess once the client is unblocked.
3. One of the changes in this PR is that no command stats are being updated once the
command is blocked (all stats will be updated once the client is unblocked). This implies
that when we have many clients blocked, users will no longer be able to get that information
from the command stats. However the information can still be gathered from the client list.
**Client blocking**
---------------------------------------------------
the blocking on key will still be triggered the same way as it is done today.
in order to block the current client on list of keys, the call to
blockForKeys will still need to be made which will perform the same as it is today:
* add the client to the list of blocked clients on each key
* keep the key with a matching list node (position in the global blocking clients list for that key)
in the client private blocking key dict.
* flag the client with CLIENT_BLOCKED
* update blocking statistics
* register the client on the timeout table
**Key Unblock**
---------------------------------------------------
Unblocking a specific key will be triggered (same as today) by calling signalKeyAsReady.
the implementation in that part will stay the same as today - adding the key to the global readyList.
The reason to maintain the readyList (as apposed to iterating over all clients blocked on the specific key)
is in order to keep the signal operation as short as possible, since it is called during the command processing.
The main change is that instead of going through a dedicated code path that operates the blocked command
we will just call processPendingCommandsAndResetClient.
**ClientUnblock (keys)**
---------------------------------------------------
1. Unblocking clients on keys will be triggered after command is
processed and during the beforeSleep
8. the general schema is:
9. For each key *k* in the readyList:
```
For each client *c* which is blocked on *k*:
in case either:
1. *k* exists AND the *k* type matches the current client blocking type
OR
2. *k* exists and *c* is blocked on module command
OR
3. *k* does not exists and *c* was blocked with the flag
unblock_on_deleted_key
do:
1. remove the client from the list of clients blocked on this key
2. remove the blocking list node from the client blocking key dict
3. remove the client from the timeout list
10. queue the client on the unblocked_clients list
11. *NEW*: call processCommandAndResetClient(c);
```
*NOTE:* for module blocked clients we will still call the moduleUnblockClientByHandle
which will queue the client for processing in moduleUnblockedClients list.
**Process Unblocked clients**
---------------------------------------------------
The process of all unblocked clients is done in the beforeSleep and no change is planned
in that part.
The general schema will be:
For each client *c* in server.unblocked_clients:
* remove client from the server.unblocked_clients
* set back the client readHandler
* continue processing the pending command and input buffer.
*Some notes regarding the new implementation*
---------------------------------------------------
1. Although it was proposed, it is currently difficult to remove the
read handler from the client while it is blocked.
The reason is that a blocked client should be unblocked when it is
disconnected, or we might consume data into void.
2. While this PR mainly keep the current blocking logic as-is, there
might be some future additions to the infrastructure that we would
like to have:
- allow non-preemptive blocking of client - sometimes we can think
that a new kind of blocking can be expected to not be preempt. for
example lets imagine we hold some keys on disk and when a command
needs to process them it will block until the keys are uploaded.
in this case we will want the client to not disconnect or be
unblocked until the process is completed (remove the client read
handler, prevent client timeout, disable unblock via debug command etc...).
- allow generic blocking based on command declared keys - we might
want to add a hook before command processing to check if any of the
declared keys require the command to block. this way it would be
easier to add new kinds of key-based blocking mechanisms.
Co-authored-by: Oran Agra <oran@redislabs.com>
Signed-off-by: Ran Shidlansik <ranshid@amazon.com>
2023-01-01 16:35:42 -05:00
# config the slowlog and reset
r config set slowlog-log-slower-than 0
r config set slowlog-max-len 110
r slowlog reset
$rd BLPOP mylist 0
wait_for_blocked_clients_count 1 50 20
assert_equal 0 [ llength [ regexp - all - inline ( ? = BLPOP ) [ r slowlog get] ] ]
r LPUSH mylist 1
wait_for_blocked_clients_count 0 50 20
assert_equal 1 [ llength [ regexp - all - inline ( ? = BLPOP ) [ r slowlog get] ] ]
$rd close
}
2022-04-24 05:16:30 -04:00
}