1
0
Fork 0
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:
Roman Gershman 2024-11-11 21:54:47 +02:00 committed by GitHub
parent 0facd6fd8f
commit fa8f3f5564
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 3 deletions

View file

@ -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 // MULTI...EXEC commands need to be collected into a single context, so squashing is not
// possible // possible
const bool is_multi = const bool is_multi = dfly_cntx->conn_state.exec_info.IsCollecting() || CO::IsTransKind(cmd);
dfly_cntx->conn_state.exec_info.IsCollecting() || CO::IsTransKind(ArgS(args, 0));
// Generally, executing any multi-transactions (including eval) is not possible because they // 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. // 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 // 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 // invocations, we can potentially execute multiple eval in parallel, which is very powerful
// paired with shardlocal eval // 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(); const bool is_blocking = cid != nullptr && cid->IsBlocking();

View file

@ -783,6 +783,16 @@ async def test_tls_reject(
await client.ping() 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}) @dfly_args({"proactor_threads": "4", "pipeline_squash": 10})
async def test_squashed_pipeline(async_client: aioredis.Redis): async def test_squashed_pipeline(async_client: aioredis.Redis):
p = async_client.pipeline(transaction=False) p = async_client.pipeline(transaction=False)