-
Notifications
You must be signed in to change notification settings - Fork 990
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: get back on the decision to put a hard limit on command interface #4203
Conversation
Limiting commands to only Transaction* and SinkReplyBuilder does not hold. We need sometimes to access context fields for multitude of reasons. But I do not want to pass the huge ConnectionContext object because, it's hard then to track unusual access patterns. The compromise: to introduce CommandContext that currently has tx, rb and extended fields. It will be relatively easy to identify irregular access patterns by tracking the extended field. This commit is the first one in series of probably 10-15 commits. No functional changes here. Signed-off-by: Roman Gershman <[email protected]>
@@ -974,14 +974,14 @@ OpStatus SetCmd::CachePrevIfNeeded(const SetCmd::SetParams& params, DbSlice::Ite | |||
return OpStatus::OK; | |||
} | |||
|
|||
void StringFamily::Set(CmdArgList args, Transaction* tx, SinkReplyBuilder* builder, | |||
ConnectionContext* cntx) { | |||
void StringFamily::Set(CmdArgList args, const CommandContext& cmnd_cntx) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all the changes here are search and replace
@@ -73,6 +73,16 @@ static_assert(!IsEvalKind("")); | |||
// Per thread vector of command stats. Each entry is {cmd_calls, cmd_latency_agg in usec}. | |||
using CmdCallStats = std::pair<uint64_t, uint64_t>; | |||
|
|||
struct CommandContext { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a thought: since this will be used quite a lot, maybe rename it to CmdContext
or CmdCntx
?
Feel free to say no obviously, I just don't think it makes the code less readable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only strange thing for me is that we don't have the class Command
, but have CommandContext
. From my point of view, the best naming for a context should look like Command::Context
or Cmd::Cntx
. The same for other contexts they are not self-sufficient so I would like to move them into other classes or they should lost the context
part of the name
Limiting commands to only Transaction* and SinkReplyBuilder does not hold. We need sometimes to access context fields for multitude of reasons.
But I do not want to pass the huge ConnectionContext object because, it's hard then to track unusual access patterns.
The compromise: to introduce CommandContext that currently has tx, rb and extended fields. It will be relatively easy to identify irregular access patterns by tracking the extended field.
This commit is the first one in series of probably 10-15 commits. No functional changes here.