mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
fix: regression in squashing code when determining eval commands (#4116)
The regression was caused by #3947 and it causes crashes in bullmq. It has not been found till now because python client sends commands in uppercase. Fixes #4113 Signed-off-by: Roman Gershman <roman@dragonflydb.io> Co-authored-by: Kostas Kyrimis <kostas@dragonflydb.io>
This commit is contained in:
parent
0facd6fd8f
commit
fa8f3f5564
2 changed files with 12 additions and 3 deletions
|
@ -1426,15 +1426,14 @@ size_t Service::DispatchManyCommands(absl::Span<CmdArgList> args_list, SinkReply
|
|||
|
||||
// MULTI...EXEC commands need to be collected into a single context, so squashing is not
|
||||
// possible
|
||||
const bool is_multi =
|
||||
dfly_cntx->conn_state.exec_info.IsCollecting() || CO::IsTransKind(ArgS(args, 0));
|
||||
const bool is_multi = dfly_cntx->conn_state.exec_info.IsCollecting() || CO::IsTransKind(cmd);
|
||||
|
||||
// Generally, executing any multi-transactions (including eval) is not possible because they
|
||||
// might request a stricter multi mode than non-atomic which is used for squashing.
|
||||
// TODO: By allowing promoting non-atomic multit transactions to lock-ahead for specific command
|
||||
// invocations, we can potentially execute multiple eval in parallel, which is very powerful
|
||||
// paired with shardlocal eval
|
||||
const bool is_eval = CO::IsEvalKind(ArgS(args, 0));
|
||||
const bool is_eval = CO::IsEvalKind(cmd);
|
||||
|
||||
const bool is_blocking = cid != nullptr && cid->IsBlocking();
|
||||
|
||||
|
|
|
@ -783,6 +783,16 @@ async def test_tls_reject(
|
|||
await client.ping()
|
||||
|
||||
|
||||
@dfly_args({"proactor_threads": "4", "pipeline_squash": 1})
|
||||
async def test_squashed_pipeline_eval(async_client: aioredis.Redis):
|
||||
p = async_client.pipeline(transaction=False)
|
||||
for _ in range(5):
|
||||
# Deliberately lowcase EVAL to test that it is not squashed
|
||||
p.execute_command("eval", "return redis.call('set', KEYS[1], 'value')", 1, "key")
|
||||
res = await p.execute()
|
||||
assert res == ["OK"] * 5
|
||||
|
||||
|
||||
@dfly_args({"proactor_threads": "4", "pipeline_squash": 10})
|
||||
async def test_squashed_pipeline(async_client: aioredis.Redis):
|
||||
p = async_client.pipeline(transaction=False)
|
||||
|
|
Loading…
Reference in a new issue