Skip to content

Commit

Permalink
fix: regression in squashing code when determining eval commands (#4116)
Browse files Browse the repository at this point in the history
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 <[email protected]>
Co-authored-by: Kostas Kyrimis <[email protected]>
  • Loading branch information
romange and kostasrim committed Nov 11, 2024
1 parent a506795 commit ea85354
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/server/main_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1491,15 +1491,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();

Expand Down
10 changes: 10 additions & 0 deletions tests/dragonfly/connection_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ea85354

Please sign in to comment.