mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2025-05-11 18:35:46 +02:00
fix: remove redundant ToLower call from the HSET function (#1141)
fix: remove redundant ToLower call from HSET function The call was left during big refactoring when we removed command name from the arguments slice passed to commands. Fixes #1140 Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
parent
ce5db032fc
commit
0b13eaa943
4 changed files with 11 additions and 7 deletions
|
@ -723,8 +723,7 @@ void GenericFamily::Expire(CmdArgList args, ConnectionContext* cntx) {
|
|||
}
|
||||
|
||||
if (int_arg > kMaxExpireDeadlineSec || int_arg < -kMaxExpireDeadlineSec) {
|
||||
ToLower(&args[0]);
|
||||
return (*cntx)->SendError(InvalidExpireTime(ArgS(args, 0)));
|
||||
return (*cntx)->SendError(InvalidExpireTime(cntx->cid->name()));
|
||||
}
|
||||
|
||||
int_arg = std::max(int_arg, -1L);
|
||||
|
|
|
@ -955,10 +955,11 @@ void HSetFamily::HScan(CmdArgList args, ConnectionContext* cntx) {
|
|||
|
||||
void HSetFamily::HSet(CmdArgList args, ConnectionContext* cntx) {
|
||||
string_view key = ArgS(args, 0);
|
||||
ToLower(&args[0]);
|
||||
|
||||
string_view cmd{cntx->cid->name()};
|
||||
|
||||
if (args.size() % 2 != 1) {
|
||||
return (*cntx)->SendError(facade::WrongNumArgsError("hset"), kSyntaxErrType);
|
||||
return (*cntx)->SendError(facade::WrongNumArgsError(cmd), kSyntaxErrType);
|
||||
}
|
||||
|
||||
args.remove_prefix(1);
|
||||
|
@ -967,7 +968,6 @@ void HSetFamily::HSet(CmdArgList args, ConnectionContext* cntx) {
|
|||
};
|
||||
|
||||
OpResult<uint32_t> result = cntx->transaction->ScheduleSingleHopT(std::move(cb));
|
||||
string_view cmd{cntx->cid->name()};
|
||||
|
||||
if (result && cmd == "HSET") {
|
||||
(*cntx)->SendLong(*result);
|
||||
|
|
|
@ -225,4 +225,10 @@ TEST_F(HSetFamilyTest, TriggerConvertToStrMap) {
|
|||
EXPECT_THAT(Run({"HLEN", "hk"}), IntArg(kElements));
|
||||
}
|
||||
|
||||
TEST_F(HSetFamilyTest, Issue1140) {
|
||||
Run({"HSET", "CaseKey", "Foo", "Bar"});
|
||||
|
||||
EXPECT_EQ("Bar", Run({"HGET", "CaseKey", "Foo"}));
|
||||
}
|
||||
|
||||
} // namespace dfly
|
||||
|
|
|
@ -1092,8 +1092,7 @@ void StringFamily::SetExGeneric(bool seconds, CmdArgList args, ConnectionContext
|
|||
}
|
||||
|
||||
if (unit_vals < 1 || unit_vals >= kMaxExpireDeadlineSec) {
|
||||
ToLower(&args[0]);
|
||||
return (*cntx)->SendError(InvalidExpireTime(ArgS(args, 0)));
|
||||
return (*cntx)->SendError(InvalidExpireTime(cntx->cid->name()));
|
||||
}
|
||||
|
||||
SetCmd::SetParams sparams;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue