chore(server): migrate main_service handlers to CmdArgParser - #7724
Conversation
PR Summary by QodoMigrate main_service command handlers to CmdArgParser Description
Diagram
High-Level Assessment
Files changed (4)
|
🤖 Augment PR SummarySummary: This PR migrates a large set of Changes:
Technical Notes: The new flow relies on 🤖 Was this summary useful? React with 👍 or 👎 |
| // INFO [cmd] | ||
| if (subcmd == "INFO" && sufficient_args) { | ||
| string cmd = absl::AsciiStrToUpper(ArgS(args, 1)); | ||
| if (subcmd == "INFO" && parser.HasNext()) { |
There was a problem hiding this comment.
src/server/main_service.cc:2762 (COMMAND INFO): after consuming the command name via parser.Next(), any additional arguments are silently ignored because there’s no validation of leftover args. This changes behavior vs the old args.size() == 2 check and could hide client misuse (or should intentionally support multiple command names).
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Code Review by Qodo
1. INFO drops trailing args
|
c25ac58 to
33ad8b8
Compare
Migrate most main_service.cc command handlers from CmdArgList to CmdArgParser, following the same pattern as the recent set_family.cc and zset_family.cc migrations. - Update Quit, Multi, Watch, Unwatch, Discard, Exec, Publish, Subscribe, Unsubscribe, PSubscribe, PUnsubscribe, Function, Monitor, Pubsub, Command handlers - Propagate ParsedArgs through ChangeSubscription/ChangePSubscription in conn_context.h/.cc to avoid CmdArgList conversion - Update MFUNC macro to call MakeParserFromContext instead of passing CmdArgList; keep MFUNC_OLD for Eval* handlers (deferred) Signed-off-by: Roman Gershman <roman@dragonflydb.io>
33ad8b8 to
b331ab0
Compare
| if (!parser.HasNext()) { | ||
| rb->SendError(WrongNumArgsError(cmd_cntx->cid()->name())); | ||
| return; | ||
| } |
There was a problem hiding this comment.
parser.Next process this situation
| } | ||
|
|
||
| string subcmd = absl::AsciiStrToUpper(ArgS(args, 0)); | ||
| string subcmd = absl::AsciiStrToUpper(parser.Next()); |
There was a problem hiding this comment.
feels like you need Map or Apply
There was a problem hiding this comment.
I prefer not to be blocked on it right now
Summary
Migrate most
main_service.cccommand handlers fromCmdArgListtoCmdArgParser, following the same pattern established in the recentset_family.ccandzset_family.ccmigrations.Changes
Quit,Multi,Watch,Unwatch,Discard,Exec,Publish,Subscribe,Unsubscribe,PSubscribe,PUnsubscribe,Function,Monitor,Pubsub,CommandParsedArgsthroughChangeSubscription/ChangePSubscription/ChangeSubscriptionsinconn_contextto avoidCmdArgListconversion at call sitesMFUNCmacro to callMakeParserFromContextinstead of forwardingCmdArgList